// JavaScript Document
// JavaScript Document
function Validate_Advisor()
{

var name=document.getElementById("txtAdName").value;
var telno=document.getElementById("txtAdMob").value;
//alert (name);
//alert(telno);
var firstdigit= telno.substring(0,1)
var len =telno.length
var charvalue=name
var invalid
   if(!name)
	{
	   alert("Enter Name...!");
		//document.getElementById("txtAdName").focus();
		document.forms["contact"].elements["txtAdName"].focus()
		return false;
	}
   invalid = "~/:<>`|^!';$%^&*()+|=1234567890";
	//charvalue =document.frmDetails.First_Name.value ;
	for(i=0;i<invalid.length;i++)
		{
			for(j=0;j<invalid.length;j++)
			{
				if(charvalue.charAt(j) ==  invalid.charAt(i))
				{
					alert("Only alphabets are allowed in  Name") ;
					document.forms["contact"].elements["txtAdName"].focus()
		return false;
				}
			}
		}
   if(!telno)
	{
	   alert("Enter Mobile No...!");
		//document.getElementById("txtAdMob").focus();
		document.forms["contact"].elements["txtAdMob"].focus()
		return false;
	}
  if(isNaN(telno)) //&& isInteger(document.forms["contact"].elements["txtAdMob"].value) == false)
  {
    alert("Mobile No should be in Digits...!");
      //document.getElementById("txtAdMob").value = "";
      document.forms["contact"].elements["txtAdMob"].value = "";
 // document.getElementById("txtAdMob").focus();
      document.forms["contact"].elements["txtAdMob"].focus()
     return false;
  }
   if(len!=10) //&& isInteger(document.forms["contact"].elements["txtAdMob"].value) == false)
        	  {
        	    alert("Mobile No should be of 10 digits...!");
        	      //document.getElementById("txtAdMob").value = "";
        	      document.forms["contact"].elements["txtAdMob"].value = "";
        	  //document.getElementById("txtAdMob").focus();
        	      document.forms["contact"].elements["txtAdMob"].focus()
        	     return false;
    }
  
    if(firstdigit!=9 && firstdigit!=8) //&& isInteger(document.forms["contact"].elements["txtAdMob"].value) == false)
    	  {
    	     alert("Mobile No should start with 9 or 8...!");
    	      //document.getElementById("txtAdMob").value = "";
    	      document.forms["contact"].elements["txtAdMob"].value = "";
    	  //document.getElementById("txtAdMob").focus();
    	      document.forms["contact"].elements["txtAdMob"].focus()
    	     return false;
    }
  
  // showAds();
  //document.contact.action="Advisor.asp?txtAdName=name & txtAdmob=telno"
 //document.contact.submit()

   asppage ="../Advisor.asp?txtAdName=" + name + "&txtAdmob=" + telno
   window.open(asppage,'_new','width=400,height=400,scrollbars=yes')
   //return true;
   
   //url='Production/Advisor.asp?txtAdName=name & txtAdmob=telno'
   //submitWindow=window.open(url,"submitWindow","width=400,height=370,scrollbars=yes");
   //submitWindow.open("thankyou.htm","submitWindow");
}

