function emailvalidation(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					
	}

	function validate_form(){
		var count=0;

		var SelectDepartment = document.getElementById("Department");
		var SelectedDepartment = SelectDepartment.options[SelectDepartment.selectedIndex].value;

		if(SelectedDepartment==""){
			document.getElementById("lbldepartment").style.color="#ff0000";
			document.getElementById("DepartmentCont").style.borderColor="#ff0000";
			document.getElementById("DepartmentCont").style.backgroundColor="#fff5f5";
			document.getElementById("Department").style.backgroundColor="#fff5f5";
			count++;
		} else {
			document.getElementById("lbldepartment").style.color="#0F0F0F";
			document.getElementById("DepartmentCont").style.borderColor="#0BA5DE";
			document.getElementById("DepartmentCont").style.backgroundColor="#ffffff";
			document.getElementById("Department").style.backgroundColor="#ffffff";		
		}
		if(document.getElementById("FirstName").value==""){
			document.getElementById("FirstName").style.borderColor="#ff0000";
			document.getElementById("FirstName").style.backgroundColor="#fff5f5";
			document.getElementById("lblname").style.color="#ff0000";
			count++;
		} else {
			document.getElementById("FirstName").style.borderColor="#0BA5DE";
			document.getElementById("FirstName").style.backgroundColor="#ffffff";
			document.getElementById("lblname").style.color="#0F0F0F";
		}
		if(emailvalidation(document.getElementById("Email").value)==false || document.getElementById("Email").value==""){

			document.getElementById("Email").style.borderColor="#ff0000";
			document.getElementById("Email").style.backgroundColor="#fff5f5";
			document.getElementById("lblto").style.color="#ff0000";
			count++;
		} else {
			document.getElementById("Email").style.borderColor="#0BA5DE";
			document.getElementById("Email").style.backgroundColor="#ffffff";
			document.getElementById("lblto").style.color="#0F0F0F";
		}
		if(document.getElementById("Phone").value==""){
			document.getElementById("Phone").style.borderColor="#ff0000";
			document.getElementById("Phone").style.backgroundColor="#fff5f5";
			document.getElementById("lblphone").style.color="#ff0000";
			count++;
		} else {
			document.getElementById("Phone").style.borderColor="#0BA5DE";
			document.getElementById("Phone").style.backgroundColor="#ffffff";
			document.getElementById("lblphone").style.color="#0F0F0F";
		}
		
		if(document.getElementById("LEADCF1").value==""){
			document.getElementById("LEADCF1").style.borderColor="#ff0000";
			document.getElementById("LEADCF1").style.backgroundColor="#fff5f5";
			document.getElementById("lblmessage").style.color="#ff0000";
			count++;
		} else {
			document.getElementById("LEADCF1").style.borderColor="#0BA5DE";
			document.getElementById("LEADCF1").style.backgroundColor="#ffffff";
			document.getElementById("lblmessage").style.color="#0F0F0F";
		}			
		if(count>0) {
			document.getElementById("error").style.display="block";
			return false;
		}
	}
	
function validate_form1(){
		var count=0;
		if(document.getElementById("FirstName").value=="" || document.getElementById("FirstName").value=="Name*"){
			document.getElementById("FirstName").style.borderColor="#ff0000";
			document.getElementById("FirstName").style.backgroundColor="#fff5f5";
			document.getElementById("FirstName").style.color="#ff0000";
			count++;
		} else {
			document.getElementById("FirstName").style.borderColor="#D4D4D4";
			document.getElementById("FirstName").style.borderRightColor="#ffffff";
			document.getElementById("FirstName").style.borderBottomColor="#ffffff";
			document.getElementById("FirstName").style.backgroundColor="#ffffff";
			document.getElementById("FirstName").style.color="#000000";
		}
		if(emailvalidation(document.getElementById("Email").value)==false || document.getElementById("Email").value=="Email*"){
			document.getElementById("Email").style.borderColor="#ff0000";
			document.getElementById("Email").style.color="#ff0000";
			document.getElementById("Email").style.backgroundColor="#fff5f5";
			count++;
		} else {
			document.getElementById("Email").style.borderColor="#D4D4D4";
			document.getElementById("Email").style.borderRightColor="#ffffff";
			document.getElementById("Email").style.borderBottomColor="#ffffff";
			document.getElementById("Email").style.backgroundColor="#ffffff";
			document.getElementById("Email").style.color="#000000";
		}
		if(document.getElementById("Phone").value=="" || document.getElementById("Phone").value=="Phone*"){
			document.getElementById("Phone").style.borderColor="#ff0000";
			document.getElementById("Phone").style.color="#ff0000";
			document.getElementById("Phone").style.backgroundColor="#fff5f5";
			count++;
		} else {
			document.getElementById("Phone").style.borderColor="#D4D4D4";
			document.getElementById("Phone").style.borderRightColor="#ffffff";
			document.getElementById("Phone").style.borderBottomColor="#ffffff";
			document.getElementById("Phone").style.backgroundColor="#ffffff";
			document.getElementById("Phone").style.color="#000000";
		}
			
		if(count>0)
			return false;
	}


