var TRIM_LEFT  = 0x0001;
var TRIM_RIGHT = 0x0002;
var TRIM_BOTH  = TRIM_LEFT | TRIM_RIGHT;

function setPointer(theRow, thePointerColor)
{
    if (thePointerColor == '' || typeof(theRow.style) == 'undefined') {
        return false;
    }
    if (typeof(document.getElementsByTagName) != 'undefined') {
        var theCells = theRow.getElementsByTagName('td');
    }
    else if (typeof(theRow.cells) != 'undefined') {
        var theCells = theRow.cells;
    }
    else {
        return false;
    }

    var rowCellsCnt  = theCells.length;
    for (var c = 0; c < rowCellsCnt; c++) {
        theCells[c].style.backgroundColor = thePointerColor;
    }

    return true;
} 


function strTrim( varText, side )
	{

	var i = 0;
	var j = varText.length - 1;
	if( side & TRIM_LEFT )
  	  {
	    for( i = 0; i < varText.length; i++ )
		{
		 if( varText.substring( i, i+1 ) != " " && varText.substring( i, i+1 ) != "\t")
		   {
		     break;
		   }
		}
	}

      if( side & TRIM_RIGHT )
	 {
	   for( j = varText.length - 1; j >= 0; j-- )
	     {
		if( varText.substring( j, j+1 ) != " " && varText.substring( j, j+1 ) != "\t")
		  {
		   break;
		  }
	     }
	  }

      if( i <= j )
	 return( varText.substring( i, (j+1) ) );
      else
	 return("");
}



/*****************************************************************************************
'Descripcion:
'		Funcion para validar que el texto ingresado en un campo texto,
'		corresponda a una dirección válida de correo (e-mail)
'.........................................................................................
'Parametros:
'		Campo:		Control con el valor a validar
'		Mensaje:	Cadena con el nombre descriptivo del control, usada para mostrar
'					un mensaje personalizado.
'.........................................................................................
'Validaciones:
'		- Los caracteres que contiene la cuenta de correo deben estar dentro de la siguiente lista
'			"0123456789abcdefghijlkmnopqrstuvwxyz@.-_"
'		- El primer y último caracter no pueden ser alguno de los caracteres "@.-_"
'		- Los caracteres anterior y posterior a la arroba (@), no pueden ser "@.-_"
'		- La cadena NO puede contener más de una arroba (@)
'		- La cadena debe contener al menos UNA arroba (@)
'		- La cadena NO puede contener espacios vacíos (" ")
'		- Después del último punto, debe haber AL MENOS 2 caracteres
*****************************************************************************************/
function ValidarEmail(Campo, Mensaje)
	{
	var perfect = true;

	with (Campo)
		{
		// Validar que los caracteres que contiene la cuenta de correo
		// esten dentro de los caracteres de la siguiente lista
		var car_validos = "0123456789abcdefghijlkmnopqrstuvwxyzABCDEFGHIJKMNOPQRSTUVWXYZ@.-_"
		var car_otros = "@.-_";

		for (var i=0; i < value.length; i++) {
			var ch = value.substring(i, i+1);
			if (car_validos.indexOf(ch) == -1) perfect = false;
		}

		apos = value.indexOf("@");
		lastpos = value.length-1;

		// Validar primer y ultimo caracter
		var car1 = value.substring(0, 1);
		var car2 = value.substring(lastpos, lastpos+1);
		if ((car_otros.indexOf(car1) != -1) || (car_otros.indexOf(car2) != -1)) perfect = false;

		// Validar anterior y siguiente caracter despues de "@"
		car1 = value.substring(apos-1, apos);
		car2= value.substring(apos+1, apos+2);
		if ((car_otros.indexOf(car1) != -1) || (car_otros.indexOf(car2) != -1)) perfect = false;

		// Buscar si existe otro simbolo "@" en el campo
		var subcadena = value.substring(apos + 1, 100);
		a2pos = subcadena.indexOf("@");
		spacepos = value.indexOf(" ");
		dotpos = value.lastIndexOf(".");

		posh=subcadena.indexOf(".");

		//if (apos < 1 || a2pos != -1 || dotpos - apos < 2 || lastpos - dotpos > 3 || lastpos - dotpos < 2 || spacepos != -1) {
		if (apos < 1 || a2pos != -1 || lastpos - dotpos < 2 || spacepos != -1||posh==-1) perfect = false;
		}

	if (!perfect) 
		{
		alert('\nEl valor de ' + Mensaje + ' (E-Mail) es inválido.\n\nPor favor corrige la información.');
		Campo.focus();
		return false;
		}

	return true;

	}
/**************************************************************************************/
function ValidarFecha(Anno, Mes, Dia, Dato) 
	{

	var intAnno = parseInt(Anno);
	var intMes = parseInt(Mes);
	var intDia = parseInt(Dia);

	// Validar que los valores no sean igual a cero
	if ((Anno == 0) || (Mes == 0) || (Dia == 0)) 
		{
		alert('Debes elegir los valores para el mes, el día y el año de ' + Dato);
		return false;
		}

	// Validar que, en un año NO bisiesto, el número de días del mes de Febrero no sea mayor que 28
	if (((intAnno % 4) != 0) && (intMes == 2) && (intDia > 28)) 
		{
		alert('El mes de Febrero no puede contener más de 28 días.\n\nPor favor, corrije la información de ' + Dato);
		return false;
		}

	// Validar que, en un año bisiesto, el número de días del mes de Febrero no sea mayor que 29
	if (((intAnno % 4) == 0) && (intMes == 2) && (intDia > 29)) 
		{
		alert('El mes de Febrero no puede contener más de 29 días.\n\n Por favor, corrije la información de ' + Dato);
		return false;
		}

	// Validar que el dia sea válido para el mes elegido, no mayor que 30
	if ( ((intMes == 4) || (intMes == 6) || (intMes == 9) || (intMes == 11)) && (intDia > 30) ) 
		{
		alert('El mes seleccionado sólo contiene 30 días.\n\nPor favor, corrije la información de ' + Dato);
		return false;
		}

	return true;
	}

