/****************************************************************
/ Nombre: getHTTPObject
/ Implentacion: 
/ Revision: 301106
/ Descripcion: Manejo del AJAX
'***************************************************************/
function getHTTPObject() {
	var xmlhttp;      
  
  /*@cc_on
  @if (@_jscript_version >= 5)
	try {
	  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
	  try {
		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	  } catch (E) {
		xmlhttp = false;
	  }
	}
  @else
  xmlhttp = false;
  @end @*/
  
	if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {  
		try {
		  xmlhttp = new XMLHttpRequest();
		} catch (e) {
		  xmlhttp = false;
		}
	}
	return xmlhttp;
}
    
//--
var http = getHTTPObject(); 


//************ SECCION PRODCUTOS **************************************************
//*********************************************************************************
function ampliaProducto(pagina,id,tipo,galeria){
	if (tipo == 1){
//		alert(tipo);
		var ref = document.getElementById("pk_info"+id).value;
		if (ref != ""){
			document.getElementById("formularioAmplia" + id).action = document.getElementById("formularioAmplia" + id).action + "&ref="+ref;
		}
	}
	document.getElementById("formularioAmplia" + id).numPagina.value=pagina
	document.getElementById("formularioAmplia" + id).numGaleria.value=galeria
	document.getElementById("formularioAmplia" + id).submit();
}


/****************************************************************
/ Nombre: Paginacion
/ Implentacion: 
/ Revision: 301106
/ Descripcion: funcion para realizar la paginacion de los productos
'***************************************************************/
function paginacion(pagina){
	document.getElementById("formularioPaginacion").numPagina.value=pagina
	document.getElementById("formularioPaginacion").submit();
}

function volverCatalogo(pagina){
	document.getElementById("formularioVolver").numPagina.value=pagina
	document.getElementById("formularioVolver").submit();
}


/****************************************************************
/ Nombre: cambiaFondo
/ Implentacion: JBernalte
/ Revision: 301106
/ Descripcion: Cambia el fondo del obj como ID
'***************************************************************/
function cambiaFondo(pagina, obj){
		var fondo;
		fondo="";
		switch(pagina){
			
			case 1: 
				fondo= "url(images/top-background-grupo.jpg)";
				break;
			default:
				fondo= "url(images/top-background.jpg)";
		}
		document.getElementById(obj).style.backgroundImage =fondo;
	}


/****************************************************************
/ Nombre: cambiaClaseFamilia
/ Implentacion
/ Revision: 301106
/ Descripcion: Cambia ela clase del obj pasado como ID
'***************************************************************/
function cambiaClaseFamilia(obj){
	
	switch(obj){
			
			case 1: 
				clase= "x";
				break;
			default:
				clase= "x";
		}
	
	document.getElementById(obj).className=clase;
}


function quitaClaseFamilia(familia,marcado){
	
	if (familia==1 && marcado==0){
		clase="x";
	}
	
	document.getElementById("familia" + familia).className=clase;
}

//****************** SECCION CONTACTO ******************************************************************************************************************************/

/****************************************************************
/ Nombre: validarEmail
/ Implentacion
/ Revision: 301106
/ Descripcion: Valida el formato del email
'***************************************************************/
function validarEmail(valor){
//funcion para validar el formato del email
	return (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(valor));
	
}

