/*seccion ajax*/


function nuevoAjax()
{ 
	/* Crea el objeto AJAX. Esta funcion es generica para cualquier utilidad de este tipo, por
	lo que se puede copiar tal como esta aqui */
	var xmlhttp=false; 
	try 
	{ 
		// Creacion del objeto AJAX para navegadores no IE
		xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); 
	}
	catch(e)
	{ 
		try
		{ 
			// Creacion del objeto AJAX para IE 
			xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); 
		} 
		catch(E) { xmlhttp=false; }
	}
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') { xmlhttp=new XMLHttpRequest(); } 

	return xmlhttp; 
} 

function eliminaEspacios(cadena)
{
	// Funcion equivalente a trim en PHP
	var x=0, y=cadena.length-1;
	while(cadena.charAt(x)==" ") x++;	
	while(cadena.charAt(y)==" ") y--;	
	return cadena.substr(x, y-x+1);
}


/*consulta con ajax*/

function pedirDatos(ididioma,iddocumento,idbanner,accion,idseccion){


	
divFormulario = parent.document.getElementById('popup');
divFormulario.innerHTML ="";
  $('#popup').fadeIn('slow');
	

	ajax=nuevoAjax();
	
	ajax.open("POST", "accionbanner.php");
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			//mostrar resultados en esta capa
			divFormulario.innerHTML = ajax.responseText
			//mostrar el formulario
			
			divFormulario.style.display="block";
		}
	}
	
	ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	
	ajax.send("&idiomaid="+ididioma+"&documentoid="+iddocumento+"&idbanner="+idbanner+"&accion="+accion+"&idseccion="+idseccion);

	
}

function pedirDatoslinks(ididioma,iddocumento,idbanner,accion,idseccion){


	
divFormulario = parent.document.getElementById('popup');
divFormulario.innerHTML ="";
  $('#popup').fadeIn('slow');
	

	ajax=nuevoAjax();
	
	ajax.open("POST", "accionbanner.php");
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			//mostrar resultados en esta capa
			divFormulario.innerHTML = ajax.responseText
			//mostrar el formulario
			
			divFormulario.style.display="block";
		}
	}
	
	ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	
	ajax.send("&idiomaid="+ididioma+"&documentoid="+iddocumento+"&idbanner="+idbanner+"&accion="+accion+"&idseccion="+idseccion);

	
}

/* ventanas para las secciones*/

function ventanaseccion(ididioma,iddocumento,idseccion,accion,nodo){
	
divFormulario = parent.document.getElementById('popup');
divFormulario.innerHTML ="";
  
	
	
	ajax=nuevoAjax();
	
	ajax.open("POST", "accionsecciones.php");
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			
			divFormulario.innerHTML = ajax.responseText
			
			
			divFormulario.style.display="block";
		}
	}
	
	ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");

	ajax.send("&idiomaid="+ididioma+"&iddoc="+iddocumento+"&idsec="+idseccion+"&accion="+accion+"&nodo="+nodo);

	
}


function ventanarevista(ididioma,iddocumento,idseccion,accion,nodo,idrevista){
	
divFormulario = parent.document.getElementById('popupmap');
divFormulario.innerHTML ="";
  

	ajax=nuevoAjax();
	
	ajax.open("POST", "accionrevista.php");
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
		
			divFormulario.innerHTML = ajax.responseText
		
			
			divFormulario.style.display="block";
		}
	}

	ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	
	ajax.send("&idiomaid="+ididioma+"&iddoc="+iddocumento+"&idsec="+idseccion+"&accion="+accion+"&nodo="+nodo+"&idrevista="+idrevista);


}

function ventanagalery(ididioma,iddocumento,idseccion,accion,nodo,idgaleria){
	
divFormulario = parent.document.getElementById('popupmap');
divFormulario.innerHTML ="";
  	

	ajax=nuevoAjax();
	
	ajax.open("POST", "acciongaleria.php");
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
		
			divFormulario.innerHTML = ajax.responseText
		
			
			divFormulario.style.display="block";
		}
	}

	ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	
	ajax.send("&idiomaid="+ididioma+"&iddoc="+iddocumento+"&idsec="+idseccion+"&accion="+accion+"&nodo="+nodo+"&idgaleria="+idgaleria);


}



function ventanagaleria(ididioma,iddocumento,idseccion,accion,nodo,idrevista){
	
divFormulario = parent.document.getElementById('popupmap');
divFormulario.innerHTML ="";
  	

	ajax=nuevoAjax();
	
	ajax.open("POST", "acciongaleria.php");
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
		
			divFormulario.innerHTML = ajax.responseText
		
			
			divFormulario.style.display="block";
		}
	}

	ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	
	ajax.send("&idiomaid="+ididioma+"&iddoc="+iddocumento+"&idsec="+idseccion+"&accion="+accion+"&nodo="+nodo+"&idrevista="+idrevista);


}
/*************************************************/

function ventanaviews(ididioma,iddocumento,idseccion,accion,contenedor){
divFormulario = parent.document.getElementById(contenedor);
divFormulario.innerHTML ="";
  $('#contenedor_conteninfo').fadeIn('slow');
	ajax=nuevoAjax();
	ajax.open("POST", "viewstitulares.php");
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			divFormulario.innerHTML = ajax.responseText
			
			divFormulario.style.display="block";
		}
	}
	
	ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	//enviando los valores
	ajax.send("&idioma="+ididioma+"&documentweb="+iddocumento+"&idseccion="+idseccion+"&accion="+accion);
 
}
/*************************************************/


