// JavaScript Document
function CambiaIdioma(CodeIdioma){
	var url = document.location.href;

	url = url.replace('/es/','/');
	url = url.replace('/en/','/');

	document.location.href = url + CodeIdioma+"/";
}

IndicePromocionActual = 0;
function CargaPromocion(IndicePromocion){
	document.getElementById('SecPromcionGuiaSitios_'+IndicePromocionActual).style.display = "none";
	document.getElementById('SecPromcionGuiaSitios_'+IndicePromocion).style.display = "block";
	
	
	document.getElementById('EnlaceFicha_'+IndicePromocionActual).className = "FlyerPromcionesGuiaSitiosMouseOut";
	document.getElementById('EnlaceFicha_'+IndicePromocion).className = "FlyerPromcionesGuiaSitiosMouseOver";
	document.getElementById('EnlaceFicha_'+IndicePromocionActual).className = "FlyerPromcionesGuiaSitiosMouseOut";
	IndicePromocionActual = IndicePromocion;
	setTimeout("ActivaPromocionMouseOut()", 1000);
}

function ActivaPromocionMouseOut(){
	document.getElementById('EnlaceFicha_'+IndicePromocionActual).className = "FlyerPromcionesGuiaSitiosMouseOver";
}



IdFichaQuienesSomosActual = 1;
function CargaFichaContenidoA(IdFicha){
	if(IdFicha != IdFichaQuienesSomosActual){
			document.getElementById('QuienesSomosFicha'+IdFichaQuienesSomosActual).style.display = "none";
			document.getElementById('QuienesSomosFicha'+IdFicha).style.display = "block";
			
			document.getElementById('EnlaceFicha'+IdFichaQuienesSomosActual).className = "EnlaceFicha_1";
			document.getElementById('EnlaceFicha'+IdFicha).className = "EnlaceFichaActiva";
			
			IdFichaQuienesSomosActual = IdFicha;
	}
}


IdFichaInscripcionActual = 1;
function CargaFichaContenidoB(IdFicha){
	if(IdFicha != IdFichaInscripcionActual){
			document.getElementById('InscripcionFicha'+IdFichaInscripcionActual).style.display = "none";
			document.getElementById('InscripcionFicha'+IdFicha).style.display = "block";
			
			document.getElementById('EnlaceFicha'+IdFichaInscripcionActual).className = "EnlaceFicha_1";
			document.getElementById('EnlaceFicha'+IdFicha).className = "EnlaceFichaActiva";
			
			IdFichaInscripcionActual = IdFicha;
	}
}


IdFichaElNegocioActual = 1;
function CargaFichaContenidoC(IdFicha){
	if(IdFicha != IdFichaElNegocioActual){
			document.getElementById('ElNegocioFicha'+IdFichaElNegocioActual).style.display = "none";
			document.getElementById('ElNegocioFicha'+IdFicha).style.display = "block";
			
			document.getElementById('EnlaceFicha'+IdFichaElNegocioActual).className = "EnlaceFicha_1";
			document.getElementById('EnlaceFicha'+IdFicha).className = "EnlaceFichaActiva";
			
			IdFichaElNegocioActual = IdFicha;
	}
}

IdFichaGuiaSitiosActual = 1;
function CargaFichaGuiaSitios(IdFicha){
	if(IdFicha != IdFichaGuiaSitiosActual){
		if(document.getElementById('GuiaSitiosFicha'+IdFicha)){
			document.getElementById('GuiaSitiosFicha'+IdFichaGuiaSitiosActual).style.display = "none";
			document.getElementById('GuiaSitiosFicha'+IdFicha).style.display = "block";
			
			document.getElementById('EnlaceFicha'+IdFichaGuiaSitiosActual).className = "EnlaceFicha_1";
			document.getElementById('EnlaceFicha'+IdFicha).className = "EnlaceFichaActiva";
			
			IdFichaGuiaSitiosActual = IdFicha;
		}
	}
}



function MuestraImagenEvento(IdEvento, ImagenEvento){
	document.getElementById('FondoAlfaNegro').style.width = document.documentElement.clientWidth+'px';
	document.getElementById('FondoAlfaNegro').style.height = (document.body.scrollHeight+40)+'px';
	document.getElementById('FondoAlfaNegro').style.display = 'block';
//	document.getElementById('DivInfoPromocion_'+CodigoIdioma).style.display = 'block';
//	document.getElementById('HidInfoPromocion'+CodigoIdioma).value = tinyMCE.get('TxaInfoPromocion'+CodigoIdioma).getContent();
}




