
Citysearch.Text.Profile={boc:"Best of Citysearch"};Citysearch.ProfileTabs={id:{tabsListId:"tabs",contentsDivId:"tabContents",loadingClass:"ajaxLoading",pagingLoadingClass:"pagingLoading",currentTabClass:"current"},init:function(){if(Citysearch.logging>=3){console.info("INFO: Citysearch.ProfileTabs.init");}
if($(this.id.tabsListId)&&Citysearch.TempConfig.ProfileTabs){$extend(this,Citysearch.TempConfig.ProfileTabs);Citysearch.TempConfig.ProfileTabs=null;this.hijaxTabs();this.initHistoryManager();}},hijaxTabs:function(){if(Citysearch.logging>=4){console.info('INFO: Citysearch.ProfileTabs.hijaxTabs');}
this.currentTab=this.Tabs[this.currentTabKey];$(this.currentTab.tabId).addClass(this.id.currentTabClass);for(var tabKey in this.Tabs){if(this.Tabs.hasOwnProperty(tabKey)){if(tabKey==='owner'){this.hijaxOwnersTab();}
$(this.Tabs[tabKey].tabId).addEvent('click',this.getTabAjax.bindWithEvent(this,tabKey));}}},getTabAjax:function(event,tabKey,ajaxUrl){if(Citysearch.logging>=4){console.info('INFO: Citysearch.ProfileTabs.getTabAjax');}
Citysearch.HistoryManager.profileHistory.setValue(0,tabKey);if(event.target.id===this.currentTab.tabId){event.preventDefault();}
else{var targetTabObj=this.Tabs[tabKey];var cacheTabContents=$(this.currentTab.contentsId).dispose();if(this.currentTab.cached!=="disabled"){this.currentTab.cached=cacheTabContents;}
if(ajaxUrl){event.preventDefault();this.loadTabAjax(targetTabObj,Citysearch.AjaxInit.hijaxHref(ajaxUrl));}
else if(targetTabObj.cached==='disabled'){event.preventDefault();this.loadTabAjax(targetTabObj);}
else if(targetTabObj.cached){event.preventDefault();$(this.id.contentsDivId).grab(targetTabObj.cached);this.setCurrentTab(targetTabObj);}
else if(targetTabObj.ajaxUrl==="none"){return;}
else{event.preventDefault();this.loadTabAjax(targetTabObj);}}
Citysearch.HistoryManager.jumpStarted=true;},loadPageAjax:function(pageUrl){Citysearch.AjaxInit.getViaAjax(pageUrl,$(this.id.contentsDivId));},loadTabAjax:function(tab,ajaxUrl){var ajaxUrl=arguments[1]||tab.ajaxUrl;if(window.location.href.contains('#')&&!Citysearch.HistoryManager.jumpStarted){Cookie.write('reload','1',{'domain':Citysearch.baseDomain,'duration':0,'path':'/'});Citysearch.HistoryManager.stopAdRefresh=true;}
Citysearch.AjaxInit.getViaAjax(ajaxUrl,$(this.id.contentsDivId));this.setCurrentTab(tab);if(window.location.href.contains('#')&&!Citysearch.HistoryManager.jumpStarted){Cookie.dispose('reload',{'domain':Citysearch.baseDomain,'duration':0,'path':'/'});}},setCurrentTab:function(tabObj){this.currentTab=tabObj;for(var tabKey in this.Tabs){$(this.Tabs[tabKey].tabId).removeClass(this.id.currentTabClass);}
$(tabObj.tabId).addClass(this.id.currentTabClass);},hijaxOwnersTab:function(){if(Citysearch.ProfileTabs.Tabs.owner.ajaxUrl==='none'&&$(Citysearch.ProfileTabs.Tabs.owner.contentsId)){var cacheTabContents=$(Citysearch.ProfileTabs.Tabs.owner.contentsId).dispose();this.Tabs.owner.cached=cacheTabContents;var houseEventLink=$('houseEventLink');if($chk(houseEventLink)){houseEventLink.addEvent('click',function(e){e.preventDefault();Citysearch.ProfileTabs.getTabAjax(e,'owner');var houseEventsSection=$('houseEvents');if($chk(houseEventsSection)){Citysearch.Utils.scrollTo($('houseEvents'));}});}
houseEventLink=$('opHouseEventLink');if($chk(houseEventLink)){houseEventLink.addEvent('click',function(e){e.preventDefault();Citysearch.ProfileTabs.getTabAjax(e,'owner');var houseEventsSection=$('houseEvents');if($chk(houseEventsSection)){Citysearch.Utils.scrollTo($('houseEvents'));}});}}},initHistoryManager:function(){if(Citysearch.logging>=4){console.info('INFO: Citysearch.ProfileTabs.initHistoryManager');}
Citysearch.HistoryManager=new HistoryManager().initialize();Citysearch.HistoryManager.profileHistory=Citysearch.HistoryManager.register('profileTab',[Citysearch.ProfileTabs.currentTabKey],function(values){var clickEvent={type:'click',target:$(Citysearch.ProfileTabs.Tabs[values[0]].tabId),preventDefault:$lambda};Citysearch.ProfileTabs.getTabAjax(clickEvent,values[0]);},function(values){return('profileTab-'+values[0]);},/profileTab-\w+/);Citysearch.HistoryManager.profileTarget=Citysearch.HistoryManager.register('target','',function(values){if(!$(values[0])){return;}
var targetLinkObj=$(values[0]);var clickEvent=function(targetObj){var clickEvent={type:'click',target:targetObj,preventDefault:$lambda};Cookie.write('reload','1',{'domain':Citysearch.baseDomain,'duration':0,'path':'/'});targetObj.fireEvent('click',clickEvent);}.pass(targetLinkObj);clickEvent.delay(1000);},function(values){return('target-'+values[0]);},/target-\w+/);Citysearch.HistoryManager.start();}};Citysearch.CoreInfo={id:{mapLinkId:"coreInfoMapLink",offerListId:"coreInfoOfferList",promoteLinkId:"promoteLink",writeReviewLinkId:"writeReviewLink",overviewWriteReviewLinkId:"overviewWriteReviewLink",overviewBottomWriteReviewLinkId:"overviewBottomWriteReviewLink",giftCertificateId:"giftCertificateLink",bookLimoLinkId:"bookLimoLink",listingReviewLinkId:"listingReviewLink",viewAllReviewsId:"viewAllReviewsButton",recomendActionId:"recommendAction",recommendListId:"recommendOptions",couponLinkId:"couponLink",printLinkId:"printLink",printLinkImmediatelyId:'printLinkImmediately',sendToLinkId:"sendToLink",shareLinkId:"shareLink",shareStaticImgClass:".thumbsUpIcon",shareAnimatedImgClass:".shareSprite",saveLinkId:"saveLink",saveSigninLinkId:"saveSigninLink",addressId:"listingAddress",nominateBocLinkId:"nominateBocLink",nominateSigninLinkId:"nominateSigninLink",voteBocLinkId:"voteBocLink",voteSigninLinkId:"voteSigninLink",reviewTabContentId:"overviewTabContents",addPhotoLinkId:"addPhotoLink",slideshowPreviewId:"slideshowPreview",addPhotoLinkId:"addPhoto",slideshowViewAllId:"viewAllPhotos"},shareTimeoutId:null,defaults:{popupWidth:400},init:function(){if(Citysearch.logging>=3){console.info("INFO: Citysearch.CoreInfo.init");}
if(Citysearch.TempConfig.CoreInfo){$extend(this,Citysearch.TempConfig.CoreInfo);Citysearch.TempConfig.CoreInfo=null;this.hijaxMapLink();this.hijaxPrint();this.hijaxOfferLink();this.hijaxPrintImmediately();this.hijaxSendTo();this.hijaxShare({popupWidth:200});this.hijaxSave({popupWidth:200});this.hijaxRecommend();this.hijaxSlideshowPreview();this.hijaxBocNominate({popupWidth:500});this.hijaxBocVote({popupWidth:500});this.coreInfoReview();this.hijaxPromote();this.hijaxCoupon();this.hijaxGiftCertificate();this.hijaxBookLimoLink();if($(this.id.reviewTabContentId)){this.hijaxHelpfulnessVote();this.hijaxHelpfulnessSignIn();this.hijaxWriteCommentLinks();this.hijaxViewCommentLinks();this.hijaxFlagReviewLinks();this.hijaxDeleteReviewLinks();this.hijaxOverviewReviewShareLinks();this.hijaxOverviewPromoteLinks();}}},hijaxGiftCertificate:function(){if($(this.id.giftCertificateId)){$(this.id.giftCertificateId).addEvent('click',function(e){e.preventDefault();Citysearch.ModalWindow.iframe(this.href,{'popupTitle':"Gift Certificate",'frameBuster':true,'frameBusterSrc':this.href,'frameBusterText':Citysearch.Text.Main.goToWebsite,'height':600,'width':954});});}
if($('opGiftCertificateLink')){$('opGiftCertificateLink').addEvent('click',function(e){e.preventDefault();Citysearch.ModalWindow.iframe(this.href,{'popupTitle':"Gift Certificate",'frameBuster':true,'frameBusterSrc':this.href,'frameBusterText':Citysearch.Text.Main.goToWebsite,'height':600,'width':954});});}},hijaxBookLimoLink:function(){if($(this.id.bookLimoLinkId)){$(this.id.bookLimoLinkId).addEvent('click',function(e){e.preventDefault();Citysearch.ModalWindow.iframe(this.href,{'popupTitle':"Book a Limo",'frameBuster':true,'frameBusterSrc':this.href,'frameBusterText':Citysearch.Text.Main.goToWebsite,'height':600,'width':954});});}},hijaxMapLink:function(){if($(this.id.mapLinkId)){$(this.id.mapLinkId).addEvent('click',function(e){e.preventDefault();Citysearch.ProfileTabs.getTabAjax(e,'maps');Citysearch.Utils.scrollTo($('tabs'));});}
if($('secondaryMap')){$('secondaryMap').addEvent('click',function(e){e.preventDefault();Citysearch.ProfileTabs.getTabAjax(e,'maps');Citysearch.Utils.scrollTo($('tabs'));});}},hijaxOfferLink:function(){if($(this.id.offerListId)){$(this.id.offerListId).addEvent('click',function(e){e.preventDefault();Citysearch.ProfileTabs.getTabAjax(e,'owner');Citysearch.Utils.scrollTo($('tabs'));});}
if($('secondaryMap')){$('secondaryMap').addEvent('click',function(e){e.preventDefault();Citysearch.ProfileTabs.getTabAjax(e,'maps');Citysearch.Utils.scrollTo($('tabs'));});}},hijaxBocNominate:function(options){if($(this.id.nominateBocLinkId)||$(this.id.nominateSigninLinkId)){options=$merge(this.defaults,options);var nominateLink=$(this.id.nominateBocLinkId)?$(this.id.nominateBocLinkId):$(this.id.nominateSigninLinkId);nominateLink.addEvent('click',function(e){e.preventDefault();Citysearch.Popup.fireNewPopup(this,{'width':options.popupWidth,'collapse':false,'titleText':Citysearch.Text.Profile.boc});});}},hijaxBocVote:function(options){if($(this.id.voteBocLinkId)){options=$merge(this.defaults,options);$(this.id.voteBocLinkId).addEvent('click',function(e){e.preventDefault();Citysearch.Popup.fireNewPopup(this,{'width':options.popupWidth,'collapse':false,'titleText':Citysearch.Text.Profile.boc});});}
if($(this.id.voteSigninLinkId)){$(this.id.voteSigninLinkId).addEvent('click',function(e){var stop=e.preventDefault();var ajaxHref=Citysearch.AjaxInit.hijaxHref(this.href);Citysearch.ModalWindow.fireNewModal(ajaxHref,"Log in to vote");});}},hijaxPrint:function(){if(!$(this.id.printLinkId)){return;}
$(this.id.printLinkId).addEvent('click',function(e){e.preventDefault();var popupHref=this.href;Citysearch.TempConfig.printNow=true;Citysearch.AjaxInit.getViaAjax(popupHref,Citysearch.ModalWindow.bodyObj,{'onRequest':function(){Citysearch.ModalWindow.show(new Element('div'),{'titleText':'Print'});},'onSuccess':function(){Citysearch.VisualSciences.modalInit();}});});},hijaxPrintImmediately:function(){if(!$(this.id.printLinkImmediatelyId)){return;}
$(this.id.printLinkImmediatelyId).addEvent('click',function(e){e.preventDefault();window.print();});},hijaxRecommend:function(){if(!$(this.id.recommendListId)){return;}
this.recommendListObj=$(this.id.recommendListId).dispose();var recomendActionObj=$(this.id.recomendActionId);var recommendText=recomendActionObj.getProperty('html');var recommendLink=new Element('a',{'id':'recommendLink','href':'#','name':'listing_profile/share','class':'popupLink','title':Citysearch.Text.Main.recommendTitle,'html':recommendText});recommendLink.replaces(recomendActionObj);recommendLink.addEvent('click',function(e){e.preventDefault();Citysearch.Popup.open(this,Citysearch.CoreInfo.recommendListObj.clone().addClass('spriteList'),{'width':150,'collapse':false,'titleText':Citysearch.Text.Main.recommendPopupTitle});});},hijaxSlideshowPreview:function(){if($(this.id.slideshowViewAllId)){$(this.id.slideshowViewAllId).addEvent('click',function(e){this.showSlideshow(e);}.bind(this));}
if($(this.id.slideshowPreviewId)){var thumbnails=$(this.id.slideshowPreviewId).getElements(".thumbnail");thumbnails.each(function(thumbnail){thumbnail.addEvent('click',function(e){this.showSlideshow(e);}.bind(Citysearch.CoreInfo));});}
if($(this.id.addPhotoLinkId)){$(this.id.addPhotoLinkId).addEvent('click',function(e){e.preventDefault();Citysearch.ModalWindow.fireNewModal(this.href,Citysearch.Text.Main.addPhotoTitle);});}
if($('firstAddPhoto')){$('firstAddPhoto').addEvent('click',function(e){e.preventDefault();Citysearch.ModalWindow.fireNewModal(this.href,Citysearch.Text.Main.addPhotoTitle);});}},showSlideshow:function(e){e.preventDefault();if(Citysearch.ProfilePhotos){Citysearch.Utils.scrollTo($('tabs'),250);Citysearch.ProfilePhotos.startShow.delay(500,Citysearch.ProfilePhotos,0);}
else{Citysearch.Utils.scrollTo($('tabs'));Citysearch.TempConfig.ProfilePhotos={startIndex:0}
Citysearch.ProfileTabs.getTabAjax(e,'photos');}},hijaxSendTo:function(){if($(this.id.sendToLinkId)){var sendToLinkObj=$(this.id.sendToLinkId);sendToLinkObj.addEvent('click',function(e){e.preventDefault();Citysearch.Popup.open(this,function(){Citysearch.AjaxInit.getViaAjax(Citysearch.CoreInfo.sendToHref,Citysearch.Popup.bodyObj);},{'width':400,'collapse':false,'titleText':Citysearch.Text.Main.sendToTitle});});sendToLinkObj.addClass('popupLink');}},hijaxShare:function(options){if($(this.id.shareLinkId)){options=$merge(this.defaults,options);var shareLinkObj=$(this.id.shareLinkId);shareLinkObj.addEvent('click',function(e){e.preventDefault();if(!Citysearch.Popup.isOpen){Citysearch.CoreInfo.setShareStatic();}
$clear(this.shareTimeoutId);if(!Citysearch.Popup.isOpen){Citysearch.Popup.fireNewPopup(this,{'width':options.popupWidth,'collapse':false,'titleText':this.get("text")});}
Citysearch.Popup.addCloseCallback('restoreAnimation',(function(){Citysearch.CoreInfo.setShareAnimation();}));});shareLinkObj.addEvent('mouseenter',function(e){e.preventDefault();if(!Citysearch.Popup.isOpen){Citysearch.CoreInfo.setShareStatic();}
this.shareTimeoutId=(function(){if(!Citysearch.Popup.isOpen){Citysearch.Popup.fireNewPopup(this,{'width':options.popupWidth,'collapse':false,'titleText':this.get("text")});Citysearch.VisualSciences.trackEvent(Citysearch.pageType+"/coreMessages/shareHover");Citysearch.Popup.addCloseCallback('restoreAnimation',(function(){Citysearch.CoreInfo.setShareAnimation();}));}}).delay(500,this);});shareLinkObj.addEvent('mouseleave',function(e){if(!Citysearch.Popup.isOpen){Citysearch.CoreInfo.setShareAnimation();}
$clear(this.shareTimeoutId);});shareLinkObj.addClass('popupLink');}},setShareStatic:function(){if($(this.id.shareLinkId)){var shareSpan=$(this.id.shareLinkId).getElement(this.id.shareStaticImgClass);shareSpan.setStyle('display','inline');var shareImg=$(this.id.shareLinkId).getElement(this.id.shareAnimatedImgClass);shareImg.setStyle('display','none');}},setShareAnimation:function(){if($(this.id.shareLinkId)){var shareImg=$(this.id.shareLinkId).getElement(this.id.shareAnimatedImgClass);shareImg.setStyle('display','');var shareSpan=$(this.id.shareLinkId).getElement(this.id.shareStaticImgClass);shareSpan.setStyle('display','none');}},hijaxSave:function(options){if($(this.id.saveLinkId)){options=$merge(this.defaults,options);var saveLinkObj=$(this.id.saveLinkId);saveLinkObj.addEvent('click',function(e){e.preventDefault();Citysearch.Popup.fireNewPopup(this,{'width':options.popupWidth,'collapse':false,'titleText':this.get("text")});});saveLinkObj.addClass('popupLink');}
if($(this.id.saveSigninLinkId)){$(this.id.saveSigninLinkId).addEvent('click',function(e){var stop=e.preventDefault();var ajaxHref=Citysearch.AjaxInit.hijaxHref(this.href);Citysearch.ModalWindow.fireNewModal(ajaxHref,"Log in to Save");});}},coreInfoReview:function(){if($(this.id.listingReviewLinkId)){var listingReviewLink=$(this.id.listingReviewLinkId);listingReviewLink.addEvent('click',Citysearch.ProfileTabs.getTabAjax.bindWithEvent(Citysearch.ProfileTabs,'reviews'));listingReviewLink.addEvent('click',function(e){e.preventDefault();Citysearch.Utils.scrollTo($('tabs'));});}
if($(this.id.viewAllReviewsId)){var viewAllReviewsObj=$(this.id.viewAllReviewsId);viewAllReviewsObj.addEvent('click',Citysearch.ProfileTabs.getTabAjax.bindWithEvent(Citysearch.ProfileTabs,'reviews'));viewAllReviewsObj.addEvent('click',function(e){e.preventDefault();Citysearch.Utils.scrollTo($('tabs'));});}
if($(this.id.writeReviewLinkId)){$(this.id.writeReviewLinkId).addEvent('click',function(e){e.preventDefault();Citysearch.ModalWindow.fireNewModal(Citysearch.CoreInfo.writeReviewHref,Citysearch.Text.Main.writeReviewTitle);});}
if($(this.id.overviewWriteReviewLinkId)){$(this.id.overviewWriteReviewLinkId).addEvent('click',function(e){e.preventDefault();Citysearch.ModalWindow.fireNewModal(Citysearch.CoreInfo.writeReviewHref,Citysearch.Text.Main.writeReviewTitle);});}
if($('opViewAllReviewsButton')){var viewAllReviewsObj=$('opViewAllReviewsButton');viewAllReviewsObj.addEvent('click',Citysearch.ProfileTabs.getTabAjax.bindWithEvent(Citysearch.ProfileTabs,'reviews'));viewAllReviewsObj.addEvent('click',function(e){e.preventDefault();Citysearch.Utils.scrollTo($('tabs'));});}
if($('opWriteReviewLink')){$('opWriteReviewLink').addEvent('click',function(e){e.preventDefault();Citysearch.ModalWindow.fireNewModal(Citysearch.CoreInfo.writeReviewHref,Citysearch.Text.Main.writeReviewTitle);});}
if($('editorsTipsLink')){var editorsTipsLinkObj=$('editorsTipsLink');editorsTipsLinkObj.addEvent('click',function(e){e.preventDefault();});editorsTipsLinkObj.addEvent('click',Citysearch.ProfileTabs.getTabAjax.bindWithEvent(Citysearch.ProfileTabs,'overview'));editorsTipsLinkObj.addEvent('click',function(e){Citysearch.Utils.scrollTo($('tabs'));});}},hijaxPromote:function(){if($(this.id.promoteLinkId)){var promoteLinkObj=$(this.id.promoteLinkId);promoteLinkObj.addEvent('click',function(e){e.preventDefault();var ajaxLink=Citysearch.AjaxInit.hijaxHref(e.target.href);Citysearch.ModalWindow.fireNewModal(ajaxLink,Citysearch.Text.Main.promoteTitle);});}},hijaxCoupon:function(){if($(this.id.couponLinkId)){$(this.id.couponLinkId).addEvent('click',function(e){e.preventDefault();var ajaxLink=Citysearch.AjaxInit.hijaxHref(this.href);Citysearch.ModalWindow.fireNewModal(ajaxLink,Citysearch.Text.Main.couponTitle,{'loadingWidth':665});});}
if($('opCouponLink')){$('opCouponLink').addEvent('click',function(e){e.preventDefault();var ajaxLink=Citysearch.AjaxInit.hijaxHref(this.href);Citysearch.ModalWindow.fireNewModal(ajaxLink,Citysearch.Text.Main.couponTitle,{'loadingWidth':665});});}},hijaxHelpfulnessVote:function(){var helpfulnessLinks=$(this.id.reviewTabContentId).getElements('a.helpfulness');for(i=0;i<helpfulnessLinks.length;i++){helpfulnessLinks[i].addEvent('click',function(e){e.preventDefault();var ajaxUrl=Citysearch.AjaxInit.hijaxHref(this.href);console.info('url: '+ajaxUrl);Citysearch.Popup.open($('reviewActions:'+this.id),function(){Citysearch.AjaxInit.getViaAjax(ajaxUrl,Citysearch.Popup.bodyObj);},{'width':250,'maxHeight':200,'collapse':true,'titleText':'THANKS FOR YOUR INPUT'});});}},hijaxHelpfulnessSignIn:function(){var notHelpfulLinks=$(this.id.reviewTabContentId).getElements('a.notLoggedIn');for(var i=0;i<notHelpfulLinks.length;i++){notHelpfulLinks[i].addEvent('click',function(e){var stop=e.preventDefault();var ajaxHref=Citysearch.AjaxInit.hijaxHref(this.href);Citysearch.ModalWindow.fireNewModal(ajaxHref,Citysearch.Text.ReviewsProfile.signupTitle);});}},hijaxWriteCommentLinks:function(){var commentLinks=$(this.id.reviewTabContentId).getElements('a.writeComment');for(var i=0;i<commentLinks.length;i++){commentLinks[i].addEvent('click',function(e){var stop=new Event(e).preventDefault();var ajaxHref=Citysearch.AjaxInit.hijaxHref(this.href);Citysearch.ModalWindow.fireNewModal(ajaxHref,Citysearch.Text.ReviewsProfile.writeCommentTitle);});}},hijaxViewCommentLinks:function(){var commentLinks=$(this.id.reviewTabContentId).getElements('a.viewComments');for(var i=0;i<commentLinks.length;i++){commentLinks[i].addEvent('click',function(e){var stop=new Event(e).preventDefault();var ajaxHref=Citysearch.AjaxInit.hijaxHref(this.href);Citysearch.ProfileTabs.loadPageAjax(ajaxHref);});}},hijaxOverviewReviewShareLinks:function(){var reviewShareLinks=$(this.id.reviewTabContentId).getElements('.reviewShareLink');for(var i=0;i<reviewShareLinks.length;i++){reviewShareLinks[i].addEvent('click',function(e){e.preventDefault();$clear(this.shareTimeoutId);Citysearch.Popup.fireNewPopup(this,{'width':200,'collapse':false,'titleText':this.get("text")});});reviewShareLinks[i].addEvent('mouseenter',function(e){var stop=new Event(e).preventDefault();this.shareTimeoutId=Citysearch.Popup.fireNewPopup.delay(500,Citysearch.Popup,[this,{'width':200,'collapse':false,'titleText':this.get("text")}]);});reviewShareLinks[i].addEvent('mouseleave',function(e){$clear(this.shareTimeoutId);});}},hijaxOverviewPromoteLinks:function(){var reviewPromoteLinks=$(this.id.reviewTabContentId).getElements('.reviewPromoteLink');for(var i=0;i<reviewPromoteLinks.length;i++){reviewPromoteLinks[i].addClass('popupLink');reviewPromoteLinks[i].addEvent('click',function(e){e.preventDefault();Citysearch.Popup.fireNewPopup(this,{'width':200,'collapse':false,'titleText':'&nbsp;'});});}},hijaxFlagReviewLinks:function(){var flagLinks=$(this.id.reviewTabContentId).getElements('.flagReview');for(var i=0;i<flagLinks.length;i++){flagLinks[i].addEvent('click',function(e){var stop=new Event(e).preventDefault();var containerObj=$(this.parentNode);var flagPopup=new Element('div',{'id':'flagPopup'});var flagPopupText=new Element('p',{'text':Citysearch.Text.ReviewsProfile.reportPopupBodyText});var flagLinkButton=Citysearch.ButtonFactory.createButton(Citysearch.Text.ReviewsProfile.reportButtonText,'submit reportIt',{'name':Citysearch.pageType+'user_review/user/report_it'});flagPopup.adopt(flagPopupText,flagLinkButton);var flagLinkButtonEvent=(function(e){var stop=new Event(e).preventDefault();Citysearch.AjaxInit.activeRequest=new Request({'url':this.href,'method':'get','onRequest':function(){Citysearch.AjaxInit.loading(Citysearch.Popup.bodyObj,{'disableCancel':true});},'onSuccess':function(){Citysearch.Popup.close();containerObj.set('text',Citysearch.Text.ReviewsProfile.reportCompleteText);Citysearch.AjaxInit.doneLoading();Citysearch.AjaxInit.run();},'onFailure':function(){Citysearch.Popup.close();containerObj.set('text',Citysearch.Text.ReviewsProfile.reportFailText);Citysearch.AjaxInit.doneLoading();Citysearch.AjaxInit.run();}});Citysearch.AjaxInit.activeRequest.send();}).bind(this);var boundFlagLinkButtonEvent=flagLinkButtonEvent.bind(this,flagLinks[i]);flagLinkButton.addEvent('click',boundFlagLinkButtonEvent);Citysearch.Popup.open(this,flagPopup,{'width':150,'onTop':true,'titleText':Citysearch.Text.ReviewsProfile.reportTitleText});});}},hijaxDeleteReviewLinks:function(){var deleteLinks=$(this.id.reviewTabContentId).getElements('.deleteReview');for(var i=0;i<deleteLinks.length;i++){deleteLinks[i].addEvent('click',function(e){var stop=new Event(e).preventDefault();var containerObj=$(this.parentNode);var deletePopup=new Element('div',{'id':'deletePopup','class':'column'});var deletePopupText=new Element('p',{'text':Citysearch.Text.ReviewsProfile.deletePopupBodyText});var deleteLinkButton=Citysearch.ButtonFactory.createButton(Citysearch.Text.ReviewsProfile.deleteButtonText,'submit reportIt',{'name':Citysearch.pageType+'/user_review/user/remove_it'});deletePopup.adopt(deletePopupText,deleteLinkButton);var deleteLinkButtonEvent=(function(e){var stop=new Event(e).preventDefault();Citysearch.AjaxInit.activeRequest=new Request({'url':this.href,'method':'get','onRequest':function(){Citysearch.AjaxInit.loading(Citysearch.Popup.bodyObj,{'disableCancel':true});},'onSuccess':function(){Citysearch.Popup.close();containerObj.set('text',Citysearch.Text.ReviewsProfile.deleteCompleteText);Citysearch.Utils.highlightElement(containerObj);Citysearch.AjaxInit.doneLoading();Citysearch.AjaxInit.run();},'onFailure':function(){Citysearch.Popup.close();containerObj.set('text',Citysearch.Text.ReviewsProfile.reportFailText);Citysearch.AjaxInit.doneLoading();Citysearch.AjaxInit.run();}});Citysearch.AjaxInit.activeRequest.send();}).bind(this);var boundDeleteLinkButtonEvent=deleteLinkButtonEvent.bind(this,deleteLinks[i]);deleteLinkButton.addEvent('click',deleteLinkButtonEvent);Citysearch.Popup.open(this,deletePopup,{'width':150,'onTop':true,'titleText':Citysearch.Text.ReviewsProfile.deleteTitleText});});}}};Citysearch.ExtendedInfo={reserveLinkId:'reservationLink',menuLinkId:'menuLink',addPhotoLinkId:'addPhotoLink',emailBusinessLinkId:'emailBusinessLink',emailBusinessFormId:'emailBusiness',emailBusinessModalWidth:500,init:function(){if(Citysearch.logging>=3){console.info("INFO: Citysearch.ExtendedInfo.init");}
this.hijaxReservation();this.hijaxMenu();this.hijaxEmailBusiness();this.hijaxAddPhoto();},hijaxReservation:function(){if($(this.reserveLinkId)){$(this.reserveLinkId).addEvent('click',function(e){e.preventDefault();Citysearch.ModalWindow.iframe(this.href,{'popupTitle':Citysearch.Text.Main.makeReservation,'frameBuster':true,'frameBusterSrc':this.href,'frameBusterText':Citysearch.Text.Main.goToWebsite,'height':600,'width':954});});}
if($('opReservationLink')){$('opReservationLink').addEvent('click',function(e){e.preventDefault();Citysearch.ModalWindow.iframe(this.href,{'popupTitle':Citysearch.Text.Main.makeReservation,'frameBuster':true,'frameBusterSrc':this.href,'frameBusterText':Citysearch.Text.Main.goToWebsite,'height':600,'width':954});});}},hijaxMenu:function(){if($(this.menuLinkId)){$(this.menuLinkId).addEvent('click',function(e){e.preventDefault();Citysearch.ModalWindow.iframe(this.href,{'popupTitle':Citysearch.Text.ExtendedInfo.viewMenu,'frameBuster':true,'frameBusterSrc':this.href,'frameBusterText':Citysearch.Text.Main.goToWebsite,'height':600,'width':870});});}
if($('opMenuLink')){$('opMenuLink').addEvent('click',function(e){e.preventDefault();Citysearch.ModalWindow.iframe(this.href,{'popupTitle':Citysearch.Text.ExtendedInfo.viewMenu,'frameBuster':true,'frameBusterSrc':this.href,'frameBusterText':Citysearch.Text.Main.goToWebsite,'height':600,'width':870});});}},hijaxEmailBusiness:function(){if($(this.emailBusinessLinkId)){$(this.emailBusinessLinkId).addEvent('click',function(e){e.preventDefault();Citysearch.ModalWindow.fireNewModal(Citysearch.AjaxInit.hijaxHref(this.href),Citysearch.Text.ExtendedInfo.emailBusiness,{'width':Citysearch.ExtendedInfo.emailBusinessModalWidth});});}
if($('opEmailBusinessLink')){$('opEmailBusinessLink').addEvent('click',function(e){e.preventDefault();Citysearch.ModalWindow.fireNewModal(Citysearch.AjaxInit.hijaxHref(this.href),Citysearch.Text.ExtendedInfo.emailBusiness,{'width':Citysearch.ExtendedInfo.emailBusinessModalWidth});});}},hijaxEmailBusinessForm:function(){if($(Citysearch.ExtendedInfo.emailBusinessFormId)){$(Citysearch.ExtendedInfo.emailBusinessFormId).addEvent('submit',function(){Citysearch.Utils.disableSubmit("emailBusinessSubmit");Citysearch.AjaxInit.postViaAjax(this,Citysearch.ExtendedInfo.emailBusinessFormUrl,Citysearch.ModalWindow.bodyObj);});}},hijaxAddPhoto:function(){if($(this.addPhotoLinkId)){var addPhotoLinkObj=$(this.addPhotoLinkId);addPhotoLinkObj.addEvent('click',function(e){e.preventDefault();var ajaxLink=Citysearch.AjaxInit.hijaxHref(addPhotoLinkObj.getProperty('href'));Citysearch.ModalWindow.fireNewModal(ajaxLink,Citysearch.Text.Main.addPhotoTitle);});}}};Citysearch.ProfileOverview={overviewDivId:"overviewTabContents",overviewDivObj:{},tweetsId:"overviewTweets",twitterFormContainerId:"recentTweetsForm",readFromOwnerId:"readOwner",readFromOwnerObj:{},ownerHeaderId:"ownerHeader",ownerHeaderObj:{},readFullEditorialId:"readEditorial",readFullEditorialObj:{},editorialHeaderId:"editorialHeader",editorialHeaderObj:{},readAllReviewsId:"readAllReview",readAllReviewsObj:{},allReviewsHeaderId:"allReviewsHeader",allReviewsHeaderObj:{},readReviewClass:"readReview",init:function(){if(Citysearch.logging>=3){console.info("INFO: Citysearch.ProfileOverview.init");}
this.loadTweets();this.overviewDivObj=$(this.overviewDivId);if(!this.overviewDivObj){return;}
this.ownerHeaderObj=$(this.ownerHeaderId);this.readFromOwnerObj=$(this.readFromOwnerId);this.editorialHeaderObj=$(this.editorialHeaderId);this.readFullEditorialObj=$(this.readFullEditorialId);this.allReviewsHeaderObj=$(this.allReviewsHeaderId);this.readAllReviewsObj=$(this.readAllReviewsId);this.hijaxOwnerHeaderLink();this.hijaxReadFromOwnerLink();this.hijaxEditorialHeaderLink();this.hijaxReadFullEditorialLink();this.hijaxAllReviewsHeaderLink();this.hijaxReadFullReviewLink();this.hijaxReadAllReviewsLink();},loadTweets:function(){if(Citysearch.logging>=4){console.info("INFO: Citysearch.ProfileOverview.loadTweets");}
if($(this.tweetsId)&&$chk(Citysearch.TempConfig.ProfileOverview.tweetsUrl)){$(this.tweetsId).setStyle('min-height','40px');Citysearch.AjaxInit.getViaAjax(Citysearch.TempConfig.ProfileOverview.tweetsUrl,$(this.tweetsId));}},hijaxOwnerHeaderLink:function(){if(!this.ownerHeaderObj){return;}
this.ownerHeaderObj.addEvent('click',Citysearch.ProfileTabs.getTabAjax.bindWithEvent(Citysearch.ProfileTabs,['owner',this.href]));},hijaxReadFromOwnerLink:function(){if(!this.readFromOwnerObj){return;}
this.readFromOwnerObj.addEvent('click',Citysearch.ProfileTabs.getTabAjax.bindWithEvent(Citysearch.ProfileTabs,['owner',this.href]));},hijaxEditorialHeaderLink:function(){if(!this.editorialHeaderObj){return;}
this.editorialHeaderObj.addEvent('click',Citysearch.ProfileTabs.getTabAjax.bindWithEvent(Citysearch.ProfileTabs,['reviews',Citysearch.AjaxInit.hijaxHref(Citysearch.ProfileOverview.editorialHeaderObj.href)]));},hijaxReadFullEditorialLink:function(){if(!this.readFullEditorialObj){return;}
this.readFullEditorialObj.addEvent('click',Citysearch.ProfileTabs.getTabAjax.bindWithEvent(Citysearch.ProfileTabs,['reviews',Citysearch.AjaxInit.hijaxHref(Citysearch.ProfileOverview.readFullEditorialObj.href)]));},hijaxAllReviewsHeaderLink:function(){if(!this.allReviewsHeaderObj){return;}
this.allReviewsHeaderObj.addEvent('click',Citysearch.ProfileTabs.getTabAjax.bindWithEvent(Citysearch.ProfileTabs,['reviews',this.href]));},hijaxReadFullReviewLink:function(){var readReviewLinks=this.overviewDivObj.getElements("."+this.readReviewClass);readReviewLinks.each(function(currItem){currItem.addEvent('click',Citysearch.ProfileTabs.getTabAjax.bindWithEvent(Citysearch.ProfileTabs,['reviews',currItem.href]));});},hijaxReadAllReviewsLink:function(){if(!this.readAllReviewsObj){return;}
this.readAllReviewsObj.addEvent('click',Citysearch.ProfileTabs.getTabAjax.bindWithEvent(Citysearch.ProfileTabs,['reviews',this.href]));}};Citysearch.Slideshow={id:{slideshowDivId:'slideshow',currentSlideDivId:'currentSlide',slideshowControlsDivId:'slideshowControls',captionId:'caption',uploadLinkId:'uploadPhotoLink',abuseLinkId:'reportAbuse',previousClass:'previous',nextClass:'next',currentSlideClass:'current',ellipsisClass:'ellipsis',captionBackgroundId:'captionBackground',abusePlaceHolderId:'abusePlaceHolder'},defaults:{slideshowWidth:384,slideshowPhotoHeight:216,slideshowVideoHeight:258},pagingList:{},totalSlides:0,currentSlideIndex:0,currentShownLinks:[],init:function(){if(Citysearch.logging>=3){console.info("INFO: Citysearch.Slideshow.init");}
this.slides=Citysearch.TempConfig.Slideshow.slides;this.uploadLink=Citysearch.TempConfig.Slideshow.uploadLink;this.loggedIn=Citysearch.TempConfig.Slideshow.loggedIn;Citysearch.TempConfig.Slideshow=null;if(!$(this.id.slideshowDivId)||!$(this.id.currentSlideDivId)){return;}
this.slideshowDiv=$(this.id.slideshowDivId);this.slideshowControls=$(this.id.slideshowControlsDivId);this.currentSlideDiv=$(this.id.currentSlideDivId);this.totalSlides=this.slides.length;this.pagingList=new Element('ul',{'class':'paging clearfix'});this.pickSlides();this.preloadSlides();this.initFirstSlide();if(this.totalSlides>0){this.createSlideControl();this.setCaptionBackground();}
if(this.totalSlides>1){this.createPagingLinks();}},pickSlides:function(){this.currentShownLinks.empty();if(this.totalSlides<=5){for(var i=0;i<this.totalSlides;i++){this.currentShownLinks.push(i);}}
else if(this.currentSlideIndex<=2){for(var i=0;i<4;i++){this.currentShownLinks.push(i);}
this.currentShownLinks.push(-1);this.currentShownLinks.push(this.totalSlides-1);}
else if((this.totalSlides-this.currentSlideIndex)<=3){this.currentShownLinks.push(0);this.currentShownLinks.push(-1);for(var i=this.totalSlides-4;i<this.totalSlides;i++){this.currentShownLinks.push(i);}}
else{this.currentShownLinks.push(0);this.currentShownLinks.push(-1);this.currentShownLinks.push(this.currentSlideIndex-1);this.currentShownLinks.push(this.currentSlideIndex-0);this.currentShownLinks.push(this.currentSlideIndex-0+1);this.currentShownLinks.push(-1);this.currentShownLinks.push(this.totalSlides-1);}},preloadSlides:function(){this.currentShownLinks.each(function(i,index){var currSlide=Citysearch.Slideshow.slides[i];if(currSlide&&currSlide.type==='image'&&!currSlide.isLoaded){currSlide.obj=new Asset.image(currSlide.src,{'id':'slide:'+i,'onload':function(){var slideIndex=this.id.split(':')[1];Citysearch.Slideshow.slides[slideIndex].isLoaded=true;}});}
else if(currSlide&&currSlide.type==='video'&&!currSlide.isLoaded){currSlide.obj=new Element('IFrame',{'src':currSlide.src,'id':'slide:'+i,'frameborder':'0','styles':{'width':Citysearch.Slideshow.defaults.slideshowWidth,'height':Citysearch.Slideshow.defaults.slideshowVideoHeight,'border':'0'},'events':{load:function(){var slideIndex=this.id.split(':')[1];Citysearch.Slideshow.slides[slideIndex].isLoaded=true;}}});$('currentSlide').empty();$('currentSlide').grab(currSlide.obj);}});},createPagingLinks:function(){this.pagingList.empty();this.createPagingLink(this.currentSlideIndex-1,Citysearch.Text.ExtendedInfo.slideshowPrevious);this.currentShownLinks.each(function(item,index){Citysearch.Slideshow.createPagingLink(item);});this.createPagingLink(this.currentSlideIndex-0+1,Citysearch.Text.ExtendedInfo.slideshowNext);this.slideshowControls.grab(this.pagingList);},createPagingLink:function(i){var pageListItem=new Element('li');var linkText=arguments[1]||(i+1);if(arguments[1]){if(arguments[1]===Citysearch.Text.ExtendedInfo.slideshowPrevious){pageListItem.addClass(this.id.previousClass);}
else if(arguments[1]===Citysearch.Text.ExtendedInfo.slideshowNext){pageListItem.addClass(this.id.nextClass);}
if(this.slides[i]&&$defined(this.slides[i].src)){var boundLoadSlide=this.loadSlide.bindWithEvent(this);pageListItem.grab(new Element('a',{'id':'slideLink:'+i,'href':'#','name':Citysearch.pageType+'/coreMessage/slideshow/'+linkText,'events':{'click':boundLoadSlide}}));}
else{pageListItem.grab(new Element('a',{'id':'slideLink:'+i,'name':Citysearch.pageType+'/coreMessage/slideshow/disabled','class':'disabledLink','href':'#','events':{'click':function(e){e.preventDefault();}}}));}}
else{if(!this.slides[i]||(i==this.currentSlideIndex)){var linkClass=(i==this.currentSlideIndex)?this.id.currentSlideClass:this.id.ellipsisClass;linkText=(i==this.currentSlideIndex)?linkText:'&#8230';pageListItem.grab(new Element('span',{'class':linkClass,'html':linkText}));}
else{var boundLoadSlide=this.loadSlide.bindWithEvent(this);pageListItem.grab(new Element('a',{'id':'slideLink:'+i,'href':'#','name':Citysearch.pageType+'/coreMessage/slideshow/slide'+(i+1),'text':linkText,'events':{'click':boundLoadSlide}}));}}
this.pagingList.grab(pageListItem);},loadSlide:function(e){var click=new Event(e).preventDefault();var slideIndex=click.target.id.split(':')[1];if($defined(this.slides[slideIndex].isLoaded)){this.currentSlideDiv.empty();this.currentSlideDiv.grab(this.slides[slideIndex].obj);this.currentSlideIndex=slideIndex;this.verticalCenterSlide();this.updateAbuseLink();this.updateCaption();this.pickSlides();this.preloadSlides();this.createPagingLinks();}},createSlideControl:function(){var uploadLink=new Element('a',{'id':this.id.uploadLinkId,'name':'listing_profile/coreMessage/slideshow/upload','href':this.uploadLink,'text':Citysearch.Text.ExtendedInfo.slideshowUpload});uploadLink.addEvent('click',function(e){e.preventDefault();var ajaxLink=Citysearch.AjaxInit.hijaxHref(this.href);Citysearch.ModalWindow.fireNewModal(ajaxLink,Citysearch.Text.Main.addPhotoTitle);});var abuseLink=new Element('a',{'id':this.id.abuseLinkId,'name':'listing_profile/coreMessage/slideshow/report','href':'#','text':Citysearch.Text.ExtendedInfo.slideshowAbuse});if(this.loggedIn){abuseLink.addEvent('click',function(e){e.preventDefault();Citysearch.Popup.fireNewPopup(this,{titleText:'Thank You'});});}
else{abuseLink.addEvent('click',function(e){e.preventDefault();var ajaxUrl=Citysearch.AjaxInit.hijaxHref($(Citysearch.Slideshow.id.abuseLinkId).href);Citysearch.ModalWindow.fireNewModal(ajaxUrl,'Citysearch');Citysearch.ModalWindow.closeObj.addEvent('click',function(e){window.location.reload();});});}
this.slideshowControls.adopt(uploadLink,abuseLink);this.updateAbuseLink();},updateAbuseLink:function(){var newLink=this.slides[this.currentSlideIndex].flaggingPath;if(newLink){$(this.id.abuseLinkId).setStyle('display','');$(this.id.abuseLinkId).setProperty('href',newLink);if($(this.id.abusePlaceHolderId)){$(this.id.abusePlaceHolderId).destroy();}}
else{var phSpan=new Element('span',{'id':this.id.abusePlaceHolderId,'html':'&nbsp;','style':'float: left; margin-left: 10px; width: 76px;'});phSpan.inject($(this.id.abuseLinkId),'before');$(this.id.abuseLinkId).setStyle('display','none');}},updateCaption:function(){if(this.slides[this.currentSlideIndex].type==='image'){var newCaption=this.slides[this.currentSlideIndex].name;var caption=new Element('p',{'id':this.id.captionId,'text':newCaption});var captionBackground=new Element('div',{'id':'captionBackground'});captionBackground.setStyle('background','#000 none repeat scroll 0 0');captionBackground.set('opacity','.50');this.currentSlideDiv.grab(captionBackground);this.currentSlideDiv.grab(caption);}},setCaptionBackground:function(){if($(this.id.captionBackgroundId)){$(this.id.captionBackgroundId).setStyle('background','#000 none repeat scroll 0 0');$(this.id.captionBackgroundId).set('opacity','.50');}},initFirstSlide:function(){if(this.currentSlideDiv.getElement('img')){slideImage=this.currentSlideDiv.getElement('img');Citysearch.Slideshow.verticalCenterSlide(slideImage);slideImage.addEvent('load',function(){Citysearch.Slideshow.verticalCenterSlide(this);});window.addEvent('domready',function(){Citysearch.Slideshow.verticalCenterSlide();});window.addEvent('load',function(){Citysearch.Slideshow.verticalCenterSlide();});}
else if(this.slides[0].type==='video'){this.currentSlideDiv.setStyle('height',this.defaults.slideshowVideoHeight);}},verticalCenterSlide:function(){var slide={};var slideContent;if(arguments[0]){slide.type='image';slideContent=arguments[0];}
else{slide=this.slides[this.currentSlideIndex];if($(slide.obj.id)){slideContent=$(slide.obj.id);}
else{return;}}
var obj_height;if(slide.type==='image'){this.currentSlideDiv.setStyle('height',this.defaults.slideshowPhotoHeight);obj_height=slideContent.getSize().y;}
else{this.currentSlideDiv.setStyle('height',this.defaults.slideshowVideoHeight);obj_height=241;}
if(obj_height===0){return;}
if(obj_height<this.defaults.slideshowPhotoHeight){var slideTop=(this.defaults.slideshowPhotoHeight-obj_height)/2;slideContent.setStyles({'position':'relative','top':slideTop});}}};Citysearch.OwnersMessage={id:{printCouponsLinkId:'printCouponsLink',allCouponsLinkId:'allCouponsLink',peripheralOwnerMessageId:'peripheralOwnerMessage',peripheralReviewsId:'peripheralReviews'},init:function(){if(Citysearch.logging>=3){console.info("INFO: Citysearch.OwnersMessage.init");}
if(Citysearch.TempConfig.OwnersMessage){$extend(this,Citysearch.TempConfig.OwnersMessage);Citysearch.TempConfig.OwnersMessage=null;this.loadPeripheralContent();}
this.hijaxPrintLinks();},hijaxPrintLinks:function(){if($(this.id.printCouponsLinkId)){$(this.id.printCouponsLinkId).addEvent('click',function(e){e.preventDefault();var hijaxedHref=Citysearch.AjaxInit.hijaxHref(this.href);Citysearch.ModalWindow.fireNewModal(hijaxedHref,Citysearch.Text.Main.couponTitle,{'loadingWidth':665});Citysearch.TempConfig.printNow=true;});}
if($(this.id.allCouponsLinkId)){$(this.id.allCouponsLinkId).addEvent('click',function(e){e.preventDefault();var hijaxedHref=Citysearch.AjaxInit.hijaxHref(this.href);Citysearch.ModalWindow.fireNewModal(hijaxedHref,Citysearch.Text.Main.couponTitle);Citysearch.TempConfig.printNow=false;});}},loadPeripheralContent:function(){if($(this.id.peripheralOwnerMessageId)||$(this.id.peripheralReviewsId)){var externalContent=new Element('div');$('content').grab(externalContent);Citysearch.AjaxInit.getViaAjax(this.externalContentPath,externalContent);}}};if($('extendedInfo')){Citysearch.PreDom.list.unshift(Citysearch.ExtendedInfo.init.bind(Citysearch.ExtendedInfo));}
if($('overviewTabContents')){Citysearch.PreDom.list.unshift(Citysearch.ProfileOverview.init.bind(Citysearch.ProfileOverview));}
Citysearch.PreDom.list.unshift(Citysearch.ProfileTabs.init.bind(Citysearch.ProfileTabs));Citysearch.PreDom.list.unshift(Citysearch.OwnersMessage.init.bind(Citysearch.OwnersMessage));Citysearch.PreDom.list.unshift(Citysearch.CoreInfo.init.bind(Citysearch.CoreInfo));Citysearch.PreDom.list.push(Citysearch.Slideshow.init.bind(Citysearch.Slideshow));