function validate_form() {
validity = true; // assume valid
var fruit = document.form1.radiobutton;
		var fave = -1;


   /*  if (!check_empty(document.form1.company.value))
        {alert('Enter your Company Name!'); 
		document.form1.company.focus();
		validity=false; return false;}
		 if (!check_empty(document.form1.firstname.value))
        {alert('Enter your First Name!'); 
		document.form1.firstname.focus();
		validity=false; return false;}
		if (!check_empty(document.form1.lastname.value))
        {alert('Enter your Last Name!'); 
		document.form1.lastname.focus();
		validity=false; return false;}
		if (!check_email(document.form1.Email.value))
	{
		alert("Please enter  Valid Email");
		document.form1.Email.focus();
		validity=false; 
		return false;
	}
	if (!check_empty(document.form1.address1.value))
	{
		alert("Please enter your Address");
		document.form1.address1.focus();
		validity=false;
		return false;
	}
	if (!check_empty(document.form1.address2.value))
	{
		alert("Please enter your Address");
		document.form1.address2.focus();
		validity=false;
		return false;
	}
	if (!check_empty(document.form1.city.value))
	{
		alert("Please enter your City Name");
		document.form1.city.focus();
		validity=false;
		return false;
	}if (!check_empty(document.form1.zip.value))
	{
		alert("Please enter your Zip Code / Postal Code");
		document.form1.zip.focus();
		validity=false;
		return false;
	}
	if (!check_empty(document.form1.country.value))
	{
		alert("Please enter your Country Name");
		document.form1.country.focus();
		validity=false;
		return false;
	}
	if (!check_empty(document.form1.phone.value))
	{
		alert("Please enter your Phone No");
		document.form1.phone.focus();
		validity=false;
		return false;
	}	*/
		
	for  (var i=0; i < fruit.length; i++) {
			if (fruit[i].checked) {
				fave = i;
			}
		}
		
		switch (fave)
		{
			case -1:
			window.alert("Please select Yes or No."); 
			validity=false;
			return false;
			
		case 0:
              
		//document.form1.action="signaltap2.asp";
		//document.form1.submit();
		if (!check_empty(document.form1.name.value))
        {
		alert('Please enter your name.'); 
		document.form1.name.focus();
		validity=false;
		 return false;
		 }
		 if (!check_email(document.form1.email.value))
	{
		alert("Please enter valid email id.");
		document.form1.email.focus();
		validity=false; 
		return false;
	}
	
			
		document.form1.action="http://www.marlabs.com/application_thanks.php";
		document.form1.method="Post";
		document.form1.submit();


		break;
		
		case 1:

//window.open('value_bi_systems_no_thanks.htm','popup','height=500,width=400,left=100,top=100,resizable=0,scrollbars=0,toolbar=0,menubar=0,location=0,directories=0,status=0');
		
		//document.form1.action="signaltap8.asp";
		//document.form1.submit();


		
		document.form1.action= "http://www.marlabs.com/application_no_thanks.php";
		document.form1.method="Post";
		document.form1.submit();
		
		//document.form1.method="Post";
		//document.form1.action="value_bi_systems_thanks.php";		
		//document.form1.submit();
		
		}
	
	//return true;
			

/*		
		if (fave < 0) { 
			window.alert("There is no fruit flavour selected."); 
			return false;
		} 
	else  if(fruit[fave].value == "Signal Tap - 2MHz"){	 	
		document.form1.action="buynow.asp";
		document.form1.submit();		
			}	
else  if(fruit[fave].value == "Signal Tap - 8MHz"){	 	
		document.form1.action="buynow1.asp";
		document.form1.submit();		
			}					 
else return false;*/
	}
	
	
	function check_empty(text) {
  return (text.length > 0); // returns false if empty
}

function check_email(address) {
  if ((address == "")
    || (address.indexOf ('@') == -1)
    || (address.indexOf ('.') == -1)
	|| (address.indexOf ('.com') == -1))
      return false;
  return true;

}
  function formIsNumeric(v) {

     v = v.replace(/\s+$|^\s*/gi, "");
     isNum = new RegExp ("[^0-9]");
     if (isNum.test(v)) {
          alert('Wrong')
     }
}

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 email id")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid email id")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid email id")
		    return false
		 }

 		 return true					
	}

function ValidateForm(){
	var emailID=document.form1.email
	var fname=document.form1.name
	
	if ((fname.value==null)||(fname.value=="")){
		alert("Please enter your name")
		fname.focus()
		return false
	}
	
	if ((emailID.value==null)||(emailID.value=="")){
		alert("Please enter your email id")
		emailID.focus()
		return false
	}
	if (echeck(emailID.value)==false){
		emailID.value=""
		emailID.focus()
		return false
	}
	
	popup = window.open("whitepaper.php", "popup",'height=600,width=510,menubar=no,status=no');

		
		//document.form1.action="value_bi_systems_thanks.php";
		//document.form1.method="Post";
		document.form1.submit();

	return true
 }
 
 function ValidateFormthanks(){
	var emailID=document.form1.email
	var fname=document.form1.fname
	
	if ((fname.value==null)||(fname.value=="")){
		alert("Please enter your name")
		fname.focus()
		return false
	}
	
	if ((emailID.value==null)||(emailID.value=="")){
		alert("Please enter your email id")
		emailID.focus()
		return false
	}
	if (echeck(emailID.value)==false){
		emailID.value=""
		emailID.focus()
		return falsez
	}
	
	popup = window.open("thankyou.php", "popup",'height=140,width=510,scrollbars=0,menubar=0,resizable=0,toolbar=0,addressbar=0,statusbar=0');

		
		//document.form1.action="value_bi_systems_thanks.php";
		//document.form1.method="Post";
		document.form1.submit();

	return true
 }