function ValidaNumeroTelefono(Valor){
	var EstadoValidacion = 0;
    var RegExPattern = /(^[0-9- +#()*]*$)$/;
    if ((Valor.match(RegExPattern)) && (Valor!='')) {
        EstadoValidacion = 1;
    } else {
        EstadoValidacion = 0;
	} 
	return EstadoValidacion;
}

function ValidaCorreo(Valor){

	if(Valor.indexOf("@")==-1 || Valor.indexOf(".")==-1){
		EstadoValidacion = 0;
	}else{
		EstadoValidacion = 1;
	}

	return EstadoValidacion;
}




function ValidaFormularioContactoGuiaSitio(){	
	var estado = 1;

	if(document.getElementById('SltMotivo').value == 0){
		document.getElementById('SltMotivo').focus();
		estado = 0;
		return;
	}
	
	if(document.getElementById('SltConocio').value == 0){
		document.getElementById('SltConocio').focus();
		estado = 0;
		return;
	}
	
	if(document.getElementById('InpNombre').value == ''){
		document.getElementById('InpNombre').focus();
		estado = 0;
		return;
	}

	if(document.getElementById('InpApellidos').value == ''){
		document.getElementById('InpApellidos').focus();
		estado = 0;
		return;
	}

	if(document.getElementById('InpCorreo').value == '' || !ValidaCorreo(document.getElementById('InpCorreo').value)){
		document.getElementById('InpCorreo').focus();
		estado = 0;
		return;
	}

	if(document.getElementById('InpTelefono').value == '' || !ValidaNumeroTelefono(document.getElementById('InpTelefono').value)){
		document.getElementById('InpTelefono').focus();
		estado = 0;
		return;
	}

	if(document.getElementById('InpDistrito').value == ''){
		document.getElementById('InpDistrito').focus();
		estado = 0;
		return;
	}
	
	if(document.getElementById('InpDireccion').value == ''){
		document.getElementById('InpDireccion').focus();
		estado = 0;
		return;
	}

	if(document.getElementById('InpMensaje').value == ''){
		document.getElementById('InpMensaje').focus();
		estado = 0;
		return;
	}
	return estado;	
}

function EnviaContactoGuiaSitio(){
	if(ValidaFormularioContactoGuiaSitio()){
	document.getElementById('HidIEstadoEnvia').value = 1;
	document.GuiaSitio.submit();
	}
}

function ValidaFormularioContactoWeb(){	
	var estado = 1;

	if(document.getElementById('SltMotivo').value == 0){
		document.getElementById('SltMotivo').focus();
		estado = 0;
		return;
	}
	
	if(document.getElementById('SltConocio').value == 0){
		document.getElementById('SltConocio').focus();
		estado = 0;
		return;
	}
	
	if(document.getElementById('InpNombre').value == ''){
		document.getElementById('InpNombre').focus();
		estado = 0;
		return;
	}

	if(document.getElementById('InpApellidos').value == ''){
		document.getElementById('InpApellidos').focus();
		estado = 0;
		return;
	}
	
	if(document.getElementById('SltDia').value == 0){
		document.getElementById('SltDia').focus();
		estado = 0;
		return;
	}
	
	if(document.getElementById('SltMes').value == 0){
		document.getElementById('SltMes').focus();
		estado = 0;
		return;
	}
	
	if(document.getElementById('SltAnio').value == 0){
		document.getElementById('SltAnio').focus();
		estado = 0;
		return;
	}
	
	if(document.getElementById('InpCorreo').value == '' || !ValidaCorreo(document.getElementById('InpCorreo').value)){
		document.getElementById('InpCorreo').focus();
		estado = 0;
		return;
	}

	if(document.getElementById('InpTelefono').value == '' || !ValidaNumeroTelefono(document.getElementById('InpTelefono').value)){
		document.getElementById('InpTelefono').focus();
		estado = 0;
		return;
	}
	
	if(document.getElementById('InpCiudad').value == ''){
		document.getElementById('InpCiudad').focus();
		estado = 0;
		return;
	}
	
	if(document.getElementById('InpDistrito').value == ''){
		document.getElementById('InpDistrito').focus();
		estado = 0;
		return;
	}
	
	if(document.getElementById('InpDireccion').value == ''){
		document.getElementById('InpDireccion').focus();
		estado = 0;
		return;
	}
	
	if(document.getElementById('InpMensaje').value == ''){
		document.getElementById('InpMensaje').focus();
		estado = 0;
		return;
	}
	return estado;	
}

function EnviaContactoWeb(){
	if(ValidaFormularioContactoWeb()){
	document.getElementById('HidIEstadoEnvia').value = 1;
	document.Contacto.submit();
	}
}

//var ListaFiltraSectorGuiaSitioDesactiivada;
function FiltraSectorGuiaSitio(Url){
	if(Url != ''){
		var Total = ListaFiltraSectorGuiaSitioDesactiivada.length;
		for(i=0; i < Total; i++){
			if(Url == ListaFiltraSectorGuiaSitioDesactiivada[i]){
				document.getElementById('SlctFiltro').value = '';
				return;
			}
		}
		document.location.href = Url;
	}
}

var TempSubsectorActivo = 0;
function MuestaSubsectores(Indice){
	if(TempSubsectorActivo != 0){
		document.getElementById('Subsector_'+TempSubsectorActivo).style.display = "none";
	}
	TempSubsectorActivo = Indice;	
	document.getElementById('Subsector_'+Indice).style.display = "block";
}

function FiltraSectorPromociones(Url){
	if(Url != ''){
		var Total = ListaFiltraSectorPromocionDesactiivada.length;
		for(i=0; i < Total; i++){
			if(Url == ListaFiltraSectorPromocionDesactiivada[i]){
				document.getElementById('SlctFiltro').value = '';
				return;
			}
		}
		document.location.href = Url;
	}
}

function FiltraAgenda(Url){
	if(Url != ''){
		var Total = ListaFiltraSectorAgendaDesactiivada.length;
		for(i=0; i < Total; i++){
			if(Url == ListaFiltraSectorAgendaDesactiivada[i]){
				document.getElementById('SlctFiltro').value = '';
				return;
			}
		}
		document.location.href = Url;
	}
}

function FiltraEvento(Url){
	if(Url != ''){
		var Total = ListaFiltraSectorEventoDesactiivada.length;
		for(i=0; i < Total; i++){
			if(Url == ListaFiltraSectorEventoDesactiivada[i]){
				document.getElementById('SlctFiltroEvento').value = '';
				return;
			}
		}
		document.location.href = Url;
	}
}

function FiltraVideo(Url){
	if(Url != ''){
		var Total = ListaFiltraSectorVideoDesactiivada.length;
		for(i=0; i < Total; i++){
			if(Url == ListaFiltraSectorVideoDesactiivada[i]){
				document.getElementById('SlctFiltroVideo').value = '';
				return;
			}
		}
		document.location.href = Url;
	}
}

/*
function EstableceBordeImagenEvento(){
	if(document.ImagenEvento.width > 350){
		document.getElementById('BordeImagenEvento').className = "ContenidoGrandeHechadaImagenAlbumEvento";
	}else{
		document.getElementById('BordeImagenEvento').className = "ContenidoGrandeParadaImagenAlbumEvento";
	}
	
}
*/




function ValidaFormularioComentarioImagenEvento(){	
	var estado = 1;
	
	if(document.getElementById('InpNombreApellido').value == ''){
		document.getElementById('InpNombreApellido').focus();
		estado = 0;
		return;
	}

	if(document.getElementById('InpComentario').value == ''){
		document.getElementById('InpComentario').focus();
		estado = 0;
		return;
	}
	return estado;	
}

function EnviaComentarioImagenEvento(){
	if(ValidaFormularioComentarioImagenEvento()){
	document.getElementById('HidIEstadoEnvia').value = 1;
	document.ComentarioImagenEvento.submit();
	}
}

function CambiaPaginaImagenEvento() {
	var e = document;
	e.onkeydown = function (evt) {
		evt = (evt) ? evt : ((window.event) ? window.event : "");
		if(evt.keyCode == 39){
		document.location.href = ImagenEventoSiguiente;
		}
		if(evt.keyCode == 37){
		document.location.href = ImagenEventoAnterior;
		}
	}
}

function FiltraFechaAgenda(Fecha){
	//alert(UrlAgenda+"F/"+Fecha+"/");
	document.location.href = UrlAgenda+"F/"+Fecha+"/";
}

var CiudadActivo = 0;
function CargaListaCiudades(){
	document.getElementById('ListaCiudad').style.display = "block";
	setTimeout("PuenteOculatSubMenu()", 3000);
	CiudadActivo = 0;
}

function CargaListaCiudadesTemporal(){
	document.getElementById('ListaCiudad').style.display = "block";
	CiudadActivo = 1;
}

function OcultaListaCiudades(){
	setTimeout("PuenteOculatSubMenu()", 3000);
	CiudadActivo = 0;
}

function PuenteOculatSubMenu(Identificador){
	if(CiudadActivo == 0){
		document.getElementById('ListaCiudad').style.display = "none";
	}
}












var fecha=new Date();
var diames=fecha.getDate();
var diasemana=fecha.getDay();
var mes=fecha.getMonth() +1 ;
var ano=fecha.getFullYear();

var textosemana = new Array (7);
  textosemana[0]="domingo";
  textosemana[1]="lunes";
  textosemana[2]="martes";
  textosemana[3]="miércoles";
  textosemana[4]="jueves";
  textosemana[5]="viernes";
  textosemana[6]="sábado";

var textomes = new Array (12);
  textomes[1]="Enero";
  textomes[2]="Febrero";
  textomes[3]="Marzo";
  textomes[4]="Abril";
  textomes[5]="Mayo";
  textomes[6]="Junio";
  textomes[7]="Julio";
  textomes[8]="Agosto";
  textomes[9]="Septiembre";
  textomes[10]="Octubre";
  textomes[11]="Noviembre";
  textomes[12]="Diciembre";
  
function FechaActual(){
	/*
	document.write("Fecha completa: " + fecha + "<br>");
	document.write("Dia mes: " + diames + "<br>");
	document.write("Dia semana: " + diasemana + "<br>");
	document.write("Mes: " + mes + "<br>");
	document.write("Año: " + ano + "<br>");
	document.write("Fecha: " + diames + "/" + mes + "/" + ano + "<br>");
	document.write("Fecha: " + textosemana[diasemana] + " " + diames + "/" + mes + "/" + ano + "<br>");
	*/
	document.write(textosemana[diasemana] + " " + diames + " de " + textomes[mes] + ", " + ano);
}