/****************************************************************
/ Nombre: validar
/ Implentacion
/ Revision: 301106
/ Descripcion: Valida los campos del formulario
'***************************************************************/
function validar(){
//Funcion para la validar los datos enviados desde el formulario de contacto
	var texto;
	texto = "";

	var cadenaEnvio;
	cadenaEnvio = "";
	
	//Aqui validamos que los campos obligatorios tengan valor y se añaden a la cadena de envio
	
	if ( document.getElementById("formularioContacto").nombre.value == "" ) {
		texto+=" * Debe indicar su nombre.<br>";
	}else{
		cadenaEnvio="nombre=" + document.getElementById("formularioContacto").nombre.value;
	}
	
	if ( document.getElementById("formularioContacto").email.value == "" ) {
		texto+=" * Debe indicar su e-mail.<br>";
	}
	
	if(document.getElementById("formularioContacto").email.value!=""){
		if(!validarEmail(document.getElementById("formularioContacto").email.value)){
				texto+=" * Formato de E-mail incorrecto.<br>";
		}else{
			cadenaEnvio+="&email=" + document.getElementById("formularioContacto").email.value;
		}
	}
	
	
	if ( document.getElementById("formularioContacto").comentarios.value == "" ){
		texto+=" * Debe indicar alguna sugerencia.<br>";
	}else{
		cadenaEnvio+="&comentarios=" + document.getElementById("formularioContacto").comentarios.value;
	}	
	
	//Aqui vamos añadiendo los demas campos sino estan vacion
	
	if ( document.getElementById("formularioContacto").tema.value != "" ){
		cadenaEnvio+="&tema=" + document.getElementById("formularioContacto").tema.value;
	}
	
	
	//Si falta algun campo obligatorio o el email no tiene un formato correcto
	//mostramos un mensaje de avios
	
	if ( texto != "" ){
		document.getElementById("mensajeError").innerHTML=texto;
		document.getElementById("capaError").style.display='block';
		
	}else{
		//alert(cadenaEnvio);
		document.getElementById("mensaje-respuesta").innerHTML="";
		document.getElementById("mensajeError").innerHTML="";
		document.getElementById("capaError").style.display='none';
		http.open("GET", "actualizer/formcorreosMultiple/envioSinBd.asp?" + cadenaEnvio, true);
		http.onreadystatechange = handleHttpResponseContacto;
		http.send(null);
	}
	
}

/****************************************************************
/ Nombre: cerrarAviso
/ Implentacion: 
/ Revision:
/ Descripcion: Cierra la capa del aviso del formulario
'***************************************************************/
function cerrarAviso(){
	document.getElementById("mensajeError").innerHTML="";
	document.getElementById("capaError").style.display='none';
}

function handleHttpResponseContacto() {
	if (http.readyState == 4) {    	
		//Aqui va el nombre de la capa donde queramos cargar el contenido
		document.getElementById("mensaje-respuesta").innerHTML = http.responseText;	
		document.getElementById("formularioContacto").reset();
	}    
}

//*********************************************************************************
//*********************************************************************************
function mostrarReferencia(id){
		if (document.getElementById("pk_info"+id).value == ""){
			document.getElementById("referencia").innerHTML = "";
			document.getElementById("referencia").style.display = "block";	
			return false;
		}
		var idReferencia = document.getElementById("pk_info"+id).value;
		http.open("GET", "./includes/getReferencia.asp?id=" + idReferencia, true);
		http.onreadystatechange = handleHttpResponseReferencia;
		http.send(null);
	
}

function handleHttpResponseReferencia() {
	if (http.readyState == 4) {    	
		//Aqui va el nombre de la capa donde queramos cargar el contenido
		document.getElementById("referencia").innerHTML = "<p class='descripcion'>-&nbsp;" + http.responseText + "</p>";	
		document.getElementById("referencia").style.display = "block";	
	}    
}

/****************************************************************
/ Nombre: openWindow
/ Implentacion: JBERNALTE
/ Revision:
/ Descripcion: Abre un popup
'***************************************************************/
	function openWindow(theURL,winName,features){
 		window.open(theURL,winName,features);
		return
	}


/****************************************************************
/ Nombre: muestraTema
/ Implentacion:
/ Revision:
/ Descripcion: Muestra los temas
'***************************************************************/
function muestraTema(id,numero) {
	for (i=1;i<=numero;i++){
		if (id != i){
			if (document.getElementById("filaContenidoTema"+ i).style.display == "block"){
				document.getElementById("filaContenidoTema"+ i).style.display = "none";
			}
				document.getElementById("enlaceTema"+ i).className = "desmarcado";
		}
	}
	if (document.getElementById("filaContenidoTema"+ id).style.display == "block") { 
		document.getElementById("filaContenidoTema"+ id).style.display = "none"; }
	else { 
		document.getElementById("filaContenidoTema"+ id).style.display = "block";
		document.getElementById("enlaceTema"+ id).className = "marcado";
		}
}


