var businessProfile=null;
var reGeoCode=false;
var startID=0;
function initPage(){
if($("photosPanel")&&$("photo-album")){
try{
photoCarousel=new UI.Carousel("photosPanel",{direction:"vertical"});
}
catch(exception){
}
}else{
if($("mycarousel")){
$("mycarousel").down(".previous_button").hide();
$("mycarousel").down(".next_button").hide();
}
}
businessProfile=getCurrentBusinessProfile();
businessProfile.CategoryKeywords="";
if(businessProfile==null){
headerShowErrorMessage("Sorry, unable to retrieve business profile details at this point. Please try again later.");
return;
}else{
try{
renderContent();
}
catch(exception){
}
}
if(window.tagArray){
new Autocompleter.Local("txtTags","tag_list",window.tagArray,{afterUpdateElement:tagAutocompleterCallback,minChars:1});
}
if(frames["graphFrame"]&&frames["graphFrame"].window&&frames["graphFrame"].window.initPage){
frames["graphFrame"].window.initPage();
if(frames["graphFrame"].window.graphTotalConnections==0&&frames["graphFrame"].window.graphSharedConnections==0){
$("peopleCenteringContainer").hide();
$("noConnectionMessage").show();
}
}
loadActions();
if(window.hasYelp){
if(window.hasYelp){
toggleBuzzContent("yelp");
}else{
toggleBuzzContent("centerd");
}
}else{
toggleBuzzContent("centerd");
}
}
function renderContent(){
try{
var fa=new fatdoorImage();
fa.initialize("ProfileImageSource",businessProfile.ProfileImagePath.replace("thumbnail","standard"),ID,"b",businessProfile.BusinessName,businessProfile.PrimaryCity+", "+businessProfile.State,businessProfile.Web,void (0));
}
catch(everything){
if(businessProfile.ProfileImagePath!=null&&businessProfile.ProfileImagePath!=""){
if(productionMode=="True"){
businessProfile.ProfileImagePath=businessProfile.ProfileImagePath.replace(/fatdoortest./gi,"fatdoor.");
}
if($("ProfileImageSource")){
$("ProfileImageSource").src=removeXSS(unescape(businessProfile.ProfileImagePath));
}
}else{
if($("ProfileImageSource")){
$("ProfileImageSource").src=fa.defaultImage();
}
}
}
}
function saveProfile(_2,_3){
var _4=rootPath+"async/businessprofile.aspx?eid="+FDAsyncCore.GetExecutionID();
var _5="ID="+businessProfile.ID+"&";
_5=_5+"Action="+_2+"&";
_5=_5+"AccountID="+businessProfile.ID+"&";
if(_2="AddTag"||_2=="RemoveTag"){
_5=_5+"Data="+removeXSS(escape(_3))+"&";
}else{
_5=_5+"Data="+removeXSS(escape(_3))+"&";
}
var _6=function(t){
try{
var r=eval(t.responseText);
if(r[0]==true){
headerShowErrorMessage(r[2],true,r[1]);
}else{
headerShowErrorMessage("Error in updating this page. Please try again later.",true,"Error");
}
}
catch(evrthng){
headerShowErrorMessage("Error in updating this page. Please try again later.",true,"Error");
}
};
var _9=new Ajax.Request(_4,{method:"post",asynchronous:true,postBody:_5,onSuccess:_6,onFailure:_6});
}
function initImageUpload(){
if(!ensureLogin()){
return;
}
window.fatDoorModalDialogCallback=selectedImage;
var _a=businessProfile.BusinessName+","+businessProfile.PrimaryCity+","+businessProfile.State;
var _b="";
if(businessProfile.Web){
_b="&imageSearch="+businessProfile.Web;
}
headerShowModalDialog(rootPath+"async/uploadimages.aspx?profileID="+businessProfile.ID+""+_b+"&query="+_a+"&isDefault="+isDefaultImage+"&eid="+FDAsyncCore.GetExecutionID(),660,775,false);
}
function selectedImage(_c){
headerHideModalDialog();
window.location.href=window.location.href;
}
function newComment(_d){
var _e="&addBiz=1";
if(!ensureLogin(_e)){
return;
}
if($("connectedButtonContainer")){
$("connectedButtonContainer").hide();
}
if($("imafanbutton")){
$("imafanbutton").innerHTML="Saving...";
}
if($("A5")){
$("A5").hide();
}
var _f=rootPath+"business/profile/newcomment.aspx?id="+businessProfile.ID;
new Ajax.Request(_f,{method:"get",onSuccess:addConfirm,onFailure:addConfirm});
}
function addConfirm(){
headerShowErrorMessage(businessProfile.BusinessName+" has been added to your places...",true,"Info");
var _10=document.location.href.replace(/addbiz/gi,"ab");
document.location.href=_10;
}
function removeFandom(){
if($("removeFan-detailsTab")){
$("removeFan-detailsTab").hide();
}
if($("RemoveFan-FansTab")){
$("RemoveFan-FansTab").hide();
}
headerShowErrorMessage("Removing "+businessProfile.BusinessName+"from your places...",true,"");
var url=rootPath+"business/profile/newcomment.aspx?id="+businessProfile.ID+"&type=remove";
var _12=function(){
document.location.reload();
};
new Ajax.Request(url,{method:"get",onSuccess:_12,onFailure:_12});
}
function tagOnEnter(e){
if(e&&e.keyCode&&e.keyCode==13){
var _14="";
try{
if(e.srcElement){
_14=e.srcElement.id;
}else{
_14=e.target.id;
}
}
catch(exception){
return false;
}
addTag();
return false;
}else{
return true;
}
}
function addTag(){
var _15="&addTags="+removeXSS($F("txtTags"));
if(!ensureLogin(_15)){
return;
}
var _16="";
_16=removeXSS($F("txtTags"));
if(_16==null||__scrubWhiteSpace(_16)==""){
headerShowErrorMessage("Tag must not be empty",true,"Error");
return;
}
s=um1.UpdateField(businessProfile,"CategoryKeywords",escape(_16));
if(s!=true){
headerShowErrorMessage("Sorry, error in updating data. Please try again later.");
return;
}else{
var _17=_16.split(",");
for(var i=0;i<_17.length;i++){
var _19=__scrubWhiteSpace(_17[i]);
_19=_19.toLowerCase();
if($("li"+_19)){
var fsz=$("li"+_19).style.fontSize;
if(fsz){
var _1b=fsz.replace(/em/g,"");
var sz=_1b*1+0.1;
$("li"+_19).style.fontSize=sz+"em";
}
}else{
var _1d="<span style='font-size: 1.0em;' id='li@tag'><a href='@roottags/@adr,-@city,-@state,-@zip/@tag' style='padding: 1px 3px 15px 1px;'><strong><span style='text-transform: capitalize;'>@tag</span></strong></a></span>";
_1d=_1d.replace(/@tag/g,_19);
_1d=_1d.replace(/@root/g,rootPath);
_1d=_1d.replace(/@adr/g,businessProfile.AddressLine.toLowerCase().replace(/ /g,"-"));
_1d=_1d.replace(/@city/g,businessProfile.PrimaryCity.toLowerCase().replace(/ /g,"-"));
_1d=_1d.replace(/@state/g,businessProfile.State);
_1d=_1d.replace(/@zip/g,businessProfile.PostalCode);
$("tagUL").innerHTML=$("tagUL").innerHTML+_1d;
}
}
$("txtTags").value="";
saveProfile("AddTag",_16);
}
}
function removeTag(tag){
tags=unescape(tags);
var ts=tags.split(",");
var tsl=ts.length;
tags="";
tag=unescape(tag);
var _21=false;
for(var i=0;i<tsl;i++){
var _23=__scrubWhiteSpace(ts[i]);
if(_23==tag&&!_21){
_21=true;
continue;
}
if(tags!=null&&tags!=""){
tags+=",";
}
tags+=_23;
}
businessProfile.CategoryKeywords=tags;
saveProfile("RemoveTag",tag);
}
function printElapsedTime(_24){
var _25=1000*60*60*24;
var _26=_24.getTime();
var now=new Date();
var _28=now.getTime();
var _29=(_28-_26)/_25;
timezoneOffset=now.getTimezoneOffset()/60;
_29+=timezoneOffset/24;
var hrs=24*(_29-Math.floor(_29));
if(_29<1){
var _2b=this.numHrsToday();
if(_2b<hrs){
return "yesterday";
}else{
flHrs=Math.floor(hrs+0.5);
if(flHrs==0){
return (" < an hour ago");
}else{
if(flHrs==1){
return (flHrs+" hour ago");
}else{
return (flHrs+" hours ago");
}
}
}
}else{
var _2c=Math.floor(_29+0.5);
if(_2c==1){
return ("yesterday");
}else{
if(_2c<365){
var _2d=Math.floor(_2c/30);
if(_2d<1){
return (_2c+" days ago");
}else{
if(_2d==1){
return (_2d+" month ago");
}else{
return (_2d+" months ago");
}
}
}else{
var _2e=Math.floor(_2c/365);
var _2d=Math.floor((_2c%365)/30);
var _2f=_2e+" year";
if(_2e>1){
_2f=_2f.replace("year","years");
}
if(_2d>0){
_2f+=" "+_2d+" month ago";
}
if(_2d>1){
_2f=_2f.replace("month","months");
}
return _2f;
}
}
}
}
function numHrsToday(){
var _30=1000*60*60;
var dt=new Date();
var dt0=new Date();
dt0.setHours(0,0,0);
return (dt.getTime()-dt0.getTime())/_30;
}
function addBizComment(){
if(headerCurrentUserProfileID!=null&&headerCurrentUserProfileID!=""){
$("commentLoading").show();
$("addCommentButton").style.display="none";
var _33=$("addComment").value;
var url=rootPath+"business/profile/newcomment.aspx?id="+businessProfile.ID+"&type=comment";
var _35="comment="+_33;
new Ajax.Request(url,{method:"post",postBody:_35,onSuccess:addCommentComplete,onFailure:addCommentComplete});
}else{
headerShowErrorMessage("You must be logged in to add a comment",true,"Error");
var _36="Join Center'd!";
var _37="In order to save, tag, and share recommendations on your favorite places, you need to have an account with us.";
var _38="?CallingPage="+rootPath+"/business/profile/?id="+businessProfile.ID+"%!comment="+$("addComment").value+"%!asyncAct=addComment";
headerShowModalDialog(authRootDomain+"auth/signinPrompt.aspx"+_38+"&SignupHeadingMessage="+_36+"&MarketingMessage="+_37,295,425,false);
}
}
function addCommentComplete(t){
var _3a=$("addComment").value;
generateAsyncCommentMarkup(_3a);
}
function generateAsyncCommentMarkup(_3b){
_3b=unescape(_3b);
var _3c="<div class='line-spots'>";
_3c+="<a href='"+profileUrl+"'><div class = 'pic' style='background:url("+imageurl+") center no-repeat;float:left;clear:left;border: 1px solid rgb(224, 224, 224); padding: 2px;'></div></a>";
_3c+="<div><div class = 'arrow-container'><div class='speach-arrow'></div></div>";
_3c+="<div style='margin-left:74px;'><div class='bubble-top'><div class='bubble-tr'></div></div>";
_3c+="<div class='bubble-middle'><div class='bubble-message'><a href = '"+profileUrl+"'>You </a> just commented and said <br/><small>"+_3b+"&nbsp</small>";
_3c+="<span class='sp-gray'>(Just now)</span></div></div>";
_3c+="<div class='bubble-bottom'><div class='bubble-br'></div></div></div></div>";
_3c+="</div>";
$("addComment").value="";
$("newCommentContainer").innerHTML=_3c;
$("commentLoading").hide();
$("addCommentButton").show();
$("bethefirsttocomment").hide();
headerShowErrorMessage("Your comment has been added",true);
}
function ensureLogin(_3d){
if(!_3d){
_3d="";
}
if(bUserSignedIn=="False"){
var _3e="Join Center'd!";
var _3f="In order to save, tag, and share recommendations on your favorite places, you need to have an account with us.";
var _40="?CallingPage="+rootPath+"/business/profile/?id="+businessProfile.ID+_3d.replace("&","%!");
headerShowModalDialog(authRootDomain+"auth/signinPrompt.aspx"+_40+"&SignupHeadingMessage="+_3e+"&MarketingMessage="+_3f,295,425,false);
return false;
}
return true;
}
function ongraphPageLoad(_41){
if(_41.allConnections){
if($("fancount")){
$("fancount").innerHTML=" "+_41.allConnections+" fans";
}
}
if(_41.allConnections<=0){
$("peopleCenteringContainer").hide();
$("noConnectionMessage").show();
}else{
$("peopleCenteringContainer").show();
$("noConnectionMessage").hide();
}
}
function share(){
headerShowSendWidget(document.location.href,"Center'd on "+businessProfile.BusinessName,"page","",true);
}
function toggleBuzzContent(id){
return;
for(var i=0;i<sourceList.length;i++){
if(sourceList[i]==id){
$(sourceList[i]+"_c").style.backgroundColor="#e0e0e0";
$(sourceList[i]+"_content").style.display="block";
$(sourceList[i]+"_radio").checked="checked";
}else{
$(sourceList[i]+"_c").style.backgroundColor="#fff";
$(sourceList[i]+"_content").hide();
$(sourceList[i]+"_radio").checked="";
}
}
}
function MakeDefaultBusinessImage(_44){
headerShowErrorMessage("Updating cover...");
var url=rootPath+"business/profile/default.aspx?id="+businessProfile.ID+"&pid="+_44+"&act=updateImage";
var _46=rootPath+"business/profile/default.aspx?id="+businessProfile.ID+"&s=photos&rand="+Math.floor(Math.random()*100000);
var _47=function(){
headerShowErrorMessage("Album cover has been updated.");
document.location.href=_46;
};
var _48=function(){
headerShowErrorMessage("There was a problem updating the cover.  Please try again","Error");
};
var _49=new Ajax.Request(url,{method:"post",asynchronous:true,onSuccess:_47,onFailure:_48});
}
function DeleteCurrentImage(_4a,_4b){
var url=rootPath+"business/profile/default.aspx?id="+businessProfile.ID+"&pid="+_4a+"&act=deleteImage&eid="+FDAsyncCore.GetExecutionID();
var _4d=function(){
document.location.href=_4b;
};
var _4e=new Ajax.Request(url,{method:"post",asynchronous:true,onSuccess:_4d,onFailure:function(){
}});
}
function toggleFeatureSection(id){
if($(id).style.display=="none"){
Effect.SlideDown(id);
}else{
Effect.SlideUp(id);
}
}
function gotoOpenTable(_50){
if(!_50){
_50=businessProfile.PostalCode;
}
var url="http://www.kqzyfj.com/interactive/?location="+_50.split("-")[0]+"&aid=10416295&pid=2888397&url=http://www.fandango.com/redirect.aspx";
window.open(url);
}
function embedSnippet(_52){
embedWidget("embedsnippetbox","centerd_snippet_widget",rootPath+"js/CreateSnippetWidget.js?v=1.0","profileFeaturesContent");
}
function embedStyle(){
embedWidget("embedstyleBox","centerd_style_widget",rootPath+"js/createstylewidget.js?v=1.0","styleswidgetembed");
}
function embedWidget(_53,_54,_55,_56){
hideSnipetBoxes();
var box=$(_53);
var _58="<div class=\""+_54+"\">\r\n\t<script>\r\n\t\tcenterd_style_wgt_bizid=\""+businessProfile.ID+"\"";
if(rdm){
_58+="\r\n\t\tcenterd_style_wgt_domain = \""+rdm+"\"";
}
_58+="\r\n\t</script>\r\n\t <script src = \""+_55+"\"></script>";
_58+="\r\n\t"+generatewidgetBottomLinks(_56);
_58+="\r\n\r\n</div>";
box.down("textarea").value=_58;
box.show();
}
function hideSnipetBoxes(){
var _59=$$(".embedbox");
for(var i=0;i<_59.length;i++){
_59[i].hide();
}
}
function generatewidgetBottomLinks(_5b){
return "<div class='bottom-links'>more info at <a class='centerd-link' href = '"+pdpurl+"' target='_blank'>Center'd</a> | <a class='grabthis' target='_blank' rel='nofollow' href = '"+pdpurl+"#"+_5b+"'>Grab this</a></div>";
}
function closeembedbox(_5c){
_5c.up(".embedbox").hide();
}
function tagAutocompleterCallback(_5d,_5e){
}

