var context_path = "/us";

function login()
{
	var un="un", pwd="pwd";
	un = document.forms[0].textfield52.value;
	pwd = document.forms[0].textfield522.value;
	
	if( un.length <= 0)
	{
		alert("Please input Username!");
		return false;
	}
	if( pwd.length <= 0)
	{
		alert("Please input password!");
		return false;
	}
	
	document.forms[0].submit();	
	return true;
}

function logout()
{	
	//document.location=context_path + "/index.asp?logout=true"
	document.location=context_path + "/member_reg.asp?logout=true"
}

function registerPage()
{
	document.location=context_path + "/member_reg.asp"
}

function forgetPasswordPage()
{
	document.location=context_path + "/forget_password.asp"
}

function updatePage()
{
	document.location=context_path + "/member_pre_update.asp"
}

function mouseEvent(id)
{
	switch(id)
	{
	  case(0):
			document.forms[0].loginButton.src = context_path + "/images/member.gif";
			break;
	  case(1):
			document.forms[0].loginButton.src = context_path + "/images/member2.gif";
			break;
	  case(2):
			document.forms[0].logoutButton.src = context_path + "/images/member_logout.gif";
			break;
	  case(3):
			document.forms[0].logoutButton.src = context_path + "/images/member_logout2.gif";
			break;
	  case(4):
			document.forms[0].joinButton.src = context_path + "/images/join.gif";
			break;
	  case(5):
			document.forms[0].joinButton.src = context_path + "/images/join2.gif";
			break;
	  case(6):
			document.forms[0].forgetPwdButton.src = context_path + "/images/forget_password.gif";
			break;
	  case(7):
			document.forms[0].forgetPwdButton.src = context_path + "/images/forget_password2.gif";
			break;
	  case(8):
			document.forms[0].updateButton.src = context_path + "/images/update_profile.gif";
			break;
	  case(9):
			document.forms[0].updateButton.src = context_path + "/images/update_profile2.gif";
			break;
	}
}

function verify_mail()
{
	var mail = document.mainform.email.value

	if( mail == null)
	{
		alert("Please input Email address!")
		return false;
	}
	else if( mail.length <= 0)
	{
		alert("Invalid Email address!")
		return false
	}
	else if( (mail.indexOf("@") < 0) || (mail.indexOf("@") >= (mail.length-1)))
	{
		alert("Invalid Email address!")
		return false
	}
	
	return true;
}