/******************************************************************************************
'Fecha : Mayo 28/2001
'.........................................................................................
'Descripcion:
'		Verifica que una cadena contenga únicamente caracteres numéricos.
'		Retorna "true" ó "false" según sea el caso
'.........................................................................................
'Parametros:
'		- str : Cadena que se quiere evaluar
'.........................................................................................
'Validaciones: 
'		- Ninguno de los caracteres que componen la cadena debe ser diferente de los
'		  caracteres de la lista "0123456789"
*****************************************************************************************/
function isNumeric(str)
	{
	for (var i=0; i < str.length; i++) 
		{
		var ch = str.substring(i, i+1);
		if(ch < "0" || ch > "9") 
			{
			return false;
			}
		}
		return true;
	}

/*
funciones para el manejo de el panel de control
*/

function VerificarCliente()
{
   var Control;
   var Dato;
   Control = document.FrmClientes.clie_nombre;
	Dato = strTrim(Control.value,TRIM_BOTH);
	if (Dato.length == 0)
		{
		alert("Debe ingresar un nombre");
		Control.focus();
		return false;
		}

   Control = document.FrmClientes.clie_apellido;
	Dato = strTrim(Control.value,TRIM_BOTH);
	if (Dato.length == 0)
		{
		alert("Debe ingresar los apellidos");
		Control.focus();
		return false;
		}
		/*
    Control = document.FrmClientes.clie_direccion;
	Dato = strTrim(Control.value,TRIM_BOTH);
	if (Dato.length == 0)
		{
		alert("Debe ingresar la direccion del cliente");
		Control.focus();
		return false;
		}
*/
    Control = document.FrmClientes.clie_telefohogar;
	Dato = strTrim(Control.value,TRIM_BOTH);
	if (Dato.length == 0)
		{
		alert("Debe ingresar el telefono del hogar del cliente");
		Control.focus();
		return false;
		}

    Control = document.FrmClientes.clie_ciudad;
	Dato = strTrim(Control.value,TRIM_BOTH);
	if (Dato.length == 0)
		{
		alert("Debe ingresar la ciudad del cliente");
		Control.focus();
		return false;
		}

    Control = document.FrmClientes.clie_nrodoc;
	Dato = strTrim(Control.value,TRIM_BOTH);
	if (Dato.length == 0)
		{
		alert("Debe ingresar la identificacion del cliente");
		Control.focus();
		return false;
		}

    Control = document.FrmClientes.clie_estado;
	Dato = strTrim(Control.value,TRIM_BOTH);
	if (Dato.length == 0)
		{
		alert("Debe ingresar el estado o el departamento del cliente");
		Control.focus();
		return false;
		}
    Control = document.FrmClientes.clie_mail;
	Dato = strTrim(Control.value,TRIM_BOTH);
	if (Dato.length == 0)
		{
		alert("Debe ingresar el mail del usuario ");
		Control.focus();
		return false;
		}

   if(!ValidarEmail(Control,"Direccion de correo mal ingresada"))
	{	Control.focus();
		return false;   
   }
document.FrmClientes.submit();
return true;
}

//Funcion para valida que ingresen usuario y clave de acceso
function validarLogin()
{
   var Control;
   var Dato;
   Control = document.frmLogin.txtUsuario;
	Dato = strTrim(Control.value,TRIM_BOTH);
	if (Dato.length == 0)
		{
		alert("Debe ingresar un nombre de usuario");
		Control.focus();
		return false;
		}

   Control = document.frmLogin.txtContasena;
	Dato = strTrim(Control.value,TRIM_BOTH);
	if (Dato.length == 0)
		{
		alert("Debe ingresar la contraseña de l usuario");
		Control.focus();
		return false;
		}

document.frmLogin.submit();
return true;
}

//Funcion para validar los datos de las categorias de las FAQs
function ValidarCategoriaFaqs()
{
   var Control;
   var Dato;
   Control = document.frmCateFaqs.tab_catf_nombre;
	Dato = strTrim(Control.value,TRIM_BOTH);
	if (Dato.length == 0)
		{
		alert("Debe ingresar un nombre de categoria de la FAQ");
		Control.focus();
		return false;
		}
    
	Control = document.frmCateFaqs.tab_catf_descripcion;
	Dato = strTrim(Control.value,TRIM_BOTH);
	if (Dato.length == 0)
		{
		alert("Debe ingresar una descripcion de la FAQs");
		Control.focus();
		return false;
		}


 document.frmCateFaqs.submit();
 return true;
}


function EjecutarScript(Script)
{ 
  window.location = Script;
}



function VentanaConfirmacion(Mensaje)
{
  if(confirm(Mensaje)==false)
	 return false;
  return true;
}

function EliminarVentana(Mensaje,Script)
{
  if(confirm(Mensaje))
	  if(confirm("Esta seguro que desea eliminar el registro"))
	     EjecutarScript(Script); 
}


function ValidarContenido()
{
   var Control;
   var Dato;
   Control = document.frmContenidos.tblcont_nombre;
   Dato = strTrim(Control.value,TRIM_BOTH);
   if (Dato.length == 0)
		{
		alert("Debe ingresar un nombre al contenido que deben ingresar");
		Control.focus();
		return false;
		}    

   Control = document.frmContenidos.tblcont_descripcion;
   Dato = strTrim(Control.value,TRIM_BOTH);
   if (Dato.length == 0)
		{
		alert("Debe ingresar una descripcion al contenido que desea grabar");
		Control.focus();
		return false;
		}
	
	Control = document.frmContenidos.tblcont_pagina;
	Dato = strTrim(Control.value,TRIM_BOTH);
	if (Dato.length == 0)
		{
		alert("Debe ingresar el número de la página");
		Control.focus();
		return false;
		}
	
	Control = document.frmContenidos.tblcont_texto;
	Dato = strTrim(Control.value,TRIM_BOTH);
	if (Dato.length == 0)
		{
		alert("Debe ingresar el contenido a publicar");
		Control.focus();
		return false;
		}
    
document.frmContenidos.submit();
return true;
   
}


