// JavaScript Document
 

/********************************************************************/
    var confirmMsg  = 'Realmente desea ';
function confirmLink(ElLink, theSqlQuery)
{
    // Confirmation is not required in the configuration file
    // or browser is Opera (crappy js implementation)
    if (confirmMsg == '' || typeof(window.opera) != 'undefined') {
        return true;
    }

    var is_confirmed = confirm(confirmMsg + ' ' + theSqlQuery);
    if (is_confirmed) {
        ElLink.href += '&is_js_confirmed=1';
    }

    return is_confirmed;
} // 

/*********************************************************************************
	VALIDAR CLIENTE
 *********************************************************************************/
function ValidarVisita() 
{
    var nombre		        = document.formVisitas.nombre.value;
	var apellido		    = document.formVisitas.apellido.value;
	var correo              = document.formVisitas.correo.value;
	var comentario         = document.formVisitas.comentario.value;
	var numero               = document.formVisitas.numero.value;

	//var trabaja           = document.form1.trabaja.value;
    //var informacion         = document.form1.informacion.value;
	
	var mensaje             = "";
	
	
	if (nombre.length==0)          {mensaje=mensaje+ "El Nombre\n";}
	
	if(apellido.length==0)         {mensaje = mensaje+ "El Apellido\n";}		
	
	if(correo.length==0)		{mensaje = mensaje+ "El Correo\n";}
	
	if(comentario.length==0)		    {mensaje = mensaje+ "EL Comentario\n";}
	
	if(numero.length==0)	{mensaje = mensaje+ "El Codigo de Seguridad\n";}
	//if(numero!= numero.length==numero) {mensaje = mensaje+ "El Codigo de Seguridad es incorrecto\n";}
		
	//if(trabaja.length==0)       //{mensaje = mensaje+ "Debe Ingresar el Alumno Trabaja\n";}
		
	
	
	if (mensaje.length > 0){alert("------------------------------------------\nPor Favor Ingresa todos los Datos le falta: \n------------------------------------------\n" + mensaje);return false;	}
}
/*********************************************************************************
	VALIDAR SUBSCRIPCION
 *********************************************************************************/
function ValidarSubs() 
{
        var nombre		        = document.formSubs.nombre.value;
	var apellido		        = document.formSubs.apellido.value;
	var email                       = document.formSubs.email.value;
	
	var mensaje                     = "";
	
	
	if (nombre.length==0)          {mensaje=mensaje+ "El Nombre\n";}
	
	if(apellido.length==0)         {mensaje = mensaje+ "El Apellido\n";}		
	
	if(email.length==0)		{mensaje = mensaje+ "El Correo\n";}

	if (mensaje.length > 0){alert("------------------------------------------\nPor Favor Ingresa todos los Datos le falta: \n------------------------------------------\n" + mensaje);return false;	}
}
/*********************************************************************************
	VALIDAR LOGEO
 *********************************************************************************/
function ValidarLog() 
{
    var usuario		        = document.formLog.usuario.value;
	var pass		        = document.formLog.pass.value;
  
	var mensaje             = "";
	
	
	if (usuario.length==0)          {mensaje=mensaje+ "El Nombre e usuario\n";}
	
	if (pass.length==0)             {mensaje = mensaje+ "La clave\n";}		
	
 
	if (mensaje.length > 0){alert("------------------------------------------\nPor Favor Ingresa todos los Datos le falta: \n------------------------------------------\n" + mensaje);return false;	}
}
/*********************************************************************************
	VALIDAR DETALLES DE USUARIO
 *********************************************************************************/
function ValidarUpdateUs() 
{
   // var usuario		                = document.formUpdateUs.usuario.value;
	var clave_nueva		            = document.formUpdateUs.clave_nueva.value; 
	var confirm_clave		        = document.formUpdateUs.confirm_clave.value;
	var mensaje                     = "";
	
	//if (usuario.length==0)          {mensaje=mensaje+ "El Nombre e usuario\n";}
	if (clave_nueva.length==0)      {mensaje = mensaje+ "La clave nueva\n";}		
	if (confirm_clave.length==0)    {mensaje = mensaje+ "La confirmacion de la clave\n";}		
	
 
	if (mensaje.length > 0){alert("------------------------------------------\nPor Favor Ingresa todos los Datos le falta: \n------------------------------------------\n" + mensaje);return false;	}
}



