$(document).ready(function() {
	popupIngrese();
	abrirVentanaOlvidoClave();
	popUpCambioIdioma();
});

function olvidarClave() {
	cerrarErroresNoty();
	$.prettyPhoto.close();
	setTimeout(abrirOlvidoClave, 1000);
	
}

function popUpCambioIdioma(){
	$("#idPopUpIdioma").prettyPhoto({
		social_tools : '',
		default_width : 450,
		default_height : 377,
		callback : function() {
			cerrarErroresNoty();
		}
	});
}

function abrirOlvidoClave(){
	clicPopUp('olvidoClave');
}

function popupIngrese() {
	$("#linkIngrese").prettyPhoto({
		social_tools : '',
		default_width : 634,
		default_height : 258,
		callback : function() {
			cerrarErroresNoty();
		}
	});
	$("#linkIngreseMF").prettyPhoto({
		social_tools : '',
		default_width : 634,
		default_height : 258,
		callback : function() {
			cerrarErroresNoty();
		}
	});
}

function abrirVentanaOlvidoClave() {
	$("#idOlvidoClave[rel^='prettyPhoto']").prettyPhoto({
		social_tools : '',
		default_width : 535,
		default_height : 230,
		callback : function() {
			cerrarErroresNoty();
		}
	});
}

function reloadContactenos() {
	var url = location.href;
	if (url.indexOf("/contactenos") !== -1) {
		reloadAjax();
	}
}

function reloadRegistro() {
	var url = location.href;
	if (url.indexOf("/suscripciones") !== -1
			|| url.indexOf("/registroSuscriptores/informacionContacto.xhtml") !== -1) {
		window.location.reload();
	}
	else if (url.indexOf("/suscripcion") !== -1
			|| url.indexOf("/registroSuscriptor/suscriptor.xhtml") !== -1) {
		window.location.reload();
	}
}

function clickBoton(event) { 
	if (event.keyCode == 13) { 
		$("#botonEnviarLogin").click();
	}
}

function abrirPopUpIdioma(value){
	console.log(value);
	if(value==1){
		$("#idPopUpIdioma")[0].click();
	}else{
		console.log("Ignorando");
	}
}
