var rand_no = Math.ceil(5*Math.random())

//var varCheck=new Array("", "chpfh","pnyuw","jdble", "frflt", "6dhrm"); 

//global variable for error flag
var errfound = false;
//alert("pages being included");
//function to validate by length
function ValidLength(item, len) {
   return (item.length >= len);
}

//function to validate an email address
function ValidEmail(item) {
   if (!ValidLength(item, 5)) return false;
   if (item.indexOf ('@', 0) == -1) return false;
   return true;
}

// display an error alert
function error(elem, text) {
// abort if we already found an error
   window.alert(text);
   
}

// main validation function


function Validate(form) {
	var temp = "";
	var flag=0;
	temp=""; // initial message
	errfound = false;			
	if (!ValidLength(form.name.value,1))
	{
		temp = temp + "Please Enter Your Name    \n";
		flag=1;
	}
	
	if (!ValidLength(form.phone.value,1))
	{
		temp = temp + "Please Enter Your Phone Number   \n";
		flag=1;
	}
	
	if (!ValidEmail(form.email.value,1))
	{
		temp = temp + "Please Enter A Valid Email Address  \n";
		flag=1;
	}
	
	if (!ValidLength(form.reason.value,1))
	{
		temp = temp + "Please Enter Your Reason For Contact  \n";
		flag=1;
	}
			  	   		
	if (flag==1) {
		error(form.Full_Name, temp);
		return false;
	}
	else{
		return true;
	}
	
	
	/*return !errfound;  true if there are no errors */
}

function showHide(thediv, cond){
	var myElement = document.getElementById(thediv);
	var theiframe = parent.document.getElementById( "FormContent"); 

	if(cond == true){
		if (myElement.style.display == "none"){
			theiframe.height = parseInt(theiframe.height) + 90;
		}
		myElement.style.display = "block";
	}
	else{
		if (myElement.style.display == "block"){
			theiframe.height = parseInt(theiframe.height) - 90;
		}
		myElement.style.display = "none";
	}
}