function submitonce(form){
//if IE 4+ or NS 6+
if (document.all||document.getElementById){
//screen thru every element in the form, and hunt down "submit" 
for (i=0;i<form.length;i++){
var tempobj=form.elements[i]
if(tempobj.type.toLowerCase()=="submit")
//disable em
tempobj.disabled=true
}
}

}
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("Su dirección de correo electrónico no es válido")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Su dirección de correo electrónico no es válido")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Su dirección de correo electrónico no es válido")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Su dirección de correo electrónico no es válido")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Su dirección de correo electrónico no es válido")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Su dirección de correo electrónico no es válido")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Su dirección de correo electrónico no es válido")
		    return false;
		 }

	}
	

function validateFrm(form) {
var themessage = "Se le requiere para completar los siguientes: \n";
var radio_choice1 = false;
var radio_choice2 = false;
var radio_choice3 = false;
 
for (counter = 0; counter < form.q1.length; counter++)
	{
		if (form.q1[counter].checked)
		radio_choice1 = true; 
	}
	if (!radio_choice1)
	{
		themessage = themessage + "Pregunta 1\n";		
	}

for (counter = 0; counter < form.q2.length; counter++)
	{
		if (form.q2[counter].checked) {
			if (form.q2[5].checked && form.q2other.value=="")
			{
            alert ("Cual fue el objetivo principal de su visita");
			return false;
			} else {
		
			radio_choice2 = true;
			}
		}

	}

	if (!radio_choice2)
	{
		themessage = themessage + "Pregunta 2\n";		
	}


for (counter = 0; counter < form.q3.length; counter++)
	{
		if (form.q3[counter].checked) {
			if (form.q3[1].checked && form.q4.value=="")
			{
            alert ("Cual es la razón por la cual no pudieron completar su orden");
			return false;
			} else {
			radio_choice3 = true; 
			}
		}
	}

	if (!radio_choice3)
	{
		themessage = themessage + "Pregunta 3\n";		
	}


if (form.email.value != "") {
	var emailchk = form.email.value;
	return echeck(emailchk);
}

if (themessage == "Se le requiere para completar los siguientes: \n") {
	submitonce(form);
 	} else {
	alert(themessage);
	return false
	}

}


