function CheckAccount()
{
	var ipt = "iptAccount";
	document.getElementById(ipt+"Tips").style.display = "none";
	document.getElementById(ipt+"Error").style.display = "block";
	document.getElementById(ipt+"Ok").style.display = "none";

	if (GetStrLength(document.getElementById('iptAccount').value) < 2 || GetStrLength(document.getElementById('iptAccount').value) > 20 )
	{ 
		document.getElementById("accountOk").value = "0";
		return false;
	}
	
	ajaxCheckAccount(document.getElementById("iptAccount").value);
}

function ajaxCheckAccount(account)
{ 
	var url = "user_reg_save.asp?method=checkAc&acc=" + account;
	AjaxRequest(url,"",ajaxCheckAccountCallBack);
}

function ajaxCheckAccountCallBack(ret, info, bFromServer)
{ 
	var ipt = "iptAccount";
	if (ret != AJAX_RETURN_SUCC)
	{  
		document.getElementById(ipt+"Error").innerHTML = ret;
		document.getElementById("accountOk").value = "0";
	}
	else
	{ 
		document.getElementById("accountOk").value = "1";
		document.getElementById(ipt+"Error").style.display = "none";
		document.getElementById(ipt+"Ok").style.display = "block";
	}
	
}

function CheckEmail(address) 
{
	if ((address == "") || (address.indexOf ('@') == -1)|| (address.indexOf ('.') == -1))
      return false;
  return true;
}

function CheckInEmail()
{
	var ipt = "iptEmail";
	document.getElementById(ipt+"Tips").style.display = "none";
	document.getElementById(ipt+"Error").style.display = "block";
	document.getElementById(ipt+"Ok").style.display = "none";
	
	if (!CheckEmail(document.getElementById('iptEmail').value))
	{ 
		document.getElementById("emailOk").value = "0";
		return false;
	}
	
	ajaxCheckEmail(document.getElementById("iptEmail").value);
}

function ajaxCheckEmail(email)
{ 
	var url = "user_reg_save.asp?method=checkEmail&email=" + email;
	AjaxRequest(url,"",ajaxCheckEmailCallBack);
}

function ajaxCheckEmailCallBack(ret, info, bFromServer)
{ 
	var ipt = "iptEmail";
	if (ret != AJAX_RETURN_SUCC)
	{  
		document.getElementById(ipt+"Error").innerHTML = ret;
		document.getElementById("emailOk").value = "0";
	}
	else
	{ 
		document.getElementById("emailOk").value = "1";
		document.getElementById(ipt+"Error").style.display = "none";
		document.getElementById(ipt+"Ok").style.display = "block";
	}
	
}

function CheckRealName()
{
	var ipt = "iptRealName";
	document.getElementById(ipt+"Tips").style.display = "none";
	document.getElementById(ipt+"Error").style.display = "block";
	document.getElementById(ipt+"Ok").style.display = "none";
	
	if (GetStrLength(document.getElementById('iptRealName').value) < 2 || GetStrLength(document.getElementById('iptRealName').value) >10) 
	{
		 document.getElementById("realnameOk").value = "0";
		 return false;
	}
	else
	{
		document.getElementById("realnameOk").value = "1";
		document.getElementById(ipt+"Error").style.display = "none";
		document.getElementById(ipt+"Ok").style.display = "block";
	}
}

function CheckPassword()
{
	var ipt = "iptPassword";
	document.getElementById(ipt+"Tips").style.display = "none";
	document.getElementById(ipt+"Error").style.display = "block";
	document.getElementById(ipt+"Ok").style.display = "none";
	
	if (GetStrLength(document.getElementById('iptPassword').value) < 6 || GetStrLength(document.getElementById('iptPassword').value) > 20) 
	{
		 document.getElementById("passwordOk").value = "0";
		 return false;
	}
	else
	{
		document.getElementById("passwordOk").value = "1";
		document.getElementById(ipt+"Error").style.display = "none";
		document.getElementById(ipt+"Ok").style.display = "block";
	}
}

