// JavaScript Document
var stdOptions = "resizable=yes,directories=no,left=10,top=10,toolbar=no,status=yes,location=no,menubar=no";
function openpop(id){
	
	var url  = "expert_popdetail.php?pid=" + id; 
        var options = stdOptions + ",scrollbars=yes"; //width=350,height=350,
        window.open(url,"detailpop",options); 
}
var stdOptions1 = "resizable=yes,directories=yes,left=10,top=10,toolbar=yes,status=yes,location=yes,menubar=yes";
function opennew(website){
	var url  = website; 
        var options = stdOptions1 + ",scrollbars=yes"; //width=350,height=350,
        window.open(url,"detail",options); 
}

function selectState(state)
	{
		//alert("Coming Soon");
		/*var stateField = document.getElementById('State');
		for(i = 0 ; i < stateField.options.length ; i++)
		{
			if(stateField.options[i].value == state.toUpperCase())
			{
				stateField.selectedIndex = i;
				break;
			}
		}*/
		document.getElementById('State').value=state;//alert(document.getElementById('State').value);
		document.searchform2.submit();
	}
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;					
	}
function email(){
	if(document.frmemail.first.value=="" && document.frmemail.last.value==""){
		alert("Please enter your first or last name");
		frmemail.first.focus();
		return false;
	}
	if(document.frmemail.emailaddress.value==""){
		alert("Please enter your email address");
		frmemail.emailaddress.focus();
		return false;
	}
	/*if(document.frmemail.emailaddress.value==""){
		alert("Please enter your phone no.");
		frmemail.phone.focus();
		return false;
	}*/

var emailID=document.frmemail.emailaddress;
	if(document.frmemail.emailaddress.value!=""){
	/*alert("Please enter your email address");
	frmemail.emailaddress.focus();
	return false;*/
	
	if (echeck(emailID.value)==false){
		emailID.value="";
		emailID.focus();
		return false;
	}
	
	}
	
	if(document.frmemail.msg.value.length<10){
		alert("Please enter your message");
		frmemail.msg.focus();
		return false;
	}
	return true;

	
}