try{document.execCommand("BackgroundImageCache",false,true);}catch(err){};
$(function(){if(page=='inicio'){$('#bigimg').cycle({fx:'fade',timeout:3500,speed:2000});}
$('.carousel').jcarousel({scroll:4});$('#inicio .carousel-hidden img').live('click',function(){var carousel=$('.carousel-hidden');var allImgs=carousel.find('li img');var pos=allImgs.index($(this));$('#bigimg').cycle('pause');$('#bigimg').cycle(pos);});$('#inicio .show-gallery').click(function(){$(this).hide();$('#home-gallery').slideDown();return!$('.carousel-hidden').jcarousel({scroll:4});});$('#inicio #home-gallery .close').click(function(){$('#home-gallery').slideUp();$('#bigimg').cycle('resume');return!$('#inicio .show-gallery').fadeIn();});$('#info-menu .close').click(function(){$('#info-menu *').fadeOut();$('#info-menu').animate({top:345});return!$('#info-menu .hidden').show();});$('#info-menu .hidden').click(function(){$('#info-menu *').fadeIn();$('#info-menu').animate({top:275});return!$('#info-menu .hidden').hide();});$('#section-menu .close').click(function(){return!$('#section-menu').animate({top:-130});});$('.datepicker').datepicker($.datepicker.regional[""],{showOn:"button",buttonImage:"static/img/datepicker/calendar.gif",dateFormat:'dd/mm/yy',buttonImageOnly:true});if(lang=='spanish'){$('.datepicker').datepicker('option',$.datepicker.regional["es"]);}
$('.carousel a').colorbox({maxHeight:570});$('#ibiza #col-img a').colorbox({maxHeight:570});$('a.modal').colorbox({maxHeight:570});$('.active').each(function(){$(this).html('> '+$(this).html())})
$('#langmenu a[href*="lang='+lang+'"]').addClass("select");$('.newPage').live('click',function(e){e.preventDefault();window.open($(this).attr("href"));return false;});var contentHeight=parseInt($('#colleft').css('top'));if(contentHeight<0){var newImage=$('<img src="'+$('#content img:last').attr('src')+'" />');$(newImage).load(function(){contentHeight=parseInt($('#colleft').css('top'));$('#content').height($('#content').height()+contentHeight+40);});}
$('#noticia_detalle .carousel img').live('click',function(){var imgsrc=$(this).attr('title');var imgcont=$('#noticia_detalle #pretext img');var newImage=$('<img src="'+imgsrc+'" />');$(newImage).load(function(){$(imgcont).fadeOut(function(){$(imgcont).attr('src',imgsrc);return!$(this).show();});});});$('.send').click(function(){var tForm=$('form').eq($('.send').index(this));var tReq=tForm.find('.required');tReq.removeClass('error');tReq.each(function(){if($(this).val()==''||($(this).attr('name')=='email'&&!checkEmail($(this).val())))$(this).addClass('error');});if(tReq.hasClass('error')){alert('Rellene los campos marcados en rojo');return false;}
$.post(tForm.attr('action'),tForm.serialize(),function(rdata){if(rdata==''){$('.send').hide();$(tForm).each(function(){this.reset();});return!$('.success').fadeIn();}
return!$('.error').fadeIn();});return false;});function checkEmail(d){var filter=/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;return filter.test(d);}
return false;});
