var win=$(window),dl=document.location,hash=dl.hash.substr(1);window.oldhash=hash.split('?')[0],date=new Date(),today=new Date();Date.format=='dd/mm/yyyy',t=[],pathBG='/photos/bg/',cal='/json/?m=c',spc='/json/?m=f&r=a',geoAPIkey='78b93d8014033cf9be29f7561f91d17b1c93a129b30282869ce9f4d9a22772a8',photoPages=['gallery'],pageExceptions=['index'],pageExceptions2=['explore','explore/art','specials','rooms','rooms/specials','rooms/amenities','rooms/deluxe','rooms/deluxesuites','rooms/demijoule','rooms/granddeluxe','rooms/joulesuites','rooms/loftdeluxe','rooms/penthouse','rooms/loftsuite','explore/dallas','explore/dallas/area','explore/dallas/concierge','explore/dallas/shopping','explore/dallas/sightseeing','explore/design','explore/diningandnightlife','explore/diningandnightlife/dining','explore/diningandnightlife/dining_prev','explore/diningandnightlife/pmnightlife','explore/diningandnightlife/joulepoule','explore/diningandnightlife/joltbar','explore/meetings','explore/meetings/events','explore/meetings/floorplans','explore/meetings/weddings','explore/meetings/venues','explore/meetings/rfp','explore/meetings/thankyou','explore/meetings/joulepoule','gallery','explore/pool','explore/pool/fitness','explore/pool/poule','explore/penthouse','explore/massage','reserve','connect','connect/contact','connect/location','connect/subscribe','connect/pressroom','careers/index','privacy','security','bestrate','sitemap','careers'],pageRfp=['explore/rfp'],widePages=[],blackPages=['explore','explore/art','specials','rooms','rooms/specials','rooms/amenities','rooms/deluxe','rooms/deluxesuites','rooms/demijoule','rooms/granddeluxe','rooms/joulesuites','rooms/loftdeluxe','rooms/penthouse','rooms/loftsuite','explore/dallas','explore/dallas/area','explore/dallas/concierge','explore/dallas/shopping','explore/dallas/sightseeing','explore/design','explore/diningandnightlife','explore/diningandnightlife/dining','explore/diningandnightlife/dining_prev','explore/diningandnightlife/pmnightlife','explore/diningandnightlife/joulepoule','explore/diningandnightlife/joltbar','explore/meetings','explore/meetings/events','explore/meetings/floorplans','explore/meetings/weddings','explore/meetings/venues','explore/meetings/rfp','explore/meetings/thankyou','explore/meetings/joulepoule','connect/thankyou','gallery','explore/pool','explore/pool/fitness','explore/pool/poule','explore/penthouse','explore/massage','reserve','connect','connect/contact','connect/location','connect/subscribe','connect/pressroom','careers/index','privacy','security','bestrate','sitemap','careers'];var content,header,logo,footer,x1,hotelnav,bottompanel,booknow,scrollbar,slider,minSlideWidth,body=$('#body');var readmore=false;minSlideWidth=430;$.ajaxSetup({timeout:10000,error:function(event,request,settings){error('Ajax: '+request);dl.hash=dl.hash.split('/').slice(0,-1).join('/');}});var lag=100,dev=false;function getData(url){log('Loading data from URL: '+url);return $.getJSON(url,function(){log('Data loading completed: '+url);});}
function showContent(){log('Show content!');var d1=$.Deferred(),name=getHash(),submenu=getSubmenu(),sub=getSubmenuLevel(),elements=content,hotel=isHotelRoot(name);setActivemenu();content.attr({rel:name});$('h1',content).removeAttr('style');switch(sub)
{case 0:content.trigger('show');x1.trigger('open');break;case 1:content.trigger('show-1');x1.trigger('close');break;case 2:content.trigger('show-1');break;case 3:content.trigger('show');x1.trigger('close');break;case 4:content.trigger('show');x1.trigger('close');break;case 99:content.trigger('show-99');if(isGallery()){$('html').addClass('photo');}
break;}
$.when(elements).done(function(){if(isGallery()){initGallery('.gallery',172,5,10);$('.gallery').show();}else{}
win.trigger('resize');d1.resolve();});return d1.promise();};function hideContent(){var d2=$.Deferred(),prevName=content.attr('rel'),sub=getSubmenuLevel(prevName),elements=$('#content, #text'),hotel=isHotelRoot(prevName);$('#booking').removeClass('suite-booking');$('#social-panel').trigger('hide');$('#popup').trigger('hide');switch(sub)
{case 0:content.trigger('hide');break;case 1:content.trigger('hide-1');break;case 2:content.trigger('hide-1');$('#supersized').fadeIn(200);break;case 99:content.trigger('hide-99',function(){$('.ts-overview .logo',content).remove();});break;}
log('Hide content!3');$.when(elements).done(function(){content.removeAttr('style').hide();x1.trigger('open');setTimeout(function(){d2.resolve();},lag);});log('Hide content!4');return d2.promise();}
function initGallery(el,t,b,m,n){var thWidth=typeof(t)!='undefined'?t:172,border=typeof(b)!='undefined'?b:5,margin=typeof(m)!='undefined'?m:5,num=typeof(n)!='undefined'?n:6,vars=getUrlVars(dl.href),gallery=$(el),imgWidth=0,ww=0,wh=0,options='',first=false,c=vars['c'];ww=$('#text').width();imgWidth=556;$('li',gallery).css({padding:border,margin:'0 '+margin+'px '+margin+'px 0'});$('a img',gallery).css({width:thWidth});$('img',gallery).each(function(){var t=$(this),li=t.parent().parent();t.data({'img':t.parent().attr('href'),'th':t.attr('src')});if(c&&c!='all'){li.css({opacity:1}).hide().filter('.'+c).show();}else{li.show();}})
gallery.imagesLoaded(function(){updateOptions();});$('a.img',gallery).die().unbind().click(function(event){event.preventDefault();var a=$(this),li=a.parent(),img=$('img',a),d1=$.Deferred(),d2=$.Deferred();$('div.sharelinks').hide();$('a.active img',gallery).animate({width:thWidth},lag+100,function(){d1.resolve();$(this).parent().parent().addClass('visited');}).attr({'src':$(this).data('th')});a.removeClass('vertical');if(a.hasClass('active')){d2.resolve();a.removeClass('active');}else{li.css({opacity:0});imgWidth=((img.height()/img.width())>1)?364:556;img.animate({width:imgWidth},lag+200,function(){d1.resolve();d2.resolve();img.attr({'src':img.data('img')});})
$('a',gallery).removeClass('active');a.addClass('active');li.detach().prependTo(gallery);if(img.height()/img.width()>1)a.addClass('vertical');}
$.when(d1,d2).done(function(){if(a.hasClass('active'))showLinks(a);gallery.masonry('reload',function(){setTimeout(centerIMG,200);li.delay(300).animate({opacity:1},200,function(){win.trigger('resize');});});})
return false;});if(vars['p'])$('a[rel="'+vars['p']+'"]').trigger('click');function centerIMG(){if(!$('a.active','.gallery').length)return false;log('Centering active image!')
var li=$('a.active','.gallery').parent(),imgtop=li.position().top,imgheight=li.height(),wheight=$('#content').height(),top=imgtop-wheight/2+imgheight/2+20;scrollbar.tinyscrollbar_update(top<0?0:top);}
function showLinks(el){var li=el.parent(),title=el.attr('title');title=encodeURI((title=='')?'Hotel Joule Photo Gallery':title),pID=el.attr('rel'),thSrc=el.attr('href'),url=encodeURI('http://'+dl.host+'/'+getHash()+'.php?p='+pID);if(!$('.sharelinks',li).length){li.append($('<div/>',{'class':'sharelinks'}).append('<a class="fl share" href="http://facebook.com/sharer.php?u='+url+'&t='+title+'" rel="external">Share this photo on Facebook</a>','<a href="http://twitter.com/?status=Check this photo: '+url+'" rel="external" class="fr share">Tweet this photo on Twitter</a>'));}else{$('.sharelinks',li).show();}}
function updateOptions(){options={itemSelector:'li:visible',isAnimated:true,animationOptions:{duration:300,queue:false},columnWidth:thWidth+margin+border*2};gallery.masonry(options);setTimeout(function(){scrollbar.tinyscrollbar_update('top');},200);}}
function galleryFilter(v){var c=v||'all';$('.gallery a.active img').trigger('click');$('.gallery li').hide().siblings(c=='all'?'':'.'+c).show().parent().masonry('reload');$('#null a').removeClass('active');$('a[href$="='+c+'"]').addClass('active');setTimeout(resetScroll,500);log('Gallery category: '+c);};function loadContent(url){var name=getHash(url),submenu=getSubmenu(),submenuName=getSubmenuName(),sub=getSubmenuLevel(),root=getRoot(),vars=getUrlVars(dl.href),omniture;if(vars['id']||vars['cat']){vars=vars['id']?'?id='+vars['id']:'?cat='+vars['cat'];}else{vars='';}
$('a').not('#spc, #cal').removeClass('active');$('a#'+submenuName+'-link, a#'+root+'-link, a[href="/'+name+'.php"]').addClass('active');busy.start(0);$.when(getData(name+'.php'+vars),hideContent()).done(function(result){busy.stop(0);supersize(window.bg?window.bg:false);var data=result[0];var pphoto=data['photo'];document.title=data['title'];$('h1',content).html(sub==0?'Welcome to The Joule Dallas':data['h1']);if($('#photo-image').data('nivo:vars'))$('#photo-image').data('nivo:vars').stop=true;$('#photo-image').removeAttr('style').html('');for(var i=0;i<pphoto.length;i++){$('#photo-image').append($('<img>').attr('src',pphoto[i]));}
if(data['res'].length>0){$('#text').empty().html('<div id="reservation">'+data['res']+'</div>'+data['content']);}else{$('#text').empty().html(data['content']);}
if(data.omniture.length&&(omniture=data.omniture)){runOmniture('page',omniture);}
if(pageExceptions2.hasValue(name)&&sub==99){$('#supersized').fadeOut(200,function(){bottompanel.trigger('hide',function(){bottompanel.hide();content.css({height:'auto'});x1.trigger('open');});});}else{bottompanel.show();x1.trigger('close');}
if(sub>=1&&$('#text').children().length>2&&!pageExceptions2.hasValue(name)){$('#text').children().slice(2).wrapAll('<div id="rm-wrapper"/>').parent().hide().parent().children('p').append($('<span />',{'class':'link',rel:' Close',text:pageRfp.hasValue(name)?' Request for Proposal':' Read more'}).click(function(){readmore=true;content.trigger('hide-1',function(){$('html').attr({'class':'level99'});content.attr({'style':''}).css({top:-content.height()});bottompanel.trigger('hide',function(){$('#supersized').fadeOut(200,function(){$('#rm-wrapper').show();$('#text .link').hide();logo.clone().before('#photo-image');content.show().trigger('show-99',function(){scrollbar.tinyscrollbar_update('top');});});});});}));}
if(widePages.hasValue(name))content.css({width:485});if(pageRfp.hasValue(name))$('.date-pick').datePicker({'clickInput':true,createButton:false,showYearNavigation:false});if($('#reservation'.length>0)){$('.date-pick').datePicker({'clickInput':true,createButton:false,showYearNavigation:false});$('select').sSelect();}
$('html').attr({'class':'level'+sub});$.when(scenario(sub)).done(function(){if(isGallery()){$('.gallery').hide();}
$('header, h2, p',content).show();if($('#photo-image img').length>1){$('#photo-image img').hide();if($('#photo-image').data('nivo:vars'))$('#photo-image').data('nivo:vars').stop=false;$('#photo-image').nivoSlider({effect:'sliceDown',slices:5,boxCols:5,boxRows:5,animSpeed:500,pauseTime:3000,startSlide:0,directionNav:false,directionNavHide:false,controlNav:false,controlNavThumbs:false,controlNavThumbsFromRel:false,controlNavThumbsSearch:'.jpg',controlNavThumbsReplace:'_thumb.jpg',keyboardNav:false,pauseOnHover:false,manualAdvance:false,captionOpacity:0.8,prevText:'Prev',nextText:'Next',randomStart:false,beforeChange:function(){},afterChange:function(){},slideshowEnd:function(){},lastSlide:function(){},afterLoad:function(){}});}
getGEO();checkLinks()
showContent();});});}
function resetScroll(){$('.ts-overview, .ts-scrollbar, .ts-scrollbar div').attr({style:''});if(IE()==7)$('.tinyscrollbar').height($('body').height()-152);scrollbar.tinyscrollbar_update('top');};function getUrlVars(url,noturl){if(url.indexOf('?')<0&&!noturl)return false;var vars=[],hash,hashes=noturl?url.split('&'):url.slice(url.indexOf('?')+1).split('&');$.each(hashes,function(i,el){hash=el.split('=');vars.push(hash[0]);vars[hash[0]]=hash[1];})
return vars;}
function navBack(){var hash=getHash(),sub=getSubmenuLevel(),hotel=isHotelRoot();switch(sub){case 0:hash='index';break;case 1:hash=hotel?hash:'index';break;case 2:hash=hash.split('/').slice(0,-1).join('/');break;case 3:hash=hash.split('/').slice(0,-1).join('/');break;case 4:hash=hash.split('/').slice(0,-1).join('/');break;case 99:hash=isHotel()?hash.split('/').slice(0,-1).join('/'):'index';break;}
log('Up one level to: '+hash);dl.hash='#'+hash;hideContent();}
function tdHover(){var wwidth=win.width();$('#jCalendar tbody td').each(function(){var td=$(this).removeClass('left'),rel=td.attr('rel'),leftOffset=td.offset().left;if((leftOffset+275)>wwidth)td.addClass('left');});}
function jCalendarInit(){$('#jCalendar a.jc-next').die().click(function(event){jCalendar(date.addMonths(1));return false;});$('#jCalendar a.jc-prev').die().click(function(event){jCalendar(date.addMonths(-1));return false;});jCalendar(date);}
function toggleTD(el,d){var d3=$.Deferred(),num=$('td',el).length;$('td',el).each(function(n,e){$(e).delay(n*(lag/10)+10).animate({'opacity':d},200,function(){if(d==0){$(this).remove();el.parent().prev().find('th').attr('colspan',num-n);}
if((n+1)==num){d3.resolve();}});});return d3.promise();}
function jCalendar(){$('<ul />',{id:"calendar-list"}).appendTo('#jCalendar > div');$.getJSON(cal,function(json){if(json.events){var d=$('#jCalendar div').append($('<ul/>',{id:'calendar-list'})),tpl='<li id="spc{ID}"><dl><dt><a href="/calendar/index.php?id={ID}" rel="static" class="img"><img src="{IMG}"></a></dt><dd><h6>{TITLE}</h6><p>{TXT} <a href="/calendar/index.php?id={ID}" rel="static" class="more">Read more</a></p></dd></dl></li>';$.each(json.events,function(n,s){var introText=s.introtext;var iTextLength=introText.length;if(iTextLength>80){introText=introText.substr(0,80);introText+='…';}
$('ul',d).append(tpl.replace(/{ID}/g,s.id).replace(/{TITLE}/g,s.title).replace(/{TXT}/g,introText).replace(/{URL}/g,s.event_link).replace(/{IMG}/g,s.img_uri));});var calSlider=$('#calendar-list');calSlider.bxSlider({controls:false,infiniteLoop:true,auto:false,displaySlideQty:4,moveSlideQty:1,pager:false,pause:5000});$('#cal-bx-prev').click(function(){calSlider.goToPreviousSlide();return false;});$('#cal-bx-next').click(function(){calSlider.goToNextSlide();return false;});}else{error('Specials loading failed...');}});}
function crossInit(){var size=23,frames=4;x1=$('<ins/>',{id:'x1','class':'cross'}).data('x',true).die().unbind().bind('click',function(event){event.preventDefault();var name=getHash();t=$(this),x=t.data('x');for(i=frames;i--;){t.delay(30).animate({'background-position':'-46px -'+Math.abs(size*((frames-1)*x-i))},0);}
x?content.trigger('show-0',function(){$('#text',content).show();if(win.height()<900){bottompanel.trigger('hide-1',function(){resetScroll();})}else{resetScroll();}}):pageExceptions.hasValue(name)?content.trigger('hide-0',function(){$('#text',content).hide();if(win.height()<900){bottompanel.trigger('show',function(){resetScroll();})}else{resetScroll();}}):navBack();t.data('x',!x);}).bind('open close',function(event){var t=(event.type=='open');$(this).data('x',t).css({'background-position':'-46px -'+!t*size*(frames-1)+'px'});}).appendTo('#content header',content);}
function busyInit(){var bt,size=23,frames=11;busy={start:function(id){if($('#busy'+id).length)return false;if(!bt)bt=setInterval(animation,40);$('body').append($('<ins/>',{id:'busy'+id,'class':'busy',rel:id}).data({'currentFrame':0}).css({'background-position':'-'+size*id+'px 0'}));$('#busy'+id).fadeIn(function(){if($.browser.msie)this.style.removeAttribute("filter");});},stop:function(id){$('#busy'+id).fadeOut(function(){$(this).remove();});},clear:function(id){var el=id?$('#busy'+id):$('.busy');el.remove();}}
function animation(){var el=$('.busy');if(el.length){el.each(function(){var obj=$(this),data=obj.data(),id=obj.attr('rel');c=data['currentFrame'],(c<frames)?c++:c=0;obj.data({'currentFrame':c}).css({'background-position':'-'+size*id+'px -'+c*size+'px'});});}else{clearInterval(bt);bt=false;}}}
function supersize(bg,num,ntr){if(!bg){log('Loading background images ini file...');$.getJSON('assets/bg.json',{m:'bg'},function(json){log('Background images ini loaded.');window.bg=json;supersize(json);});return false;}
var name=getHash(),ssi=$('#supersized img'),src=ssi.attr('src'),v=(typeof(bg[name])=='object'),i=(typeof(bg['index'])=='object'),imgname=(!bg[name])?i?bg['index'][0]:bg['index']:v?bg[name][num?num:0]:bg[name],newsrc=pathBG+imgname;if(v&&!ntr){var arrsrc=new Array();$.each(bg[name],function(n,img){arrsrc[n]=pathBG+img;});supersizeChange(arrsrc,ssi,0);}else{log('Changing background image to: '+imgname);if(newsrc!=src){busy.start(1);var newBG=new Image();$(newBG).load(function(){log('Image loaded...')
ssi.delay(lag*2+500).show().fadeOut(400,function(){busy.stop(1);ssi.attr('src',newsrc).fadeIn();log('Background image changed to: '+newsrc);});}).error(function(){error('Background image loading failed: '+newsrc);busy.stop(1);src[4]==':'?ssi.attr('src',pathBG+i?bg['index'][0]:bg['index']):log('Old picture looks even better ;)');});newBG.src=newsrc;}}}
function supersizeChange(imgs,ssi,n){var newImg=new Image();var src=imgs[n];newImg.src=src;log(n);log(src);$(newImg).load(function(){ssi.delay(lag*2+500).show().fadeOut(400,function(){busy.stop(1);ssi.attr('src',src).fadeIn(function(){n++;if(n>=imgs.length)n=0;setTimeout(function(){supersizeChange(imgs,ssi,n)},8000);});});});}
function setActivemenu(){var hash=getHash(),vars=getUrlVars(dl.href);vars=vars['cat']?'?cat='+vars['cat']:'';var href;if(vars!=''){href='/'+hash+'.php'+vars+'';}else{href=hash+'.php';}
$('a[href="'+href+'"]').addClass('active');log('Set Active menu: '+href);return false;}
function isHotelRoot(hash){var name=getHash(hash?hash:false);return(name=='houston'||name=='dallas')?true:false;};function isHotel(){var root=getRoot();return(root=='houston'||root=='dallas')?true:false;};function scenario(n){log('Current sub is: '+n);var d3=$.Deferred(),hash=getHash(),sub=getSubmenuLevel(),submenu=getSubmenu(),root=getRoot(),vars=getUrlVars(dl.href),hotel=isHotelRoot(hash),elements=$('#booknow, #booking, #booking-statue, #hotel, #content, #null','#jCalendar'),leftbooking=$('#booking').hasClass('leftSide');log('Redraw layout with scenario: '+sub);content.removeAttr('class').data('notfirst',false);content.show();$('#booking-statue').attr({rel:'closed',style:''}).hide();$('#null').removeAttr('class');$('.scroll-up, .scroll-down').remove();switch(sub)
{case 0:content.css({width:'520px'});renderSubmenu();$('#text',content).hide();$('.logo',content).remove();bottompanel.trigger('show',function(){$('#supersized').stop().fadeIn(200);});break;case 1:content.css({top:-400,right:0,left:'auto',bottom:'auto',width:'680px'});renderSubmenu();$('#text',content).show();$('.logo',content).remove();bottompanel.trigger('show',function(){$('#supersized').stop().fadeIn(200);});break;case 2:content.css({top:-400,right:0,left:'auto',bottom:'auto',width:'680px'});renderSubmenu();$('#text',content).show();$('.logo',content).remove();bottompanel.trigger('show',function(){$('#supersized').fadeIn(200);});break;case 99:if(!isGallery()){content.css({top:-content.height()});}else{content.css({top:-content.height(),width:'100%',height:'100%'});}
$('#text',content).show();logo.clone().prependTo('.ts-overview');renderSubmenu();break;}
function renderSubmenu(){if(isGallery()){var vars=getUrlVars(dl.href),c=vars['c']||false,p=vars['p']||false;$('#null').addClass('photo').html(submenu?submenu.clone():'').show();if(c){$('#null a[href$="='+c+'"]').addClass('active');}
if(p){$('#null a[rel="ph'+p+'"]').trigger('click');}}else{if(sub&&submenu){$('#null').html(submenu.clone()).show();$('#null li').removeClass('active');$('#null a.active').parents().addClass('active');$('#null ul > li:has(ul)').hover(function(e){var that=this;if($(this).data().timer)clearTimeout($(this).data().timer);$(this).data().timer=setTimeout(function(){if(e.type=='mouseover')headerSubmenuShow($('ul:first',that));if(e.type=='mouseout')headerSubmenuHide($('ul:first',that));},500);});function headerSubmenuShow(target){if(target.parent().hasClass('active')){return false}else{target.stop(true,true).show(200,function(){scrollbar.tinyscrollbar_update('relative');}).parent().addClass('expanded');}}
function headerSubmenuHide(target,noAnimation){if(target.parent().hasClass('active')){return false}else{target.stop(true,true);if(noAnimation){target.hide();scrollbar.tinyscrollbar_update('relative');}else{target.hide(200,function(){scrollbar.tinyscrollbar_update('relative');});}}}
content.addClass('submenu');}else{content.removeClass('submenu');$('#null').html('').hide();}}}
$.when($(elements)).done(function(){d3.resolve()});return d3.promise();};function isGallery(){return $('.gallery').length?true:false;};function centerContent(){var center=(win.width()-content.width())/2;return center;}
function getRoot(){var hash=getHash();var root=hash.split('/')[0];$('header:first').attr({'class':'root-'+root})
return root;}
function getSubmenuLevel(name){var hash=getHash(name?name:false);var level=(hash=='index')?0:blackPages.hasValue(hash)?99:hash.split('/').length;return level;}
function getSubmenuName(){var hash=getHash();var sub=getSubmenuLevel();var name=hash.split('/').slice(0,1);return name;}
function getSubmenu(){var submenu=$('#'+getSubmenuName());return(submenu.length)?submenu:false;}
function alternateArray(a,b){var res=$.map(a.length>b.length?a:b,function(v,i){var aa=a[i],bb=b[i];return(aa!==undefined&&bb!==undefined)?[aa,bb]:(aa===undefined)?bb:aa;});return res;};function initTwitter(){if($('#twitter-feed').length)return false;$('#x2').fadeOut();var id1='ZaZaHouston',id2='ZaZaDallas',tw1=$.Deferred(),tw2=$.Deferred(),tpl='<div class="feed-header cln"><h6>@{screen_name}</h6><a href="{user_url}" rel="external">Follow</a></div><p>{text}</p><div class="feed-controls"><a href="http://twitter.com/home?status=RT+@{screen_name}+{tweet_raw_text}" rel="external">Retweet</a><a href="{user_url}" class="s_twitter" rel="external">All Tweets</a></div>',t=$('#twitter'),t1=$('<div/>',{id:'t1'}).appendTo(t),t2=$('<div/>',{id:'t2'}).appendTo(t);log('Loading Twitter feeds...');busy.start(0);t1.hide().tweet({username:id1,loading_text:"",template:tpl,count:7}).bind('loaded',function(){tw1.resolve()});t2.hide().tweet({username:id2,loading_text:'',template:tpl,count:7}).bind('loaded',function(){tw2.resolve()});$.when(tw1,tw2).done(function(){busy.stop(0);$('#x2').fadeIn();log('Twitter feeds loading complete!');$('.inner',t).append($('<ul/>',{'class':'feed-content',id:'twitter-feed'}).html(alternateArray($('li',t1),$('li',t2))));$('.s_twitter',t).live('click',function(){return runOmniture('twitter');});t1.remove();t2.remove();$('#twitter-feed').slider({auto:false,width:340,hover:false,nav:true,num:2,speed:400});t.hide().slideDown();})}
function initFacebook(){if($('#facebook-feed').length)return false;$('#x2').fadeOut();var id1='177434265186',id2='72591010043',fbd1=$.Deferred(),fbd2=$.Deferred(),tpl='<li class="feed-item"><div class="feed-header cln"><h6>{title}</h6></div><p>{message}</p><div class="feed-controls"><a href="{href}" class="s_facebook" rel="external">{linktitle}</a></div></li>',f=$('#facebook'),f1=$('<div/>',{id:'f1'}).appendTo(f),f2=$('<div/>',{id:'f2'}).appendTo(f),regexp=/\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))/gi;log('Loading Facebook feeds...');busy.start(0);parceFBfeed(id1,f1,fbd1,'Hotel Zaza Houston','Zaza Houston on Facebook');parceFBfeed(id2,f2,fbd2,'Hotel Zaza Dallas','Zaza Dallas on Facebook');function parceFBfeed(id,fb,d,title,linktitle){var html;$.getJSON('/json/?m=facebook&profile_id='+id,function(json){$.each($.grep(json.data,function(a){return((a.type=='status'||a.type=='link')&&(a.from.id==id))}).slice(0,6),function(i,fbe){var message=fbe.message?fbe.message.replace(regexp,function(match){var url=(/^[a-z]+:/i).test(match)?match:"http://"+match;return"<a href=\""+url+"\">"+match+"</a>";}):'',tplvars={'{title}':title,'{message}':message,'{href}':'http://facebook.com/'+id,'{linktitle}':linktitle},tmp=tpl;for(var n in tplvars)tmp=tmp.replace(n,tplvars[n]);html+=tmp;});fb.hide().html(html);d.resolve();});return d.promise();};$.when(fbd1,fbd2).done(function(){busy.stop(0);$('#x2').fadeIn();log('Facebook feeds loading complete!');$('.inner',f).append($('<ul/>',{'class':'feed-content',id:'facebook-feed'}).html(alternateArray($('li.feed-item',f1),$('li.feed-item',f2))));$('.s_facebook',f).live('click',function(){return runOmniture('facebook');});f1.remove();f2.remove();$('#facebook-feed').slider({auto:false,width:340,hover:false,nav:true,num:2,speed:400});f.hide().slideDown();});}
function initFeeds(p){var f=$('#social-panel');$('#tw, #fb').die().click(function(event){event.preventDefault();$('#tw, #fb').removeClass('active');var t=$(this);target=t.attr('id'),rev=f.attr('rev');target=='tw'?initTwitter():initFacebook();f.attr('rev',target);f.trigger((target==rev||rev=='init')?'toggle':'switch');return false;});$('#x2').live('click',function(){f.trigger('hide');});f.bind('hide',function(){$('#main').removeClass('feed-active');f.animate({top:-220});}).bind('show',function(){f.animate({top:40},function(){$('#main').addClass('feed-active');});$('#'+f.attr('rev')).addClass('active')}).bind('toggle',function(){f.stop().trigger((f.position().top==40)?'hide':'show');}).bind('switch',function(){f.animate({top:-220},200,function(){$('section',f).hide().siblings('[rel="'+f.attr('rev')+'"]').show();f.trigger('show');});})};function capitalize(str){function convert(){return arguments[0].toUpperCase();}
return str.toLowerCase().replace(/\b[a-z]/g,convert);}
function googleMap(){if(!$('#googlemap').length)return false;var g=$('#googlemap'),hotel=g.attr('rel');geo={dallas:{lat:32.780571,lon:-96.798394,title:'Hotel Joule Dallas',address:'1530 Main Street, Dallas, TX 75201'}},saddr=window.geo?'&saddr='+window.address:'',url='http://maps.google.com/maps?daddr=1530 Main Street, Dallas, TX 75201'+saddr;$('.getdirections').attr({href:url});g.gMap({markers:[{address:'1530 Main Street, Dallas, TX 75201',latitude:32.780571,longitude:-96.798394,title:'Hotel Joule Dallas',html:'<h6>Hotel Joule Dallas</h6><p>1530 Main Street, Dallas, TX 75201</p><a href="'+url+'" rel="external">Get Directions</a>',icon:{image:'/images/pin.png',iconsize:[32,32],iconanchor:[14,32],infowindowanchor:[12,0]}}],zoom:14,mapTypeControl:false,zoomControl:true,panControl:false,scaleControl:true,streetViewControl:false,scrollwheel:false,onComplete:function(){}});}
function getGEO(reload){if(!$.cookie('geo')||reload){var script=document.createElement('script');script.type='text/javascript';script.src='http://api.ipinfodb.com/v3/ip-city/?key='+geoAPIkey+'&format=json&callback=geoCallback';$('body').append(script);}else{geoCallback();}};function geoCallback(json){if(json){$.cookie('geo','{ "zip":"'+json.zipCode+'","city":"'+capitalize(json.cityName)+'","state":"'+capitalize(json.regionName)+'","country":"'+capitalize(json.countryName)+'"}',{expires:1});}
json=$.parseJSON($.cookie('geo'));var city=json.city,zip=json.zip,state=json.state,country=json.country,address=(city?city+', ':'')+(state?state+', ':'')+(zip?zip+', ':'')+(country?country:'');$('input#city').val(city);$('input#zip').val(zip);$('#state option').each(function(n,el){if(capitalize($(el).text())==state){$(el).attr({selected:'selected'});}});$('#country option').each(function(n,el){if(capitalize($(el).text())==country){$(el).attr({selected:'selected'});}});if(!window.address){window.address=address;log('Detected location: '+address+'. © 2011 www.ipinfodb.com');}
googleMap();}
function ajaxLinks(){$('a').live('click',function(event){var types=['.pdf','.doc','.zip'];a=$(this),rel=a.attr('rel'),href=a.attr('href'),ext=href.slice(-4),vars=getUrlVars(href);if(rel=='external'||types.hasValue(ext)||rel=='share'||a.attr('target')=='_blank'){error('external link');a.attr('target','_blank');rel=='share'?a.attr('href',getShareUrl(a)):log('External link: '+href);}else{event.preventDefault();a.addClass('active');if(rel=='welcome'){showContent();}else{if(!vars['c'])log('Ajax link: '+href);(rel=='static'||href.substr(0,6)=='mailto')?dl.href=href:dl.hash=getHash(href)+((vars=href.split('?')[1])?'?'+vars:'');if($.browser.msie&&$.browser.version.slice(0,1)=="7")win.trigger('hashchange');}}});}
function ajaxForms(){$('form[id$="_rfp"]').live('submit',function(event){event.preventDefault();var f=$(this),data=[],params='submit_ok=true&'+f.serialize(),p=params.split('&');$('#submit_ok').attr({disabled:'disabled'}).addClass('disabled');busy.start(0);$.post(f.attr('action'),params,function(json){busy.stop(0);if(json){$('#submit_ok').removeAttr('disabled').removeClass('disabled');if(json.status){log('Form successfully submited...');dl.hash='#'+getHash($('#redirect_to').val());log('REDIRECT FORM TO: '+dl.hash);}else{error('Form has some errors: ',json.errors);var top=10000,atop=$('#text',content).position().top;$('p',f).removeClass('error');$.each(json.errors,function(n,e){var ntop=$('#'+n).parent().position().top;if(ntop<top)top=ntop;$('#'+n,f).parent().addClass('error');});scrollbar.tinyscrollbar_update(top);}}else{error('Form submit error...');}})
return false;});$('select, input, textarea','form[id$="_rfp"]').live('focus',function(){var t=$(this);$('form[id$="_rfp"] p ').removeClass('active');t.parent().addClass('active');})}
function initShare(){$('#popup').bind('show',function(){$(this).fadeIn(function(){$('#popup-window').fadeIn();});}).bind('hide',function(){$(this).fadeOut(function(){$('#popup').fadeOut();});}).find('ins').bind('click',function(){$('#popup').trigger('hide');$('a#share-this-site').removeClass('active');});$('a#share-this-site').die().click(function(event){$('#popup').trigger('show');return false;});};function initSpecials(){$.getJSON(spc,function(json){if(json.data.length){var d=$('#fspecials div').append($('<ul/>',{id:'specials-list'})),tpl='<li id="spc{ID}"><dl><dt><img src="{IMG}"></dt><dd><h6>{TITLE}</h6><p>{TXT}. <a href="{URL}"  class="more">{LINK_TITLE}</a></p></dd></dl></li>';$.each(json.data,function(n,s){$('ul',d).append(tpl.replace(/{ID}/g,s.id).replace(/{TITLE}/g,s.tile_name).replace(/{TXT}/g,s.descr).replace(/{URL}/g,s.link).replace(/{LINK_TITLE}/g,s.link_title).replace(/{IMG}/g,s.image_src));});var spcSlider=$('#specials-list');spcSlider.bxSlider({controls:false,infiniteLoop:true,auto:true,displaySlideQty:4,moveSlideQty:1,pager:false,pause:5000});$('#spc-bx-prev').click(function(){spcSlider.goToPreviousSlide();return false;});$('#spc-bx-next').click(function(){spcSlider.goToNextSlide();return false;});}else{error('Specials loading failed...');}});$('#spc, #cal').die().click(function(event){event.preventDefault();$('#spc, #cal').removeClass('active');var a=$(this).addClass('active'),id=a.attr('id'),s=$(bottompanel);s.animate({bottom:-14},function(){$('section',bottompanel).attr({rel:'closed'}).hide();$('section[rev="'+id+'"]').attr({rel:'opened'}).show();s.animate({bottom:96},function(){$('body').removeClass('nobottompanel').removeClass('specialsactive').removeClass('calendaractive').addClass(id=='spc'?'specialsactive':'calendaractive');scrollbar.tinyscrollbar_update('relative');});});return false;});$('body').addClass('specialsactive');};function getShareUrl(t){var link=(dl.href.replace('#','')+'.php').replace('index.php',''),url=t.attr('href')+'?'+t.attr('rev').replace(/{URL}/g,encodeURIComponent(link)).replace(/{TITLE}/g,$('title:first').html()).replace(/{H1}/g,$('h1:first').html()).replace(/{TXT}/g,encodeURIComponent($('meta[name="Description"]').attr('content'))).replace(/{TAG}/g,encodeURIComponent($('meta[name="Keywords"]').attr('content')));return url.replace('#?#','#');};function initBooking(){var HeBS_Link_Checkin_Checkout_Inputs=function HeBS_Link_Checkin_Checkout_Inputs_function(checkin_selector,checkout_selector){Date.format='mm/dd/yyyy';$(checkin_selector).bind('dateSelected',function(e,selectedDate,$td,state){var t=new Date(selectedDate);var dt=new Date.fromString($(checkin_selector).val());var edate=new Date.fromString($(checkout_selector).val());var one_day=1000*60*60*24;var days_diff=Math.ceil((edate.getTime()-dt.getTime())/(one_day));if(edate.getTime()<=dt.getTime()){$(checkout_selector).val(t.addDays(1).asString());}});$(checkout_selector).bind('dateSelected',function(e,selectedDate,$td,state){var t=new Date(selectedDate);var dt=new Date.fromString($(checkin_selector).val());var edate=new Date.fromString($(checkout_selector).val());var one_day=1000*60*60*24;var days_diff=Math.ceil((edate.getTime()-dt.getTime())/(one_day));var edate=new Date.fromString($(checkout_selector).val());if(edate.getTime()<=dt.getTime()){$(checkin_selector).val(t.addDays(-1).asString());}});var today=new Date();$(checkin_selector).val(today.asString());$(checkout_selector).val(today.addDays(1).asString());$(checkout_selector).dpSetStartDate(today.asString());};var HeBS_Link_Checkin_Checkout_Inputs2=function HeBS_Link_Checkin_Checkout_Inputs_function2(checkin_selector,checkout_selector){Date.format='mm/dd/yyyy';$(checkin_selector).datePicker({inline:true,showYearNavigation:false}).bind('dateSelected',function(e,selectedDate,$td){var t=new Date(selectedDate);var start=t.asString();var edate=new Date.fromString($('#checkout').val());var one_day=1000*60*60*24;var days_diff=Math.ceil((edate.getTime()-t.getTime())/(one_day));if(edate.getTime()<=t.getTime()){$('#checkout').val(t.addDays(1).asString());}
$(checkin_selector).animate({top:-350});$('#checkin').val(start);}).append('<span class="cross"></span>').click(function(){$(checkin_selector).animate({top:-350})});$(checkout_selector).datePicker({inline:true,showYearNavigation:false}).bind('dateSelected',function(e,selectedDate,$td){var t=new Date(selectedDate);var end=t.asString();var dt=new Date.fromString($('#checkin').val());var edate=t;var one_day=1000*60*60*24;var days_diff=Math.ceil((edate.getTime()-dt.getTime())/(one_day));if(edate.getTime()<=dt.getTime()){$('#checkin').val(t.addDays(-1).asString());}
$('#checkout').val(end);$(checkout_selector).animate({top:-350})}).append('<span class="cross"></span>').click(function(){$(checkout_selector).animate({top:-350})});var today=new Date();$('#checkin').val(today.asString());$('#checkout').val(today.addDays(1).asString());};if($('#arrival').length){HeBS_Link_Checkin_Checkout_Inputs('#arrival','#departure');}
if($('#booking-checkin').length){HeBS_Link_Checkin_Checkout_Inputs2('#booking-checkin','#booking-checkout');$('#checkin').click(function(){$(this).blur();$('#booking-checkin').animate({top:0});})
$('#checkout').click(function(){$(this).blur();$('#booking-checkout').animate({top:0});})}};function suitsListInit(){$('.suites dt').live('click',function(){var t=$(this);$.when(hideContent()).done(function(){$('.ts-overview').removeAttr('style');$('#text').children().not('dl').hide();$('dt,dd',t.parent()).hide();t.hide().next().show().append($('<div/>',{id:'rm-button'}).append($('<span/>',{text:'Book now'}).die().click(function(){var t=$(this).toggleClass('opened');$('#booking-statue').show();$('#booking').css({top:t.position().top+90}).toggle();})))
$('#booking').addClass('suite-booking').hide();content.css({width:485}).show().find('h1').html(t.children().html());dl.hash+='/'+t.children().html().replace(/ /g,'');resetScroll();supersize();showContent();});});};function navInit(){$('nav ul').each(function(){$('li:first-child',this).addClass('first');$('li:last-child',this).addClass('last');});$('nav li').hover(function(){var sub=getSubmenuLevel(),t=$(this);t.addClass('hover').parent().addClass('hover');if(sub==1){var subTop=t.position().top,mHeight=$('ul',t).height();}},function(){t=$(this);t.removeClass('hover').parent().removeClass('hover');});};function hashchangeInit(){win.bind('hashchange',function(x,y){var w=document.location,hash=getHash(w.href),vars=getUrlVars(w.href),oldhash=window.oldhash,sub=getSubmenuLevel();if(hash!=oldhash&&sub!=4){loadContent(hash);}else{if(hash=='specials'){loadContent(hash+'?id='+vars['id']);}
if(photoPages.hasValue(hash)){galleryFilter(vars['c']);}}
window.oldhash=hash;});};function animationInit(){header=$('#header').bind('show',function(event,f){$(this).animate({width:'auto'},lag+200,f);}).bind('hide',function(event,f){$(this).animate({width:960},lag+200,f);});logo=$('.logo').bind('show',function(event,f){$(this).animate({left:50},lag+200,f);}).bind('hide',function(event,f){$(this).animate({left:20},lag+200,f);});bottompanel=$('#bottompanel').bind('show',function(event,f){$(this).animate({bottom:96},lag+200,f);}).bind('hide',function(event,f){$(this).animate({bottom:-160},lag+200,f);}).bind('hide-1',function(event,f){$(this).animate({bottom:-14},lag+200,f);});footer=$('#footer-container').bind('show',function(event,f){$(this).animate({width:'auto'},lag+200,f);}).bind('hide',function(event,f){$(this).animate({width:960},lag+200,f);});content=$('#content').bind('show',function(event,f){$(this).animate({marginLeft:0,left:0},lag+200,f);}).bind('hide',function(event,f){$(this).animate({marginLeft:'-520px'},lag+200,f);}).bind('show-0',function(event,f){var h=(win.height()<900)?250:310;$(this).animate({width:960,height:h},lag+200,f);}).bind('hide-0',function(event,f){var h=(win.height()<900)?50:65;$(this).animate({width:520,height:h},lag+200,f);}).bind('show-1',function(event,f){var t=(win.height()<900)?45:56;$(this).animate({top:t},lag+200,f);}).bind('hide-1',function(event,f){$(this).animate({top:-440},lag+200,f);}).bind('show-99',function(event,f){var t=(win.height()<900)?45:56;$(this).animate({top:t},lag+200,f);}).bind('hide-99',function(event,f){var theight=$('#text').height()+$('h1').height()+$('#photo-image').height();$(this).animate({top:-theight},lag+200,f);});scrollbar=$('.tinyscrollbar');};function iOS(){var platform=navigator.platform;return((platform.indexOf("iPhone")!=-1)||(platform.indexOf("iPod")!=-1));};function IE(){return $.browser.msie?$.browser.version.slice(0,1):false;};function runOmniture(type,args){var omniture;switch(type){case'facebook':omniture="var s=s_gi(s_account);s.linkTrackVars='events,eVar12';s.linkTrackEvents='event7';s.events='event7';s.eVar12='Facebook';(s.tl(this,'e','Website Referral'))";break;case'twitter':omniture="var s=s_gi(s_account);s.linkTrackVars='events,eVar12';s.linkTrackEvents='event7';s.events='event7';s.eVar12='Twitter';(s.tl(this,'e','Website Referral'))";break;case'booknow':if(args&&args[0]){hotelname=args[0];omniture="var s=s_gi(s_account);s.linkTrackVars='events,eVar12';s.linkTrackEvents='event6,scOpen';s.events='event6,scOpen';s.eVar12='"+hotelname+"';(s.tl(this,'o','Booking Initiated'))";}
break;case'page':omniture=args.replace('<script type="text/javascript">','').replace("</script>",'');break;}
eval(omniture);log('Omniture tracking: '+(type=='page'?s.pageName:type));return true;}
jQuery.cookie=function(key,value,options){if(arguments.length>1&&String(value)!=="[object Object]"){options=jQuery.extend({},options);if(value===null||value===undefined){options.expires=-1;}
if(typeof options.expires==='number'){var days=options.expires,t=options.expires=new Date();t.setDate(t.getDate()+days);}
value=String(value);return(document.cookie=[encodeURIComponent(key),'=',options.raw?value:encodeURIComponent(value),options.expires?'; expires='+options.expires.toUTCString():'',options.path?'; path='+options.path:'',options.domain?'; domain='+options.domain:'',options.secure?'; secure':''].join(''));}
options=value||{};var result,decode=options.raw?function(s){return s;}:decodeURIComponent;return(result=new RegExp('(?:^|; )'+encodeURIComponent(key)+'=([^;]*)').exec(document.cookie))?decode(result[1]):null;};function checkLinks(){$('#text a').not('[href^="mailto:"], .newList a').each(function(){var a=new RegExp('/'+window.location.host+'/');if(!a.test(this.href)){$(this).click(function(event){event.preventDefault();event.stopPropagation();window.open(this.href,'_blank');});}});}
$(function(){animationInit();if(!isStatic){$.supersized({slide:'data:image/gif;base64,R0lGODlhIwAYAIAAAP///wAAACH5BAEAAAAALAAAAAAjABgAAAIbhI+py+0Po5y02ouz3rz7D4biSJbmiabqymIFADs='});ajaxLinks();ajaxForms();busyInit();crossInit();initSpecials();initBooking();jCalendar();initShare();hashchangeInit();navInit();$('.booking select').sSelect();if(hash)loadContent(hash);}else{$('body').addClass('black');initBooking();checkLinks();$('.booking select').sSelect();$('nav li').hover(function(){t=$(this);t.addClass('hover').parent().addClass('hover');},function(){t=$(this);t.removeClass('hover').parent().removeClass('hover');});}
scrollbar.tinyscrollbar();setTimeout(function(){scrollbar.tinyscrollbar_update('top');},200);});if(!dev){log=function(){};error=function(){};}