/****************************************************************
/ Nombre: capaPosition
/ Implentacion: JBERNALTE
/ Revision:
/ Descripcion: Posiciona una capa en el centro de la pantalla +- los pixeles deseados
'***************************************************************/
function capaPosition(layer, position){
		element = document.getElementById(layer);
		screenCenterX = document.body.clientWidth / 2;
		element.style.left = screenCenterX + position;
		element.style.display = 'inline';
	}


/****************************************************************************************
/ Nombre: ampliaImagen
/ Implentacion: PACO
/ Revision:
/ Descripcion: Muestra el PopUp de ampliacion de las imagenes y lo redimensiona
'***************************************************************************************/
function ampliaImagen(url){
	document.getElementById('imagenAmpliada').src = "images/" + url;
	}

function redimensionarImagen(img){
	var anchoImagen,altoImagen,anchoPantalla,altoPantalla;
	img1 = new Image(); 
	img1.src = img.src;
	anchoImagen = img1.width;
	altoImagen = img1.height;
//	anchoPantalla = window.screen.width;
	anchoPantalla = 930
	altoPantalla = window.screen.height - 240;
	posicionx = (anchoPantalla/2) - (anchoImagen/2);
	posiciony = (altoPantalla/2) - (altoImagen/2);
	
	// coloca la capa de la imagen y la redimensiona
	document.getElementById('capaImagenAmpliada').style.top = posiciony + 'px';
	document.getElementById('capaImagenAmpliada').style.left = posicionx + 'px';
	document.getElementById('capaImagenAmpliada').style.width = anchoImagen + 'px';
	document.getElementById('capaImagenAmpliada').style.height = altoImagen + 'px';
	// coloca un poco más arriba la capa del enlace para cerrar
	posicionCerrar = posiciony - 19;
	document.getElementById('cerrarImagenAmpliada').style.top = posicionCerrar + 'px';
	document.getElementById('cerrarImagenAmpliada').style.left = posicionx + 'px';

	document.getElementById('capaImagenAmpliada').style.display = 'block';
	document.getElementById('cerrarImagenAmpliada').style.display = 'block';
	// en caso del formulario de contacto, ocultamos el combo
	document.getElementById('pais').style.visibility = 'hidden';
}

function cerrarImagenAmpliada(){
	document.getElementById('imagenAmpliada').src = "";
	document.getElementById('capaImagenAmpliada').style.display = 'none';
	document.getElementById('cerrarImagenAmpliada').style.display = 'none';
	document.getElementById('pais').style.visibility = 'visible';
}
//***************************************************************************
//***************************************************************************


/****************************************************************************************
/ Nombre: autentifica
/ Implentacion: JBERNALTE
/Parametros: [Type] (off) desautentifica (otra cosa) autentifica
/ Revision:
/ Descripcion: Login de usuario en la zona privada
'***************************************************************************************/
function autentifica(type){
	var strEnvio = '';
	
	if(type != 'off'){
		
		var campos = new Array();
		var mensajes = new Array();
		
		
		/* DENINE CAMPO A VALIDAR MENSAJE*/
		campos[0] = 'user'; mensajes[0] = 'Indique su usuario';
		campos[1] = 'password'; mensajes[1] = 'Indique su contraseña';
	
		
		valid = false; 
		i=0;
		
		for(campo in campos){
			valor = document.formLogin[campo].value;
			if (   (valor == '') || (valor == mensajes[i])  ) {
				document.formLogin[campo].value = mensajes[i];
				valid = false;
			}else{
				strEnvio += "" + campos[i] + "=" + document.formLogin[campo].value + "&";
				valid = true;
			}
			i++;
		}
		strEnvio += "login=on"
	}else{
		valid=true;
		strEnvio += "login=off"
		
	}
	
	if(valid){
		url = "includes/loginEngine.asp?" + strEnvio;
		http.open("GET", url , true);
		http.onreadystatechange = handleHttpResponseReload;
		http.send(null);		
	}else{
		return false;	
	}	
}


/****************************************************************************************
/ Nombre: edit, handleHttpResponseEdit
/ Implentacion: JBERNALTE
/Parametros: [Type] (off) previsualiza (otra cosa) edita
/ Revision:
/ Descripcion: Cambia a modo edicion en la zona privada
'***************************************************************************************/
function edit(type){
	var strEnvio = '';
	

		strEnvio += "edicionMode=" + type;

	
		url = "includes/loginEngine.asp?" + strEnvio;
		http.open("GET", url , true);
		http.onreadystatechange = handleHttpResponseReload;
		http.send(null);		
}


