' + $(this).attr('extraname')+' (x '+ parseFloat('0' + $(this).val().replace(',','.')) +')'+ (parseFloat($(this).attr('extrarate').replace(',','.')) * parseFloat($(this).val().replace(',','.'))).formatPrice() + ' €
');
}
});
$('.rate:checked').each( function(){ jTotalRate += parseFloat($(this).val().replace(',','.')); });
$('#TotalRate').html(jTotalRate.formatPrice() + ' €');
var strDiaryRates = $(this).attr('diaryrates');
var tabDiaryRates = strDiaryRates.split('#');
$('#SummaryDetails'+$(this).attr('roomnum')).html('' + $(this).attr('extraname')+' (x '+ parseFloat('0' + $(this).val().replace(',','.')) +')'+ (parseFloat($(this).attr('extrarate').replace(',','.')) * parseFloat($(this).val().replace(',','.'))).formatPrice() + ' €
');
}
});
$('.rate:checked').each( function(){ jTotalRate += parseFloat($(this).val().replace(',','.')); });
$('#TotalRate').html(jTotalRate.formatPrice() + ' €');
});
// PICTS NO EXISTE
$('img').each(function(){
//if($(this).length < 10) $(this).parent('a').parent('div.pic, div.descSlider').remove();
});
// VALIDATION
function BuenMail (string)
{
var at="@";
var dot=".";
var lat=string.indexOf(at);
var lstr=string.length;
var ldot=string.indexOf(dot);
if (string.indexOf(at)==-1){ return false; }
if (string.indexOf(at)==-1 || string.indexOf(at)==0 || string.indexOf(at)==lstr){ return false; }
if (string.indexOf(dot)==-1 || string.indexOf(dot)==0 || string.indexOf(dot)==lstr){ return false; }
if (string.indexOf(at,(lat+1))!=-1){ return false; }
if (string.substring(lat-1,lat)==dot || string.substring(lat+1,lat+2)==dot){ return false; }
if (string.indexOf(dot,(lat+2))==-1){ return false; }
if (string.indexOf(" ")!=-1){ return false; }
return true;
}
$('#ConfirmBookingBtn, #ConfirmBookingBtn2').click(function(){
var button = $(this);
button.attr('disabled', true).text('Cargando...');
if($('#BookingPolitic').is(':checked')){
var strAlert = '';
$('#ConfirmBooking input:visible').each(function(){
if($(this).attr('required') == 'required' && $(this).val() == '' && $(this).val().length < 3){
if(strAlert == ''){
$(this).focus();
$('html, body').animate({
scrollTop: $(this).offset().top
}, 2000);
}
$(this).addClass('warning').blur(function(){ if($(this).val() != '' && $(this).val().length >= 3) $(this).removeClass('warning'); });
strAlert += $(this).attr('help') + '\n';
} else if($(this).attr('required') == 'required' && $(this).attr('type') == 'email' && !BuenMail ($(this).val())){
if(strAlert == ''){
$(this).focus();
$('html, body').animate({
scrollTop: $(this).offset().top
}, 2000);
}
$(this).addClass('warning').blur(function(){ if($(this).val() != '' && $(this).val().length >= 3) $(this).removeClass('warning'); });
strAlert += $(this).attr('help') + '\n';
}
});
if(strAlert == '') $('#ConfirmBooking').submit();
else alert(strAlert);
} else {
$('html, body').animate({
scrollTop: $("#HaveToAccept").offset().top
}, 2000);
$('#HaveToAccept').show();
for(i=0;i<3;i++) {
$('#HaveToAccept').fadeTo('slow', 0.5).fadeTo('slow', 1.0);
}
alert($('#BookingPolitic').attr('help'));
}
button.attr('disabled', false).text('CONFIRMAR');
});
$('#loginBtn').click(function(){
var strAlert = '';
$('#loginFrm input:visible').each(function(){
if($(this).attr('required') == 'required' && $(this).val() == '' && $(this).length < 3){
if(strAlert == '') $(this).focus();
strAlert += $(this).attr('help') + '\n';
$(this).addClass('warning').click(function(){ $(this).removeClass('warning'); });
}
});
if(strAlert == '') $('#loginFrm').submit();
else alert(strAlert);
});
function codificarFuncion(funcio, param){
return encodeURI(funcio.toString().replace('param', param));
}
function SendFramePost(funcio, param){
window.parent.postMessage(codificarFuncion(funcio, param),'*');
}
function SetiFrame(){
document.getElementById("iRolineSystem").style.height = param+"px";
}
function SetHeight(){
var iframeHeight;
var bodyheight = $('#bookingEngine').height();
if(bodyheight <= 600) iframeHeight = 600;
else iframeHeight = bodyheight+60;
return iframeHeight;
}
setTimeout(function(){ SendFramePost(SetiFrame, SetHeight() + 250); }, 1000);
$('#bookingEngine').scroll(function (){ SendFramePost(SetiFrame, SetHeight()); });
$('#ShoppingCart').click( function() { SendFramePost(SetiFrame, SetHeight() + 250); });
});