// JavaScript Document

function politicaCalidad()
{
	document.getElementById("formulario").action="politicacalidad.asp";
	document.getElementById("formulario").submit();	
}

function encuestaEs()
{
	document.getElementById("txtIdioma").value="0";
	document.getElementById("formulario").action="encuestacalidad.asp";
	document.getElementById("formulario").submit();	
}

function encuestaEn()
{
	document.getElementById("txtIdioma").value="1";
	document.getElementById("formulario").action="encuestacalidad.asp";
	document.getElementById("formulario").submit();	
}

function practicas()
{
	
}

function radioClick(radiobt, destino)
{
	document.getElementById(destino).value=radiobt.value;
}

function quitaTab(texto)
{
	var tx=true;
	while (tx)
	{
		if (texto.lastIndexOf("\t")<0)
		{
			tx=false;	
		}
		else
		{
			texto=texto.replace("\t", "");
		}
	}
	return texto;
}

function enviarEncuesta()
{
	var envio;
	if (trim(document.getElementById("txtProyecto").value)=="")
	{
		alert (errormsg);
		document.getElementById("txtProyecto").focus();
		return;
	}
	
	if (trim(document.getElementById("r0101").value)=="")
	{
		alert (errormsg + " " + quitaTab(document.getElementById("cp01").innerHTML));
		document.location.href="#p01";
		return;
	}
	if (trim(document.getElementById("r0102").value)=="")
	{
		alert (errormsg + " " + quitaTab(document.getElementById("cp02").innerHTML));
		document.location.href="#p01";
		return;
	}
	for (i=1; i<=6; i++)
	{
		var obj='r020' + i;
		if (trim(document.getElementById(obj).value)=="")
		{
			alert (errormsg + " " + quitaTab(document.getElementById("cp02").innerHTML));
			document.location.href="#p02";
			return;
		}
	}
	for (i=1; i<=5; i++)
	{
		var obj="document.getElementById('r030' + i).value";
		if (eval(trim(obj))=="")
		{
			alert (errormsg + " " + quitaTab(document.getElementById("cp03").innerHTML));
			document.location.href="#p03";
			return;
		}
	}
	if (document.getElementById("cmb04").value=="")
	{
		alert (errormsg + " " + quitaTab(document.getElementById("cp04").innerHTML));
		document.location.href="#p04";
		return;
	}
	if (trim(document.getElementById("r0501").value)=="")
	{
		alert (errormsg + " " + quitaTab(document.getElementById("cp05").innerHTML));
		document.location.href="#p05";
		return;
	}
	if (document.getElementById("cmb06").value=="")
	{
		alert (errormsg + " " + quitaTab(document.getElementById("cp06").innerHTML));
		document.location.href="#p06";
		return;
	}
	if (trim(document.getElementById("r0701").value)=="")
	{
		alert (errormsg + " " + quitaTab(document.getElementById("cp07").innerHTML));
		document.location.href="#p07";
		return;
	}
	if (trim(document.getElementById("r0702").value)=="")
	{
		alert (errormsg + " " + quitaTab(document.getElementById("cp07").innerHTML));
		document.location.href="#p07";
		return;
	}
	if (trim(document.getElementById("r0801").value)=="")
	{
		alert (errormsg + " " + quitaTab(document.getElementById("cp08").innerHTML));
		document.location.href="#p08";
		return;
	}
	if (document.getElementById("cmb09").value=="")
	{
		alert (errormsg + " " + quitaTab(document.getElementById("cp09").innerHTML));
		document.location.href="#p09";
		return;
	}
	if (document.getElementById("cmb09").value=="r0901")
	{
		if (trim(document.getElementById("r09").value)=="")
		{
			alert (errormsg + " " + quitaTab(document.getElementById("cp09").innerHTML));
			document.location.href="#p09";
			return;
		}	
	}
	if (document.getElementById("cmb10").value=="")
	{
		alert (errormsg + " " + quitaTab(document.getElementById("cp10").innerHTML));
		document.location.href="#p10";
		return;
	}
	if (document.getElementById("cmb10").value=="r1001")
	{
		if (trim(document.getElementById("r10").value)=="")
		{
			alert (errormsg + " " + quitaTab(document.getElementById("cp10").innerHTML));
			document.location.href="#p10";
			return;
		}	
	}
	if (document.getElementById("cmb11").value=="")
	{
		alert (errormsg + " " + quitaTab(document.getElementById("cp11").innerHTML));
		document.location.href="#p11";
		return;
	}
	if (document.getElementById("cmb11").value=="r1102")
	{
		if (trim(document.getElementById("r11").value)=="")
		{
			alert (errormsg + " " + quitaTab(document.getElementById("cp11").innerHTML));
			document.location.href="#p11";
			return;
		}	
	}
	tx=false
	for (i=1; i<=5; i++)
	{
		if (document.getElementById("r130" + i).checked)
		{
			tx=true;
		}
	}
	if (! tx)
	{
		alert (errormsg + " " + quitaTab(document.getElementById("cp12").innerHTML));
		document.location.href="#p12";
		return;
	}
	if (document.getElementById("cmb14").value=="")
	{
		alert (errormsg + " " + quitaTab(document.getElementById("cp13").innerHTML));
		document.location.href="#p13";
		return;
	}
	if (document.getElementById("cmb15").value=="")
	{
		alert (errormsg + " " + quitaTab(document.getElementById("cp14").innerHTML));
		document.location.href="#p14";
		return;
	}
	tx=false;
	for (i=1; i<=7; i++)
	{
		if (document.getElementById("r160" + i).checked)
		{
			tx=true;
		}
	}
	if (! tx)
	{
		if (trim(document.getElementById("r16").value)=="")
		{
			alert (errormsg + " " + quitaTab(document.getElementById("cp15").innerHTML));
			document.location.href="#p15";
			return;
		}
	}
	if (document.getElementById("cmb17").value=="")
	{
		alert (errormsg + " " + quitaTab(document.getElementById("cp16").innerHTML));
		document.location.href="#p16";
		return;
	}
	if (trim(document.getElementById("r1801").value)=="")
	{
		alert (errormsg + " " + quitaTab(document.getElementById("cp17").innerHTML));
		document.location.href="#p17";
		return;
	}
	document.getElementById("formulario").action="enviarencuestacalidad.asp";
	document.getElementById("formulario").submit();
}