function ValidarUsuarios()
{
   var Control;
   var Dato;
   var Control1;
   var Dato1;

   Control = document.frmUsuario.tblk_usua_login;
   Dato = strTrim(Control.value,TRIM_BOTH);
   if (Dato.length == 0)
		{
		alert("Debe ingresar un login para el usuario");
		Control.focus();
		return false;
		}
    
   Control = document.frmUsuario.tblusua_nombre;
   Dato = strTrim(Control.value,TRIM_BOTH);
   if (Dato.length == 0)
		{
		alert("Debe ingresar el nombre del usuario");
		Control.focus();
		return false;
		}

   Control = document.frmUsuario.tblusua_apellido;
   Dato = strTrim(Control.value,TRIM_BOTH);
   if (Dato.length == 0)
		{
		alert("Debe ingresar el apellido del usuario");
		Control.focus();
		return false;
		}


   Control = document.frmUsuario.tblusua_clave;
   Dato = strTrim(Control.value,TRIM_BOTH);
   if (Dato.length == 0)
		{
		alert("Debe ingresar la clave de acceso");
		Control.focus();
		return false;
		}

   Control1 = document.frmUsuario.usua_clave1;
   Dato1 = strTrim(Control1.value,TRIM_BOTH);
   if (Dato1.length == 0)
		{
		alert("Debe ingresar la clave de confirmacion ");
		Control1.focus();
		return false;
		}

   if (Control1.value!=Control.value)
   {
	   alert("Las claves ingresadas no entran");
	   Control.focus();
	   return false;
   }

   Control = document.frmUsuario.tblusua_mail;
   Dato = strTrim(Control.value,TRIM_BOTH);
   if (Dato.length == 0)
		{
		alert("Debe ingresar la direccion de correo electronico");
		Control.focus();
		return false;
		}

if(!ValidarEmail(Control,"Direccion de correo mal ingresada"))
	{	Control.focus();
		return false;   
   }	  
	  

document.frmUsuario.submit();
return true;
}


//validacion noticias
function ValidarNoticias()
{
   var Control;
   var Dato;
   var Control1;
   var Dato1;

   Control = document.frmNoticias.tblnoti_nombre;
   Dato = strTrim(Control.value,TRIM_BOTH);
   if (Dato.length == 0)
		{
		alert("Debe ingresar el nombre de la noticia");
		Control.focus();
		return false;
		}

   Control = document.frmNoticias.tblnoti_titulo;
   Dato = strTrim(Control.value,TRIM_BOTH);
   if (Dato.length == 0)
		{
		alert("Debe ingresar el titulo de la noticia");
		Control.focus();
		return false;
		}
   
   Control = document.frmNoticias.tblnoti_descripcion;
   Dato = strTrim(Control.value,TRIM_BOTH);
   if (Dato.length == 0)
		{
		alert("Debe ingresar la descripcion de la noticia");
		Control.focus();
		return false;
		}
	
  Control = document.frmNoticias.tblnoti_imagen;
  Dato = strTrim(Control.value,TRIM_BOTH);
  Control1 = document.frmNoticias.imagen;
  Dato1 = strTrim(Control1.value,TRIM_BOTH);
   
   if (Dato.length == 0 && Dato1.length==0)
		{
	      if(!confirm("Desea guardar la noticia sin imagen asociada"))
			{
			   Control.focus();
		       return false;
			}
		}
document.frmNoticias.submit();
return true;

}

function ValidarAgencias()
{  var Control;
   var Dato;
Control=document.frmAgencias.tblagen_nombre;
Dato = strTrim(Control.value,TRIM_BOTH);
   if (Dato.length == 0)
		{
		alert("Debe ingresar el nombre de la agencia");
		Control.focus();
		return false;
		}


Control=document.frmAgencias.tblagen_ciudad;
Dato = strTrim(Control.value,TRIM_BOTH);
   if (Dato.length == 0)
		{
		alert("Debe ingresar el nombre de la ciudad donde esta la agencia");
		Control.focus();
		return false;
		}
/*
Control=document.frmAgencias.tblagen_logo;
Dato = strTrim(Control.value,TRIM_BOTH);
   if (Dato.length == 0)
		{
		alert("Debe ingresar el nombre del logo de la agencia");
		Control.focus();
		return false;
		}

Control=document.frmAgencias.tblagen_bandera;
Dato = strTrim(Control.value,TRIM_BOTH);
   if (Dato.length == 0)
		{
		alert("Debe ingresar el nombre de la imagen de la bandera del pais donde esta la agencia");
		Control.focus();
		return false;
		}
*/
Control=document.frmAgencias.tblagen_telefono;
Dato = strTrim(Control.value,TRIM_BOTH);
   if (Dato.length == 0)
		{
		alert("Debe ingresar el telefono de la agencia");
		Control.focus();
		return false;
		}

Control=document.frmAgencias.tblagen_direccion;
Dato = strTrim(Control.value,TRIM_BOTH);
   if (Dato.length == 0)
		{
		alert("Debe ingresar la direccion de la agencia");
		Control.focus();
		return false;
		}

Control=document.frmAgencias.tblagen_contacto;
Dato = strTrim(Control.value,TRIM_BOTH);
   if (Dato.length == 0)
		{
		alert("Debe ingresar el contacto de la agencia");
		Control.focus();
		return false;
		}

Control=document.frmAgencias.tblagen_mailcontacto;
Dato = strTrim(Control.value,TRIM_BOTH);
   if (Dato.length == 0)
		{
		alert("Debe ingresar el mail del contacto de la agencia");
		Control.focus();
		return false;
		}
document.frmAgencias.submit();
return true;

}

function ValidarInfoAdicional()
{
 var Control;
   var Dato;
 /*Control=document.frmInfoAdiciona.tblinfo_adicional;
Dato = strTrim(Control.value,TRIM_BOTH);
   if (Dato.length == 0)
		{
		alert("Debe ingresar la informacion adicional");
		Control.focus();
		return false;
		}*/
document.frmInfoAdiciona.submit();
return true;
}

function ValidarArchivos()
{
   var Control;
   var Dato;
   var Control1;
   var Dato1;

Control=document.frmArchivos.tblarch_nombre;
Dato = strTrim(Control.value,TRIM_BOTH);
   if (Dato.length == 0)
		{
		alert("Debe ingresar el nombre para identificar el archivo");
		Control.focus();
		return false;
		}

Control=document.frmArchivos.tblarch_descri;
Dato = strTrim(Control.value,TRIM_BOTH);
   if (Dato.length == 0)
		{
		alert("Debe ingresar la descripcion del archivo");
		Control.focus();
		return false;
		}

Control=document.frmArchivos.tblarch_archivo;
Dato = strTrim(Control.value,TRIM_BOTH);
Control1=document.frmArchivos.Archivo;
Dato1 = strTrim(Control1.value,TRIM_BOTH);


   if (Dato.length == 0 &&Dato1.length==0)
		{
		alert("Debe seleccionar elarchivo a subir al servidor ");
		Control.focus();
		return false;
		}
document.frmArchivos.submit();
return true;

}