function imageplantilla(idplantilla,tipo){
	var selectOrigen=document.getElementById(idplantilla);
	
	var plantillaid=selectOrigen.options[selectOrigen.selectedIndex].value;
	divContenido = parent.document.getElementById('plantillaimg');
	ajax=nuevoAjax();
	
	ajax.open("GET", "cargaplantilla.php?idplantilla="+plantillaid+"&tipos="+tipo);
	divContenido.innerHTML= '<img src="images/web_app/25.gif" >';
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			//mostrar resultados en esta capa
			divContenido.innerHTML = ajax.responseText
		}
	}

	ajax.send(null)
}

/*carga clima ciudad*/
function cargaclima(ciudadcode,acction){
	
	var selectOrigen=document.getElementById(ciudadcode);
	// Obtengo la opcion que el usuario selecciono
	var ciudad=selectOrigen.options[selectOrigen.selectedIndex].value;
	divContenido = parent.document.getElementById('clima');
	ajax=nuevoAjax();
	ajax.open("GET", "cargaclima.php?codeciudad="+ciudad+"&accion="+acction);
	divContenido.innerHTML= '<div style="width:64px; height:64px; margin:0 auto;"><img src="images/web_app/25.gif" ></div>';
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			//mostrar resultados en esta capa
			divContenido.innerHTML = ajax.responseText
		}
	}
	
	ajax.send(null)
}


function pedirDatosmap(ididioma,iddocumento,idmaps,accion,idseccion){
divFormulario = parent.document.getElementById('popupmap');
divFormulario.innerHTML ="";
  
	
	ajax=nuevoAjax();
	ajax.open("POST", "accionmaps.php");
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			divFormulario.innerHTML = ajax.responseText
			
			divFormulario.style.display="block";
		}
	}
	
	ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	ajax.send("&idiomaid="+ididioma+"&documentoid="+iddocumento+"&idmaps="+idmaps+"&accion="+accion+"&idseccion="+idseccion);

}

/*actualizar la seccion de la imagen cragando la nueva ultima*/
function actualizaultima(ididioma,iddocumento,idmaps,idseccion){


divFormulario = parent.document.getElementById('map_seccion');
divFormulario.innerHTML ="";
  
	
	ajax=nuevoAjax();
	ajax.open("POST", "actimagmaps.php");
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			divFormulario.innerHTML = ajax.responseText
			
			divFormulario.style.display="block";
		}
	}
	ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	ajax.send("&idiomaid="+ididioma+"&documentoid="+iddocumento+"&idmaps="+idmaps+"&idseccion="+idseccion);

	//parent.document.getElementById(layer).style.display="none";
}

/*descarga maps y rutas*/


function cerraramigos(layer) {
	
			document.getElementById(layer).style.display="none";
			/*c5 = document.getElementById(layer);
	       c5.innerHTML ="";*/
		}

/*query para acciones pr
oductos*/

function pedirDatoshop(ididioma,iddocumento,idproducto,accion,idseccion){


	//donde se mostrará el formulario con los datos
divFormulario = parent.document.getElementById('popupshop');
divFormulario.innerHTML ="";
 
	
	//instanciamos el objetoAjax
	ajax=nuevoAjax();
	//uso del medotod GET
	ajax.open("POST", "accionshop.php");
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			//mostrar resultados en esta capa
			divFormulario.innerHTML = ajax.responseText
			//mostrar el formulario
			$('#popupshop').fadeIn('slow');
			divFormulario.style.display="block";
		}
	}
	//como hacemos uso del metodo GET
	//colocamos null
	ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	//enviando los valores
	ajax.send("&idiomaid="+ididioma+"&documentoid="+iddocumento+"&idproducto="+idproducto+"&accion="+accion+"&idseccion="+idseccion);
}


function listshop(ididioma,iddocumento,idseccion){

	///donde se mostrará los registros
	divContenido = parent.document.getElementById('body_inner');
	ajax=nuevoAjax();
	
	ajax.open("GET", "listshop.php?idioma="+ididioma+"&documentweb="+iddocumento+"&idseccion="+idseccion);
	divContenido.innerHTML= '<img src="images/web_app/25.gif">';
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			//mostrar resultados en esta capa
			divContenido.innerHTML = ajax.responseText
		}
	}
	ajax.send(null);
	

}

function veriimageshop(idimagen, idproducto){


	//donde se mostrará el formulario con los datos
divFormulario = parent.document.getElementById('imageproducto');
divFormulario.innerHTML ="";
  
	
	//instanciamos el objetoAjax
	ajax=nuevoAjax();
	//uso del medotod GET
	ajax.open("POST", "veriimageshop.php");
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			//mostrar resultados en esta capa
			divFormulario.innerHTML = ajax.responseText
			//mostrar el formulario
			
			divFormulario.style.display="block";
		}
	}
	//como hacemos uso del metodo GET
	//colocamos null
	ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	//enviando los valores
	ajax.send("&idimagen="+idimagen+"&idproducto="+idproducto);

}


