var blank = new Image();
blank.src = '/nImg/blank.gif';
var state = 'none';
$(document).ready(function() {
var badBrowser = (/MSIE ((5\.5)|6)/.test(navigator.userAgent) && navigator.platform == "Win32");
if (badBrowser) {
// get all pngs on page
$('img[src$=.png]').each(function() {
if (!this.complete) {
this.onload = function() { fixPng(this) };
} else {
fixPng(this);
}
});
}
// versiones internacionales
$("#despIntVersions").click(function(e) {
$("#callCenter").hide();
e.preventDefault();
$("#intVersions").toggle();
});
$("#intVersions").mouseup(function() {
return false;
});
$(document).mouseup(function(e) {
if($(e.target).parent("a#despIntVersions").length==0) {
$("#intVersions").hide();
}
});
// Telefonos
$("#tfnoContacto").click(function(e) {
$("#intVersions").hide();
e.preventDefault();
$("#callCenter").toggle();
});
$("#tfnoContacto").mouseup(function() {
return false;
});
$(document).mouseup(function(e) {
if($(e.target).parent("a#tfnoContacto").length==0) {
$("#callCenter").hide();
}
});
$(".phonenumber_mas").colorbox({
width:"700", height:"500", resize:false, iframe:true, scrolling:"no", scrolling:"noresize", opacity:"0.25"
});
initSlide();
});
function fixPng(png) {
// get src
var src = png.src;
// set width and height
if (!png.style.width) { png.style.width = $(png).width(); }
if (!png.style.height) { png.style.height = $(png).height(); }
// replace by blank image
png.onload = function() { };
png.src = blank.src;
// set filter (display original image)
png.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "',sizingMethod='scale')";
}
function loginMas(formulario) {
try{
var params = "login=" + document.getElementById(formulario).email.value;
params += "&password=" + document.getElementById(formulario).password.value;
params += "&rand=" + Math.random();
params = encodeURI(params);
$.ajax({type: 'GET',
url: '../../nMas/jsp/E_Login.jsp',
data: params,
dataType: "xml",
success: function(xml){
if ($(xml).find('numErrores').text() == "0") {
actualizarLogin();
if ($(xml).find('com_solmelia_user_logged').text() == "true") {
}
else
{
nAlert('smAlert.ERROR_NO_LOGGED');
}
}
else
{
var errores = $(xml).find('errorcode');
var txtError = errores[0].firstChild.data;
if (txtError == "ERROR_PASS_EXPIRED")
{
$.fn.colorbox({width:'620', height:'330',scrollbars:false, iframe:true, opacity:'0.25',href:'../../nMas/jsp/C_Data_Renew_Pass.jsp',open:true});
}
else
{
if (txtError == "FALTA_LOGIN") txtError = 'El campo e-mail / log-in es obligatorio. Por favor, verifica los datos introducidos. En caso de duda, rogamos contactes con helpme.web@solmelia.com';
if (txtError == "FALTA_PASSWORD") txtError = 'Falta el password';
if (txtError == "LOGIN_NO_VALIDO") txtError = 'La contraseña introducida no es correcta. Por favor, inténtalo de nuevo. Si no recuerdas la contraseña envía un e-mail a helpme.web@solmelia.com o llama al Servicio de Atención al Cliente más cercano. Estaremos encantados de ayudarte';
if (txtError == "ERROR_PETICION") txtError = 'Error en la petición';
if (txtError == "LOGIN_NO_EXISTE") txtError = 'El e-mail introducido no está registrado. Por favor, revisa que lo has introducido correctamente. Si tienes cualquier problema, envía un correo a helpme.web@solmelia.com o llama al Servicio de Atención al Cliente más cercano. Estaremos encantados de ayudarte';
if (txtError == "CUENTA_BLOQUEADA") txtError = 'Esta cuenta de usuario ha sido bloqueada. Para desbloquearla regenerando la contraseña PULSE AQUÍ.
La nueva contraseña será enviada a su dirección de email.';
if (txtError == "USUARIO_DE_BAJA") txtError = 'El e-mail que has introducido está registrado en nuestra sección para Agencias. Si tienes cualquier problema, envía un correo a. helpme.web@solmelia.com o llama al Servicio de Atención al Cliente más cercano ';
if (txtError == "NUM_TARJETA_NO_VALIDO") txtError = 'El número de tarjeta Club Amigos introducido no es válido. Por favor, comprueba los datos. En caso de duda rogamos contacte con helpme.web@solmelia.com';
if (txtError == "WTC1109") txtError = 'Nuestro servidor de momento no está disponible. Por favor, vuelve a intentarlo más tarde.';
nAlert(txtError);
}
}
},
error:function (xhr, textStatus, thrownError){
//CASO DE ERROR
nAlert('smAlert.ERROR_CONSULTA');
actualizarLogin();
}
});
} catch(err){
nAlert("Error");
return false;
}
}
function logoutMas() {
try{
$.ajax({type: 'GET',
url: '/nMas/jsp/E_Logout.jsp',
dataType: "text",
success: function(xml){
actualizarLogin();
},
error:function (xhr, textStatus, thrownError){
//CASO DE ERROR
nAlert("Error en la consulta: "+textStatus);
actualizarLogin();
}
});
} catch(err){
nAlert("Error");
}
}
function actualizarLogin(){
$("div#panel").slideUp("slow");
$.post("/nMenus/jsp/menuSlideMas.jsp", null, function(data){
/// Ponemos la respuesta de nuestro script en el DIV recargado
$("#slide_login").html(data);
initSlide();
});
}
function initSlide(){
// Expand Panel
$("#open").click(function(){
$("div#panel").slideDown("slow");
});
// Collapse Panel
$("#close").click(function(){
$("div#panel").slideUp("slow");
});
// Switch buttons from "Log In | Register" to "Close Panel" on click
$("#toggle a").click(function () {
$("#toggle a").toggle();
});
$("#olvPasswordCab").colorbox({width:"520", height:"400", resize:false, iframe:true, opacity:"0.25"});
$("#olvEmailCab").colorbox({ width:"520", height:"400", resize:false, iframe:true, opacity:"0.25"});
}