function validate()
{
	var err="";
	//if (ValidatorTrim(document.formmain.clsactivation_firstname.value)=="")	err+="First Name is required field.\n";
	//if (ValidatorTrim(document.formmain.clsactivation_lastname.value)=="")	err+="Last Name is required field.\n";
	//if (ValidatorTrim(document.formmain.clsactivation_address.value)=="")	err+="Address is required field.\n";
	//if (ValidatorTrim(document.formmain.clsactivation_city.value)=="")	err+="City is required field.\n";
	//if (ValidatorTrim(document.formmain.clsactivation_state.value)=="")	err+="State is required field.\n";
	//if (ValidatorTrim(document.formmain.clsactivation_country.value)=="")	err+="Country is required field.\n";
	if (ValidatorTrim(document.frmactivation.clsactivation_email.value)=="")	
		err+="Email is required field.\n";
	else
		err += checkEmail(document.frmactivation.clsactivation_email.value);
	if (ValidatorTrim(document.frmactivation.clsactivation_username.value)=="")	err+="UserName is required field.\n";
	if (ValidatorTrim(document.frmactivation.clsactivation_password.value)=="")	err+="Password is required field.\n";
	if(!checkcharlength(document.frmactivation.clsactivation_username, 6,15)) err+="Username must be between 6-15 characters long.\n";
	if(!checkcharlength(document.frmactivation.clsactivation_password, 6,15)) err+="Password must be between 6-15 characters long.\n";
	//if(!checkpassword()) err+="Password & Re-enter Password must be same.\n";
	//if (ValidatorTrim(document.formmain.clsactivation_provider.value)=="")	err+="Provider is required field.\n";
	
	/*
	  if (ValidatorTrim(document.formmain.clsactivation_mobile.value)=="")	
       err+="Mobile No. is required field.\n";	
   else if(isNaN(document.formmain.clsactivation_mobile.value))
   	   err+="Mobile No. is invalid.\n";	
   else if(document.formmain.clsactivation_mobile.length<10)	
	   err+="Mobile No. is invalid.\n";		 
	 */  
	return err;
}

function validateMyAccount()
{
	var err="";
	if (ValidatorTrim(document.frmmyaccount.clsactivation_firstname.value)=="")	err+="First Name is required field.\n";
	if (ValidatorTrim(document.frmmyaccount.clsactivation_lastname.value)=="")	err+="Last Name is required field.\n";
	/*
	if (ValidatorTrim(document.frmmyaccount.clsactivation_address.value)=="")	err+="Address is required field.\n";
	if (ValidatorTrim(document.frmmyaccount.clsactivation_city.value)=="")	err+="City is required field.\n";
	if (ValidatorTrim(document.frmmyaccount.clsactivation_state.value)=="")	err+="State is required field.\n";
	*/
	if (ValidatorTrim(document.frmmyaccount.clsactivation_country.value)=="")	err+="Country is required field.\n";
	/*
	 if (ValidatorTrim(document.frmmyaccount.clsactivation_email.value)=="")	
		err+="Email is required field.\n";
	else
		err += checkEmail(document.frmmyaccount.clsactivation_email.value);
    */ 		
	//if (ValidatorTrim(document.frmmyaccount.clsactivation_username.value)=="")	err+="UserName is required field.\n";
	if (ValidatorTrim(document.frmmyaccount.clsactivation_password.value)=="")	err+="Existing Password is required field.\n";
	//if(!checkcharlength(document.frmmyaccount.clsactivation_username, 6,15)) err+="Username must be between 6-15 characters long.\n";
	if(!checkcharlength(document.frmmyaccount.clsactivation_password, 6,15)) err+="Existing Password must be between 6-15 characters long.\n";
	  
	if(document.frmmyaccount.clsactivation_chkChangePassword.checked==1)
	  {	
	  	if (ValidatorTrim(document.frmmyaccount.clsactivation_password_new.value)=="")	err+="New Password is required field.\n";
	//if(!checkcharlength(document.frmmyaccount.clsactivation_username, 6,15)) err+="Username must be between 6-15 characters long.\n";
	if(!checkcharlength(document.frmmyaccount.clsactivation_password_new, 6,15)) err+="New Password must be between 6-15 characters long.\n";
		if(!checkpasswordMyAccount()) err+="New Password & Re-entered Password must be same.\n";
	  }
	  	
	//if (ValidatorTrim(document.frmmyaccount.clsactivation_provider.value)=="-1")	err+="Provider is required field.\n";
	
  /*	
	if (ValidatorTrim(document.frmmyaccount.clsactivation_mobile.value)=="")	
       err+="Mobile No. is required field.\n";	
   else if(isNaN(document.frmmyaccount.clsactivation_mobile.value))
   	   err+="Mobile No. is invalid.\n";	
   else if(document.frmmyaccount.clsactivation_mobile.length<10)	
	   err+="Mobile No. is invalid.\n";		 
  */	   
  
	if (err!="")
	{
		alert(err);
		return;
	}
  else
	{
		document.frmmyaccount.clsactivation_hdn_action.value="Edit";	
		document.frmmyaccount.submit();		
	}
}

