// JavaScript Document

function retroceder1() {window.onmousedown = history.go(-1);}
function retroceder2() {window.onmousedown = history.go(-2);}
/*******************************************************************************************************/

function imprimir() {window.print();}

/*******************************************************************************************************/

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

/*******************************************************************************************************/
function validarEntradas(){
 if ( document.form1.idParque.checked == false )
    {
        alert ( "Debe de elegir un parque" );
        return (false);
    }
}
/*******************************************************************************************************/	
	
function checkUncheck(theElement) {
 var theForm = theElement.form, z = 0,i=0;
 for(z=0; z<theForm.length;z++){
  if(theForm[z].type == 'checkbox' && theForm[z].id =='idmunicipio'){
  theForm.idmunicipio[i].checked = theElement.checked;
  i=i+1;
  
  }
 }
}

/***********************POr si acaso**************************************/

function checkUncheck2(theElement) {
 var theForm = theElement.form, z = 0;
 for(z=0; z<theForm.length;z++){
  if(theForm[z].type == 'checkbox' && theForm[z].name != 'checkall'){
  theForm.idmunicipio[z].checked = theElement.checked;
  }
 }
}

/*******************************************************************************************************/

function validarMunicipios(){
var count = false;
var docLength = eval("document.forms[0]." + "idmunicipio" + ".length");

if (typeof docLength == 'undefined')
{
	if (eval("document.forms[0]." + "idmunicipio" + ".checked"))
	{
		count = true;
	}
} else
{
   for (i = 0; i < document.forms[0].idmunicipio.length; i++)
   {
	   if (document.forms[0].idmunicipio[i].checked)
	   {
			count = true;
	   }
   }
}

	if (count ==false)
	{
	   alert ("Debe Seleccionar por lo menos un municipio");
	}
	
return count;
}

/*******************************************************************************************************/

function validarServicios(){
var count = false;
var docLength = eval("document.forms[0]." + "idservicio" + ".length");

if (typeof docLength == 'undefined')
{
	if (eval("document.forms[0]." + "idservicio" + ".checked"))
	{
		count = true;
	}
} else
{
   for (i = 0; i < document.forms[0].idservicio.length; i++)
   {
	   if (document.forms[0].idservicio[i].checked)
	   {
			count = true;
	   }
   }
}

	if (count ==false)
	{
	   alert ("Debe Seleccionar por lo menos un servicio");
	}
	
return count;
}

/*******************************************************************************************************/

function validarActividades(){
var count = false;
var docLength = eval("document.forms[0]." + "actividades" + ".length");

if (typeof docLength == 'undefined')
{
	if (eval("document.forms[0]." + "actividades" + ".checked"))
	{
		count = true;
	}
} else
{
   for (i = 0; i < docLength; i++)
   {
	   if (document.forms[0].actividades[i].checked)
	   {
			count = true;
	   }
   }
}

	if (count ==false)
	{
	   alert ("Debe Seleccionar por lo menos una actividad");
	}
	
return count;
}

/*******************************************************************************************************/

function validarTodo() {
var form = window.document.forms[0]
for (var i = 0; i < form.elements.length; i++) {
if (form.elements[i].value == "") {
alert ("Esta vacio el campo "+form.elements[i].id);
focus (form.elements[i].id);
return (false);
}
} 
}

/*******************************************************************************************************/

function validarCampos()
{
	var form = window.document.forms[0]
	if (form.f1.value == "")
	{
		alert("Escriba un valor para el campo \"Nombre\".");
		form.f1.focus();
		return (false);
	}
	if (form.f3.value == "")
	{
		alert("Escriba un valor para el campo \"E-mail\".");
		form.f3.focus();
		return (false);
	}
  
return (true);
} 