/*********************************************************************************
	VALIDAR REGISTRO
 *********************************************************************************/
function ValidarReg() 
{
    var nombre		                = document.formReg.nombre.value;
    var apellidos		        = document.formReg.apellidos.value;
    var usuario      	                = document.formReg.usuario.value;
    var mail		                = document.formReg.mail.value;
    var pass     		        = document.formReg.pass.value;
    var password2		        = document.formReg.password2.value;
  
	var mensaje             = "";
	
	
	if (nombre.length==0)             {mensaje = mensaje+ "Sus Nombres \n";}
	if (apellidos.length==0)          {mensaje = mensaje+ "Los apellidos\n";}		
	if (usuario.length==0)            {mensaje = mensaje+ "El Nombre de usuario\n";}
	if (mail.length==0)               {mensaje = mensaje+ "Su direccion de correo electronico\n";}		
	if (pass.length==0)               {mensaje = mensaje+ "La clave\n";}
	if (password2.length==0)          {mensaje = mensaje+ "La clave de verificacion\n";}		
	
 
	if (mensaje.length > 0){alert("------------------------------------------\nPor Favor Ingresa todos los Datos le falta: \n------------------------------------------\n" + mensaje);return false;	}
}


/*********************************************************************************
	VALIDAR INVITACION
 *********************************************************************************/
function ValidarInvitacion() 
{
    var nombre		        = document.formInvitacion.nombre.value;
	var apellido		    = document.formInvitacion.apellido.value;
	var rif                 = document.formInvitacion.rif.value;
	var direccion           = document.formInvitacion.direccion.value;
	var telefono            = document.formInvitacion.telefono.value;
	var correo              = document.formInvitacion.correo.value;
	var descripcion         = document.formInvitacion.descripcion.value;
	var lugar               = document.formInvitacion.lugar.value;
	var fecha               = document.formInvitacion.fecha.value;
	var hora                = document.formInvitacion.hora.value;
	var fecha_invitacion    = document.formInvitacion.fecha_invitacion.value;

	//var trabaja           = document.form1.trabaja.value;
    //var informacion         = document.form1.informacion.value;
	
	var mensaje             = "";
	
	
	if (nombre.length==0)          {mensaje=mensaje+ "El Nombre\n";}
	
	if(apellido.length==0)         {mensaje = mensaje+ "El Apellido\n";}		
	
	if(rif.length==0)		{mensaje = mensaje+ "El Rif o Cedula\n";}
	
	if(direccion.length==0)		    {mensaje = mensaje+ "La Dirección\n";}
	
	if(telefono.length==0)	{mensaje = mensaje+ "El Teléfono\n";}
		
	if(correo.length==0)        {mensaje = mensaje+ "El Correo\n";}
	
	if(descripcion.length==0)        {mensaje = mensaje+ "El Comentario\n";}
	
	if(lugar.length==0)        {mensaje = mensaje+ "El Lugar\n";}
	
	if(fecha.length==0)        {mensaje = mensaje+ "La Fecha de la Pautada\n";}
	
	if(hora.length==0)        {mensaje = mensaje+ "La Hora\n";}
	
	if(fecha_invitacion.length==0)        {mensaje = mensaje+ "La Fecha en que estas haciendo la Invitación\n";}
		
	
	
	if (mensaje.length > 0){alert("------------------------------------------\nPor Favor Ingresa todos los Datos: \n------------------------------------------\n" + mensaje);return false;	}
}
/*********************************************************************************
	WINDOWS
 *********************************************************************************/
function Open(Objeto,Archivo,Nombre,Ancho,Alto){

  Objeto = window.open('ayuda.php','Nombre','location=no,status=no,scrollbars=no,innerBorder=no,border=thick borderStyle=raised,width=600,height=500,resizable=no');
  //setTimeout(cerrarVentana,1000);
}
function Map(Objeto,Archivo,Nombre,Ancho,Alto) {
  Objeto = window.open("op_map.php","Nombre", 'status=0 , toolbars=0,scrollbars=0,width=950,height=700,resizable=no');
 
}