function CheckPassword2()
{
	var ipt = "iptPassword2";
	document.getElementById(ipt+"Tips").style.display = "none";
	document.getElementById(ipt+"Error").style.display = "block";
	document.getElementById(ipt+"Ok").style.display = "none";
	
	if (GetStrLength(document.getElementById('iptPassword').value) < 1 ||  document.getElementById('iptPassword').value != document.getElementById('iptPassword2').value ) 
	{
		 document.getElementById("password2Ok").value = "0";
		 document.getElementById(ipt+"Error").innerHTML = "횅훰쵱쯤宅쵱쯤꼇륜";
		 return false;
	}
	else
	{
		document.getElementById("password2Ok").value = "1";
		document.getElementById(ipt+"Error").style.display = "none";
		document.getElementById(ipt+"Ok").style.display = "block";
	}
}

function CheckQuestion()
{
	var ipt = "iptQuestion";
	document.getElementById(ipt+"Tips").style.display = "none";
	document.getElementById(ipt+"Error").style.display = "block";
	document.getElementById(ipt+"Ok").style.display = "none";
	
	if (GetStrLength(document.getElementById('iptQuestion').value) < 1 || GetStrLength(document.getElementById('iptQuestion').value) > 50) 
	{
		 document.getElementById("questionOk").value = "0";
		 return false;
	}
	else
	{
		document.getElementById("questionOk").value = "1";
		document.getElementById(ipt+"Error").style.display = "none";
		document.getElementById(ipt+"Ok").style.display = "block";
	}
}

function CheckAnswer()
{
	var ipt = "iptAnswer";
	document.getElementById(ipt+"Tips").style.display = "none";
	document.getElementById(ipt+"Error").style.display = "block";
	document.getElementById(ipt+"Ok").style.display = "none";
	
	if (GetStrLength(document.getElementById('iptAnswer').value) < 1 || GetStrLength(document.getElementById('iptAnswer').value) > 50) 
	{
		 document.getElementById("answerOk").value = "0";
		 return false;
	}
	else
	{
		document.getElementById("answerOk").value = "1";
		document.getElementById(ipt+"Error").style.display = "none";
		document.getElementById(ipt+"Ok").style.display = "block";
	}
}

function CheckWorkShop()
{
	var ipt = "iptWorkShop";
	document.getElementById(ipt+"Tips").style.display = "none";
	document.getElementById(ipt+"Error").style.display = "block";
	document.getElementById(ipt+"Ok").style.display = "none";
	
	if (GetStrLength(document.getElementById('iptWorkShop').value) < 4 || GetStrLength(document.getElementById('iptWorkShop').value) > 100) 
	{
		 document.getElementById("workshopOk").value = "0";
		 return false;
	}
	else
	{
		document.getElementById("workshopOk").value = "1";
		document.getElementById(ipt+"Error").style.display = "none";
		document.getElementById(ipt+"Ok").style.display = "block";
	}
}

 


function CheckClass()
{
	var ipt = "selClass";
	document.getElementById(ipt+"Tips").style.display = "none";
	document.getElementById(ipt+"Error").style.display = "block";
	document.getElementById(ipt+"Ok").style.display = "none";
	
	if (GetStrLength(document.getElementById('selClass').value) < 2 || GetStrLength(document.getElementById('selClass').value) > 200) 
	{
		 document.getElementById("classOk").value = "0";
		 return false;
	}
	else
	{
		document.getElementById("classOk").value = "1";
		document.getElementById(ipt+"Error").style.display = "none";
		document.getElementById(ipt+"Ok").style.display = "block";
	}
}

function ShowMemo(ipt){ 
  document.getElementById(ipt+"Tips").style.display = "block";
  document.getElementById(ipt+"Error").style.display = "none";
  document.getElementById(ipt+"Ok").style.display = "none";
}

function ShowMemoOk(ipt){ 
  document.getElementById(ipt+"Tips").style.display = "none";
  document.getElementById(ipt+"Error").style.display = "none";
  document.getElementById(ipt+"Ok").style.display = "block";
}