function ValidarMenus()
{
   var Control;
   var Dato;
Control=document.frmMenu.tblmenu_nombre;
Dato = strTrim(Control.value,TRIM_BOTH);
if (Dato.length == 0)
	{
	alert("Debe ingresar el nombre al menu");
	Control.focus();
	return false;
	}
Control=document.frmMenu.tblmenu_descripcion;
Dato = strTrim(Control.value,TRIM_BOTH);
if (Dato.length == 0)
	{
	alert("Debe ingresar la descripcion de ese menu");
	Control.focus();
	return false;
	}

Control=document.frmMenu.tblmenu_padre;
Dato = strTrim(Control.value,TRIM_BOTH);
if (Dato.length == 0)
	{
	alert("Debe seleccionar el menu en el cual se agrupa esa nueva opcion");
	Control.focus();
	return false;
	}

Control=document.frmMenu.tblmenu_target;
Dato = strTrim(Control.value,TRIM_BOTH);
if (Dato.length == 0)
	{
	alert("Debe seleccion si el menu abre en una nueva ventana o en la misma ventana");
	Control.focus();
	return false;
	}

Control=document.frmMenu.tblmenu_script;
Dato = strTrim(Control.value,TRIM_BOTH);
if (Dato.length == 0)
	{
	alert("Debe seleccionar el script a ejecutar para ese menu");
	Control.focus();
	return false;
	}

//Control=document.frmMenu.tblmenu_link;
Control=document.frmMenu.tblmenu_contenido;
Dato = strTrim(Control.value,TRIM_BOTH);
if (Dato.length == 0)
	{
	alert("Debe seleccionar el contenido a mostrar en esa opcion de menu");
	Control.focus();
	return false;
	}

//Control=document.frmMenu.tbl menu_ejecuta;
//Control=document.frmMenu.tblmenu_forma;
//Control=document.frmMenu.tblmenu_alcance;
Control=document.frmMenu.tblmenu_imagen;
Dato = strTrim(Control.value,TRIM_BOTH);
if (Dato.length == 0)
	{
	if(confirm("Desea grabar la informacion sin imagen de apoyo"))
		{
	     document.frmMenu.submit();
         return true;
	    }
//	alert("Debe escoger una imagen de apoyo para ese menu ingresar el nombre al menu");
	Control.focus();
	return false;
	}
document.frmMenu.submit();
return true;
}

function ValidarFotos()
{
  var Control;
  var Dato;
  var Control1;
  var Dato1;


Control=document.frmFotos.tblfoto_nombre ;
Dato = strTrim(Control.value,TRIM_BOTH);
if (Dato.length == 0)
	{
	alert("Debe ingresar el nombre al grupo de fotografias");
	Control.focus();
	return false;
	}

Control=document.frmFotos.tblfoto_descripcion;
Dato = strTrim(Control.value,TRIM_BOTH);
if (Dato.length == 0)
	{
	alert("Debe ingresar la descripción de las fotografias");
	Control.focus();
	return false;
	}


Control=document.frmFotos.tblfoto_path1;
Dato = strTrim(Control.value,TRIM_BOTH);
Control1=document.frmFotos.foto_path1;
Dato1 = strTrim(Control1.value,TRIM_BOTH);

if (Dato.length == 0 && Dato1.length==0)
	{
	alert("Debe ingresar al menos una fotografia");
	Control.focus();
	return false;
	}

document.frmFotos.submit();
return true;
}


function validarAgendas()
{
var Control;
var Dato;


Control=document.frmAgenda.tblagen_nombre;
Dato = strTrim(Control.value,TRIM_BOTH);
if (Dato.length == 0)
	{
	alert("Debe ingresar un nombre  a la agencia");
	Control.focus();
	return false;
	}



Control=document.frmAgenda.tblagen_descripcion;
Dato = strTrim(Control.value,TRIM_BOTH);
if (Dato.length == 0)
	{
	alert("Debe ingresar la descripcion de la agenda");
	Control.focus();
	return false;
	}


Control=document.frmAgenda.tblagen_ciudad ;
Dato = strTrim(Control.value,TRIM_BOTH);
if (Dato.length == 0)
	{
	alert("Debe ingresar el nombre de una ciudad ");
	Control.focus();
	return false;
	}

Control=document.frmAgenda.tblagen_lugar;
Dato = strTrim(Control.value,TRIM_BOTH);
if (Dato.length == 0)
	{
	alert("Debe ingresar el lugar de la agenda");
	Control.focus();
	return false;
	}

Control=document.frmAgenda.tblagen_fecreunion;
Dato = strTrim(Control.value,TRIM_BOTH);
if (Dato.length == 0)
	{
	alert("Debe ingresar la fecha de la reunion");
	Control.focus();
	return false;
	}
document.frmAgenda.submit();
return true;

}

function validarProductosxLinea()
{
var Control;
var Dato;
var Control1;
var Dato1;

Control=document.FrmProducto.tblprod_nombre;
Dato = strTrim(Control.value,TRIM_BOTH);
if (Dato.length == 0)
	{
	alert("Debe ingresar el nombre del producto");
	Control.focus();
	return false;
	}

Control=document.FrmProducto.tblprod_descrip;
Dato = strTrim(Control.value,TRIM_BOTH);
if (Dato.length == 0)
	{
	alert("Debe ingresar la descripción del producto");
	Control.focus();
	return false;
	}

Control=document.FrmProducto.tblprod_imagen;
Dato = strTrim(Control.value,TRIM_BOTH);
Control1=document.FrmProducto.bkprod_imagen;
Dato1 = strTrim(Control1.value,TRIM_BOTH);
if (Dato.length ==0 && Dato1.length==0)
	{
	alert("Debe seleccionar una imágen que identifique al producto");
	Control.focus();
	return false;
	}

Control=document.FrmProducto.tblprod_enlace;
Dato = strTrim(Control.value,TRIM_BOTH);
if (Dato.length == 0)
	{
	alert("Debe ingresar el vínculo del producto");
	Control.focus();
	return false;
	}

document.FrmProducto.submit();
return true;
}