function Paginabannerini(nropagina,idioma,documentweb,idseccion){
	//donde se mostrará los registros
	divContenido = document.getElementById('carousel-container');
	
	ajax=nuevoAjax();
	//uso del medoto GET
	//indicamos el archivo que realizará el proceso de paginar
	//junto con un valor que representa el nro de pagina
	ajax.open("GET", "paginadorbanner.php?pag="+nropagina+"&idioma="+idioma+"&documentweb="+documentweb+"&idseccion="+idseccion);
	//divContenido.innerHTML= '<img src="images/preini.gif">';
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			//mostrar resultados en esta capa
			divContenido.innerHTML = ajax.responseText
		}
	}
	//como hacemos uso del metodo GET
	//colocamos null ya que enviamos 
	//el valor por la url ?pag=nropagina
	ajax.send(null)
}

//paginar recomendaciones
function lstrmendaciones(nropagina,idioma,documentweb,idseccion,nodo){
	divContenido = parent.document.getElementById('seccionrecomend');
	//
	ajax=nuevoAjax();
	ajax.open("GET", "listrecomendaciones.php?pagrc="+nropagina+"&idioma="+idioma+"&documentweb="+documentweb+"&nodo="+nodo+"&idseccion="+idseccion);
	divContenido.innerHTML= '<img src="images/web_app/25.gif">';
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			//mostrar resultados en esta capa
			divContenido.innerHTML = ajax.responseText
		}
	}
	ajax.send(null)
}



/* ventanas para las recomendaciones*/

function ventanarecomienda(ididioma,iddocumento,idrecomendacion,accion,idseccion){


	//donde se mostrará el formulario con los datos
divFormulario = parent.document.getElementById('popupreconoce');
divFormulario.innerHTML ="";
 
	
	//instanciamos el objetoAjax
	ajax=nuevoAjax();
	//uso del medotod GET
	ajax.open("POST", "actionrecomienda.php");
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			//mostrar resultados en esta capa
			divFormulario.innerHTML = ajax.responseText
			//mostrar el formulario
			
			divFormulario.style.display="block";
		}
	}
	//como hacemos uso del metodo GET
	//colocamos null
	ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	ajax.send("&idiomaid="+ididioma+"&documentoid="+iddocumento+"&idreconoce="+idrecomendacion+"&accion="+accion+"&idseccion="+idseccion);
}

/*mostrar comentario tripadvisor*/

function tripadvisor(ididioma,iddocumento,idrecomendacion,accion,idseccion){


	//donde se mostrará el formulario con los datos
divFormulario = parent.document.getElementById('tripadvisor');
divFormulario.innerHTML ="";
  
	
	//instanciamos el objetoAjax
	ajax=nuevoAjax();
	//uso del medotod GET
	ajax.open("POST", "actionrecomienda.php");
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			//mostrar resultados en esta capa
			divFormulario.innerHTML = ajax.responseText
			//mostrar el formulario
			
			divFormulario.style.display="block";
		}
	}
	//como hacemos uso del metodo GET
	//colocamos null
	ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	//enviando los valores
	ajax.send("&idiomaid="+ididioma+"&documentoid="+iddocumento+"&idreconoce="+idrecomendacion+"&accion="+accion+"&idseccion="+idseccion);
}


function tripadvisorblog(ididioma,iddocumento,idseccion,accion){

divFormulario = parent.document.getElementById('tripadvisor');
divFormulario.innerHTML ="";
 
	//instanciamos el objetoAjax
	ajax=nuevoAjax();
	//uso del medotod GET
	ajax.open("POST", "accionsecciones.php");
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			//mostrar resultados en esta capa
			divFormulario.innerHTML = ajax.responseText
			//mostrar el formulario
			
			divFormulario.style.display="block";
		}
	}
	//como hacemos uso del metodo GET
	//colocamos null
	ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	//enviando los valores
	
	ajax.send("&idiomaid="+ididioma+"&iddoc="+iddocumento+"&accion="+accion+"&idsec="+idseccion);
}

/**************************************************************************************************/
function pediruser(ididioma,iddocumento,iduser,accion,idseccion){


	//donde se mostrará el formulario con los datos
divFormulario = parent.document.getElementById('popunreguser');
divFormulario.innerHTML ="";
 
	
	//instanciamos el objetoAjax
	ajax=nuevoAjax();
	//uso del medotod GET
	ajax.open("POST", "accionusers.php");
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			divFormulario.innerHTML = ajax.responseText
			divFormulario.style.display="block";
		}
	}
	//como hacemos uso del metodo GET
	//colocamos null
	ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	//enviando los valores
	ajax.send("&idiomaid="+ididioma+"&documentoid="+iddocumento+"&iduser="+iduser+"&accion="+accion+"&idseccion="+idseccion);

	//parent.document.getElementById(layer).style.display="none";
}

function loginuser(ididioma,iddocumento,iduser,accion,idseccion){
divuser = parent.document.getElementById('emailuser').value;
divpassword = parent.document.getElementById('passworduser').value;


	//donde se mostrará el formulario con los datos
divFormulario = parent.document.getElementById('messagelogin');
divFormulario.innerHTML ="";
 
	
	//instanciamos el objetoAjax
	ajax=nuevoAjax();
	//uso del medotod GET
	ajax.open("POST", "phpscript/validarlogin.php");
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			//mostrar resultados en esta capa
			divFormulario.innerHTML = ajax.responseText
			//mostrar el formulario
			//$('#p'+divFormulario).fadeIn('slow');
			divFormulario.style.display="block";
		}
	}
	//como hacemos uso del metodo GET
	//colocamos null
	ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	//enviando los valores
	ajax.send("&idiomaid="+ididioma+"&documentoid="+iddocumento+"&iduser="+iduser+"&accion="+accion+"&idseccion="+idseccion+"&user="+divuser+"&password="+divpassword);

}

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