function radio_check(err)
{
	var radio_choice = false;

	for (counter = 0; counter < document.formmain.clsactivation_usertype.length; counter++)
	{
		if (document.formmain.clsactivation_usertype[counter].checked)
		radio_choice = true; 
	}

	if (!radio_choice)
	{
		err+="Career Type is a required field.";
		return err;
	}
}
function fee()
{
	window.open('<?=DOMAIN_NAME?>','LCPOPUP', 'height=400,width=500,toolbar=no,scrollbars=yes,top=100,left=100');
}
function reasons()
{
	window.open('<?=DOMAIN_NAME?>','LCPOPUP', 'height=400,width=500,toolbar=no,scrollbars=yes,top=100,left=100');
}
function validateActivationFirstStep()
{
	var err="";
	err=validate();
	if (err!="")
	{
		alert(err);
		return;
	}
  else
	{
		document.frmactivation.clsactivation_hdn_action.value="1";	
		document.frmactivation.submit();
		return;
	}
}

function validateSecondStep()
{
	var err="";
	var activationcode=ValidatorTrim(document.formmain.clsactivation_activation_code.value);
	/*if (ValidatorTrim(document.formmain.clsactivation_mobile.value)=="")	
       err+="Mobile No. is required field.\n";	
   else if(isNaN(document.formmain.clsactivation_mobile.value))
   	   err+="Mobile No. is invalid.\n";	
    else if(document.formmain.clsactivation_mobile.length<10)	
	   err+="Mobile No. is invalid.\n";		 
	*/   
	if (activationcode=="")	err+="Activation Code is required field.\n";
	else if(activationcode.length!=10) err+="Invalid Activation Code!!!\n";
	if (err!="")
	{
		alert(err);
		return;
	}
  else
	{
		document.formmain.clsactivation_hdn_action.value="2";	
		document.formmain.submit();
		return;
	}
}

function resendCode()
{
	var err="";
	if (ValidatorTrim(document.formmain.clsactivation_mobile.value)=="")	
       err+="Mobile No. is required field.\n";	
   else if(isNaN(document.formmain.clsactivation_mobile.value))
   	   err+="Mobile No. is invalid.\n";	
   else if(document.formmain.clsactivation_mobile.length<10)	
	   err+="Mobile No. is invalid.\n";		 
	if (err!="")
	{
		alert(err);
		return;
	}
  else
	{
		document.formmain.clsactivation_hdn_action.value="3";	
		document.formmain.submit();
		//return;
	}
}