function validarProveedoresxLinea()
{
var Control;
var Dato;
var Control1;
var Dato1;

Control=document.FrmProveedores.tblprov_nombre;
Dato = strTrim(Control.value,TRIM_BOTH);
if (Dato.length == 0)
	{
	alert("Debe ingresar el nombre del proveedor");
	Control.focus();
	return false;
	}

Control=document.FrmProveedores.tblprov_descrip;
Dato = strTrim(Control.value,TRIM_BOTH);
if (Dato.length == 0)
	{
	alert("Debe ingresar la descripción del proveedor");
	Control.focus();
	return false;
	}

Control=document.FrmProveedores.tblprov_imagen;
Dato = strTrim(Control.value,TRIM_BOTH);
Control1=document.FrmProveedores.bkprov_imagen;
Dato1 = strTrim(Control1.value,TRIM_BOTH);
if (Dato.length ==0 && Dato1.length==0)
	{
	alert("Debe seleccionar una imágen que identifique al proveedor");
	Control.focus();
	return false;
	}

Control=document.FrmProveedores.tblprov_enlace;
Dato = strTrim(Control.value,TRIM_BOTH);
if (Dato.length == 0)
	{
	alert("Debe ingresar el vínculo web del proveedor");
	Control.focus();
	return false;
	}

document.FrmProveedores.submit();
return true;
}

function ValidarSocioJD()
{
	var Control;
    var Dato;
    var Control1;
    var Dato1;

Control=document.frmSocioJunta.tblk_usua_usua;
Dato = strTrim(Control.value,TRIM_BOTH);
if (Dato.length == 0)
	{
	alert("Debe ingresar un login de acceso para el usuario");
	Control.focus();
	return false;
	}

Control=document.frmSocioJunta.tblusua_nombre;
Dato = strTrim(Control.value,TRIM_BOTH);
if (Dato.length == 0)
	{
	alert("Debe ingresar el nombre del usuario(Socio/JD)");
	Control.focus();
	return false;
	}


Control=document.frmSocioJunta.tblusua_apellido;
Dato = strTrim(Control.value,TRIM_BOTH);
if (Dato.length == 0)
	{
	alert("Debe ingresar el apellido del usuario(Socio/JD)");
	Control.focus();
	return false;
	}



Control=document.frmSocioJunta.tblusua_clave;
Dato = strTrim(Control.value,TRIM_BOTH);
if (Dato.length == 0)
	{
	alert("Debe ingresar la clave de acceso del usuario(Socio/JD)");
	Control.focus();
	return false;
	}

Control1=document.frmSocioJunta.usua_clave1;
Dato1 = strTrim(Control1.value,TRIM_BOTH);
   if (Control1.value!=Control.value)
   {
	   alert("Las claves no concuerdan por favor verifique");
	   Control.focus();
	   return false;
   }




Control=document.frmSocioJunta.tblusua_mail;
Dato = strTrim(Control.value,TRIM_BOTH);
if (Dato.length == 0)
	{
	alert("Debe ingresar la direccion de correo del usuario(Socio/JD)");
	Control.focus();
	return false;
	}
if(!ValidarEmail(Control,"Direccion de correo mal ingresada"))
	{	Control.focus();
		return false;   
   }	

document.frmSocioJunta.submit();
return true;
}

function ValidarVideos()
{
  var Control;
  var Dato;
  var Control1;
  var Dato1;

Control=document.frmVideos.tblvide_nombre;
Dato = strTrim(Control.value,TRIM_BOTH);
if (Dato.length == 0)
	{
	alert("Debe ingresar el nombre al video");
	Control.focus();
	return false;
	}

                  
Control=document.frmVideos.tblvide_descri;                 
Dato = strTrim(Control.value,TRIM_BOTH);                       
if (Dato.length == 0)                                          
	{                                                             
	alert("Debe ingresar la descripcuion del video");    
	Control.focus();                                              
	return false;                                                 
	}                                                             
                                                               
                                                               

Control=document.frmVideos.tblvide_foto1;
Dato = strTrim(Control.value,TRIM_BOTH);
Control1=document.frmVideos.vide_foto1;
Dato1 = strTrim(Control1.value,TRIM_BOTH);

if (Dato.length == 0 && Dato1.length==0)
	{
	alert("Debe ingresar al menos una fotografia para representar el video");
	Control.focus();
	return false;
	}

Control=document.frmVideos.tblvide_video;
Dato = strTrim(Control.value,TRIM_BOTH);
Control1=document.frmVideos.vide_video;
Dato1 = strTrim(Control1.value,TRIM_BOTH);

if (Dato.length == 0 && Dato1.length==0)
	{
	alert("Debe seleccionar el video a mostrar en la pagina");
	Control.focus();
	return false;
	}

document.frmVideos.submit();
return true;
}





function ValidarBanners()
{
  var Control;
  var Dato;
  var Control1;
  var Dato1;

Control=document.frmBanners.tblbann_nombre;
Dato = strTrim(Control.value,TRIM_BOTH);
if (Dato.length == 0)
	{
	alert("Debe ingresar el nombre del Banner ");
	Control.focus();
	return false;
	}

Control=document.frmBanners.tblbann_descri;
Dato = strTrim(Control.value,TRIM_BOTH);
if (Dato.length == 0)
	{
	alert("Debe ingresar una descripción para el Banner ");
	Control.focus();
	return false;
	}

Control=document.frmBanners.tblbann_imagen1;
Dato = strTrim(Control.value,TRIM_BOTH);

Control1=document.frmBanners.bann_imagen1;
Dato1 = strTrim(Control1.value,TRIM_BOTH);

if (Dato.length == 0 &&Dato1.length==0 )
	{
	alert("Debe seleccionar como minimo una imagen para ser agregada al banner ");
	Control.focus();
	return false;
	}

Control=document.frmBanners.tblbann_link;
Dato = strTrim(Control.value,TRIM_BOTH);
if (Dato.length == 0)
	{
	alert("Debe ingresar el link que va ser asociado al Banner ");
	Control.focus();
	return false;
	}
document.frmBanners.submit();
return true;
}