function pagcomentario(nropagina,idioma,documentweb,idseccion,nodo){
	//donde se mostrará los registros
	divContenido = parent.document.getElementById('comentario_user_blog');
	
	ajax=nuevoAjax();
	ajax.open("GET", "listcoment.php?pagcm="+nropagina+"&idioma="+idioma+"&documentweb="+documentweb+"&nodo="+nodo+"&idseccion="+idseccion);
	divContenido.innerHTML= '<img src="images/web_app/25.gif">';
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			//mostrar resultados en esta capa
			divContenido.innerHTML = ajax.responseText
		}
	}
	ajax.send(null)
}


/**************************************************************************************************/
/*seccion java script*/
var cursor;
		if (document.all) {
		// Está utilizando EXPLORER
		cursor='hand';
		} else {
		// Está utilizando MOZILLA/NETSCAPE
		cursor='pointer';
		}
		
/******************************************************************************/
/* DOM */
function crearLI(txt){
	var objLI = document.createElement('li');
	objLI.appendChild( document.createTextNode( txt ) );
	return objLI;
}
function limpiarNodo(nodo){
	while( nodo.hasChildNodes() ) nodo.removeChild(nodo.firstChild);
}

 function esFechaValida(fecha){
	if (fecha != undefined && fecha.value != "" ){
		if (!/^\d{4}\-\d{2}\-\d{2}$/.test(fecha.value)){
			alert("formato de fecha no válido (aaaa-mm-dd)");
			return false;
		}
		var anio =  parseInt(fecha.value.substring(0,4),10);
		var mes  =  parseInt(fecha.value.substring(5,7),10);
		var dia =  parseInt(fecha.value.substring(8),10);
	switch(mes){
		case 1:
		case 3:
		case 5:
		case 7:
		case 8:
		case 10:
		case 12:
			numDias=31;
			break;
		case 4: case 6: case 9: case 11:
			numDias=30;
			break;
		case 2:
			if (comprobarSiBisisesto(anio)){ numDias=29 }else{ numDias=28};
			break;
		default:
			alert("Fecha introducida errónea");
			return false;
	}
		if (dia>numDias || dia==0){
			alert("Fecha introducida errónea");
			return false;
		}
		return true;
	}
}


/********************************************************************************/
function vererror(layer) {
	alert(layer);
			document.getElementById(layer).style.display="block";
		}
		
function cerrarerror(layer) {
			document.getElementById(layer).style.display="none";
			
		}
/*------------registro de usurio ventana */
/*--------------------------------*/		
function vererroruser(layer) {
			document.getElementById(layer).style.display="block";
			c5 = document.getElementById(layer);
	        c5.innerHTML ="";
		}
		
function cerrarerroruser(layer) {
			document.getElementById(layer).style.display="none";
			c5 = document.getElementById(layer);
	       c5.innerHTML ="";
		}
/*--------------------------------*/		
/*--------------------------------*/		
function vererrormap(layer) {
			document.getElementById(layer).style.display="block";
			c5 = document.getElementById(layer);
	        c5.innerHTML ="";
		}
		
function cerrarerrormap(layer) {
			document.getElementById(layer).style.display="none";
			c5 = document.getElementById(layer);
	       c5.innerHTML ="";
		}
/*--------------------------------*/			
function vererroralert() {
	titulo=document.getElementById("tituloalert");
	  titulo.innerHTML='Espere un momento debe completar los siguientes campos';
			document.getElementById("Layer").style.display="block";
		}
function vererrorvarios() {
	titulo=document.getElementById("tituloalertav");
	  titulo.innerHTML='Espere un momento debe completar los siguientes campos';
			document.getElementById("avisos").style.display="block";
		}

function validara() 
			{
				//alert ("validando ");
	  c5 =  document.getElementById("imagen");
	  c5.innerHTML = '<div style="margin:0 auto; width:64px; height:64px" ><img src="images/web_app/25.gif" width="64" height="64"  /></div>';
	  titulo=document.getElementById("tituloalert");
	  titulo.innerHTML='Espere un momento ';
document.getElementById("Layer").style.display="block";
document.getElementById("bannerreg").submit();


}

/*validar registro de usuario*/

function validauser()
			{
				//alert ("validando ");
	  c5 =  document.getElementById("imagen");
	  c5.innerHTML = '<div style="margin:0 auto; width:64px; height:64px" ><img src="images/web_app/25.gif" width="64" height="64"  /></div>';
	  titulo=document.getElementById("tituloalert");
	  titulo.innerHTML='Espere un momento ';
document.getElementById("Layer").style.display="block";
document.getElementById("reguser").submit();


}