/****************************************************************************************
/ Nombre: edit, handleHttpResponseReload
/ Implentacion: JBERNALTE
/ Revision:
/ Descripcion: Recarga la pagina despues de ejecutar AJAX
'***************************************************************************************/
function handleHttpResponseReload() {
	if (http.readyState == 4) {
//		window.location.reload();
		var e = http.responseText;
		if (e=='ok'){
			window.location.href = 'index.asp?pagina=zona-privada';
		} else {
		document.getElementById("respuesta").innerHTML = http.responseText ;	
		document.getElementById("respuesta").style.display = "block";	
		document.getElementById("mensaje-caracteres").style.display = "none";	
		}
	}    
}

function handleHttpResponseReload4() {
	if (http.readyState == 4) {
//		window.location.reload();
		var e = http.responseText;
		if (e=='ok'){
			alert("Se ha conectado");					
		}
		else {
			alert("El usuario o contraseña introducidos son erroneos. Intentelo de nuevo.");	
		}
	}    
}



/****************************************************************************************
/ Nombre: changePicture
/ Implentacion: JBERNALTE
/ Revision:
/ Descripcion: Cambia una imagen
'***************************************************************************************/
function changePicture(id, picture){
		
		document.getElementById(id).src = picture;
}

/****************************************************************
/ Nombre: compruebaFecha()
/ Implentacion: Fperez

/ Revision:
/ Descripcion: Comprueba que las fechas sean correctas
'***************************************************************/
function compruebaFecha(dia, mes, anyo){
	var error;
	if ((dia > 30) && ((mes == 2) || (mes == 4) || (mes == 6) || (mes == 9) || (mes == 11))){
		return false;
	}
	if ((dia > 29) && (mes == 2)){
		return false;
	}
	var resto = parseInt(anyo)%4;
	if (resto != 0){
		if ((dia > 28) && (mes == 2)){
			return false;
		}
	}
	
	return true;
}


function valTexto(txt){

	var cval="abcdefghijklmnñopqrstuvwxyzABCDEFGHIJKLMNÑOPQRSTUVWXYZ0123456789$&+-_*çÇ @.";	
	var aux,n=0;
	aux=txt;	
	if(aux!=""){
		for(i=0;i<aux.length;i++){
			for(j=0;j<cval.length;j++){
				if(cval.charAt(j)==aux.charAt(i)){
					n++;
				}
			}
		}
	}
	if(n==aux.length){
		return true;
	}else{
		return false;
	}

}


/****************************************************************************************
/ Nombre: autentifica
/ Implentacion: FPEREZ
/ Revision:
/ Descripcion: Login de usuario en la zona privada
'***************************************************************************************/
function autentifica3(type){
	var strEnvio = '';
	
		
		var campos = new Array();
		var mensajes = new Array();
		
		
		/* DENINE CAMPO A VALIDAR MENSAJE*/
		campos[0] = 'user'; mensajes[0] = 'Indique su usuario';
		campos[1] = 'password'; mensajes[1] = 'Indique su contraseña';
	
		
		valid = false; 
		c=0;
		
		for(campo in campos){
			valor = document.formLogin2[campo].value;
			if (   (valor == '') || (valor == mensajes[c])  ) {
				document.formLogin2[campo].value = mensajes[c];
				valid = false;
			}else if(!valTexto(valor)){
				 		document.getElementById("mensaje-caracteres").style.display='block';
						document.getElementById("mensaje-caracteres").innerHTML='Carácteres no permitidos';
				 		document.getElementById("respuesta").style.display='none';
						document.formLogin2[0].value = '';
						document.formLogin2[1].value = '';
						valid = false;
			}else{
				strEnvio += "" + campos[c] + "=" + document.formLogin2[campo].value + "&";
				valid = true;
			}
			c++;
		}
	
	if(valid){
//		window.location.href = "includes/loginEngine.asp?" + strEnvio;
		url = "includes/login2.asp?" + strEnvio;
		http.open("GET", url , true);
		http.onreadystatechange = handleHttpResponseReload;
		http.send(null);		
	}else{
		return false;	
	}	
}

