// JavaScript Document

 function roll_over(id,img_src){
	document.getElementById(id).src=img_src;
 }
 
 //validation for opinion form
 function opinionSubmit(){
	valid=true;
	if(document.frmItrt.first_name.value.length==0 ){			
		alert("The Name field cannot be left blank !");
		document.frmItrt.first_name.focus();
		valid=false;
		return valid;	
	}
	
	if(document.frmItrt.position.value.length==0 ){			
		alert("The position field cannot be left blank !");
		document.frmItrt.position.focus();
		valid=false;
		return valid;	
	}
	
	
	if(document.frmItrt.company.value.length==0 ){			
		alert("The company field cannot be left blank !");
		document.frmItrt.company.focus();
		valid=false;
		return valid;	
	}
	
	
	
	if(document.frmItrt.email.value==null||document.frmItrt.email.value==""){
		alert("Please Enter your Email ID");
		document.frmItrt.email.focus();
		valid=false;
		return valid;	
	}
	
	if (echeck(document.frmItrt.email.value)==false){
			document.frmItrt.email.value="";
			document.frmItrt.email.focus();
			valid=false;
			return valid;	
	}

	
	/*if(document.frmItrt.country_id.value.length==0 ){			
		alert("Please select the country field !");
		document.frmItrt.country_id.focus();
		valid=false;
		return valid;	
	}*/
	if(document.frmItrt.enquiry.value.length==0 ){			
		alert("Theere is no Message to send !");
		document.frmItrt.enquiry.focus();
		valid=false;
		return valid;
	}
	
	return valid;
}



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 ID")
	   return false
	}

	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
	   alert("Invalid E-mail ID")
	   return false
	}

	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		alert("Invalid E-mail ID")
		return false
	}

	 if (str.indexOf(at,(lat+1))!=-1){
		alert("Invalid E-mail ID")
		return false
	 }

	 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		alert("Invalid E-mail ID")
		return false
	 }

	 if (str.indexOf(dot,(lat+2))==-1){
		alert("Invalid E-mail ID")
		return false
	 }
	
	 if (str.indexOf(" ")!=-1){
		alert("Invalid E-mail ID")
		return false
	 }

	 return true					
}