function validmail()
			{
				//alert ("validando ");
	  c5 =  document.getElementById("imagen");
	  c5.innerHTML = '<div style="margin:0 auto; width:64px; height:64px" ><img src="images/web_app/25.gif" width="64" height="64"  /></div>';
	  titulo=document.getElementById("tituloalert");
	  titulo.innerHTML='Espere un momento ';
document.getElementById("Layer").style.display="block";
document.getElementById("mail").submit();


}

function validmailamigo()
			{
				//alert ("validando ");
	  c5 =  document.getElementById("imagen");
	  c5.innerHTML = '<div style="margin:0 auto; width:64px; height:64px" ><img src="images/web_app/25.gif" width="64" height="64"  /></div>';
	  titulo=document.getElementById("tituloalert");
	  titulo.innerHTML='Espere un momento ';
document.getElementById("Layer").style.display="block";
document.getElementById("mail").submit();


}


/***************************COMENTARIOS*/
function validarcomentario()
			{
				
	c5 =  document.getElementById("imagenav");
	c5.innerHTML = '<ul style="font-family:Arial, Helvetica, sans-serif; font-size:12px; color:#666; text-align:left; margin-left:5px; margin-top:5px; list-style-type: square; "  id="lista"></ul>';
	var listaErrores = document.getElementById("lista");
	limpiarNodo(listaErrores);
	var mensaje="";
	var entero=0;
	var enteroo=0;
	
	if ( document.getElementById("AComentario").value.length==0 ){ 
      mensaje="-Coloque su comentario.\n";
     listaErrores.appendChild( crearLI(mensaje) );
	
    }
formValido = listaErrores.getElementsByTagName("li").length;
if (formValido) {

     document.getElementById("avisos").style.display="block";
//document.getElementById("Layer").style.visibility="visible"
c5 =  document.getElementById("tituloalertav");
c5.innerHTML = '<span class="Estilo6"><strong>¡Advertencia!</strong></span>';
				} 
			else {

c5 =  document.getElementById("imagenav");
	 c5.innerHTML = '<div style="margin:0 auto; width:64px; height:64px" ><img src="images/web_app/25.gif" width="64" height="64"  /></div>';
	 titulo=document.getElementById("tituloalertav");
	 titulo.innerHTML='Espere un momento ';
     document.getElementById("avisos").style.display="block";
     document.getElementById("regusercoment").submit();
	 
				}
	
			


}


function validarpassmail()
			{
				
	c5 =  document.getElementById("imagenav");
	c5.innerHTML = '<ul style="font-family:Arial, Helvetica, sans-serif; font-size:12px; color:#666; text-align:left; margin-left:5px; margin-top:5px; list-style-type: square; "  id="lista"></ul>';
	var listaErrores = document.getElementById("lista");
	limpiarNodo(listaErrores);
	var mensaje="";
	var entero=0;
	var enteroo=0;
	
	if ( document.getElementById("Apassword").value.length==0 ){ 
      mensaje="Coloque su nueva contraseÃ±a.\n";
     listaErrores.appendChild( crearLI(mensaje) );
	
    }
	
	if ( document.getElementById("Email").value.toLowerCase().search('(^[a-z][a-z0-9\-_.]+[@][a-z0-9\-_.]+[.][a-z]+$)') != -1 ){ 
	}else{
      mensaje="Email no Valido.\n";
     listaErrores.appendChild( crearLI(mensaje) );
	
    }
	
formValido = listaErrores.getElementsByTagName("li").length;
if (formValido) {

     document.getElementById("avisos").style.display="block";
//document.getElementById("Layer").style.visibility="visible"
c5 =  document.getElementById("tituloalertav");
c5.innerHTML = '<span class="Estilo6"><strong>Advertencia</strong></span>';
				} 
			else {

c5 =  document.getElementById("imagenav");
	 c5.innerHTML = '<div style="margin:0 auto; width:64px; height:64px" ><img src="images/web_app/25.gif" width="64" height="64"  /></div>';
	 titulo=document.getElementById("tituloalertav");
	 titulo.innerHTML='Espere un momento ';
     document.getElementById("avisos").style.display="block";
     document.getElementById("mail").submit();
	 
				}
	
			


}


function validaramaps() 
			{
				
	  c5 =  document.getElementById("imagen");
	  c5.innerHTML = '<div style="margin:0 auto; width:64px; height:64px" ><img src="images/web_app/25.gif" width="64" height="64"  /></div>';
	  titulo=document.getElementById("tituloalert");
	  titulo.innerHTML='Espere un momento ';
document.getElementById("Layer").style.display="block";
document.getElementById("mapreg").submit();


}