function ValidarConstrucciones()
{
  var Control;
  var Dato;
  var Control1;
  var Dato1;

Control=document.frmConstrucciones.tblcons_nombre;
Dato = strTrim(Control.value,TRIM_BOTH);
if (Dato.length == 0)
	{
	alert("Debe ingresar el nombre de la Construcción ");
	Control.focus();
	return false;
	}

Control=document.frmConstrucciones.tblcons_descri;
Dato = strTrim(Control.value,TRIM_BOTH);
if (Dato.length == 0)
	{
	alert("Debe ingresar una descripción para la Construcción ");
	Control.focus();
	return false;
	}

Control=document.frmConstrucciones.tblcons_imagen;
Dato = strTrim(Control.value,TRIM_BOTH);

Control1=document.frmConstrucciones.cons_imagen;
Dato1 = strTrim(Control1.value,TRIM_BOTH);

if (Dato.length == 0 && Dato1.length == 0)
	{
	alert("Debe seleccionar una imagen para ser agregada al Construcción ");
	Control.focus();
	return false;
	}

Control=document.frmConstrucciones.tblcons_logo;
Dato = strTrim(Control.value,TRIM_BOTH);
Control1=document.frmConstrucciones.cons_logo;
Dato1 = strTrim(Control1.value,TRIM_BOTH);


if (Dato.length == 0 && Dato1.length==0 )
	{
	alert("Debe seleccionar una Logo para ser agregada al Construcción ");
	Control.focus();
	return false;
	}
document.frmConstrucciones.submit();
return true;

}


///
function ValidarProyectos()
{
  var Control;
  var Dato;
  var Control1;
  var Dato1;

Control=document.frmProyectos.tblproy_nombre;
Dato = strTrim(Control.value,TRIM_BOTH);
if (Dato.length == 0)
	{
	alert("Debe ingresar el nombre de el proyecto ");
	Control.focus();
	return false;
	}

Control=document.frmProyectos.tblproy_descri;
Dato = strTrim(Control.value,TRIM_BOTH);
if (Dato.length == 0)
	{
	alert("Debe ingresar una descripción para el Proyecto ");
	Control.focus();
	return false;
	}

Control=document.frmProyectos.tblproy_valor;
Dato = strTrim(Control.value,TRIM_BOTH);
if (Dato.length == 0)
	{
	alert("Debe digitar un valor para ser agregada al Proyectos ");
	Control.focus();
	return false;
	}



Control=document.frmProyectos.tblproy_fotppal;
Dato = strTrim(Control.value,TRIM_BOTH);
Control1=document.frmProyectos.proy_fotppal;
Dato1 = strTrim(Control1.value,TRIM_BOTH);
if (Dato.length == 0 && Dato1.length == 0)
	{
	alert("Debe seleccionar una foto para el proyecto ");
	Control.focus();
	return false;
	}
/*
Control=document.frmProyectos.tblproy_logo;
Dato = strTrim(Control.value,TRIM_BOTH);
if (Dato.length == 0)
	{
	alert("Debe seleccionar un logo para el proyecto ");
	Control.focus();
	return false;
	}

Control=document.frmProyectos.tblproy_animacion;
Dato = strTrim(Control.value,TRIM_BOTH);
if (Dato.length == 0)
	{
	alert("Debe seleccionar un archivo de animación para el proyecto ");
	Control.focus();
	return false;
	}

Control=document.frmProyectos.tblproy_numunidade;
Dato = strTrim(Control.value,TRIM_BOTH);
if (Dato.length == 0)
	{
	alert("Debe seleccionar un numero de unidades para el proyecto ");
	Control.focus();
	return false;
	}
*/
Control=document.frmProyectos.tblproy_direccion;
Dato = strTrim(Control.value,TRIM_BOTH);
if (Dato.length == 0)
	{
	alert("Debe digitar una dirección para el proyecto ");
	Control.focus();
	return false;
	}
/*
Control=document.frmProyectos.tblproy_mailcontacto;
Dato = strTrim(Control.value,TRIM_BOTH);
if (Dato.length == 0)
	{
	alert("Debe digitar un mail para el proyecto ");
	Control.focus();
	return false;
	}
*/
Control=document.frmProyectos.tblproy_entifinan;
Dato = strTrim(Control.value,TRIM_BOTH);
if (Dato.length == 0)
	{
	alert("Debe seleccionar una entidad financiera para el proyecto ");
	Control.focus();
	return false;
	}

//si ingreso algo en la direccion de correo se valida que sea un valor correcto
Control=document.frmProyectos.tblproy_mailcontacto;
Dato = strTrim(Control.value,TRIM_BOTH);
if (Dato.length > 0)	
   if(!ValidarEmail(Control,"Direccion de correo mal ingresada"))
	{	Control.focus();
		return false;   
   }	
document.frmProyectos.submit();
return true;

}


function ValidImgXProyecto()
{
  var Control;
  var Dato;
  var Control1;
  var Dato1;

Control=document.frmimgXproyec.tblimgx_nombre;
Dato = strTrim(Control.value,TRIM_BOTH);
if (Dato.length == 0)
	{
	alert("Debe ingresar el nombre a la imagen ");
	Control.focus();
	return false;
	}

Control=document.frmimgXproyec.tblimgx_descri;
Dato = strTrim(Control.value,TRIM_BOTH);
if (Dato.length == 0)
	{
	alert("Debe ingresar una descripcion a la imagen");
	Control.focus();
	return false;
	}

Control=document.frmimgXproyec.tblimgx_archivo;
Dato = strTrim(Control.value,TRIM_BOTH);
Control1=document.frmimgXproyec.imgx_archivo;
Dato1 = strTrim(Control1.value,TRIM_BOTH);
if (Dato.length == 0 &&Dato1.length==0)
	{
	alert("Debe seleccionar un archivo a asociar");
	Control.focus();
	return false;
	}

document.frmimgXproyec.submit();
return true;

}


function ValidSubXProyecto()
{
  var Control;
  var Dato;

Control=document.frmTipXproyec.tbltipv_nombre;
Dato = strTrim(Control.value,TRIM_BOTH);
if (Dato.length == 0)
	{
	alert("Debe ingresar el nombre del subtipo de proyecto");
	Control.focus();
	return false;
	}

Control=document.frmTipXproyec.tbltipv_descri;
Dato = strTrim(Control.value,TRIM_BOTH);
if (Dato.length == 0)
	{
	alert("Debe ingresar la descripcion del sub tipo de proyecto");
	Control.focus();
	return false;
	}

Control=document.frmTipXproyec.tbltipv_precio;
Dato = strTrim(Control.value,TRIM_BOTH);
if (Dato.length == 0)
	{
	alert("Debe ingresar el precio");
	Control.focus();
	return false;
	}

document.frmTipXproyec.submit();
return true;
}


