	function numbersonly(e) {
	var unicode=e.charCode? e.charCode : e.keyCode
		if (unicode!=9 && unicode!=8 && unicode!=46) { //if the key isn't the backspace key (which we should allow)
			 if (unicode<48||unicode>58){
			alert("Enter Only Number"); //if not a number
				return false
			 } 
		}
	}
	function validate() {	
		var error = new Array();
		var errorMessage = "";
		
		var frm = document.mail;
		error[1] = checkText(frm.name_txt) ? "" : "Name is empty!";
		error[2] = checkText(frm.email_txt) ? "" : "Email is empty!";
		if(error[2]=="") {
			error[2]=emailCheck(frm.email_txt.value) ? "" : "Please Enter a valid Email Address"; 
		}
		error[3] = checkText(frm.phone_txt) ? "" : "Phone Number is empty!";
		
		error[4] = checkText(frm.security_code) ? "" : "Please Enter the security code!";
		if(error[4]==""){
			if(document.getElementById('capctha_code').value!=document.getElementById('security_code').value){
				error[4]='Please Enter the secuirty code correctly';
			}
		}
		saveIt('ppkcookie1');	
		for(var i= 0 ;i<error.length; ++i)
		  if(error[i]!=undefined)
			errorMessage+= error[i] != "" ? " * " +error[i]+"\n" : "";
		
		if(errorMessage == "") {
			document.mail.submit();
			return true;
		} else {
			alert(errorMessage);
			return false;
		}
	}

	function randomString() {
		var chars = "23456789bcdfghjkmnpqrstvwxyz";
		var string_length = 6;
		var randomstring = '';
		var randomstringHiden = '';
		for (var i=0; i<string_length; i++) {
			var rnum = Math.floor(Math.random() * chars.length);
			randomstringHiden += chars.substring(rnum,rnum+1);
			randomstring += "&nbsp;&nbsp;"+chars.substring(rnum,rnum+1);
		}
		document.getElementById('randomfield').innerHTML = randomstring;
		document.getElementById('capctha_code').value = randomstringHiden;
	}

	function createCookie(name,value,days) {
		if (days) {
			var date = new Date();
			date.setTime(date.getTime()+(days*24*60*60*1000));
			var expires = "; expires="+date.toGMTString();
		}
		else var expires = "";
		document.cookie = name+"="+value+expires+"; path=/";
	}
	
	function eraseCookie(name) {
		createCookie(name,"",-1);
	}
	
	function saveIt(name) {
		var x = document.forms['mail'].capctha_code.value;//alert(x);
		if (!x)
			alert('Please fill in a value in the input box.');
		else {
			eraseCookie(name);
			createCookie(name,x,7);
		}
	}	
	
	function history1(){
		return randomString();		
	}	

function validateForm() {	
	var error = new Array();
	var errorMessage = "";
	
	var frm = document.demoform;
		
	error[0] = checkText(frm.name_txt) ? "" : "Name is empty!";	
	error[1] = checkText(frm.phone_txt) ? "" : "Phone Number is empty!";
	error[2] = checkText(frm.email_txt) ? "" : "Email is empty!";
	if(error[2]=="") {
		error[2]=emailCheck(frm.email_txt.value) ? "" : "Please Enter a valid Email Address"; 
	}
	error[3] = checkText(frm.time_txt) ? "" : "Preferred time is empty!";
				
	for(var i= 0 ;i<error.length; ++i)
	  if(error[i]!=undefined)
		errorMessage+= error[i] != "" ? " * " +error[i]+"\n" : "";
	
	if(errorMessage == "") {
		frm.submit();
	    return true;
	} else {
	    alert(errorMessage);
	    return false;
	}
}