/***************************revista*/
function validrevista()
			{
	extensiones_permitidas = new Array(".gif", ".jpg", ".jpeg", ".png");					
	c5 =  document.getElementById("imagen");
	c5.innerHTML = '<ul style="font-family:Arial, Helvetica, sans-serif; font-size:12px; color:#666; text-align:left; margin-left:5px; margin-top:5px; list-style-type: square; "  id="lista"></ul>';
	var listaErrores = document.getElementById("lista");
	limpiarNodo(listaErrores);
	var mensaje="";
	var entero=0;
	var enteroo=0;
  var archivo=document.getElementById("Aarchivoimagen[]").value;
  
  if ( !archivo){ 
      mensaje="No has seleccionado ninguna imagen para la portada";
     listaErrores.appendChild( crearLI(mensaje) );
	
    }else{
		
		//recupero la extensión de este nombre de archivo
 extension = (archivo.substring(archivo.lastIndexOf("."))).toLowerCase();
 //alert (extension);
 //compruebo si la extensión está entre las permitidas
 permitida = false;
 for (var i = 0; i < extensiones_permitidas.length; i++) {
 if (extensiones_permitidas[i] == extension) {
 permitida = true;
 break;
 }
 }
 if (!permitida) {
 mensaje= "Comprueba la extension de los archivos a subir. \nSolo se pueden subir archivos con extensiones: " + extensiones_permitidas.join();
  listaErrores.appendChild( crearLI(mensaje) );
 }
	}
  

  if ( document.getElementById("Ndia").value<=0  ){ 
      mensaje="El dia no es valido debes ser mayor a 0";
     listaErrores.appendChild( crearLI(mensaje) );
	
    }
	if ( document.getElementById("NAnio").value.length<=0 || document.getElementById("NAnio").value.length >4 ){ 
      mensaje="El años es incorrecto el formato debe ser 4 numeros: \n ejemplo: 2011.\n";
     listaErrores.appendChild( crearLI(mensaje) );
	
    }
	
	if (document.getElementById("AMes").selectedIndex==0){
mensaje="Seleccione el mes de la Publicacion.\n";
listaErrores.appendChild( crearLI(mensaje ) );
document.getElementById("AMes").focus()

} 

formValido = listaErrores.getElementsByTagName("li").length;
if (formValido) {
     document.getElementById("Layer").style.display="block";
c5 =  document.getElementById("tituloalert");
c5.innerHTML = '<span class="Estilo6"><strong>¡Advertencia!</strong></span>';
				} 
			else {

c5 = document.getElementById("imagen");
	 c5.innerHTML = '<div style="margin:0 auto; width:64px; height:64px" ><img src="images/web_app/25.gif" width="64" height="64"  /></div>';
	 titulo=document.getElementById("tituloalert");
	 titulo.innerHTML='Espere un momento ';
     document.getElementById("Layer").style.display="block";
     document.getElementById("revreg").submit();
	 
				}
	
			


}

function validrevistaedit()
			{
	extensiones_permitidas = new Array(".gif", ".jpg", ".jpeg", ".png");					
	c5 =  document.getElementById("imagen");
	c5.innerHTML = '<ul style="font-family:Arial, Helvetica, sans-serif; font-size:12px; color:#666; text-align:left; margin-left:5px; margin-top:5px; list-style-type: square; "  id="lista"></ul>';
	var listaErrores = document.getElementById("lista");
	limpiarNodo(listaErrores);
	var mensaje="";
	var entero=0;
	var enteroo=0;
  var archivo=document.getElementById("Aarchivoimagen[]").value;
  
  
if ( document.getElementById("NAnio").value.length<=0 || document.getElementById("NAnio").value.length >4 ){ 
      mensaje="El años es incorrecto el formato debe ser 4 numeros: \n ejemplo: 2011.\n";
     listaErrores.appendChild( crearLI(mensaje) );
	
    }
	
if (document.getElementById("AMes").selectedIndex==0){
mensaje="Seleccione el mes de la Publicacion.\n";
listaErrores.appendChild( crearLI(mensaje ) );
document.getElementById("AMes").focus()

} 

formValido = listaErrores.getElementsByTagName("li").length;
if (formValido) {
     document.getElementById("Layer").style.display="block";
c5 =  document.getElementById("tituloalert");
c5.innerHTML = '<span class="Estilo6"><strong>¡Advertencia!</strong></span>';
				} 
			else {

c5 = document.getElementById("imagen");
	 c5.innerHTML = '<div style="margin:0 auto; width:64px; height:64px" ><img src="images/web_app/25.gif" width="64" height="64"  /></div>';
	 titulo=document.getElementById("tituloalert");
	 titulo.innerHTML='Espere un momento ';
     document.getElementById("Layer").style.display="block";
     document.getElementById("revreg").submit();
	 
				}
	
			


}

/********************************/
function validpgrevista()
			{
	extensiones_permitidas = new Array(".gif", ".jpg", ".jpeg", ".png");		
	c5 =  document.getElementById("imagen");
	c5.innerHTML = '<ul style="font-family:Arial, Helvetica, sans-serif; font-size:12px; color:#666; text-align:left; margin-left:5px; margin-top:5px; list-style-type: square; "  id="lista"></ul>';
	var listaErrores = document.getElementById("lista");
	limpiarNodo(listaErrores);
	var mensaje="";
	var entero=0;
	var enteroo=0;
    var archivo=document.getElementById("Aarchivoimagen[]").value;
	if ( !archivo){ 
      mensaje="No has seleccionado ningun archivo";
     listaErrores.appendChild( crearLI(mensaje) );
	
    }else{
		
		//recupero la extensión de este nombre de archivo
 extension = (archivo.substring(archivo.lastIndexOf("."))).toLowerCase();
 //alert (extension);
 //compruebo si la extensión está entre las permitidas
 permitida = false;
 for (var i = 0; i < extensiones_permitidas.length; i++) {
 if (extensiones_permitidas[i] == extension) {
 permitida = true;
 break;
 }
 }
 if (!permitida) {
 mensaje= "Comprueba la extension de los archivos a subir. \nSolo se pueden subir archivos con extensiones: " + extensiones_permitidas.join();
  listaErrores.appendChild( crearLI(mensaje) );
 }
	}
	 

formValido = listaErrores.getElementsByTagName("li").length;
if (formValido) {
     document.getElementById("Layer").style.display="block";
c5 =  document.getElementById("tituloalert");
c5.innerHTML = '<span class="Estilo6"><strong>Aviso</strong></span>';
				} 
			else {

c5 = document.getElementById("imagen");
	 c5.innerHTML = '<div style="margin:0 auto; width:64px; height:64px" ><img src="images/web_app/25.gif" width="64" height="64"  /></div>';
	 titulo=document.getElementById("tituloalert");
	 titulo.innerHTML='Espere un momento ';
     document.getElementById("Layer").style.display="block";
     document.getElementById("pagreg").submit();
	 
				}
	
			


}

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