function getrandompromotioncode()
{
	document.formmain.action = "";
	document.formmain.target = "";
	
	document.formmain.clsrandompromotion_email.value = document.formmain.clsactivation_email.value;	
	window.open("","RandomPromotion","height=340,width=335,toolbar=no,scrollbars=no,top=100,left=100");			
	document.formmain.action="lcrandormpromotion.php";
	document.formmain.target="RandomPromotion";
	document.formmain.submit();
	
	document.formmain.action = "";
	document.formmain.target = "";
}
function checklength(obj)
{
	var temp = obj.value;
	if((temp.length < 6) || (temp.length > 8))
	{
//		alert("Please Enter minimum 6 characters.");
//		obj.value = "";
//		obj.focus();
		return false;
	}
	return true;
}
function checkcharlength(obj,len,len1)
{
	var temp = obj.value;
	if((temp.length < len) || (temp.length > len1))
		return false;
	return true;
}
function checkpassword()
{
	if(document.formmain.clsactivation_password.value != document.formmain.clsactivation_repassword.value)
	{
		document.formmain.clsactivation_password.value = "";
		document.formmain.clsactivation_repassword.value="";
		return false;
	}
	return true;
}
function checkpasswordMyAccount()
{
	if(document.frmmyaccount.clsactivation_password_new.value != document.frmmyaccount.clsactivation_repassword_new.value)
	{
		document.frmmyaccount.clsactivation_password_new.value = "";
		document.frmmyaccount.clsactivation_repassword_new.value="";
		return false;
	}
	return true;
}
function cvvcode()
{
	window.open('<?=HTTP_PATH?>cvvpopup.php','CVVPOPUP', 'height=600,width=750,toolbar=no,scrollbars=yes,top=100,left=100');
}// JavaScript Document
function validsubmit2()
{
	document.formmain.clsactivation_hdnsubmited.value="1";
	document.formmain.submit();	
}
function forgotpasslink()
{
	document.formmain.clsactivation_hdnaction.value="FE"; // Forgot E-mail
	document.formmain.clsactivation_hdnsubmited.value="1";
	document.formmain.submit();	
}
function activationlink()
{
	document.formmain.clsactivation_hdnaction.value="AE"; // Activation E-mail
	document.formmain.clsactivation_hdnsubmited.value="1";
	document.formmain.submit();	
}
function riskreversal()
{
	window.open('<?=DOMAIN_NAME?>lcriskreversal.php','lcriskreversal', 'height=250,width=382,scrollbars=no,toolbar=no,top=80,left=100,resizable=no,');
}
function gaurentee()
{
	window.open('<?=DOMAIN_NAME?>lcguaranteepopup.php','lctellus', 'height=200,width=382,scrollbars=no,toolbar=no,top=80,left=100,resizable=no,');
}
	
	function check_handle(result)
	{
		document.getElementById('username').style.display = 'inline';
		document.getElementById('username').style.visibility = 'visible';
		if(result[0] == 'yes') {
			document.getElementById('not_available').style.display = 'none';
			document.getElementById('not_available').style.visibility = 'hidden';
			document.getElementById('available').style.display = 'inline';
			document.getElementById('available').style.visibility = 'visible';
			document.getElementById('available').style.textalign= 'center';
		}
		else {
			document.getElementById('available').style.display = 'none';
			document.getElementById('not_available').style.display = 'block';
			document.getElementById('not_available').style.visibility = 'visible';
			
		//	var str = 'Sorry that username is not available try these <br />';
			/*for(i = 1; i < result[1]; i++) {
			str += "<input type=\"radio\" name=\"try\" onclick=\"switch_username('"+result[i+1]+"')\"/>" + result[i+1] + "<br />";
			}*/
			////var str;
			//document.getElementById('not_available').innerHTML = str;
		}
	}
	function check_user_exist()
	{
		
		
		var err="";
		var username = document.getElementById('clsactivation_username').value;
		if (ValidatorTrim(document.frmactivation.clsactivation_username.value)=="")	err+="UserName is required field.\n";
		if(!checkcharlength(document.frmactivation.clsactivation_username, 6,15)) err+="Username must be between 6-15 characters long.\n";
		if (err!="")
		{
			alert(err);
			return;
		}
	  else
		x_check_user_exist(username, check_handle);
	}

	function switch_username(username) 
	{
		document.getElementById('clsactivation_username').value = username;
	}
	
function getProvidersOfCountry(cntrl)
{
	cntrl_id="";
	cntrl_id=cntrl.id;
	country_code=cntrl.value;
	//arrindex=cntrl_id.split('_');
	//cntrl_index=arrindex[4];
		
	//current_selected_index=cntrl_index;	
	x_getProvidersForCountry(country_code,check_handle2);

}
	
function check_handle2(result)
{
	prepend="";
	append="";
	prepend="<select name=\"clsactivation_provider\" id=\"clsactivation_provider\"><option value=''>Select</option>";
	append="<option value='-1'>Don't Know</option></select>";
	clsinternational_providers=document.getElementById('div_clsactivation_provider');	
	if(result!=0) {
	  if(result.length!=0)
	  {	
	   clsinternational_providers.innerHTML = prepend+result+append;
	  }	
	  else
	    clsinternational_providers.innerHTML = prepend+append;
	}
	  else
	     clsinternational_providers.innerHTML = prepend+append;
	return;
}	