﻿Authentication = {}
Authentication.ShowLoginArea = function (LoginPanelID, focusCtl)
{
	if($get(LoginPanelID).style.display == "none")
	{
		$get(LoginPanelID).style.display = "";
		if(focusCtl) $get(focusCtl).focus();;
	}else
		$get(LoginPanelID).style.display = "none";
}

Authentication.EnterForLogin = function(LoginBtn)
{	
	if(event.keyCode == 13) 
	{
		$get(LoginBtn).click();	
		self.focus();
		return;
	}	
	else 
		return false;	
}

Authentication.Logout = function()
{
	location.href = "/Users/Logout.aspx";
}

Authentication.UserOut = function()
{
	if(confirm("정말로 탈퇴하시겠습니까?\n\n탈퇴와 동시에 사용자님의 모든 개인정보는 삭제됩니다"))
	{
		location.href="/MyPage/EditUserOut.aspx";
	}
	else
	{
		return;
	}
}

Authentication.NotValidLoginInfo =  function (panel, controlId)
{   
    Authentication.ShowLoginArea(panel, null); 
    if($get(controlId).type == "password")
    {
        $get(controlId).select();
        alert('비밀번호가 일치하지 않습니다');
    }else {
        $get(controlId).focus();
        alert('존재하지 않는 사용자 ID 입니다');
    }   
}
                                
//function ReplaceAll(strOriginal, strFind, strChange){
//    var position, length;
//    position = strOriginal.indexOf(strFind);  
//    
//    while (position != -1){
//      strOriginal = strOriginal.replace(strFind, strChange);
//      position    = strOriginal.indexOf(strFind);
//    }
//    
//    return strOriginal;
//}