function viewtool(layertool){
	 $(layertool).fadeIn('slow');
	document.getElementById(layertool).style.display="block";
	}
function closetool(layertool){
	document.getElementById(layertool).style.display="none";
	}

/*seccion de cpmpras.php*/
function validarashop() 
			{

	  c5 =  document.getElementById("imagen");
	  c5.innerHTML = '<div style="margin:0 auto; width:64px; height:64px" ><img src="images/web_app/25.gif" width="64" height="64"  /></div>';
	  titulo=document.getElementById("tituloalert");
	  titulo.innerHTML='Espere un momento ';
document.getElementById("Layer").style.display="block";
document.getElementById("shopreg").submit();


}

/*seccion de blogview.php*/
function validarblog() 
			{
				
				
				//alert ("validando ");
	  c5 =  document.getElementById("imagen");
	  c5.innerHTML = '<div style="margin:0 auto; width:64px; height:64px" ><img src="images/web_app/25.gif" width="64" height="64"  /></div>';
	  titulo=document.getElementById("tituloalert");
	  titulo.innerHTML='Espere un momento ';
document.getElementById("Layer").style.display="block";
document.getElementById("blogview").submit();


}

/*seccion de recomendaciones comida.php*/
function validarrec() 
			{
				//alert ("validando ");
	  c5 =  document.getElementById("imagen");
	  c5.innerHTML = '<div style="margin:0 auto; width:64px; height:64px" ><img src="images/web_app/25.gif" width="64" height="64"  /></div>';
	  titulo=document.getElementById("tituloalert");
	  titulo.innerHTML='Espere un momento ';
document.getElementById("Layer").style.display="block";
document.getElementById("recom_cli").submit();


}


function cerrarerrormap(layer) {
			document.getElementById(layer).style.display="none";
		}
		
/*paginacion dedr ventana de imagenesd de productyos*/

function paginar() {
			document.getElementById("iniciopaginaventanaest").value=document.getElementById("paginasventanaest").value;
			document.getElementById("shopreg").submit();
		}
		
		
		
		function hacer_cadena_busqueda() {
			var idusuario=document.getElementById("idusuario").value;
			var mes=document.getElementById("mes").value;
			var anno=document.getElementById("anno").value;
			var turno=document.getElementById("turno").value;
			
			var cadena="";
			cadena="~"+idusuario+"~"+mes+"~"+anno+"~"+turno+"~";
			return cadena;
			}
		
/*     ventada escrpt */
function enviarventanaest() {
	document.getElementById("Layer").style.display="block";	
c4 =  document.getElementById("tituloalert");
c4.innerHTML = '<span class="Estilo6"><strong>Espere un momento....</strong></span>';
 c5 =  parent.document.getElementById("imagen");
c5.innerHTML = '<img src="../../images/precarga.gif" width="64" height="64" />';	
	//document.getElementById("cargaframeest").value="alta"
	document.getElementById("shopreg").submit();
	
}
			

/*paginacion vebntana estadisticas*/
/*paginacion vebntana estadisticas*/
function paginarventanaest() {
	
	document.getElementById("iniciopaginaventanaest").value=document.getElementById("paginasventanaest").value;
    //document.getElementById("cargaframeest").value="busqueda"
	       document.getElementById("accion").value="consulta"
			document.getElementById("pagreg").submit();
			document.getElementById("accion").value="subir"
	//document.getElementById("cargaframeest").value="alta"
}
function buscar() {
          
			//var cadena;
			//document.getElementById("cadena_busqueda").value=cadena;
			if (document.getElementById("iniciopaginaventanaest").value=="") {
				document.getElementById("iniciopaginaventanaest").value=1;
			} else {
				document.getElementById("iniciopaginaventanaest").value=document.getElementById("paginasventanaest").value;
			}
			/***************************************/
			
			
			document.getElementById("shopreg").submit();
			
		}
function buscarrev() {
          
			//var cadena;
			//document.getElementById("cadena_busqueda").value=cadena;
			if (document.getElementById("iniciopaginaventanaest").value=="") {
				document.getElementById("iniciopaginaventanaest").value=1;
			} else {
				document.getElementById("iniciopaginaventanaest").value=document.getElementById("paginasventanaest").value;
			}
			/***************************************/
			document.getElementById("accion").value="consulta"
			document.getElementById("pagreg").submit();
			document.getElementById("accion").value="subir"
			
		}
function link(urls){
	location.href=urls;
	}
	
	