function autentifica4(type){
	var strEnvio = '';
	
		
		var campos = new Array();
		var mensajes = new Array();
		
		
		/* DENINE CAMPO A VALIDAR MENSAJE*/
		campos[0] = 'user'; mensajes[0] = 'Indique su usuario';
		campos[1] = 'password'; mensajes[1] = 'Indique su contraseña';
	
		
		valid = false; 
		i=0;
		
		for(campo in campos){
			valor = document.formLogin2[campo].value;
			if (   (valor == '') || (valor == mensajes[i])  ) {
				document.formLogin2[campo].value = mensajes[i];
				valid = false;
			}else{
				strEnvio += "" + campos[i] + "=" + document.formLogin2[campo].value + "&";
				valid = true;
			}
			i++;
		}
	if(valid){
		url = "includes/login2.asp?" + strEnvio;
		http.open("GET", url , true);
		http.onreadystatechange = handleHttpResponseReload4;
		http.send(null);		
	}else{
		return false;	
	}	
}

//************************************************
//FUNCIONES PARA MOSTRAR LA CAPA DE RECORDAR CONTRASEÑA
//************************************************
function muestraCapa(){
	document.getElementById('recordarPassword').style.display = 'block';
}
/****************************************************************************************
/ Nombre: enviarEmail
/ Implentacion: Fperez
/ Revision:
/ Descripcion: Envia el recordatorio de la contraseña por email
'***************************************************************************************/
function enviarEmail(email){
//	alert(document.formrecuerdo.email.value);
		cadenaEnvio = 'email='+document.formrecuerdo.email.value;
		http.open("GET", "actualizer/formcorreosMultiple/envioEmail.asp?" + cadenaEnvio, true);
		http.onreadystatechange = handleHttpResponseEmail;
		http.send(null);
}
function handleHttpResponseEmail() {
	if (http.readyState == 4) {    	
		//Aqui va el nombre de la capa donde queramos cargar el contenido
		document.getElementById("recordarPassword").style.display = 'none';	
		document.getElementById("respuestaRecuerdo").style.display = 'block';	
		document.getElementById("respuestaRecuerdo").innerHTML = http.responseText;	
		document.getElementById("formrecuerdo").reset();
	}    
}
//************************************************
// FIN FUNCIONES PARA MOSTRAR LA CAPA DE RECORDAR CONTRASEÑA
//************************************************