function Ini()
    {
     window.open('main.php','','width=' + (window.screen.width -10) + ',height=' + (window.screen.height - 35 )+ ',screenX=0,screenY=0,left=0,top=0,menubar=no,toolbar=no,status=no,resizable=yes');
	 //setTimeout(cerrarVentana,0); 
	 //window.close();
	
  setTimeout(cerrarVentana,1);
}
function opwm(Objeto,Archivo,Nombre,Ancho,Alto) {
  Objeto = window.open("http://www.manantialeneldesierto.org/webmaster.php","Nombre", 'status=0 , toolbars=0,scrollbars=0,width=680,height=610,resizable=no');
 
}

function cerrarVentana(){
  window.close();
}

function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "','toolbar=0,scrollbars=0,location=0,statusbar=yes,menubar=0,resizable=0,width=510,height=420');");
}

function popUpBook(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "','toolbar=0,scrollbars=1,location=0,statusbar=yes,menubar=0,resizable=0,width=560,height=400');");
}

function popUpVideo(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "','toolbar=0,scrollbars=0,location=0,statusbar=yes,menubar=0,resizable=0,width=500,height=400');");
}

function popUpEncargar(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "','toolbar=0,scrollbars=1,location=0,statusbar=yes,menubar=0,resizable=0,width=560,height=400');");
}

function popUpContratar(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "','toolbar=0,scrollbars=1,location=0,statusbar=yes,menubar=0,resizable=0,width=560,height=400');");
}

function popUpInvitar(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "','toolbar=0,scrollbars=1,location=0,statusbar=yes,menubar=0,resizable=0,width=560,height=400');");
}

function centrar() {
    iz=(screen.width-document.body.clientWidth) /20;
    de=(screen.height-document.body.clientHeight) / 20;
    moveTo(iz,de);
}
/*********************************************************************************
 * RESALTAR FILA EN UNA TABLA CUANDO EL APUNTADOR DEL MOUSE SE COLOCA SOBRE ELLA.
/*********************************************************************************/ 
function setPointer(theRow, theRowNum, theAction, theDefaultColor, thePointerColor, theMarkColor)
{
    var theCells = null;
    if ((thePointerColor == '' && theMarkColor == '') || typeof(theRow.style) == 'undefined') {
        return false;
    }
    if (typeof(document.getElementsByTagName) != 'undefined') {
        theCells = theRow.getElementsByTagName('td');
    }
    else if (typeof(theRow.cells) != 'undefined') {
        theCells = theRow.cells;
    }
    else {
        return false;
    }
    var rowCellsCnt  = theCells.length;
    var domDetect    = null;
    var currentColor = null;
    var newColor     = null;

    if (typeof(theCells[0].getAttribute) != 'undefined') {
        currentColor = theCells[0].getAttribute('bgcolor');
        domDetect    = true;
    }
    else {
        currentColor = theCells[0].style.backgroundColor;
        domDetect    = false;
    } 
    if (theAction == 'over') {
            newColor              = thePointerColor;
    }
    if (theAction == 'out') {
            newColor              = theDefaultColor;
    }
    if (newColor) {
        var c = null;
        if (domDetect) {
            for (c = 0; c < rowCellsCnt; c++) {
                theCells[c].setAttribute('bgcolor', newColor, 0);
            } // end for
        }
        else {
            for (c = 0; c < rowCellsCnt; c++) {
                theCells[c].style.backgroundColor = newColor;
            }
        }
    } 
    return true;
}
/*********************************************************************************/
/* Iniciar Funcion Calendario */
/*********************************************************************************/
function iniciarCalendario(){
Calendar.setup({
		inputField     :    "fecha",  		//id del campo de entrada													    
		ifFormat       :    "%Y/%m/%d",     // formato del campo de entrada
		showsTime      :    false,          // despliegue de un seleccionador de tiempo
		button         :    "calendario",  	// activa el calendario co el (botón ID)
		singleClick    :    false,          // doble-pulse el botón modo
		step           :    1  });          // muestre todos los años en gota-abajo las cajas (en lugar de cada dos años como valor por defecto)
}
function iniciarCalendarioInvitacion(){
Calendar.setup({
		inputField     :    "fecha_invitacion",  		//id del campo de entrada													    
		ifFormat       :    "%Y/%m/%d",     // formato del campo de entrada
		showsTime      :    false,          // despliegue de un seleccionador de tiempo
		button         :    "calendario1",  	// activa el calendario co el (botón ID)
		singleClick    :    false,          // doble-pulse el botón modo
		step           :    1  });          // muestre todos los años en gota-abajo las cajas (en lugar de cada dos años como valor por defecto)
}