(function($){if(!window.ifpbLoaded)window.ifpbLoaded={};var slugUrl="floor-plans";if(window.ifpbLoaded[slugUrl])return;window.ifpbLoaded[slugUrl]=true;var isMobile=/Android|webOS|iP(hone|ad|od)|BlackBerry/i.test((window.navigator.userAgent||window.navigator.vendor||window.opera)),$w=$(window),$body=$('body'),ajo,origtitle,_w_dest,_w_term,_w_animed,aptdata={},$cont=$('');aptdata.raw={};function getAptData(){if(aptdata.raw.fetched)return true;var success=false;$.ajax({url:"https:\/\/apt.razzinteractive.com\/nine15midtown\/wp-admin\/admin-ajax.php",async:false,data:{action:'lbm',a:1},dataType:'json',error:function(http,message,exc){success=false},success:function(res){if(res.res=='ok'){aptdata.raw.fetched=true;aptdata.raw.units=res.units;aptdata.raw.models=res.models;aptdata.raw.floors=res.floors;aptdata.raw.buildings=res.buildings;aptdata.raw.unitorder=[];$.each(res.units,function(key,value){aptdata.raw.unitorder.push(key)});aptdata.raw.unitorder.sort();aptdata.raw.modelorder=[];$.each(res.models,function(key,value){aptdata.raw.modelorder.push(key)});aptdata.raw.modelorder.sort();aptdata.raw.floororder=[];$.each(res.floors,function(key,value){aptdata.raw.floororder.push(key)});aptdata.raw.floororder.sort();success=true}}});return success};function getNextUnit(id){if(!getAptData())return false;var order=aptdata.raw.unitorder,index=order.indexOf(id);if(index==-1)return false;if(index>=order.length-1){index=0}else index++;return aptdata.raw.unitorder[index]};function getPrevUnit(id){if(!getAptData())return false;var order=aptdata.raw.unitorder,index=order.indexOf(id);if(index==-1)return false;if(index<=0){index=order.length-1}else index--;return aptdata.raw.unitorder[index]};function getNextFloor(id){if(!getAptData())return false;var order=aptdata.raw.floororder,index=order.indexOf(id);if(index==-1)return false;if(index>=order.length-1){index=0}else index++;return aptdata.raw.floororder[index]};function getPrevFloor(id){if(!getAptData())return false;var order=aptdata.raw.floororder,index=order.indexOf(id);if(index==-1)return false;if(index<=0){index=order.length-1}else index--;return aptdata.raw.floororder[index]};function getNextModel(id){if(!getAptData())return false;var order=aptdata.raw.modelorder,index=order.indexOf(id);if(index==-1)return false;if(index>=order.length-1){index=0}else index++;return aptdata.raw.modelorder[index]};function getPrevModel(id){if(!getAptData())return false;var order=aptdata.raw.modelorder,index=order.indexOf(id);if(index==-1)return false;if(index<=0){index=order.length-1}else index--;return aptdata.raw.modelorder[index]};aptdata.getUnits=function(){if(!getAptData())return false;return aptdata.raw.units};aptdata.getBuildings=function(){if(!getAptData())return false;return aptdata.raw.buildings};aptdata.getFloors=function(){if(!getAptData())return false;return aptdata.raw.floors};aptdata.getModels=function(){if(!getAptData())return false;return aptdata.raw.models};var setTitle=function(title){if(!title){$.address.title(origtitle)}else $.address.title(title+' | '+origtitle)};aptdata.setTitle=setTitle;$.urlParam=function(name,url){if(url===undefined)url=window.location.href;var results=new RegExp('[\?&]'+name+'=([^&#]*)').exec(url);if(results==null){return false}else return results[1]||0};aptdata.openUnit=function(id){var units=aptdata.getUnits();if(!units||!units[id])return false;loadLBURL(cdn+'floor-plan/unit.php?id='+id)};aptdata.openModel=function(id){loadLBURL(cdn+'floor-plan/model.php?id='+id)};aptdata.openFloor=function(id,building,unit){var url=cdn+'floor-plan/floor.php?id='+id;if(building)url+='&building='+encodeURIComponent(building);if(unit)url+='&unit='+encodeURIComponent(unit);loadLBURL(url)};aptdata.openModels=function(){loadLBURL(cdn+'floor-plan/models.php')};aptdata.openSearch=function(filter,filter_value){loadLBURL(cdn+'floor-plan/search.php?filter='+filter+'&filter_value='+filter_value)};aptdata.openFloors=function(building){var buildings=aptdata.getBuildings();if(isMobile){setTimeout(function(){setHash('search')},1);return}else if(buildings){if(building){if(!buildings[building]){setTimeout(function(){setHash('floors')},1);return};loadLBURL(cdn+'floor-plan/floors.php?id='+building);return};loadLBURL(cdn+'floor-plan/buildings.php');return};loadLBURL(cdn+'floor-plan/floors.php')};aptdata.openHome=function(){setTimeout(function(){setHash('floors',true)},1)};window.lw=[];var cdn="https:\/\/apt.razzinteractive.com\/nine15midtown\/wp-content\/plugins\/razz-apt-new\/",rpc;function loadJS(url,callback){setTimeout(function(){$.ajax({dataType:"script",cache:true,url:url,complete:callback})},1)};function loadJSDef(url,callback){var id=lw.push($.Deferred())-1;loadJS(url,function(){if(callback)callback();lw[id].resolve()})};function loadCSS(url){setTimeout(function(){$("<link>",{rel:"stylesheet",type:"text/css",href:url}).appendTo('head')},1)};$(document).ready(function(){if(window.ifpbReady){$cont=$('<div/>',{id:'apttool-container-'+slugUrl,class:'apttool-container',style:''});$cont.prependTo('body');$.when.apply($,lw).done(main);return};window.ifpbReady=true;$('head').append($('<style></style>').text('.apttool-container{display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.8); z-index: 9999999999}.apttool-container iframe{position: absolute; top: 0; left: 0; width: 1px; min-width: 100%; height: 100%; z-index: 1001}'));$cont=$('<div/>',{id:'apttool-container-'+slugUrl,class:'apttool-container',style:''});$cont.prependTo('body');if(/iP(hone|ad|od)/i.test((window.navigator.userAgent||window.navigator.vendor||window.opera)))$cont.css({'-webkit-overflow-scrolling':'touch','overflow-y':'scroll'});loadCSS('//cdnjs.cloudflare.com/ajax/libs/animate.css/3.5.2/animate.min.css');loadJSDef(cdn+'xdm/json2.js');loadJSDef(cdn+'xdm/easyXDM.js');loadJSDef(cdn+'floor-plan/js/jquery.address.js');$.when.apply($,lw).done(main)});function main(){origtitle=$.address.title();initAddress()};function loadLBURL(rurl){if(_w_term){rurl+=(rurl.indexOf('?')===-1)?'?':'&';rurl+='term='+encodeURIComponent(_w_term)};if(slugUrl&&slugUrl!=='floor-plans'){rurl+=(rurl.indexOf('?')===-1)?'?':'&';rurl+='path='+encodeURIComponent(slugUrl)};rpc=new easyXDM.Rpc({swf:cdn+"xdm/easyxdm.swf",remote:rurl,container:$cont[0]},{remote:{},local:{setHash:function(dest){setHash(dest)},setTerm:function(term){_w_term=term;setHash(_w_dest)},setTitle:function(title){setTitle(title)}}});$cont.find('iframe').attr('scrolling','no');showIFrame()};function setHash(dest,noHistory){_w_dest=dest;if(dest!=="!"&&dest.indexOf('!/floor-plans/')===-1)dest='!/floor-plans/'+dest.replace(/^\//,'');setTitle('');if(_w_term&&dest!=="!"){var termSlug=_w_term==-1?'lowest':_w_term;dest+='/term/'+termSlug};if(noHistory){window.location.replace('#'+dest)}else window.location.hash=dest};function showIFrame(){if($cont.is(':hidden')){$('html,body').css({overflow:'hidden'});$cont.show();$cont.animatecss("fadeInDownBig")}else{var $old=$cont.find('iframe:not(:last-child)'),$new=$cont.find('iframe:last-child');$old.animatecss("fadeOut",{onComplete:function(){$(this).remove()}});$new.animatecss("fadeIn")}};function hideIFrame(){if($cont.is(':visible')){$('html,body').css('overflow','');$cont.animatecss("fadeOutUpBig",{onComplete:function(){$cont.hide();$cont.html('')}})}};function initAddress(){var lastpath=window.location.hash;$.address.strict(false);$.address.change(function(e){if(e.path==lastpath)return;lastpath=e.path;var pathLength=e.pathNames.length;if(pathLength<2||e.pathNames[0]!='!'||(e.pathNames[1]!=slugUrl&&e.pathNames[1]!='apt')){hideIFrame();return};if(e.pathNames[pathLength-2]==='term'){var termSlug=e.pathNames[pathLength-1];_w_term=termSlug==='lowest'?-1:termSlug;e.pathNames=e.pathNames.slice(0,pathLength-2)};_w_dest=e.pathNames.join('/');switch(e.pathNames[2]){case'floors':{aptdata.openFloors(e.pathNames[3]);break};case'unit':{var units=aptdata.getUnits();if(!units[e.pathNames[3]]){aptdata.openHome()}else aptdata.openUnit(e.pathNames[3]);break};case'floor':{var params={floor:e.pathNames[3]};for(var floorI=4;floorI<e.pathNames.length;floorI+=2)params[e.pathNames[floorI]]=e.pathNames[floorI+1];aptdata.openFloor(params.floor,params.building,params.unit);break};case'model':{if(!e.pathNames[3]){aptdata.openHome()}else aptdata.openModel(e.pathNames[3]);break};case'models':{aptdata.openModels();break};case'search':{var filter=e.pathNames[3]?e.pathNames[3]:'',filter_value=e.pathNames[4]?e.pathNames[4]:'';aptdata.openSearch(filter,filter_value);break};default:aptdata.openHome()}});$.address.update()};_w_animed='webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend cancelanimation';$.fn.extend({animatecss:function(type,settings){if(!settings)settings={};settings=$.extend({onComplete:function(){}},settings);var cananimate=window.Modernizr?Modernizr.csstransitions:true;return this.each(function(){var $this=$(this);if(!cananimate){settings.onComplete.call(this)}else{if($this.hasClass('animating'))$this.trigger('cancelanimation');var tmr=setTimeout(function(){$this.trigger('cancelanimation')},2100);$this.addClass('animated animating '+type).one(_w_animed,function(e){e.stopPropagation();clearTimeout(tmr);$this.removeClass('animated animating '+type);settings.onComplete.call(this)})};return true})}})})(jQuery)