/****************************************************************
/ Nombre: validar
/ Implentacion
/ Revision: 301106
/ Descripcion: Valida los campos del formulario
'***************************************************************/
function validarIns(tipo){
//Funcion para la validar los datos enviados desde el formulario de contacto
	var texto;
	texto = "";

	var cadenaEnvio;
	cadenaEnvio = "";

	var objPais = document.formRegistro.pais;
	var objProvincia = document.formRegistro.provincia1;
	
	nomPais = objPais.options[document.formRegistro.pais.selectedIndex].text;
	codPais = objPais.options[document.formRegistro.pais.selectedIndex].value;
	
	if (document.formRegistro.provincia1.style.display == "block"){
		nomProvincia = objProvincia.options[document.formRegistro.provincia1.selectedIndex].text;
		codProvincia = objProvincia.options[document.formRegistro.provincia1.selectedIndex].value;
	} else {
		nomProvincia = document.formRegistro.provincia2.value;
		codProvincia = "";
	}

//		alert(nomPais);
//		alert(codPais);
//		alert(nomProvincia);
//		alert(codProvincia);
		
	document.formRegistro.nombre_pais.value = nomPais;
	document.formRegistro.zona_pais.value = codPais;
	document.formRegistro.provincia.value = nomProvincia;
	document.formRegistro.zona_provincia.value = codProvincia;
	
	//Aqui validamos que los campos obligatorios tengan valor y se añaden a la cadena de envio
	
/*	if ( document.getElementById("formRegistro").nombre.value == "" ) {
		texto+=" * Debe indicar su nombre.\n";
	}else{
		cadenaEnvio="nombre=" + document.getElementById("formRegistro").nombre.value;
	}*/
	
	if ( document.getElementById("formRegistro").empresa.value == "" ) {
		texto+=" * Debe indicar el nombre de su empresa.\n";
	}
	if ( document.getElementById("formRegistro").nif.value == "" ) {
		texto+=" * Debe indicar su NIF.\n";
	} else if (document.getElementById("formRegistro").nif.value.length > 9){
		texto+=" * El NIF debe tener un máximo de 9 dígitos.\n";
	}
	if (( document.getElementById("formRegistro").telefono.value != "" ) && ( isNaN(document.getElementById("formRegistro").telefono.value)) ){
		texto+=" * El número de teléfono debe ser numérico.\n";
	}
	if ( isNaN(document.getElementById("formRegistro").cpostal.value) ){
		texto+=" * El código postal debe ser numérico.\n";
	} else if (document.getElementById("formRegistro").cpostal.value.length > 5){
		texto+=" * El código postal debe tener un máximo de 5 dígitos.\n";
	}

	if ( document.getElementById("formRegistro").nombre.value == "" ) {
		texto+=" * Debe indicar una persona de contacto.\n";
	}
	if ( document.getElementById("formRegistro").direccion.value == "" ) {
		texto+=" * Debe indicar su domicilio.\n";
	}
	if ( document.getElementById("formRegistro").cpostal.value == "" ) {
		texto+=" * Debe indicar su código postal.\n";
	}
	if ( document.getElementById("formRegistro").poblacion.value == "" ) {
		texto+=" * Debe indicar su población.\n";	
	}
	if ( document.getElementById("formRegistro").provincia.value == "" ) {
		texto+=" * Debe indicar su provincia.\n";
	}
	if ( document.getElementById("formRegistro").telefono.value == "" ) {
		texto+=" * Debe indicar su teléfono.\n";
	}
	if ( document.getElementById("formRegistro").email.value == "" ) {
		texto+=" * Debe indicar su e-mail.\n";
	}
	
	if(document.getElementById("formRegistro").email.value!=""){
		if(!validarEmail(document.getElementById("formRegistro").email.value)){
				texto+=" * Formato de E-mail incorrecto.\n";
		}else{
			cadenaEnvio+="&email=" + document.getElementById("formRegistro").email.value;
		}
	}
	if ( document.getElementById("formRegistro").clave.value == "" ) {
		texto+=" * Debe indicar su contraseña.\n";
	}
	
	
/*	if ( document.getElementById("formRegistro").dia.value == "0" ) {
		texto+=" * Debe seleccionar el día de su fecha de nacimiento.\n";
	}
	if ( document.getElementById("formRegistro").mes.value == "0" ) {
		texto+=" * Debe seleccionar el mes de su fecha de nacimiento.\n";
	}
	if ( document.getElementById("formRegistro").anyo.value == "0" ) {
		texto+=" * Debe seleccionar el año de su fecha de nacimiento.\n";
	}*/
	
	//para controlar que las fechas sean correctas
	var dia, mes, anyo;
	
/*	dia = document.getElementById('formRegistro').dia.value;
	mes = document.getElementById('formRegistro').mes.value;
	anyo = document.getElementById('formRegistro').anyo.value;
	
	if (!compruebaFecha(dia, mes, anyo)){
		texto+=" * La fecha intorducida es incorrecta.\n";
	}

		cadenaEnvio+="&=" + document.getElementById("formRegistro").preferencias.value;*/

	var email = document.getElementById("formRegistro").email.value;
	
		if ( texto != "" ){
				alert(texto);
		}else{
//			http.open("GET", "registro/compruebaEmail.asp?email=" + email +"&nick=" + , true);
			http.open("GET", "registro/compruebaEmail.asp?email=" + email, true);
			http.onreadystatechange = handleHttpResponseComprobar;
			http.send(null);
		}
	
	
}

function handleHttpResponseComprobar() {
	if (http.readyState == 4) {    	
		//Aqui va el nombre de la capa donde queramos cargar el contenido
			var t =  http.responseText;	
		if ( t != "" ){
				alert(t);
		}else{
				document.getElementById("formRegistro").op.value = 0;
				document.formRegistro.submit();
		}
	}    
}