function validate_form2(){
		var count=0;
		if(document.getElementById("fFirstName").value=="" || document.getElementById("fFirstName").value=="Name*"){
			document.getElementById("fFirstName").style.borderColor="#ff0000";
			document.getElementById("fFirstName").style.backgroundColor="#fff5f5";
			document.getElementById("fFirstName").style.color="#ff0000";
			count++;
		} else {
			document.getElementById("fFirstName").style.borderColor="#D4D4D4";
			document.getElementById("fFirstName").style.backgroundColor="#ffffff";
			document.getElementById("fFirstName").style.color="#000000";
		}
		if(emailvalidation(document.getElementById("fEmail").value)==false || document.getElementById("fEmail").value=="Email*"){
			document.getElementById("fEmail").style.borderColor="#ff0000";
			document.getElementById("fEmail").style.backgroundColor="#fff5f5";
			document.getElementById("fEmail").style.color="#ff0000";
			count++;
		} else {
			document.getElementById("fEmail").style.borderColor="#D4D4D4";
			document.getElementById("fEmail").style.backgroundColor="#ffffff";
			document.getElementById("fEmail").style.color="#000000";
		}
		if(document.getElementById("fPhone").value=="" || document.getElementById("fPhone").value=="Phone*"){
			document.getElementById("fPhone").style.borderColor="#ff0000";
			document.getElementById("fPhone").style.backgroundColor="#fff5f5";
			document.getElementById("fPhone").style.color="#ff0000";
			count++;
		} else {
			document.getElementById("fPhone").style.borderColor="#D4D4D4";
			document.getElementById("fPhone").style.backgroundColor="#ffffff";
			document.getElementById("fPhone").style.color="#000000";
		}
			
		if(count>0)
			return false;
}
function validate_form3(){
		var count=0;
		if(emailvalidation(document.getElementById("newsletter-Email").value)==false || document.getElementById("newsletter-Email").value=="Enter your email address"){
			document.getElementById("newsletter-Email").style.borderColor="#ff0000";
			document.getElementById("newsletter-Email").style.backgroundColor="#fff5f5";
			document.getElementById("newsletter-Email").style.color="#ff0000";
			count++;
		}			
		if(count>0)
			return false;
}
		
	function focusme(strname){
		document.getElementById(strname).style.color="#000";
		document.getElementById(strname).value="";	
	}
	function focusme2(strname){
		var dm = document.footer-enquiry;
		evaluate("dm."+strname+".style.color")="#000";
		evaluate("dm."+strname+".value")="";

	}	
	function blurme(strname,strvalue){
		if(document.getElementById(strname).value=="")
			document.getElementById(strname).value=strvalue;	
	}	
	
	
	function display_footer_div(divid1,divid2){
		if(document.getElementById(divid1).style.display=="none")
		{
			document.getElementById("footer-team").style.display="none";
			document.getElementById("footer-contact").style.display="none";
			document.getElementById("footer-client").style.display="none";
			document.getElementById("footerlink1").style.color="#fff";
			document.getElementById("footerlink2").style.color="#fff";
			document.getElementById("footerlink3").style.color="#fff";			
			document.getElementById(divid1).style.display="block";
			document.getElementById(divid2).style.color="#2ACAF9";
		}else{	
			document.getElementById(divid1).style.display="none";
			document.getElementById(divid2).style.color="#fff";
			
		}
	}	



function validate_comment_form(){
		var count=0;
		if(document.getElementById("author").value==""){
			document.getElementById("author").style.borderColor="#ff0000";
			document.getElementById("author").style.backgroundColor="#fff5f5";
			document.getElementById("lblauthor").style.color="#ff0000";
			count++;
		}
		if(emailvalidation(document.getElementById("email").value)==false || document.getElementById("email").value=="email*"){
			if(document.getElementById("email").value=="")

			document.getElementById("email").style.borderColor="#ff0000";
			document.getElementById("email").style.backgroundColor="#fff5f5";
			document.getElementById("lblemail").style.color="#ff0000";
			count++;
		}
		if(document.getElementById("comment").value==""){
			document.getElementById("comment").style.borderColor="#ff0000";
			document.getElementById("comment").style.backgroundColor="#fff5f5";
			document.getElementById("lblcomment").style.color="#ff0000";
			count++;
		}			
		if(count>0) {
			document.getElementById("error").style.display="block";
			return false;
		}
	}



	$(document).ready(function(){
		$('a.jmail').each(function(){
			e = this.rel.replace('/','@');
			this.href = 'mailto:' + e;
			$(this).text(e);
		});
		$('#fadeIn').click(function() {$('.fadeIn').fadeIn('fast');});
		$('#fadeOut').click(function() {$('.fadeIn').fadeOut('fast');});
	});
