


function disableTrack(){



document.frm.trackname.disabled=true;

}



function enableTrack(){

document.frm.trackname.disabled=false;

}







function isEmptyString(s)

{   whitespace = "\t \n\r";

   	var i;

  	if((s == null) || (s.length == 0)) return true;

  	for(i=0;i < s.length;i++)

  	{

  		var currchar = s.charAt(i);

  		if(whitespace.indexOf(currchar) == -1) return false;

  	}

      return true;

}



function isEmail(n)

{ whitespace = "\t \n\r";

		

		if (isEmptyString(n)) return false;

		var i=1;

		var nLength=n.length;

		while((parseInt(i) < parseInt(nLength)) && (n.charAt(parseInt(i)) != '@'))

		{

			i++;

		}

		if ((parseInt(i) >= parseInt(nLength)) || (n.charAt(i)!="@"))

		{

			return false;	

		}	

		else i+=2;

		while((i<nLength) && (n.charAt(i)!="."))

		{

			i++;

		}

		if ((i>=nLength-1) || (n.charAt(i)!="."))

		{

			return false;	

		}	

		else return true;		

}



function openWindow(URL, h, w) 

{

  	var gg = typeof (popupWin);

  	if (gg =='object')

	{ 

	  	if (popupWin.closed ) {}

		else { popupWin.close();  }

	};

  	popupWin = window.open(URL, 'popup', 'dependent=0,height='+h+',width='+w+',screenX=20,left=60,screenY=70,top=50,channelmode=0,dependent=0,directories=0,fullscreen=0,location=0,menubar=0,resizable=0,scrollbars=1,status=0,toolbar=0', 'launcher');

	if (window.focus)

	{

   		popupWin.focus();

   	}

}



function checkval()

{

		  if(isEmptyString(document.frm.name.value))

		  {

		   alert("Please enter your name");

		   document.frm.name.focus();

		   return false;

		  }

		  

		  if(isEmptyString(document.frm.companyname.value))

		  {

		   alert("Please enter your Company name");

		   document.frm.companyname.focus();

		   return false;

		  }

		  

		  if(isEmptyString(document.frm.address.value))

		  {

		   alert("Please enter your address");

		   document.frm.address.focus();

		   return false;

		  }

		   

		   if(isEmptyString(document.frm.city.value))

		  {

		   alert("Please enter your City");

		   document.frm.city.focus();

		   return false;

		  }

		  if(isEmptyString(document.frm.pincode.value))

		  {

		   alert("Please enter your Pincode");

		   document.frm.pincode.focus();

		   return false;

		  }

 if(document.frm.country.value=="none")

		  {

		   alert("Please select country");

		   document.frm.country.focus();

		   return false;

		  }

		  

		  if(isEmptyString(document.frm.email.value))

		  {

		   alert("Please enter your email");

		   document.frm.email.focus();

		   flag=1;

		   return false;

		  }

		  else

		  {

 			var str = document.frm.email.value;

			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 Address")

		   return false

		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){

		   alert("Invalid E-mail Address")

		   return false

		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){

			alert("Invalid E-mail Address")

			return false

		}

   	    if (str.indexOf(at,(lat+1))!=-1){

			alert("Invalid E-mail Address")

			return false

		 }



		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){

			alert("Invalid E-mail Address")

			return false

		 }

		 if (str.indexOf(dot,(lat+2))==-1){

			alert("Invalid E-mail Address")

			return false

		 }



		 if (str.indexOf(" ")!=-1){

			alert("Invalid E-mail Address")

			return false

		 }



	  }

		

		 if(isEmptyString(document.frm.phonenumber.value))

		  {

		   alert("Please enter your Phone Number");

		   document.frm.phonenumber.focus();

		   return false;

		  }
		   if(isEmptyString(document.frm.faxnumber.value))

		  {

		   alert("Please enter your fax Number");

		   document.frm.faxnumber.focus();

		   return false;

		  }
		   if(isEmptyString(document.frm.subject.value))

		  {

		   alert("Please enter your Subject");

		   document.frm.subject.focus();

		   return false;

		  }
		   if(isEmptyString(document.frm.detail.value))

		  {

		   alert("Please enter your Details");

		   document.frm.detail.focus();

		   return false;

		  }

		  document.frm.action="sendform.php";

          document.frm.submit();



		  

		  }

		        
