// JavaScript Document
function rollOverImages(imageId,imageName){
	eval(imageId).src=imageName;
}
function callFeature(fname){
	fpath="popup/"+fname
	window.open(fpath,"Feature","width=530,height=430,scrollbars=yes,resizable=no")
}
function callPopup(fname){
	fpath="popup/"+fname
	window.open(fpath,"Popup","width=780,height=400,scrollbars=yes,resizable=no")
}
function validateForm(){
	var fName=document.requestDemo.firstName.value;
	var lName=document.requestDemo.lastName.value;
	var cName=document.requestDemo.companyName.value;
	var cNo=document.requestDemo.contactNumber.value;
	var email=document.requestDemo.emailAddress.value;
	var jTitle=document.requestDemo.jobTitle.value;
	var oState=document.requestDemo.oState.value;
	var nEmployees=document.requestDemo.noEmployees.value;
	
	if(fName==''){		
		alert("Please enter First Name");		
		return false;
	}else{
		if(!chkNum(fName))
		return false;
	}
	if(lName==''){		
		alert("Please enter Last Name");		
		return false;
	}else{
		if(!chkNum(lName))
		return false;
	}
	if(cName==''){		
		alert("Please enter Company Name");		
		return false;
	}
	if(cNo==''){		
		alert("Please enter Contact Number");		
		return false;
	}
	if(email==''){		
		alert("Please enter Email Address");		
		return false;
	}else{
		if(!emailValidate(email))
		return false;
	}
	if(jTitle==''){		
		alert("Please enter Job Title");		
		return false;
	}
	if(document.requestDemo.country.value=="select"){
		alert("Please Select Country");		
		return false;
	}else{
		if(document.requestDemo.country.value!="US" ){
			if(oState==''){		
			alert("Please enter State");		
			return false;
			}
		}else{
			if(document.requestDemo.state.value=="select"){
				alert("Please Select State");		
				return false;
				}
		}
	}
	if(document.requestDemo.industryType.value=="select"){
		alert("Please Select Industry Type");		
		return false;
	}
	if(nEmployees==''){		
		alert("Please enter Number of Employees");		
		return false;
	}else{	
	
	return true;
	}
	
	
}
function chkNum(stringChk){
	sLength=stringChk.length;
	for(var i=0;i<sLength;i++){
				var x=stringChk.charAt(i);
				var anum=/(^\d+$)|(^\d+\.\d+$)/
				if (anum.test(x)){
				alert("Please input a valid entry!");
				testresult=false;
				break;
				}
				else{
				testresult=true;
				}				
		}
		return (testresult);				
}
function emailValidate(emailValue){
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(emailValue)){
	return (true)
	}
	alert("Invalid E-mail Address! Please re-enter.")
	return (false)
}



