// JavaScript Document
var key=0, Long=0, speed=1
var n4 = (document.layers)? true:false, ie = (document.all)? true:false, n6 = (document.getElementById)? true:false

//JavaScript: Revisar Digito Verificador
function revisarDigito(dvr,tipo)
{	
	dv = dvr + ""	
	if ( dv != '0' && dv != '1' && dv != '2' && dv != '3' && dv != '4' && dv != '5' && dv != '6' && dv != '7' && dv != '8' && dv != '9' && dv != 'k'  && dv != 'K')	
	{		
		alert("Debe ingresar un digito verificador valido");
		if (tipo=="1")
		{
			window.document.all.rut_ing.focus();
			window.document.all.rut_ing.select();
		}
		return false;	
	}	
	return true;
}
//JavaScript: Revisar Digito Verificador
function revisarDigito2(crut,tipo)
{	
	largo = crut.length;	
	if ( largo < 2 )	
	{		
		//alert("Debe ingresar el rut completo");
		if (tipo=="1")
		{
			window.document.all.rut_ing.focus();
			window.document.all.rut_ing.select();
		}
		return false;
	}	
	if ( largo > 2 )		
		rut = crut.substring(0, largo - 1);	
	else		
		rut = crut.charAt(0);	
	dv = crut.charAt(largo-1);	
	revisarDigito(dv,tipo);	

	if ( rut == null || dv == null )
		return 0	

	var dvr = '0'	
	suma = 0	
	mul  = 2	

	for (i= rut.length -1 ; i >= 0; i--)	
	{	
		suma = suma + rut.charAt(i) * mul		
		if (mul == 7)			
			mul = 2		
		else    			
			mul++	
	}	
	res = suma % 11	
	if (res==1)		
		dvr = 'k'	
	else if (res==0)		
		dvr = '0'	
	else	
	{		
		dvi = 11-res		
		dvr = dvi + ""	
	}
	if ( dvr != dv.toLowerCase() )	
	{		
		alert("EL rut es incorrecto")
		if (tipo=="1")
		{
			window.document.all.rut_ing.value="";
			window.document.all.rut_ing.focus();
			window.document.all.rut_ing.select();
		}
		return false;
	}

	return true
}
//JavaScript: Función obtiene el Rut desde Pagina.
function Rut(texto,tipo)
{	
	var tmpstr = "";	
	for ( i=0; i < texto.length ; i++ )		
		if ( texto.charAt(i) != ' ' && texto.charAt(i) != '.' && texto.charAt(i) != '-' )
			tmpstr = tmpstr + texto.charAt(i);	
	texto = tmpstr;	
	largo = texto.length;	

	if ( largo < 2 )	
	{		
		//alert("Debe ingresar el rut completo")		
		if (tipo=="1")
		{
			window.document.all.rut_ing.focus();
			window.document.all.rut_ing.select();
		}
		return false;
	}	

	for (i=0; i < largo ; i++ )	
	{			
		if ( texto.charAt(i) !="0" && texto.charAt(i) != "1" && texto.charAt(i) !="2" && texto.charAt(i) != "3" && texto.charAt(i) != "4" && texto.charAt(i) !="5" && texto.charAt(i) != "6" && texto.charAt(i) != "7" && texto.charAt(i) !="8" && texto.charAt(i) != "9" && texto.charAt(i) !="k" && texto.charAt(i) != "K" )
 		{			
			alert("El valor ingresado no corresponde a un R.U.T valido");
			if (tipo=="1")
			{
				window.document.all.rut_ing.value="";
				window.document.all.rut_ing.focus();
				window.document.all.rut_ing.select();
			}
			return false;
		}	
	}	

	var invertido = "";	
	for ( i=(largo-1),j=0; i>=0; i--,j++ )		
		invertido = invertido + texto.charAt(i);	
	var dtexto = "";	
	dtexto = dtexto + invertido.charAt(0);	
	dtexto = dtexto + '-';	
	cnt = 0;	

	for ( i=1,j=2; i<largo; i++,j++ )	
	{		
		if ( cnt == 3 )		
		{			
			dtexto = dtexto + '.';			
			j++;			
			dtexto = dtexto + invertido.charAt(i);			
			cnt = 1;		
		}		
		else		
		{				
			dtexto = dtexto + invertido.charAt(i);			
			cnt++;		
		}	
	}	

	invertido = "";	
	for ( i=(dtexto.length-1),j=0; i>=0; i--,j++ )		
		invertido = invertido + dtexto.charAt(i);	
		if (tipo=="1")
		{
			window.document.all.rut_ing.value = invertido.toUpperCase();
		}
	if (revisarDigito2(texto,tipo))		
		return true;	

	return false;
}
//valida fecha
function Valida_fecha(id, flag)    
{   
   Cant = new Array(31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
   Nombres = new Array("Enero", "Febrero", "Marzo", "Abril", "Mayo",
                       "Junio", "Julio", "Agosto", "Septiembre", "Octubre",
                       "Noviembre", "Diciembre");
   str = flag;        
   if(flag > id.value.length)
   {
      if(id.value.length == 2)
         id.value=id.value.substr(0, 1);
      if(id.value.length == 5)
         id.value=id.value.substr(0, 4);
   }
   else
   {
      if(id.value.length >= 2 && id.value.charAt(2) != '/') // Tecleador Rápido               
         id.value = id.value.substr(0, 2) + "/" + id.value.substr(2);                      
      if(id.value.length >= 5 && id.value.charAt(5) != '/')
         id.value = id.value.substr(0, 2) + "/" + id.value.substr(3, 2) + "/" + id.value.substr(5);      
	  d = id.value.substr(0, 2);
      if(id.value.length >= 2 && (d < 1 || d > 31 || isNaN(d)))
      {
         alert("El día debe ser un número entre 1 y 31");
         id.value = "";
      }
      m = id.value.substr(3, 2);
      if(id.value.length >= 5)
      {
         if(m < 1 || m > 12 || isNaN(d))
         {
            alert("El mes debe ser un número entre 1 y 12");
            id.value = id.value.substr(0, 3);
         }
         else if(d > Cant[m - 1])
         {
            alert("Fecha no valida, "+Nombres[m - 1]+" sólo tiene "+Cant[m - 1]+" días.");
            id.value = id.value.substr(0, 3);
         }
      }
      if(id.value.length == 10)
      {         
         Agno = id.value.substr(6);                  
         if(Math.ceil(Agno/4)*4 != Agno && m == 2 && d == 29)
         {
            alert("Fecha no valida, en "+Agno+", Febrero sólo tiene 28 días");
            id.value = id.value.substr(0, 6);
         }         
      }
   }      
   return id.value.length;
}
function acceptNum(evt)
{
  // Backspace = 8, Enter = 13, '0' = 48, '9' = 57
  var key = n4 ? evt.which : evt.keyCode;
  return (key < 13 || (key >= 48 && key <= 57));
}
function CampoAntiguo(id,band)
{
  if(band==0)
    OldValue=id.value
  else
    OldValue=eval("id.value='"+OldValue+"'")
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//Valida Hora
function SetHora(evt,id)
{
	var key = n4 ? evt.which : evt.keyCode;
	if(key!=8)
		if(id.value.length==2)
		{
			if (id.value<24 && id.value>=0)
			{
				id.value=id.value+":"
			}
			else
			{
				alert("Hora no válida, hasta 23 hrs., luego es 00:00");
				id.focus()
			}	
		}
		else
		{
			if(id.value.length==5)
			{
				minuto = id.value.substr(3, 2);
				if (minuto>"59")
				{
					alert("Hora no válida, Minutos hasta 59 min.");
					id.focus()
				}
			}
		}	
}
function acceptNumSignoMenos(evt)
{
	key = n4 ? evt.which : evt.keyCode;
	return (key == 46 || key == 45 || key >= 48 && key <= 57);
}
function aceptHora(evt)
{	
  var key = n4 ? evt.which : evt.keyCode; //58 = ":"
  return ((key >= 48 && key <= 57) || key==58);
}
function CancelarNoticia()
{
	document.all.nombre.value = "";
	document.all.fecha.value  = "";
	document.all.hora.value   = "";
	document.all.File1.value  = "";
	document.all.descripcion.value = "";
	document.all.nombre.focus();
}
function Filtrar()
{
	extArray = new Array(".jpg",".gif",".jpeg");
	form = document.form1
	file = document.all.File1.value
	allowSubmit = false;
	if (file != "")
	{
		if (!file) return;
		while (file.indexOf("\\") != -1)
		
		file = file.slice(file.indexOf("\\") + 1);
		ext = file.slice(file.indexOf(".")).toLowerCase();
		
		for (var i = 0; i < extArray.length; i++)
		{
			if (extArray[i] == ext) 
			{ 
				allowSubmit = true; break; 
			}
		}
		//alert(allowSubmit)
		if (allowSubmit)
		{
			if (document.all.nombre.value != "")
			{
				if (document.all.fecha.value != "")
				{
					if (document.all.hora.value != "")
					{
						if (document.all.descripcion.value != "")
						{
							//form.submit();
							return true;
						}
						else
						{
							alert("Debe Ingresar la Descripción de la Noticia");
							document.body.style.cursor = "default"
							document.all.descripcion.focus();
							return false;
						}
					}
					else
					{
						alert("Debe Ingresar la hora de la Noticia");
						document.body.style.cursor = "default"
						document.all.hora.focus();
						return false;
					}
				}
				else
				{
					alert("Debe Ingresar la Fecha de la Noticia");
					document.body.style.cursor = "default"
					document.all.fecha.focus();
					return false;
				}
			}
			else
			{
				alert("Debe Ingresar el Nombre de la Noticia");
				document.body.style.cursor = "default"
				document.all.nombre.focus();
				return false;
			}
		}
		else
		{
			alert("Por favor, seleccione un archivo valido para subir");
			document.body.style.cursor = "default"
			document.forms[0].reset();
			document.all.File1.focus();
			return false;
		}
	}
	else
	{
		alert("Por favor, Ingrese un archivo de Imagen");
		document.body.style.cursor = "default"
		document.all.File1.focus();
		return false;
	}
}
//Actividades deportivas
function CargaDeporte(tmp_cod,tmp_nombre,tmp_fecha,tmp_hora,tmp_descripcion)
{
	document.all.codigo_ad.value = tmp_cod;
	document.all.nombre.value = tmp_nombre;
	document.all.fecha.value = tmp_fecha;
	document.all.hora.value = tmp_hora;
	document.all.descripcion.value = tmp_descripcion;
	HabilitaDeporte()
	document.all.guardo.disabled = true;
	document.all.modifico.disabled = false;
	document.all.elimino.disabled = false;
}
function CancelarDeporte()
{
	document.all.nombre.value = "";
	document.all.fecha.value = "";
	document.all.hora.value = "";
	document.all.descripcion.value = "";
	document.all.codigo_ad.value = "";
	HabilitaDeporte()
	document.all.guardo.disabled = false;
	document.all.modifico.disabled = true;
	document.all.elimino.disabled = true;
	document.all.nombre.focus();
}
function NuevoDeporte()
{
	document.all.guardo.disabled = false;
	document.all.modifico.disabled = true;
	document.all.elimino.disabled = true;
	HabilitaDeporte()
	CancelarDeporte()
}
function HabilitaDeporte()
{
	document.all.nombre.disabled = false;
	document.all.fecha.disabled = false;
	document.all.hora.disabled = false;
	document.all.descripcion.disabled = false;
}
function DeshabilitaDeporte()
{
	document.all.nombre.disabled = true;
	document.all.fecha.disabled = true;
	document.all.hora.disabled = true;
	document.all.descripcion.disabled = true;
	document.all.guardo.disabled = true;
	document.all.modifico.disabled = true;
	document.all.elimino.disabled = true;
}
//Actividades Sociales
function CargaSocial(tmp_cod,tmp_nombre,tmp_fecha,tmp_hora,tmp_descripcion)
{
	document.all.codigo_ad.value = tmp_cod;
	document.all.nombre.value = tmp_nombre;
	document.all.fecha.value = tmp_fecha;
	document.all.hora.value = tmp_hora;
	document.all.descripcion.value = tmp_descripcion;
	HabilitaSocial()
	document.all.guardo.disabled = true;
	document.all.modifico.disabled = false;
	document.all.elimino.disabled = false;
}
function CancelarSocial()
{
	document.all.nombre.value = "";
	document.all.fecha.value = "";
	document.all.hora.value = "";
	document.all.descripcion.value = "";
	document.all.codigo_ad.value = "";
	HabilitaSocial()
	document.all.guardo.disabled = false;
	document.all.modifico.disabled = true;
	document.all.elimino.disabled = true;
	document.all.nombre.focus();
}
function NuevoSocial()
{
	document.all.guardo.disabled = false;
	document.all.modifico.disabled = true;
	document.all.elimino.disabled = true;
	HabilitaSocial()
	CancelarSocial()
}
function HabilitaSocial()
{
	document.all.nombre.disabled = false;
	document.all.fecha.disabled = false;
	document.all.hora.disabled = false;
	document.all.descripcion.disabled = false;
}
function DeshabilitaSocial()
{
	document.all.nombre.disabled = true;
	document.all.fecha.disabled = true;
	document.all.hora.disabled = true;
	document.all.descripcion.disabled = true;
	document.all.guardo.disabled = true;
	document.all.modifico.disabled = true;
	document.all.elimino.disabled = true;
}
//USUARIOS
function CargaUsuarios(tmp_cod,tmp_nombre,tmp_pass,tmp_estado)
{
	document.all.rut_ing.value = tmp_cod;
	document.all.nombre.value = tmp_nombre;
	document.all.pass.value = tmp_pass;
	document.all.repass.value = tmp_pass;
	document.all.estado.value = tmp_estado;
	HabilitaUsuarios()
	document.all.rut_ing.disabled = true;
	document.all.guardo.disabled = true;
	document.all.modifico.disabled = false;
	document.all.elimino.disabled = false;
}
function CancelarUsuarios()
{
	document.all.nombre.value = "";
	document.all.rut_ing.value = "";
	document.all.pass.value = "";
	document.all.repass.value = "";
	document.all.estado.value = "";
	HabilitaUsuarios()
	document.all.rut_ing.focus();
}
function NuevoUsuarios()
{
	document.all.guardo.disabled = false;
	document.all.modifico.disabled = true;
	document.all.elimino.disabled = true;
	HabilitaUsuarios()
	CancelarUsuarios()
}
function HabilitaUsuarios()
{
	document.all.nombre.disabled = false;
	document.all.rut_ing.disabled = false;
	document.all.pass.disabled = false;
	document.all.repass.disabled = false;
	document.all.estado.disabled = false;
}
function DeshabilitaUsuarios()
{
	document.all.nombre.disabled = true;
	document.all.rut_ing.disabled = true;
	document.all.pass.disabled = true;
	document.all.repass.disabled = true;
	document.all.estado.disabled = true;
	document.all.guardo.disabled = true;
	document.all.modifico.disabled = true;
	document.all.elimino.disabled = true;
}
function CargaNoticias(tmp_cod,tmp_nombre,tmp_fecha,tmp_hora,tmp_mostrar)
{
	document.all.codigo.value = tmp_cod;
	document.all.nombre.value = tmp_nombre;
	document.all.fecha.value  = tmp_fecha;
	document.all.hora.value = tmp_hora;
	document.all.estado.value = tmp_mostrar;
	document.all.elimino.disabled = false;
}
function CancelarNoticias()
{
	document.all.codigo.value = "";
	document.all.nombre.value = "";
	document.all.fecha.value = "";
	document.all.hora.value = "";
	document.all.estado.value = "-1";
	document.all.elimino.disabled = true;
}
function CancelarActividad()
{
	document.all.nombre.value = "";
	document.all.fecha.value = "";
}
function CargaActividad(tmp_cod,tmp_nombre,tmp_fecha)
{
	document.all.codigo.value = tmp_cod;
	document.all.nombre.value = tmp_nombre;
	document.all.fecha.value  = tmp_fecha;
	document.all.elimino.disabled = false;
}
function FiltrarComite()
{
	extArray = new Array(".jpg",".gif",".jpeg");
	form = document.form1
	file = document.all.File1.value
	allowSubmit = false;
	if (file != "")
	{
		if (!file) return;
		while (file.indexOf("\\") != -1)
		
		file = file.slice(file.indexOf("\\") + 1);
		ext = file.slice(file.indexOf(".")).toLowerCase();
		
		for (var i = 0; i < extArray.length; i++)
		{
			if (extArray[i] == ext) 
			{ 
				allowSubmit = true; break; 
			}
		}
		//alert(allowSubmit)
		if (allowSubmit)
		{
			if (document.all.nombre.value != "")
			{
				if (document.all.fecha.value != "")
				{
					//form.submit();
					return true;
				}
				else
				{
					alert("Debe Ingresar la Fecha de la Actividad");
					document.body.style.cursor = "default"
					document.all.fecha.focus();
					return false;
				}
			}
			else
			{
				alert("Debe Ingresar el Nombre de la Actividad");
				document.body.style.cursor = "default"
				document.all.nombre.focus();
				return false;
			}
		}
		else
		{
			alert("Por favor, seleccione un archivo valido para subir");
			document.body.style.cursor = "default"
			document.forms[0].reset();
			document.all.nombre.focus();
			return false;
		}
	}
	else
	{
		alert("Por favor, Ingrese un archivo de Imagen");
		document.body.style.cursor = "default"
		document.all.File1.focus();
		return false;
	}
}
function FiltrarTorneo()
{
	if (document.all.nombre.value != "")
	{
		if (document.all.fecha.value != "")
		{
			if (document.all.descripcion.value != "")
			{
				return true;
			}
			else
			{
				alert("Debe Ingresar Hora y Lugar de la Actividad");
				document.body.style.cursor = "default"
				document.all.descripcion.focus();
				return false;
			}	
		}
		else
		{
			alert("Debe Ingresar la Fecha de la Actividad");
			document.body.style.cursor = "default"
			document.all.fecha.focus();
			return false;
		}
	}
	else
	{
		alert("Debe Ingresar el Nombre de la Actividad");
		document.body.style.cursor = "default"
		document.all.nombre.focus();
		return false;
	}
}
function CancelarTorneo()
{
	document.all.nombre.value = "";
	document.all.fecha.value = "";
	document.all.descripcion.value = "";
}
function CargaTorneos(tmp_cod,tmp_nombre,tmp_fecha,tmp_lugar,tipo)
{
	document.all.codigo.value = tmp_cod;
	document.all.nombre.value = tmp_nombre;
	document.all.fecha.value  = tmp_fecha;
	document.all.descripcion.value = tmp_lugar;
	//si es 1 = DEL, 0 = MOD
	if (tipo == 1)
	{
		document.all.elimino.disabled = false;
	}
	else
	{
		document.all.codigo.disabled = false;
		document.all.nombre.disabled = false;
		document.all.fecha.disabled = false;
		document.all.descripcion.disabled = false;
		document.all.modifico.disabled = false;
	}
}
function FiltrarEntrevista()
{
	if (document.all.nombre.value != "")
	{
		if (document.all.fecha.value != "")
		{
			if (document.all.descripcion.value != "")
			{
				return true;
			}
			else
			{
				alert("Debe Ingresar la entrevista");
				document.body.style.cursor = "default"
				document.all.descripcion.focus();
				return false;
			}	
		}
		else
		{
			alert("Debe Ingresar la Fecha de la Entrevista");
			document.body.style.cursor = "default"
			document.all.fecha.focus();
			return false;
		}
	}
	else
	{
		alert("Debe Ingresar el Nombre de la Entrevista");
		document.body.style.cursor = "default"
		document.all.nombre.focus();
		return false;
	}
}
function CancelarEntrevista()
{
	document.all.nombre.value = "";
	document.all.fecha.value = "";
	document.all.descripcion.value = "";
	//document.all.elimino.disabled = true;
}
function CargaEntrevista(tmp_cod,tmp_nombre,tmp_fecha,tipo)
{
	document.all.codigo.value = tmp_cod;
	document.all.nombre.value = tmp_nombre;
	document.all.fecha.value  = tmp_fecha;
	document.all.estado.value  = tipo;
	document.all.elimino.disabled = false;
}
function FiltrarEquipos()
{
	if (document.all.nombre.value != "")
	{
		if (document.all.delegado.value != "")
		{
			return true;
		}
		else
		{
			alert("Debe Ingresar el nombre del Equipo");
			document.body.style.cursor = "default"
			document.all.nombre.focus();
			return false;
		}	
	}
	else
	{
		alert("Debe Ingresar el Delegado del Equipo");
		document.body.style.cursor = "default"
		document.all.delegado.focus();
		return false;
	}
}
function CancelarEquipos()
{
	document.all.nombre.value = "";
	document.all.delegado.value = "";
	//document.all.elimino.disabled = true;
}
function CargaEquipos(tmp_cod,tmp_nombre,tmp_delegado)
{
	document.all.codigo.value = tmp_cod;
	document.all.nombre.value = tmp_nombre;
	document.all.delegado.value  = tmp_delegado;
	document.all.elimino.disabled = false;
}
function FiltrarTabla()
{
	if (document.all.equipo.value != "-1")
	{
		if (document.all.grupo.value != "-1")
		{
			return true;
		}
		else
		{
			alert("Debe Seleccionar el Grupo al cual pertenece el Equipo");
			document.body.style.cursor = "default"
			document.all.grupo.focus();
			return false;
		}	
	}
	else
	{
		alert("Debe Seleccionar el Equipo");
		document.body.style.cursor = "default"
		document.all.equipo.focus();
		return false;
	}
}
function CargaTabla(tmp_cod,tmp_nombre,tmp_grupo,tmp_equipo)
{
	document.all.codigo.value = tmp_cod;
	document.all.nombre.value = tmp_equipo;
	document.all.grupo.value  = tmp_grupo;
	document.all.elimino.disabled = false;
}
function CancelarTabla()
{
	document.all.equipo.value = "-1";
	document.all.grupo.value = "-1";
	document.all.pj.value = "";
	document.all.pg.value = "";
	document.all.pe.value = "";
	document.all.pp.value = "";
	document.all.gf.value = "";
	document.all.gc.value = "";
	document.all.dif.value = "";
	document.all.pts.value = "";
}
function FiltrarFotos()
{
	extArray = new Array(".jpg",".gif",".jpeg");
	form = document.form1
	file = document.all.File1.value
	allowSubmit = false;
	if (file != "")
	{
		if (!file) return;
		while (file.indexOf("\\") != -1)
		
		file = file.slice(file.indexOf("\\") + 1);
		ext = file.slice(file.indexOf(".")).toLowerCase();
		
		for (var i = 0; i < extArray.length; i++)
		{
			if (extArray[i] == ext) 
			{ 
				allowSubmit = true; break; 
			}
		}
		//alert(allowSubmit)
		if (allowSubmit)
		{
			if (document.all.nombre.value != "")
			{
				if (document.all.fecha.value != "")
				{
					if (document.all.descripcion.value != "")
					{
						//form.submit();
						return true;
					}
					else
					{
						alert("Debe Ingresar la Descripción de la Foto");
						document.body.style.cursor = "default"
						document.all.descripcion.focus();
						return false;
					}
				}
				else
				{
					alert("Debe Ingresar la Fecha de la Foto");
					document.body.style.cursor = "default"
					document.all.fecha.focus();
					return false;
				}
			}
			else
			{
				alert("Debe Ingresar el Nombre de la Foto");
				document.body.style.cursor = "default"
				document.all.nombre.focus();
				return false;
			}
		}
		else
		{
			alert("Por favor, seleccione un archivo valido para subir");
			document.body.style.cursor = "default"
			document.forms[0].reset();
			document.all.File1.focus();
			return false;
		}
	}
	else
	{
		alert("Por favor, Ingrese un archivo de Imagen");
		document.body.style.cursor = "default"
		document.all.File1.focus();
		return false;
	}
}
function CancelarFotos()
{
	document.all.nombre.value = "";
	document.all.fecha.value  = "";
	document.all.File1.value  = "";
	document.all.descripcion.value = "";
	document.all.nombre.focus();
}
function CargaFotos(tmp_cod,tmp_nombre,tmp_fecha)
{
	document.all.codigo.value = tmp_cod;
	document.all.nombre.value = tmp_nombre;
	document.all.fecha.value  = tmp_fecha;
	document.all.elimino.disabled = false;
}
function FiltrarMenu()
{
	if (document.all.fecha.value != "")
	{
		if (document.all.descripcion.value != "")
		{
			if (document.all.valor.value != "")
			{
				return true;
			}
			else
			{
				alert("Debe Ingresar el Precio del Menú del día");
				document.body.style.cursor = "default"
				document.all.valor.focus();
				return false;
			}
		}
		else
		{
			alert("Debe Ingresar el Menú del día");
			document.body.style.cursor = "default"
			document.all.descripcion.focus();
			return false;
		}
	}
	else
	{
		alert("Debe Ingresar la Fecha del Menú");
		document.body.style.cursor = "default"
		document.all.fecha.focus();
		return false;
	}
}
function CancelarMenu()
{
	document.all.fecha.value = "";
	document.all.descripcion.value = "";
	document.all.valor.value = "";
	document.all.codigo.value = "";
}
function CargaMenu(tmp_cod,tmp_fecha,tmp_descripcion,tmp_valor)
{
	document.all.codigo.value = tmp_cod;
	document.all.fecha.value = tmp_fecha;
	tmp_descripcion = tmp_descripcion.replace('\n','_');
	document.all.descripcion.value  = tmp_descripcion;
	document.all.valor.value  = tmp_valor;
	document.all.elimino.disabled = false;
}
function FiltrarRest()
{
	if (document.all.fecha.value != "")
	{
		if (document.all.hora.value != "")
		{
			if (document.all.nombre.value != "")
			{
				if (document.all.descripcion.value != "")
				{
					return true;
				}
				else
				{
					alert("Debe Ingresar la descripción de la Actividad");
					document.body.style.cursor = "default"
					document.all.descripcion.focus();
					return false;
				}
			}
			else
			{
				alert("Debe Ingresar el nombre de la Actividad");
				document.body.style.cursor = "default"
				document.all.nombre.focus();
				return false;
			}	
		}
		else
		{
			alert("Debe Ingresar la Hora de la Actividad");
			document.body.style.cursor = "default"
			document.all.hora.focus();
			return false;
		}
	}
	else
	{
		alert("Debe Ingresar la Fecha de la Actividad");
		document.body.style.cursor = "default"
		document.all.fecha.focus();
		return false;
	}
}
function CancelarRest()
{
	document.all.fecha.value = "";
	document.all.hora.value = "";
	document.all.nombre.value = "";
	document.all.descripcion.value = "";
	document.all.codigo.value = "";
}
function CargaRest(tmp_cod,tmp_fecha,tmp_hora,tmp_nombre,tmp_descripcion)
{	
	document.all.codigo.value = tmp_cod;
	document.all.fecha.value = tmp_fecha;
	document.all.hora.value  = tmp_hora;
	document.all.nombre.value  = tmp_nombre;
	document.all.descripcion.value = tmp_descripcion;
	document.all.elimino.disabled = false;
}
function CargaLenadores(tmp_cod,tmp_nombre,tmp_tipo,tmp_mostrar)
{
	document.all.codigo.value = tmp_cod;
	document.all.nombre.value = tmp_nombre;
	document.all.tipo.value  = tmp_tipo;
	document.all.estado.value = tmp_mostrar;
	document.all.elimino.disabled = false;
}
function CancelarLenadores()
{
	document.all.codigo.value = "";
	document.all.nombre.value = "";
	document.all.tipo.value = "";
	document.all.estado.value = "-1";
	document.all.elimino.disabled = true;
}
function FiltrarLenadores()
{
	extArray = new Array(".jpg",".gif",".jpeg");
	form = document.form1
	file = document.all.File1.value
	allowSubmit = false;
	if (file != "")
	{
		if (!file) return;
		while (file.indexOf("\\") != -1)
		
		file = file.slice(file.indexOf("\\") + 1);
		ext = file.slice(file.indexOf(".")).toLowerCase();
		
		for (var i = 0; i < extArray.length; i++)
		{
			if (extArray[i] == ext) 
			{ 
				allowSubmit = true; break; 
			}
		}
		//alert(allowSubmit)
		if (allowSubmit)
		{
			if (document.all.nombre.value != "")
			{
				if (document.all.tipo.value != "")
				{
					if (document.all.descripcion.value != "")
					{
						//form.submit();
						return true;
					}
					else
					{
						alert("Debe Ingresar la Descripción de la Empresa");
						document.body.style.cursor = "default"
						document.all.descripcion.focus();
						return false;
					}
				}
				else
				{
					alert("Debe Ingresar el tipo de Empresa");
					document.body.style.cursor = "default"
					document.all.tipo.focus();
					return false;
				}
			}
			else
			{
				alert("Debe Ingresar el Nombre de la Empresa");
				document.body.style.cursor = "default"
				document.all.nombre.focus();
				return false;
			}
		}
		else
		{
			alert("Por favor, seleccione un archivo valido para subir");
			document.body.style.cursor = "default"
			document.forms[0].reset();
			document.all.File1.focus();
			return false;
		}
	}
	else
	{
		alert("Por favor, Ingrese un archivo de Imagen");
		document.body.style.cursor = "default"
		document.all.File1.focus();
		return false;
	}
}
function FiltrarSpa()
{
	if (document.all.fecha.value != "")
	{
		if (document.all.titulo.value != "")
		{
			if (document.all.descripcion.value != "")
			{
				return true;
			}
			else
			{
				alert("Debe Ingresar la descripción de la promoción");
				document.body.style.cursor = "default"
				document.all.descripcion.focus();
				return false;
			}
		}
		else
		{
			alert("Debe Ingresar el título de la promoción");
			document.body.style.cursor = "default"
			document.all.titulo.focus();
			return false;
		}	
	}
	else
	{
		alert("Debe Ingresar la Fecha de la promoción");
		document.body.style.cursor = "default"
		document.all.fecha.focus();
		return false;
	}
}
function CancelarSpa()
{
	document.all.fecha.value = "";
	document.all.titulo.value = "";
	document.all.descripcion.value = "";
}
function CargaSpa(tmp_cod,tmp_fecha,tmp_nombre,tmp_descripcion)
{	
	document.all.codigo.value = tmp_cod;
	document.all.fecha.value = tmp_fecha;
	document.all.titulo.value  = tmp_nombre;
	document.all.descripcion.value = tmp_descripcion;
	document.all.elimino.disabled = false;
}