

	function IsNumeric(strString)
	   //  check for valid numeric strings	
	   {
	   var strValidChars = "0123456789.-";
	   var strChar;
	   var blnResult = true;

	   if (strString.length == 0) return false;

	   //  test strString consists of valid characters listed above
	   for (i = 0; i < strString.length && blnResult == true; i++)
	      {
	      strChar = strString.charAt(i);
	      if (strValidChars.indexOf(strChar) == -1)
		 {
		 blnResult = false;
		 }
	      }
	   return blnResult;
	   }


function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Invalid E-mail Address")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail Address")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail Address")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail Address")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail Address")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail Address")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail Address")
		    return false
		 }

 		 return true					
	}






function SetCookie() {
if(arguments.length < 2) { return; }
var n = arguments[0];
var v = arguments[1];
var d = 0;
if(arguments.length > 2) { d = parseInt(arguments[2]); }
var exp = '';
if(d > 0) {
	var now = new Date();
	then = now.getTime() + (d * 24 * 60 * 60 * 1000);
	now.setTime(then);
	exp = '; expires=' + now.toGMTString();
	}
document.cookie = n + "=" + escape(String(v)) + '; path=/' + exp;
} 

function ReadCookie(n) {
var cookiecontent = new String();
if(document.cookie.length > 0) {
	var cookiename = n+ '=';
	var cookiebegin = document.cookie.indexOf(cookiename);
	var cookieend = 0;
	if(cookiebegin > -1) {
		cookiebegin += cookiename.length;
		cookieend = document.cookie.indexOf(";",cookiebegin);
		if(cookieend < cookiebegin) { cookieend = document.cookie.length; }
		cookiecontent = document.cookie.substring(cookiebegin,cookieend);
		}
	}
return unescape(cookiecontent);
}




	function contact_check(){

		var ValidChars = "0123456789";

		var emailID=document.contact_form.email
		
		//var capture_code_hidden=ReadCookie("captchastr");
		
		//alert(ReadCookie("captchastr")); 

		
		if (document.contact_form.name.value == "" ) {
			alert("Please add your name");
			document.contact_form.name.focus();
			document.contact_form.name.style.borderColor="red";
			//document.contact_form.name.style.background="#FF6C6C";			
			return false;
		}
		document.contact_form.name.style.borderColor="green";
		//document.contact_form.name.style.background="green";	

		if ((emailID.value==null)||(emailID.value=="")){
			alert("Please Enter your Email Address")
			emailID.focus()
			document.contact_form.email.style.borderColor="red";
			//document.contact_form.email.style.background="#FF6C6C";
			return false;
		}

		if (echeck(emailID.value)==false){
			emailID.value=""
			emailID.focus()
			document.contact_form.email.style.borderColor="red";
			//document.contact_form.email.style.background="#FF6C6C";
			return false;
		}
		document.contact_form.email.style.borderColor="green";
		//document.contact_form.email.style.background="green";


		if (document.contact_form.message.value == "" ) {
			alert("Please add your message");
			document.contact_form.message.focus();
			document.contact_form.message.style.borderColor="red";
			//document.contact_form.message.style.background="#FF6C6C";
			return false;
		}
		document.contact_form.message.style.borderColor="";
		//document.contact_form.message.style.background="green";
		

		//if (document.contact_form.capture_code.value == "" ) {
		//	alert("Please add the confirmation code from the image");
		//	document.contact_form.capture_code.focus();
		//	document.contact_form.capture_code.style.borderColor="red";
		//	//document.contact_form.capture_code.style.background="#FF6C6C";
		//	return false;
		//}
		//document.contact_form.capture_code.style.borderColor="";
		//document.contact_form.capture_code.style.background="green";


		//if (document.contact_form.capture_code.value == capture_code_hidden) {
		//}else{
		//	alert("Sorry the code is incorrect");
		//	document.contact_form.capture_code.focus();
		//	document.contact_form.capture_code.style.borderColor="red";
		//	//document.contact_form.capture_code.style.background="#FF6C6C";
		///	document.contact_form.capture_code.value="";
		//	return false;
		//}
		//document.contact_form.capture_code.style.borderColor="";
		//document.contact_form.capture_code.style.background="green";

		return true;
	}
	
	
    function refreshiframe()  
    {  
        parent.capture_iframe.location.href="capture.php"  
    } 	
    
    
	function protect(name,domain){
	
		document.write(name + '@' + domain)
	
	}
    