function bookmarksite(title,url){

var title=String(document.title);
var url=String(window.location);

if (window.sidebar) // firefox
    window.sidebar.addPanel(title, url, "");
else if(window.opera && window.print){ // opera
    var elem = document.createElement('a');
    elem.setAttribute('href',href);
    elem.setAttribute('title',title);
    elem.setAttribute('rel','sidebar');
    elem.click();
} 
else if(document.all)// ie
    window.external.AddFavorite(url, title);
    else {// otros web Browsers
    alert ("Presione Crtl+D para agregar a este sitio en sus Bookmarks");  
}
}

/*cargaimagen pagina*/
function verimgpagina(url){


	//donde se mostrará el formulario con los datos
divFormulario = parent.document.getElementById('pagnrevact');
divFormulario.innerHTML ='<img src="'+url+'" width="132" height="171" />';
 

}


/* geolocalizacion*/
 function pedirPosicion(pos) {
   var centro = new google.maps.LatLng(pos.coords.latitude,pos.coords.longitude);
   map.setCenter(centro); //pedimos que centre el mapa..
   map.setMapTypeId(google.maps.MapTypeId.ROADMAP); //y lo volvemos un mapa callejero
  alert("¡Hola! Estas en : "+pos.coords.latitude+ ","+pos.coords.longitude+" Rango de localización de +/- "+pos.coords.accuracy+" metros");
}
 
function geolocalizame(){
navigator.geolocation.getCurrentPosition(pedirPosicion);
 }
function fundacionest(div,idestado){
divFormulario=parent.document.getElementById("famediretorio");
divFormulario.innerHTML ="";
	//instanciamos el objetoAjax
	ajax=nuevoAjax();
	//uso del medotod GET
	ajax.open("POST", "directorio-fpresult.php");
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			//mostrar resultados en esta capa
			divFormulario.innerHTML = ajax.responseText
			//mostrar el formulario
			
			divFormulario.style.display="block";
		}
	}
	//como hacemos uso del metodo GET
	//colocamos null
	ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	ajax.send("&idestado="+idestado);


	
	}

function openfotos(url)
{
//wordthumb.php?src=<? echo $thums?>&h=218&w=291&zc=1&cropfrom=topright"
document.getElementById("light").style.display="block";	
document.getElementById("fade").style.display="block";	
c5 =parent.document.getElementById("light");
c5.innerHTML = '<img src="images/lightbox-btn-close.gif" onclick="closefotosg()"  alt="" width="66" height="22" style="position:absolute; right:0px; top:0px;" /><img src="wordthumb.php?src='+url+'&h=480&w=722&zc=1 " width="722" height="480" onclick="closefotosg()"  />';
}

function openfotossite(url)
{
//wordthumb.php?src=<? echo $thums?>&h=218&w=291&zc=1&cropfrom=topright"
document.getElementById("light").style.display="block";	
document.getElementById("fade").style.display="block";	
c5 =parent.document.getElementById("light");
c5.innerHTML = '<img src="images/lightbox-btn-close.gif" onclick="closefotosg()"  alt="" width="66" height="22" style="position:absolute; right:0px; top:0px;" /><div style="text-align:center" align="center"><img src="wordthumb.php?src='+url+'&h=484&zc=1 "  onclick="closefotosg()"  /></div>';
}

function closefotosg()
{

document.getElementById("light").style.display="none";	
document.getElementById("fade").style.display="none";		
c5 =parent.document.getElementById("light");
c5.innerHTML = '';
}




/**jquery tab ortenable*/
 // When the document is ready set up our sortable with it's inherant function(s)
 function sliderbaner(ididioma,iddocumento,idbanner,idseccion){


	
divFormulario = parent.document.getElementById('featuredslider');
divFormulario.innerHTML ="";
 
	

	ajax=nuevoAjax();
	
	ajax.open("POST", "imagenbanner.php");
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			//mostrar resultados en esta capa
			divFormulario.innerHTML = ajax.responseText
			//mostrar el formulario
			divFormulario.style.display="block";
		}
	}
	
	ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	//'<? echo $idioma?>','<? echo $documentweb?>','<? echo $idbannerweb?>','<? echo $idseccion?>'
	//ididioma='$idioma' and  iddocumento='$documentweb' and idseccion='$idseccion'
	ajax.send("&idiomaid="+ididioma+"&documentoid="+iddocumento+"&idbanner="+idbanner+"&idseccion="+idseccion);

	
}

function sliderini(ididioma,iddocumento,idbanner,idseccion){

divFormulario = parent.document.getElementById('carouselcaption');
divFormulario.innerHTML ="";
 
	

	ajax=nuevoAjax();
	
	ajax.open("POST", "phpscript/captiobanner.php");
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			//mostrar resultados en esta capa
			divFormulario.innerHTML = ajax.responseText
			//mostrar el formulario
			divFormulario.style.display="block";
		}
	}
	
	ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	//$where="ididioma='$idioma' and  iddocumento='$documentweb=' and idseccion='$idseccion'";
	ajax.send("&idioma="+ididioma+"&documentweb="+iddocumento+"&idbanner="+idbanner+"&idseccion="+idseccion);

	
}

//animar banner{}
function animabanner(pagina){
	var nropagina=document.getElementById('pagsig').value
	Paginabannerini(nropagina)

	}
