﻿jQuery.fn.corner=function(o){function hex2(s){var s=parseInt(s).toString(16);return(s.length<2)?"0"+s:s;}function gpc(node){for(;node&&node.nodeName.toLowerCase()!="html";node=node.parentNode){var v=jQuery.css(node,"backgroundColor");if(v.indexOf("rgb")>=0){rgb=v.match(/\d+/g);return"#"+hex2(rgb[0])+hex2(rgb[1])+hex2(rgb[2]);}if(v&&v!="transparent"){return v;}}return"#ffffff";}function getW(i){switch(fx){case"round":return Math.round(width*(1-Math.cos(Math.asin(i/width))));}}o=(o||"").toLowerCase();var keep=/keep/.test(o);var cc=((o.match(/cc:(#[0-9a-f]+)/)||[])[1]);var sc=((o.match(/sc:(#[0-9a-f]+)/)||[])[1]);var width=parseInt((o.match(/(\d+)px/)||[])[1])||10;var re=/round|bevel|notch|bite|cool|sharp|slide|jut|curl|tear|fray|wicked|sculpt|long|dog3|dog2|dog/;var fx=((o.match(re)||["round"])[0]);var edges={T:0,B:1};var opts={TL:/top|tl/.test(o),TR:/top|tr/.test(o),BL:/bottom|bl/.test(o),BR:/bottom|br/.test(o)};if(!opts.TL&&!opts.TR&&!opts.BL&&!opts.BR){opts={TL:1,TR:1,BL:1,BR:1};}var strip=document.createElement("div");strip.style.overflow="hidden";strip.style.height="1px";strip.style.backgroundColor=sc||"transparent";strip.style.borderStyle="solid";return this.each(function(index){var pad={T:parseInt(jQuery.css(this,"paddingTop"))||0,R:parseInt(jQuery.css(this,"paddingRight"))||0,B:parseInt(jQuery.css(this,"paddingBottom"))||0,L:parseInt(jQuery.css(this,"paddingLeft"))||0};if(jQuery.browser.msie){this.style.zoom=1;}if(!keep){this.style.border="none";}strip.style.borderColor=cc||gpc(this.parentNode);var cssHeight=jQuery.curCSS(this,"height");for(var j in edges){var bot=edges[j];strip.style.borderStyle="none "+(opts[j+"R"]?"solid":"none")+" none "+(opts[j+"L"]?"solid":"none");var d=document.createElement("div");var ds=d.style;bot?this.appendChild(d):this.insertBefore(d,this.firstChild);if(bot&&cssHeight!="auto"){if(jQuery.css(this,"position")=="static"){this.style.position="relative";}ds.position="absolute";ds.bottom=ds.left=ds.padding=ds.margin="0";if(jQuery.browser.msie){ds.width="100%";}else{ds.width="100%";}}else{ds.margin=!bot?"-"+pad.T+"px -"+pad.R+"px "+(pad.T-width)+"px -"+pad.L+"px":(pad.B-width)+"px -"+pad.R+"px -"+pad.B+"px -"+pad.L+"px";}for(var i=0;i<width;i++){var w=Math.max(0,getW(i));var e=strip.cloneNode(false);e.style.borderWidth="0 "+(opts[j+"R"]?w:0)+"px 0 "+(opts[j+"L"]?w:0)+"px";bot?d.appendChild(e):d.insertBefore(e,d.firstChild);}}});};(function($){function fixTitle($ele){if($ele.attr("title")||typeof($ele.attr("original-title"))!="string"){$ele.attr("original-title",$ele.attr("title")||"").removeAttr("title");}}function Tipsy(element,options){this.$element=$(element);this.options=options;this.enabled=true;fixTitle(this.$element);}Tipsy.prototype={show:function(){var title=this.getTitle();if(title&&this.enabled){var $tip=this.tip();$tip.find(".tipsy-inner")[this.options.html?"html":"text"](title);$tip[0].className="tipsy";$tip.remove().css({top:0,left:0,visibility:"hidden",display:"block"}).appendTo(document.body);var pos=$.extend({},this.$element.offset(),{width:this.$element[0].offsetWidth,height:this.$element[0].offsetHeight});var actualWidth=$tip[0].offsetWidth,actualHeight=$tip[0].offsetHeight;var gravity=(typeof this.options.gravity=="function")?this.options.gravity.call(this.$element[0]):this.options.gravity;var tp;switch(gravity.charAt(0)){case"n":tp={top:pos.top+pos.height+this.options.offset,left:pos.left+pos.width/2-actualWidth/2};break;case"s":tp={top:pos.top-actualHeight-this.options.offset,left:pos.left+pos.width/2-actualWidth/2};break;case"e":tp={top:pos.top+pos.height/2-actualHeight/2,left:pos.left-actualWidth-this.options.offset};break;case"w":tp={top:pos.top+pos.height/2-actualHeight/2,left:pos.left+pos.width+this.options.offset};break;}if(gravity.length==2){if(gravity.charAt(1)=="w"){tp.left=pos.left+pos.width/2-15;}else{tp.left=pos.left+pos.width/2-actualWidth+15;}}$tip.css(tp).addClass("tipsy-"+gravity);if(this.options.fade){$tip.stop().css({opacity:0,display:"block",visibility:"visible"}).animate({opacity:this.options.opacity});}else{$tip.css({visibility:"visible",opacity:this.options.opacity});}}},hide:function(){if(this.options.fade){this.tip().stop().fadeOut(function(){$(this).remove();});}else{this.tip().remove();}},getTitle:function(){var title,$e=this.$element,o=this.options;fixTitle($e);var title,o=this.options;if(typeof o.title=="string"){title=$e.attr(o.title=="title"?"original-title":o.title);}else{if(typeof o.title=="function"){title=o.title.call($e[0]);}}title=(""+title).replace(/(^\s*|\s*$)/,"");return title||o.fallback;},tip:function(){if(!this.$tip){this.$tip=$('<div class="tipsy"></div>').html('<div class="tipsy-arrow"></div><div class="tipsy-inner"/></div>');}return this.$tip;},validate:function(){if(!this.$element[0].parentNode){this.hide();this.$element=null;this.options=null;}},enable:function(){this.enabled=true;},disable:function(){this.enabled=false;},toggleEnabled:function(){this.enabled=!this.enabled;}};$.fn.tipsy=function(options){if(options===true){return this.data("tipsy");}else{if(typeof options=="string"){return this.data("tipsy")[options]();}}options=$.extend({},$.fn.tipsy.defaults,options);function get(ele){var tipsy=$.data(ele,"tipsy");if(!tipsy){tipsy=new Tipsy(ele,$.fn.tipsy.elementOptions(ele,options));$.data(ele,"tipsy",tipsy);}return tipsy;}function enter(){var tipsy=get(this);tipsy.hoverState="in";if(options.delayIn==0){tipsy.show();}else{setTimeout(function(){if(tipsy.hoverState=="in"){tipsy.show();}},options.delayIn);}}function leave(){var tipsy=get(this);tipsy.hoverState="out";if(options.delayOut==0){tipsy.hide();}else{setTimeout(function(){if(tipsy.hoverState=="out"){tipsy.hide();}},options.delayOut);}}if(!options.live){this.each(function(){get(this);});}if(options.trigger!="manual"){var binder=options.live?"live":"bind",eventIn=options.trigger=="hover"?"mouseenter":"focus",eventOut=options.trigger=="hover"?"mouseleave":"blur";this[binder](eventIn,enter)[binder](eventOut,leave);}return this;};$.fn.tipsy.defaults={delayIn:0,delayOut:0,fade:false,fallback:"",gravity:"n",html:false,live:false,offset:0,opacity:0.8,title:"title",trigger:"hover"};$.fn.tipsy.elementOptions=function(ele,options){return $.metadata?$.extend({},options,$(ele).metadata()):options;};$.fn.tipsy.autoNS=function(){return $(this).offset().top>($(document).scrollTop()+$(window).height()/2)?"s":"n";};$.fn.tipsy.autoWE=function(){return $(this).offset().left>($(document).scrollLeft()+$(window).width()/2)?"e":"w";};})(jQuery);function loadAjax_GetApartmentsMyList(){$.mylist.loadAjax_GetApartmentsMyList();}function loadAjax_GetApartmentsMapMyList(){$.mylist.loadAjax_GetApartmentsMapMyList();}function addToList(value){if(value){$.mylist.addToList(value);}}function deleteItemIdList(value){if(value){$.mylist.deleteItemId(value);}}function deleteItem(value){if(value){$.mylist.deleteItem(value);}}jQuery.mylist=function(containerId,options){var defaults={onLoadResultsComplete:function(){}};var imgProp='width="30" height="30"';var pathimg="/imgs/eqp/icons/";var rootPath="/";var max=9;var containerName=containerId;var $container;if(containerName=="#mylist"){$container=$(containerName);}var $spannum=$("#num-items-mylist");var $calarr=$("#fcal-arr");var $calgo=$("#fcal-go");var $fpax=$("#fPax");var $fPaxKids=$("#fPaxKids");var calarrVal=$calarr.val();var calgoVal=$calgo.val();var fpaxVal=$fpax.val();var fPaxKidsVal=$fPaxKids.val();var fpaxTotalVal=Number(fpaxVal)+Number(fPaxKidsVal);var numHiddenMylist=0;if(fPaxKidsVal==""){fPaxKidsVal=0;}fpaxVal=fPaxKidsVal+fpaxVal;var numItems=0;var itemsMylist=Array();var $jcookie;var pr="";var ordenacio="PreuTotal";var arrayIds=Array();$.oaCookie("OAMyList",90);var res=$.oaCookie.read();var cookieContent=$.oaCookie.results;if(cookieContent!=null&&cookieContent.length>0){arrayIds=cookieContent.split(",");}numHiddenMylist=arrayIds.length;if(containerName=="#mylist"){if(numHiddenMylist>0){addToListQuery(arrayIds);}else{updateNumItems();}}else{$spannum.html(numHiddenMylist);numItems=numHiddenMylist;}function updateDates(){calarrVal=$calarr.val();calgoVal=$calgo.val();fpaxVal=$fpax.val();fPaxKidsVal=$fPaxKids.val();fpaxTotalVal=Number(fpaxVal)+Number(fPaxKidsVal);}jQuery.mylist.addToList=function(idIn){if(numItems<max){$boton=$("#idapt-"+idIn);$boton.removeClass("btno");$boton.addClass("btngr");$boton.prev().removeClass("rbtn2");$boton.prev().addClass("rbtn2a");addInternalList(idIn);}else{if(itemsMylist.length>=max){alert(objDictionary.SearchMap_miLista_AlertMaximoAparts);}}};function addInternalList(value){if(containerName!=""&&!existApartment(value)){var items=Array();items.push(value);addToListQuery(items);numItems++;}else{if(!existApartmentIds(value)&&containerName==""){arrayIds.push(value);numHiddenMylist++;$spannum.html(numHiddenMylist);saveCookieIds();$("#idapt-"+value).effect("transfer",{to:$("#mylistIcon")},1000);numItems++;}}}function existApartment(value){for(i=0;i<itemsMylist.length;i++){if(itemsMylist[i].ApartmentId==value){return true;}}return false;}function existApartmentIds(value){for(i=0;i<arrayIds.length;i++){if(arrayIds[i]==value){return true;}}return false;}function _succesLoadResultsMylist(results){if(results.d.Apartments.length>0&&itemsMylist.length==0){$("#noitems-mylist").remove();}$.each(results.d.Apartments,function(i,item){if(i<max){if(containerName=="#mylist"){$container.append(dataToDom_Mylist(item));}itemsMylist.push(item);}});saveCookieItems();}function saveCookieItems(){var content="";for(i=0;i<itemsMylist.length;i++){content=content+itemsMylist[i].ApartmentId+",";}content=content.substring(0,content.length-1);$.oaCookie.save(content);}function saveCookieIds(){var content="";for(i=0;i<arrayIds.length;i++){content=content+arrayIds[i]+",";}content=content.substring(0,content.length-1);$.oaCookie.save(content);}function appendItemsComparator(data){var i=0;$.each(data,function(i,item){if(containerName=="#rpage"){appendToComparator(item);}itemsMylist[i]=item;i++;});updateNumItems();}jQuery.mylist.deleteItem=function(iditem){deleteItem(iditem);};function deleteItem(iditem){for(i=0;i<itemsMylist.length;i++){if(itemsMylist[i].ApartmentId==iditem){itemsMylist.splice(i,1);break;}}saveCookieItems();updateNumItems();}function deleteItemId(iditem){for(i=0;i<arrayIds.length;i++){if(arrayIds[i]==iditem){arrayIds.splice(i,1);break;}}saveCookieIds();numHiddenMylist--;$spannum.html(numHiddenMylist);}jQuery.mylist.deleteItemId=function(iditem){deleteItemId(iditem);};function updateNumItems(){$spannum.html(itemsMylist.length);numItems=itemsMylist.length;if(itemsMylist.length==0){if(containerName=="#mylist"){$container.html(dataToDom_MyListNoItems());}}else{$("#noitems-mylist").remove();}}function dataToDom_Mylist(item){var arrEquipmentItem=Array();arrEquipmentItem=item.Equipment.split(",");var datatotdom=document.createElement("div");var $rdatatotdom=$(datatotdom);$rdatatotdom.attr("id","apt"+item.ApartmentId);$rdatatotdom.addClass("apartment-detail");var pathimg="/imgs/eqp/icons/";var htmlDisp="";TotalPriceTxt=item.TotalPrice;if(item.IsAvaible==true){htmlDisp='<img src="/imgs/but/btnl-g.gif" alt="btn-detail" class="rbtn" /><a href="javascript:Book('+item.ApartmentId+')" class="btng">'+objDictionary.SearchMap_ApartmentItem_ButtonReservar+"</a>";}else{TotalPriceTxt="--";htmlDisp='<img src="/imgs/but/btnl-gr.gif" alt="btn-detail" class="rbtn" /><a href="'+item.PhotoSmall+'" class="btngr">'+objDictionary.SearchMap_miLista_NoDisp+"</a>";}var htmlDispPrecio="";if(!item.IsAvaible){htmlDispPrecio='style="color:#cccccc"';}var habitaciones=item.Rooms;if(item.Rooms==0){habitaciones=objDictionary.SearchMap_ApartmentItem_Estudio;}var terraza=item.SurfaceBalcony+"m2";if(arrEquipmentItem[11]==0){terraza=objDictionary.SearchMap_general_no;}else{if(item.SurfaceBalcony==0){terraza=objDictionary.SearchMap_general_si;}}$rdatatotdom.append('<div class="apartment-image"><a href="'+item.UrlDetail+'"><img height="60px" width="60px" src="'+rootImgPath+item.Photo+'" alt="'+item.Name+'" /></a></div><div class="apartment-title"><ul><li><h2>'+item.Name+"</h2></li><li>"+objDictionary.SearchMap_ApartmentItem_Zona+": <em>"+item.Zone+'</em></li>         <li class="btlist"><img src="/imgs/but/btnl-b.gif" alt="btn-detail" class="rbtn" /><a href="'+item.UrlDetail+'" class="btnb">'+objDictionary.SearchMap_ApartmentItem_ButtonDetalle+'</a><div class="btn-eq">'+objDictionary.SearchMap_ApartmentItem_VerEquipamiento+'</div></li></ul></div><div class="apartment-features"><ul><li>'+objDictionary.SearchMap_Superficie_Short+": <em>"+item.Surface+" m2</em></li><li>"+objDictionary.SearchMap_Habitaciones_Short+":<em>"+habitaciones+"</em></li><li>"+objDictionary.SearchMap_ApartmentItem_Terraza+": <em>"+terraza+"</em></li><li>"+objDictionary.SearchMap_ApartmentItem_Planta+":<em>"+item.Floor+'</em></li></ul></div><div class="apartment-price"><ul><li class="price" '+htmlDispPrecio+">"+objDictionary.SearchMap_miLista_Total+":<em "+htmlDispPrecio+'><span class="symbol"> '+currencySymbol+" </span>"+TotalPriceTxt+'</em></li><li class="btlist"><img src="/imgs/but/btnl-o.gif" alt="btn-detail" class="rbtn" /><div class="btno">- '+objDictionary.SearchMap_BotonMiLista+"</div>"+htmlDisp+'</li></ul></div><div class="apartment-equipment"><img src="'+pathimg+arrEquipmentItem[3]+'_ico_calefac.png" alt="'+objDictionary.SearchMap_apartEquip_Calefaccion+'" /><img src="'+pathimg+arrEquipmentItem[0]+'_ico_air.png" alt="'+objDictionary.SearchMap_apartEquip_Aire+'" /><img src="'+pathimg+arrEquipmentItem[2]+'_ico_elevator.png" alt="'+objDictionary.SearchMap_apartEquip_Ascensor+'" /><img src="'+pathimg+arrEquipmentItem[5]+'_ico_cot.png" alt="'+objDictionary.SearchMap_apartEquip_Cuna+'" /><img src="'+pathimg+arrEquipmentItem[4]+'_ico_kitchen.png" alt="'+objDictionary.SearchMap_apartEquip_Cocina+'" /><img src="'+pathimg+arrEquipmentItem[8]+'_ico_wash.png" alt="'+objDictionary.SearchMap_apartEquip_Lavadora+'" /><img src="'+pathimg+arrEquipmentItem[7]+'_ico_net.png" alt="'+objDictionary.SearchMap_apartEquip_Internet+'" /><img src="'+pathimg+arrEquipmentItem[10]+'_ico_parking.png" alt="'+objDictionary.SearchMap_apartEquip_Parking+'" /><img src="'+pathimg+arrEquipmentItem[1]+'_ico_pet.png" alt="'+objDictionary.SearchMap_apartEquip_Mascota+'" /><img src="'+pathimg+arrEquipmentItem[6]+'_ico_smoke.png" alt="'+objDictionary.SearchMap_apartEquip_Fumadores+'" /><img src="'+pathimg+arrEquipmentItem[9]+'_ico_dis.png" alt="'+objDictionary.SearchMap_apartEquip_Accesible+'" /><img src="'+pathimg+arrEquipmentItem[11]+'_ico_terrace.png" alt="'+objDictionary.SearchMap_ApartmentItem_Terraza+'" />');$rdatatotdom.find("div.btn-eq").click(function(){$(this).parent().parent().parent().parent().find(".apartment-equipment").slideToggle("normal");if($(this).is(".btn-eq-active")){$(this).removeClass("btn-eq-active");}else{$(this).addClass("btn-eq-active");}});$rdatatotdom.find(".btno").click(function(){$boton=$("#idapt-"+item.ApartmentId);$boton.removeClass("btngr");$boton.addClass("btno");$boton.prev().addClass("rbtn2");$boton.prev().removeClass("rbtn2a");$(this).parent().parent().parent().parent().fadeOut("fast",function(){deleteItem(item.ApartmentId);$(this).remove();updateNumItems();});});return $rdatatotdom;}function dataToDom_MyListNoItems(){var datatotdom=document.createElement("div");var $rdatatotdom=$(datatotdom);$rdatatotdom.attr("id","noitems-mylist");var htmlDispPrecio="";$rdatatotdom.append('<div id="msg-noitems">'+objDictionary.SearchMap_miLista_TextoInfoCaixaLista+'<div id="msg-noitems-but"><img src="/imgs/but/btnl-o.gif" alt="btn-detail" class="rbtn" /><div class="btno">+ '+objDictionary.SearchMap_BotonMiLista+'</div><img src="/imgs/but/btnl-o.gif" alt="btn-detail" class="rbtn" /><div class="btno">- '+objDictionary.SearchMap_BotonMiLista+"</div></div></div>");return $rdatatotdom;}function addToListQuery(idIn){pApartmentIds=idIn.join(",");updateDates();$.ajax({type:"POST",url:"/FinderServices.asmx/GetApartmentsMyList",data:"{'pAdults':"+pAdults+",'pKids':0,'pStartDate':'"+pStartDate+"','pEndDate':'"+pEndDate+"','pSymbolMoney':'"+currency+"','pApartmentIds':'"+pApartmentIds+"'}",contentType:"application/json; charset=utf-8",dataType:"json",cache:false,success:function(results){_succesLoadResultsMylist(results);updateNumItems();},error:function(result){$container.html('<div class="notav">Search error.</div>');}});}jQuery.mylist.loadAjax_GetApartmentsMapMyList=function(){updateDates();pApartmentIds=arrayIds.join(",");$.ajax({type:"POST",url:"/FinderServices.asmx/GetApartmentsMyListByMap",data:"{'pAdults':"+pAdults+",'pKids':0,'pStartDate':'"+pStartDate+"','pEndDate':'"+pEndDate+"','pSymbolMoney':'"+currency+"','pApartmentIds':'"+pApartmentIds+"'}",contentType:"application/json; charset=utf-8",dataType:"json",cache:false,success:function(results){loadContainerResults(results);},error:function(result){alert("error");}});};jQuery.mylist.loadAjax_GetApartmentsMyList=function(){updateDates();pApartmentIds=arrayIds.join(",");if(containerName=="#rpage"){$(".container-wh").addClass("loadingicon");}$.ajax({type:"POST",url:"/FinderServices.asmx/GetApartmentsMyList",data:"{'pAdults':"+pAdults+",'pKids':0,'pStartDate':'"+pStartDate+"','pEndDate':'"+pEndDate+"','pSymbolMoney':'"+currency+"','pApartmentIds':'"+pApartmentIds+"'}",contentType:"application/json; charset=utf-8",dataType:"json",cache:false,success:function(results){loadContainerResults(results);},error:function(result){$container.html('<div class="notav">Search error.</div>');}});};};jQuery.oaCookie=function(nameIn,expirationDaysIn,options){var _name=nameIn;var expirationDays=expirationDaysIn;var results="";jQuery.oaCookie.set_Name=function(value){set_Name(value);};jQuery.oaCookie.get_Name=function(){get_Name();};jQuery.oaCookie.set_ExpirationDays=function(value){set_ExpirationDays(value);};jQuery.oaCookie.get_ExpirationDays=function(){get_ExpirationDays();};jQuery.oaCookie.read=function(){read();};jQuery.oaCookie.save=function(content){save(content);};jQuery.oaCookie.deletec=function(){deletec();};jQuery.oaCookie.exist=function(){exist();};jQuery.oaCookie.create=function(content){create(content);};jQuery.oaCookie.results="";function set_Name(value){_name=value;}function get_Name(){return _name;}function set_ExpirationDays(nDays){expirationDays=nDays;}function get_ExpirationDays(){return expirationDays;}function read(){var cookieValue=null;if(document.cookie&&document.cookie!=""){var cookies=document.cookie.split(";");for(var i=0;i<cookies.length;i++){var cookie=jQuery.trim(cookies[i]);if(cookie.substring(0,_name.length+1)==(_name+"=")){cookieValue=decodeURIComponent(cookie.substring(_name.length+1));break;}}}jQuery.oaCookie.results=cookieValue;return cookieValue;}function save(content){var exdate=new Date();exdate.setDate(exdate.getDate()+expirationDays);document.cookie=_name+"="+content+";expires="+exdate.toGMTString()+";path=/";}function deletec(){var cookie_date=new Date();cookie_date.setTime(cookie_date.getTime()-1);document.cookie=_name+"=;expires="+cookie_date.toGMTString();}function exist(){if(read()!=null){return true;}else{return false;}}function create(content){save(content);}};(function($){$.showbox=function(data,klass){$.showbox.loading();fillshowboxFromHref(data.div);};$.extend($.showbox,{settings:{opacity:0,overlay:true,loadingImage:"/imgs/lybox/loading.gif",closeImage:"/imgs/lybox/closelabel.gif",imageTypes:["png","jpg","jpeg","gif"],showboxHtml:'<div id="showbox" style="display:none;"><div class="popup"><table><tbody><tr><td class="tl"/><td class="b"/><td class="tr"/></tr><tr><td class="b"/><td class="body"><div class="footerpop"><a href="#" class="close"><img src="/imgs/lybox/closelabel.gif" title="close" class="close_image" /></a></div><div class="contentpop"></div></td><td class="b"/></tr><tr><td class="bl"/><td class="b"/><td class="br"/></tr></tbody></table></div></div>'},loading:function(){init();if($("#showbox .loading").length==1){return true;}showOverlay();$("#showbox .contentpop").empty();$("#showbox .body").children().hide().end().append('<div class="loading"><img src="/'+$.showbox.settings.loadingImage+'"/></div>');$("#showbox").css({top:getPageScroll()[1]+(getPageHeight()/10),left:385.5}).show();$(document).bind("keydown.showbox",function(e){if(e.keyCode==27){$.showbox.close();}return true;});$(document).trigger("loading.showbox");},reveal:function(data,klass){$(document).trigger("beforeReveal.showbox");if(klass){$("#showbox .contentpop").addClass(klass);}$("#showbox .contentpop").append(data);$("#showbox .loading").remove();$("#showbox .body").children().fadeIn("normal");$("#showbox").css("left",$(window).width()/2-($("#showbox table").width()/2));$(document).trigger("reveal.showbox").trigger("afterReveal.showbox");},close:function(){$(document).trigger("close.showbox");return false;}});$.fn.showbox=function(settings){init(settings);function clickHandler(){$.showbox.loading(true);var klass=this.rel.match(/showbox\[?\.(\w+)\]?/);if(klass){klass=klass[1];}fillshowboxFromHref(this.href,klass);return false;}return this.click(clickHandler);};function init(settings){if($.showbox.settings.inited){return true;}else{$.showbox.settings.inited=true;}$(document).trigger("init.showbox");makeCompatible();var imageTypes=$.showbox.settings.imageTypes.join("|");$.showbox.settings.imageTypesRegexp=new RegExp("."+imageTypes+"$","i");if(settings){$.extend($.showbox.settings,settings);}$("body").append($.showbox.settings.showboxHtml);var preload=[new Image(),new Image()];preload[0].src=$.showbox.settings.closeImage;preload[1].src=$.showbox.settings.loadingImage;$("#showbox .close").click($.showbox.close);$("#showbox .close_image").attr("src",$.showbox.settings.closeImage);}function getPageScroll(){var xScroll,yScroll;if(self.pageYOffset){yScroll=self.pageYOffset;xScroll=self.pageXOffset;}else{if(document.documentElement&&document.documentElement.scrollTop){yScroll=document.documentElement.scrollTop;xScroll=document.documentElement.scrollLeft;}else{if(document.body){yScroll=document.body.scrollTop;xScroll=document.body.scrollLeft;}}}return new Array(xScroll,yScroll);}function getPageHeight(){var windowHeight;if(self.innerHeight){windowHeight=self.innerHeight;}else{if(document.documentElement&&document.documentElement.clientHeight){windowHeight=document.documentElement.clientHeight;}else{if(document.body){windowHeight=document.body.clientHeight;}}}return windowHeight;}function makeCompatible(){var $s=$.showbox.settings;$s.loadingImage=$s.loading_image||$s.loadingImage;$s.closeImage=$s.close_image||$s.closeImage;$s.imageTypes=$s.image_types||$s.imageTypes;$s.showboxHtml=$s.showbox_html||$s.showboxHtml;}function fillshowboxFromHref(href,klass){if(href.match(/#/)){var url=window.location.href.split("#")[0];var target=href.replace(url,"");$.showbox.reveal($(target).clone().show(),klass);}}function skipOverlay(){return $.showbox.settings.overlay==false||$.showbox.settings.opacity===null;}function showOverlay(){if(skipOverlay()){return;}if($("showbox_overlay").length==0){$("body").append('<div id="showbox_overlay" class="showbox_hide"></div>');}$("#showbox_overlay").hide().addClass("showbox_overlayBG").css("opacity",$.showbox.settings.opacity).click(function(){$(document).trigger("close.showbox");}).fadeIn(200);return false;}function hideOverlay(){if(skipOverlay()){return;}$("#showbox_overlay").fadeOut(200,function(){$("#showbox_overlay").removeClass("showbox_overlayBG");$("#showbox_overlay").addClass("showbox_hide");$("#showbox_overlay").remove();});return false;}$(document).bind("close.showbox",function(){$(document).unbind("keydown.showbox");$("#showbox").fadeOut(function(){$("#showbox .contentpop").removeClass().addClass("contentpop");hideOverlay();$("#showbox .loading").remove();});});})(jQuery);
