function myChrisFunction(frm)
{
    with (frm)
    {
		
		
		for(var j=0;j<document.getElementById("iLotBOx").value;j++)
		{
			if(document.getElementById("votingNo_"+j).value == '##')
			{
				alert(MSG_JS_CHEACK_LOTTERY_NO);
		 		return false;
			}
		}
		if(!checkValidNull(vFirstName,MSG_JS_ENTER_FIRST_NAME))
		{
        	vFirstName.focus();
			return false;
		}
		if(!checkValidNull(vLastName,MSG_JS_ENTER_LAST_NAME))
		{
        	vLastName.focus();
			return false;
		}
		/*if(!checkValidNull(vZip,MSG_JS_ENTER_ZIP))
		{
        	vZip.focus();
			return false;
		}*/
		if(document.getElementById("vSocialSec1").value == '' && document.getElementById("vSocialSec1").value == '' && document.getElementById("vSocialSec1").value == '')
		{
        	alert(MSG_JS_SOCIAL_SECURITY);
			vSocialSec1.focus();
			return false;
		}
		if(document.getElementById("vSocialSec1").value.length !=3 || document.getElementById("vSocialSec2").value.length !=7 || document.getElementById("vSocialSec3").value.length !=1)
		{
			alert(MSG_JS_SOCIAL_SECURITY_LEN);
			document.getElementById("vSocialSec1").focus();
		 	return false;
		}
		if(!checkValidNull(vEmail,MSG_JS_ENTER_EMAIL))
		{
	     	vEmail.focus();
		 	return false;
		}
		if(vEmail.value != '')
		{
			if(!isValidEmail(vEmail.value))	
			{
				vEmail.focus();
				return false;
			}
		}
		if(document.getElementById("chkTerms").checked == false)
		{
			alert(MSG_JS_CHEACK_TERMS);
			document.getElementById("chkTerms").focus();
		 	return false;
		}
		if(!checkValidNull(security_code,MSG_JS_ENTER_CAPTCHA))
		{
        	security_code.focus();
			return false;
		}
		getSecurityCaptcha1(frm);

		//getSecurityCaptcha1(frm);
	}
	return false;
	//frm.submit();
}
var httpcode;

function handleSecurityCodeData() 
{ 
	if (httpcode.readyState == 4) 
	{	
		isWorking = false;
		var strXML=httpcode.responseText;
		var xmlDocument = httpcode.responseXML; 
		var	code=xmlDocument.getElementsByTagName('code').item(0).firstChild.data;
		if(code == 0)
		{
			alert(LBL_VALID_SECURITYCODE);
			document.getElementById("security_code").value="";
			document.getElementById("security_code").focus();
			return false;
		}else if(code == 1){
			var mode=document.getElementById("mode").value;
			checkDuplicate(document.frmregister,'member',"vEmail","iMemberId",mode);
			document.getElementById("vEmail").focus();
			return false;
		}
		document.frmregister.submit();
	}
}
function checkValidPhoneFaxDigit(events) 
{
var unicodes=events.charCode? events.charCode :events.keyCode;
/*alert(unicodes);
return false;*/
	if (unicodes!=8)
	{ //backspace
	        if( (unicodes>46 && unicodes<59) || unicodes == 46 || unicodes == 45 || unicodes == 40 || unicodes == 41 || unicodes == 43 || unicodes == 32 || unicodes == 9)
	            return true;
			else
				return false; 
	}
}
function checkAvaibility(frm)
{
	with (frm)
	{
		if(!checkValidNull(vEmail,MSG_JS_ENTER_EMAIL))
        	return false;
		if(vEmail.value != '')
		{
			if(!isValidEmail(vEmail.value))	
			{
				vEmail.focus();
				return false;
			}
			else
			{
				var url = SITE_AJAX_URL+"checkMailAvaibility.php?vEMail="+vEmail.value;
				/*alert(url);
				return false;*/
				if (window.XMLHttpRequest)
			  	{
			  		http=new XMLHttpRequest()
			  		http.open("GET",url,true)
				  	http.onreadystatechange=getEMailAvailable;
				  	http.send(null)
			  	}
				// code for IE
				else if (window.ActiveXObject)
			  	{
			  		http=new ActiveXObject("Microsoft.XMLHTTP")
			    	if (http)
			    	{
			    		http.open("GET",url,true)
			    		http.onreadystatechange=getEMailAvailable;
			    		http.send()
			    	}
			  	} // Else
			}//IF
		}//Outer If
	}// With
}

function getEMailAvailable()
{
	if (http.readyState == 4) 
	{	
      	isWorking = false;
		/*alert(http.responseText);
		return false;*/
    	if (http.responseText.indexOf('invalid') == -1) 
		{
    		var xmlDocument = http.responseXML; 
			var succ = xmlDocument.getElementsByTagName('succ').item(0).firstChild.data;

			if(succ == '1'){
				document.getElementById("msgid").style.display = "";			
				document.getElementById("avaimsg").innerHTML = MSG_JS_EMAIL_EXIST;
				return false;
			}else{
				document.getElementById("msgid").style.display = "";			
				document.getElementById("avaimsg").innerHTML = MSG_JS_EMAIL_AVLB;
			}
		}
	}	
}