/****************************************************************
/ Nombre: compruebaFecha()
/ Implentacion: Fperez

/ Revision:
/ Descripcion: Comprueba que las fechas sean correctas
'***************************************************************/
function compruebaFecha(dia, mes, anyo){
	var error;
	if ((dia > 30) && ((mes == 2) || (mes == 4) || (mes == 6) || (mes == 9) || (mes == 11))){
		return false;
	}
	if ((dia > 29) && (mes == 2)){
		return false;
	}
	var resto = parseInt(anyo)%4;
	if (resto != 0){
		if ((dia > 28) && (mes == 2)){
			return false;
		}
	}
	
	return true;
}


/****************************************************************
/ Nombre: 
/ Implentacion: 
/ Revision:
/ Descripcion: 
'***************************************************************/

var strRef=""
var strTipo=""
function handleHttpResponseMuestraCatalogo() {
	if (http.readyState == 4) {
		if (strTipo=="sello")
		{	
			strRef=strRef.substring(6,100);
		}
		if (strTipo=="estiloMusical")
		{	
			strRef=strRef.substring(13,100);
		}
		document.getElementById("refBusqueda").innerHTML = "<td class='txt_blanco'>"+strRef+"</td>";	
		strRef=""
		document.getElementById("busqueda").innerHTML = http.responseText;	
	}    
}

function muestraCatalogo(estilo, autor, sello, titulo, estiloMusical)
{
	if(autor!="")
	{
		strRef=autor;
		strTipo="autor";
	}
	if(sello!="")
	{
		strRef=sello;
		strTipo="sello";
	}
	if(titulo!="")
	{
		strRef=titulo;
		strTipo="titulo";
	}
	
	if(estiloMusical!="")
	{
		strRef=estiloMusical;
		strTipo="estiloMusical";	
	}
	
	strURL="busquedaCatalogo.asp?estilo="+estilo+"&autor="+autor+"&sello="+sello+"&titulo="+titulo+"&estilomusical="+estiloMusical
	http.open("GET", strURL, true);
	http.onreadystatechange = handleHttpResponseMuestraCatalogo;
	http.send(null);
}

//************* PEDIDOS ************************************************

function pedir(cual){	
	var p,i;
//	i = document.getElementById('pk_info'+cual).value;
	p = document.getElementById('pk_pedidos').value;
//	i=eval('document.getElementById('pk_info''+cual'.value');
//	p=eval('document.pedidos'+cual+'.pk_pedidos'+cual+'.value');
	window.open('actualizer/pedidos/pedidos_va01.asp?pk_fotos='+cual+'&pk_pedidos='+p,'pedido','scrollbars=yes,width=600,height=650,top=40,left=30,status=no,toolbar=no,menubar=no,location=no,titlebar=0,resizable=no, fullscreen = no ');
}
function pedirOferta(cual){	
	var p,i;
//	i = document.getElementById('pk_info'+cual).value;
	p = document.getElementById('pk_pedidos').value;
//	i=eval('document.getElementById('pk_info''+cual'.value');
//	p=eval('document.pedidos'+cual+'.pk_pedidos'+cual+'.value');
	window.open('actualizer/pedidos/pedidos_va01.asp?pk_fotos='+cual+'&pk_pedidos='+p+'&oferta=1','pedido','scrollbars=yes,width=600,height=650,top=40,left=30,status=no,toolbar=no,menubar=no,location=no,titlebar=0,resizable=no, fullscreen = no ');
}


function ver_pedidos(){
window.open('actualizer/pedidos/ver_pedidos.asp','pedido','scrollbars=yes,width=600,height=650,top=40,left=30,status=no,toolbar=no,menubar=no,location=no,titlebar=0,resizable=no, fullscreen = no ');
}
function ver_pedidosIng(){
window.open('actualizer/pedidosIng/ver_pedidos.asp','pedido','scrollbars=yes,width=600,height=650,top=40,left=30,status=no,toolbar=no,menubar=no,location=no,titlebar=0,resizable=no, fullscreen = no ');
}
function ver_pedidosFr(){
window.open('actualizer/pedidosFr/ver_pedidos.asp','pedido','scrollbars=yes,width=600,height=650,top=40,left=30,status=no,toolbar=no,menubar=no,location=no,titlebar=0,resizable=no, fullscreen = no ');
}
//************* PEDIDOS ************************************************