function ValidarContactenos()
{
  var Control;
  var Dato;
alert("jsjs");
/*
Control=document.frmContactenos.tbltipv_nombre;
Dato = strTrim(Control.value,TRIM_BOTH);
if (Dato.length == 0)
	{
	alert("Debe ingresar su nombre por favor");
	Control.focus();
	return false;
	}

Control=document.frmContactenos.tblcont_apellido;
Dato = strTrim(Control.value,TRIM_BOTH);
if (Dato.length == 0)
	{
	alert("Debe ingresar sus Apellidos por favor");
	Control.focus();
	return false;
	}

Control=document.frmContactenos.tblcont_apellido;
Dato = strTrim(Control.value,TRIM_BOTH);
if (Dato.length == 0)
	{
	alert("Debe ingresar el nombre del pais ");
	Control.focus();
	return false;
	}


Control=document.frmContactenos.tblcont_pais;
Dato = strTrim(Control.value,TRIM_BOTH);
if (Dato.length == 0)
	{
	alert("Debe ingresar el nombre del pais ");
	Control.focus();
	return false;
	}

Control=document.frmContactenos.tblcont_ciudad;
Dato = strTrim(Control.value,TRIM_BOTH);
if (Dato.length == 0)
	{
	alert("Debe ingresar el nombre de la ciudad");
	Control.focus();
	return false;
	}



Control=document.frmContactenos.tblcont_mail;
Dato = strTrim(Control.value,TRIM_BOTH);
if (Dato.length == 0)
	{
	alert("Debe ingresar su direccion de correo electronico");
	Control.focus();
	return false;
	}
if(!ValidarEmail(Control,"Direccion de correo mal ingresada"))
{	Control.focus();
	return false;   
}



Control=document.frmContactenos.tblcont_direccion;
Dato = strTrim(Control.value,TRIM_BOTH);
if (Dato.length == 0)
	{
	alert("Debe ingresar su direccion de residencia");
	Control.focus();
	return false;
	}



Control=document.frmContactenos.tblcont_telefono;
Dato = strTrim(Control.value,TRIM_BOTH);
if (Dato.length == 0)
	{
	alert("Por favor ingrese sus numeros telefonico para contactarlo");
	Control.focus();
	return false;
	}



Control=document.frmContactenos.tblcont_comentario;
Dato = strTrim(Control.value,TRIM_BOTH);
if (Dato.length == 0)
	{
	alert("Por favor ingrese algun comentario para poderlo orientarlo mas facilmente");
	Control.focus();
	return false;
	}
*/
document.frmContactenos.submit();
return true;
}

function ValidarJuego(){
  var Control;
  var Dato;
  var Control1;
  var Dato1;

Control = document.frmJuegos.tbljuego_fecha;
Dato = strTrim(Control.value,TRIM_BOTH);
if (Dato.length == 0)
	{
	alert("Debe ingresar la fecha del juego");
	Control.focus();
	return false;
	}

Control = document.frmJuegos.tbljuego_hora;
Dato = strTrim(Control.value,TRIM_BOTH);
if (Dato.length == 0)
	{
	alert("Debe ingresar la hora del juego");
	Control.focus();
	return false;
	}

Control = document.frmJuegos.tbljuego_idEqLocal;
Dato = strTrim(Control.value,TRIM_BOTH);
Control1 = document.frmJuegos.tbljuego_idEqVisita;
Dato1 = strTrim(Control1.value,TRIM_BOTH);
if(Dato1==Dato)
{
    alert("Los equipos deben ser diferentes");
	Control.focus();
	return false;
 }

document.frmJuegos.submit();
return true;

}

function ValidarGol()
{
  var Control;
  var Dato;

Control = document.frmGoles.tblgol_fecha;
Dato = strTrim(Control.value,TRIM_BOTH);
if (Dato.length == 0)
	{
	alert("Debe ingresar la fecha de la anotación");
	Control.focus();
	return false;
	}

Control = document.frmGoles.tblgol_hora;
Dato = strTrim(Control.value,TRIM_BOTH);
if (Dato.length == 0)
	{
	alert("Debe ingresar la hora de la anotación");
	Control.focus();
	return false;
	}

document.frmGoles.submit();
return true;
}

function ValidarAmonestacion()
{
  var Control;
  var Dato;

Control = document.frmAmonestacion.tblamon_fecha;
Dato = strTrim(Control.value,TRIM_BOTH);
if (Dato.length == 0)
	{
	alert("Debe ingresar la fecha de la amonestación");
	Control.focus();
	return false;
	}

Control = document.frmAmonestacion.tblamon_hora;
Dato = strTrim(Control.value,TRIM_BOTH);
if (Dato.length == 0)
	{
	alert("Debe ingresar la hora de la amonestación");
	Control.focus();
	return false;
	}

document.frmAmonestacion.submit();
return true;
}

function ValidarEquipo()
{
	var Control;
	var Dato;

	Control = document.frmEquipos.tblequi_nombreEqui;
	Dato = strTrim(Control.value,TRIM_BOTH);
	if (Dato.length == 0)
	{
		alert("Debe ingresar el nombre del equipo");
		Control.focus();
		return false;
	}

	Control = document.frmEquipos.tblequi_descripEqui;
	Dato = strTrim(Control.value,TRIM_BOTH);
	if (Dato.length == 0)
	{
		alert("Debe ingresar una descripción del equipo");
		Control.focus();
		return false;
	}

	Control = document.frmEquipos.tblequi_nomCortoEqui;
	Dato = strTrim(Control.value,TRIM_BOTH);
	if (Dato.length == 0)
	{
		alert("Debe ingresar el nombre corto del equipo");
		Control.focus();
		return false;
	}

	Control = document.frmEquipos.tblequi_escudoEqui;
	Dato = strTrim(Control.value,TRIM_BOTH);
	if (Dato.length == 0)
	{
		alert("Debe ingresar una imágen como escudo del equipo");
		Control.focus();
		return false;
	}

	Control = document.frmEquipos.tblequi_logoEqui;
	Dato = strTrim(Control.value,TRIM_BOTH);
	if (Dato.length == 0)
	{
		alert("Debe ingresar una imágen como logo del equipo");
		Control.focus();
		return false;
	}

	Control = document.frmEquipos.tblequi_iconoEqui;
	Dato = strTrim(Control.value,TRIM_BOTH);
	if (Dato.length == 0)
	{
		alert("Debe ingresar una imágen como ícono del jugador del equipo");
		Control.focus();
		return false;
	}

	Control = document.frmEquipos.tblequi_dtEqui;
	Dato = strTrim(Control.value,TRIM_BOTH);
	if (Dato.length == 0)
	{
		alert("Debe ingresar el nombre del Director Técnico del equipo");
		Control.focus();
		return false;
	}

	Control = document.frmEquipos.tblequi_colorEqui;
	Dato = strTrim(Control.value,TRIM_BOTH);
	if (Dato.length == 0)
	{
		alert("Debe ingresar el color institucional del equipo");
		Control.focus();
		return false;
	}

	document.frmEquipos.submit();
	return true;
}

function ValidarJugador()
{
  var Control;
  var Dato;

	Control = document.frmJugadores.tbljuga_nomJugador;
	Dato = strTrim(Control.value,TRIM_BOTH);
	if (Dato.length == 0)
	{
		alert("Debe ingresar el nombre del jugador");
		Control.focus();
		return false;
	}

	Control = document.frmJugadores.tbljuga_apeJugador;
	Dato = strTrim(Control.value,TRIM_BOTH);
	if (Dato.length == 0)
	{
		alert("Debe ingresar el apellido del jugador");
		Control.focus();
		return false;
	}

	Control = document.frmJugadores.tbljuga_numJugador;
	Dato = strTrim(Control.value,TRIM_BOTH);
	if (Dato.length == 0)
	{
		alert("Debe ingresar el número de la camiseta del jugador");
		Control.focus();
		return false;
	}

	document.frmJugadores.submit();
	return true;
}

function ValidarEstadio()
{
	var Control;
	var Dato;

	Control = document.frmEstadios.tblestad_nombre;
	Dato = strTrim(Control.value,TRIM_BOTH);
	if (Dato.length == 0)
	{
		alert("Debe ingresar el nombre del estadio");
		Control.focus();
		return false;
	}
	
	Control = document.frmEstadios.tblestad_Descripcion;
	Dato = strTrim(Control.value,TRIM_BOTH);
	if (Dato.length == 0)
	{
		alert("Debe ingresar la descripción del estadio");
		Control.focus();
		return false;
	}


	document.frmEstadios.submit();
	return true;
}

function ValidarPaises()
{
  var Control;
  var Dato;

Control=document.frmPaises.tblpais_nombre;
Dato = strTrim(Control.value,TRIM_BOTH);
if (Dato.length == 0)
	{
	alert("Debe ingresar el nombre del pais");
	Control.focus();
	return false;
	}

Control=document.frmPaises.tblpais_moneda;
Dato = strTrim(Control.value,TRIM_BOTH);
if (Dato.length == 0)
	{
	alert("Debe ingresar el nombre de la moneda del pais");
	Control.focus();
	return false;
	}

Control=document.frmPaises.tblpais_idioma;
Dato = strTrim(Control.value,TRIM_BOTH);
if (Dato.length == 0)
	{
	alert("Debe ingresar el idioma nativo del pais");
	Control.focus();
	return false;
	}
document.frmPaises.submit();
return true;
}


function ValidarCiudad()
{
  var Control;
  var Dato;

Control=document.frmCiudades.tblciud_nombre;
Dato = strTrim(Control.value,TRIM_BOTH);
if (Dato.length == 0)
	{
	alert("Debe ingresar el nombre de la ciudad");
	Control.focus();
	return false;
	}
document.frmCiudades.submit();
return true;
}

function validarCorreo()
{
	var Control;
	var Dato;

	Control=document.form1.nombre;
	Dato = strTrim(Control.value,TRIM_BOTH);
	if (Dato.length == 0)
	{
		alert("Debe ingresar su nombre");
		Control.focus();
		return false;
	}

	Control=document.form1.apellido;
	Dato = strTrim(Control.value,TRIM_BOTH);
	if (Dato.length == 0)
	{
		alert("Debe ingresar su apellido");
		Control.focus();
		return false;
	}

	Control=document.form1.email;
	Dato = strTrim(Control.value,TRIM_BOTH);
	if (Dato.length == 0)
	{
		alert("Debe ingresar una dirección de correo válida");
		Control.focus();
		return false;
	}

	if(!ValidarEmail(Control,"Dirección de correo mal ingresada"))
	{	
		Control.focus();
		return false;   
	}

	Control=document.form1.empresa;
	Dato = strTrim(Control.value,TRIM_BOTH);
	if (Dato.length == 0)
	{
		alert("Debe ingresar el nombre de la empresa");
		Control.focus();
		return false;
	}

	Control=document.form1.direccion;
	Dato = strTrim(Control.value,TRIM_BOTH);
	if (Dato.length == 0)
	{
		alert("Debe ingresar una dirección válida");
		Control.focus();
		return false;
	}
	
	Control=document.form1.telefono;
	Dato = strTrim(Control.value,TRIM_BOTH);
	if (Dato.length == 0)
	{
		alert("Debe ingresar un núemro de teléfono válido");
		Control.focus();
		return false;
	}

	Control=document.form1.comentario;
	Dato = strTrim(Control.value,TRIM_BOTH);
	if (Dato.length == 0)
	{
		alert("Debe ingresar un comentario válido");
		Control.focus();
		return false;
	}
	
	document.form1.submit();
	return true;
}

// Funciones para la encuesta
function MM_openBrWindow(theURL,winName,features, myWidth, myHeight, isCenter) 
{
	if(window.screen)if(isCenter)if(isCenter=="true")
	{
		var myLeft = (screen.width-myWidth)/2;
		var myTop = (screen.height-myHeight)/2;
		features+=(features!='')?',':'';
		features+=',left='+myLeft+',top='+myTop;
	}
	window.open(theURL,winName,features+((features!='')?',':'')+'width='+myWidth+',height='+myHeight);	           
}

function abrirVotacion(valor)
{
	var respuesta;
	var cont;
	for(cont=0;cont<5;cont++)
	{
		if(valor.selEncuesta[cont].checked)
			respuesta = cont + 1;
	}
	var enlace = 'votacion.php?idEnc='+document.encuesta.idEncuesta.value+'&resp='+respuesta;
	MM_openBrWindow(enlace,'Atesa_Encuesta','','530','350','true');
}
// Fin de las funciones