/****************************************************************
/ Nombre: validarvalidarSuscripcion
/ Implentacion: Fperez
/ Revision: 11-07-07
/ Descripcion: Valida los campos del formulario de suscripcion
'***************************************************************/
function validarSuscripcion(idioma){


	var texto,texto_en,texto_fr,texto_val,texto_de;
	texto = "";
	texto_en = "";
	texto_fr = "";
	texto_val = "";
	texto_de = "";


	if ( document.getElementById("formularioSuscripcion").nombre.value == "" ) {
		texto+=" * Debe indicar su nombre.<br>";
		texto_en+=" * You must enter your name.<br>";
		texto_fr+=" * Vous devez indiquer votre nom.<br>";
		texto_val+=" * Deu indicar el seu nom.<br>";
		texto_de+=" * Ihren Namen bitte.<br>";
	}else{
		cadenaEnvio="nombre=" + document.getElementById("formularioSuscripcion").nombre.value;
	}
	
	if (( document.getElementById("rock").checked == false ) && ( document.getElementById("dance").checked == false )) {

			document.getElementById("textoSuscripcion").innerHTML= "Debes seleccionar uno de los dos estilos (rock - dance).";
			return;
			
	} else { 
			if (document.getElementById("rock").checked ){
				cadenaEnvio+="&rock=1";
			}
			if (document.getElementById("dance").checked ){
				cadenaEnvio+="&dance=1";
			}
	}
	
	
	if ( document.getElementById("formularioSuscripcion").email.value == "" ) {
		texto+=" * Debe indicar su email.<br>";
		texto_en+=" * You must enter your e-mail.<br>";
		texto_fr+=" * Vous devez indiquer votre email.<br>";
		texto_val+=" * Deu indicar el seu e-mail.<br>";
		texto_de+=" * Ihre E-Mail Adresse bitte.<br>";
	}
	
	if(document.getElementById("formularioSuscripcion").email.value!=""){
		if(!validarEmail(document.getElementById("formularioSuscripcion").email.value)){
				texto+=" * Formato de E-mail incorrecto.<br>";
				texto_en+=" * The E-mail format is wrong.<br>";
				texto_fr+=" * Format d'email incorrect.<br>";
				texto_val+=" * Format de E-mail incorrecte.<br>";
				texto_de+=" * E-Mail Format ist nicht richtig.<br>";
		}else{
//			cadenaEnvio="nombre=" + document.getElementById("formularioSuscripcion").email.value;
			cadenaEnvio+="&email=" + document.getElementById("formularioSuscripcion").email.value;
		}
	}
//			cadenaEnvio+="&estilo=" + document.getElementById("formularioSuscripcion").estilo.value;

	if (texto!=""){
		document.getElementById("textoSuscripcion").innerHTML="";

			switch (idioma) { 
				case 'en': 
					document.getElementById("textoSuscripcion").innerHTML=texto_en;
				   break 
				case 'fr': 
					document.getElementById("textoSuscripcion").innerHTML=texto_fr;
				   break 
				case 'val': 
					document.getElementById("textoSuscripcion").innerHTML=texto_val;
				   break 
				case 'de': 
					document.getElementById("textoSuscripcion").innerHTML=texto_de;
				   break 
				default: 
					document.getElementById("textoSuscripcion").innerHTML=texto;
			} 
		document.getElementById("textoSuscripcion").style.display="block";
	}else{
		http.open("GET", "actualizer/suscripcion/suscripcion.asp?" + cadenaEnvio, true);
		http.onreadystatechange = handleHttpResponseSuscripcion;
		http.send(null);
	}	
}
function handleHttpResponseSuscripcion() {
	if (http.readyState == 4) {    	
		//Aqui va el nombre de la capa donde queramos cargar el contenido
//			alert(http.responseText);
		document.getElementById("textoSuscripcion").innerHTML = http.responseText;	
		document.getElementById("formularioSuscripcion").reset();
	}    
}
function blanco(){
	if (document.getElementById('nombre').value == '  nombre') {
		document.getElementById('nombre').value = '';
	}
	if (document.getElementById('email').value == '  e-mail') {
		document.getElementById('email').value = '';
	}
}

