
var js_regExp=/<\/?[^>]+>/gi;var js_app_domain='';var js_trackquery='&amp;ref=nf';function js_replace_tags(xStr){xStr=xStr.replace(js_regExp,"");return xStr;}
function GotoFacebookLogin(a,url,guest){var url=url||(a&&a.href)||(parent&&parent.location.href)||'';if(url.toString().toLowerCase().indexOf('/facebook/login')>0||url.toString().toLowerCase().indexOf('/facebook/logout')>0){url='/Restaurant/index.htm?rnd='+Math.random();}
if(parent&&(parent!=window)){window.open('/Facebook/login.htm?loginurl='+escape(urlrn(url)).replace(/\//g,'%2f'),'_top');}
else{js_facebook_popuplogin(function(){window.open('/Facebook/postlogin.htm?loginurl='+escape(urlrn(url)).replace(/\//g,'%2f'),'_top');},1);}
return false;}
function GotoFacebookLogout(a,url,guest){var url=url||(a&&a.href)||(parent&&parent.location.href)||'';if(url.toString().toLowerCase().indexOf('/facebook/login')>0||url.toString().toLowerCase().indexOf('/facebook/logout')>0){url='/Restaurant/index.htm?rnd='+Math.random();}
url='/MemberLogin/logout.htm?logouturl='+escape(urlrn(url)).replace(/\//g,'%2f');if(parent&&(parent!=window)){window.open('/Facebook/logout.htm?logouturl='+escape(urlrn(url)).replace(/\//g,'%2f'),'_top');}
else{js_facebook_logout(url);}
return false;}
function js_facebook_logout(url){if(!js_facebook_init()){setTimeout(function(){js_facebook_logout(url)},100);}
else{url=url?url:'/MemberLogin/logout.htm';FB.ensureInit(function(){FB.Connect.logout(function(){window.open(url,'_self');});});}
return false;}
function js_facebook_popuplogin(callback,tryTimes){if(!js_facebook_init()){if(tryTimes++>=50){alert("對不起, 未能連結至Facebook。 請稍後重試。");return;}
setTimeout(function(){js_facebook_popuplogin(callback,tryTimes)},100);}
else{FB.ensureInit(function(){if(!callback)
FB.Connect.requireSession(js_logindo);else
FB.Connect.requireSession(callback);});}}
function js_logindo(){window.open('/Facebook/postlogin.htm?rnd='+Math.random(),'_self');}
function js_facebook_publish_myreview(restname,restid,distname,distid,reviewtitle,reviewbody,reviewthumb,reviewid){reviewtitle=js_replace_tags(reviewtitle);restname=js_replace_tags(restname);distname=js_replace_tags(distname);restid=js_replace_tags(restid);distid=js_replace_tags(distid);reviewid=js_replace_tags(reviewid);reviewbody=reviewbody?js_replace_tags(reviewbody.toString()):'';reviewthumb=(reviewthumb.length>0)?js_getdomain()+reviewthumb+'?'+js_trackquery:js_getdomain()+'/Images/Header/logo.gif?'+js_trackquery;if(reviewbody.length>199){reviewbody=reviewbody.substring(0,199)+'...';}
var reviewurl=js_getdomain()+'/restaurant/commentdetail.htm?commentid='+reviewid+js_trackquery;var reviewmain='<a target="openrice" href="'+reviewurl+'">'+reviewtitle+'</a><br/>';reviewmain+='<a target="openrice" href="'+js_getdomain()+'/restaurant/sr2.htm?shopid='+restid+js_trackquery+'">'+restname+'</a> ('+'<a target="openrice" href="http://www.openrice.com/restaurant/sr1.htm?s=1&district_id='+distid+js_trackquery+'">'+distname+'</a>)<br/>';reviewmain+=reviewbody;var template_data={"reviewmain":reviewmain,"images":[{"src":reviewthumb,"href":reviewurl}]};js_facebook_publish_feed_story(118250926962,template_data);}
function js_facebook_publish_myrestaurant(restname,restid,distname,distid,restaddr,restthumb,cuisinechinese){restname=js_replace_tags(restname);restaddr=js_replace_tags(restaddr);distname=js_replace_tags(distname);restid=js_replace_tags(restid);distid=js_replace_tags(distid);restthumb=(restthumb.length>0)?js_getdomain()+restthumb+'?'+js_trackquery:js_getdomain()+'/Images/Header/logo.gif?'+js_trackquery;var resturl=js_getdomain()+'/restaurant/sr2.htm?shopid='+restid+js_trackquery;var templatebody='<a target="openrice" href="'+resturl+'">'+restname+'</a> ('+'<a target="openrice" href="'+js_getdomain()+'/restaurant/sr1.htm?s=1&district_id='+distid+js_trackquery+'">'+distname+'</a>)<br/>';if(cuisinechinese.toString().length>0)
templatebody+='類別:'+cuisinechinese+'<br/>';if(restaddr.toString().length>0)
templatebody+='地址:'+restaddr;var template_data={"templatebody":templatebody,"images":[{"src":restthumb,"href":resturl}]};js_facebook_publish_feed_story(118250521962,template_data);}
function js_facebook_publish_coupon(couponid,titlechinese,subtitlechinese,restname,couponthumb){couponid=js_replace_tags(couponid);titlechinese=js_replace_tags(titlechinese);subtitlechinese=js_replace_tags(subtitlechinese);restname=js_replace_tags(restname);couponthumb=(couponthumb.length>0)?js_getdomain()+couponthumb+'?'+js_trackquery:js_getdomain()+'/Images/Header/logo.gif?'+js_trackquery;var couponurl=js_getdomain()+'/coupon/detail.htm?CouponId='+couponid+js_trackquery;var templatebody='<a target="openrice" href="'+couponurl+'">'+restname+'</a><br/>';if(titlechinese.toString().length>0)
templatebody+=titlechinese+'<br/>';if(subtitlechinese.toString().length>0)
templatebody+=subtitlechinese;var template_data={"templatebody":templatebody,"images":[{"src":couponthumb,"href":couponurl}]};js_facebook_publish_feed_story(108113798053,template_data);}
function js_facebook_publish_feed_story(template_id,template_data){if(!js_facebook_init()){setTimeout(function(){js_facebook_publish_feed_story(template_id,template_data)},100);}
else{FB.ensureInit(function(){FB.Connect.showFeedDialog(template_id,template_data);});}}
function js_facebook_init(){if(window.FBinited){return true;}
else if(window.FB&&!window.FBinited){FB.init("d75611f347fa9ab5044cbe77158995dc","/xd_receiver.html");FBinited={};return true;}
return false;}
function js_facebook_checkSessionState(){if(!js_facebook_init()){setTimeout(function(){js_facebook_checkSessionState()},100);}
else{FB.ensureInit(function(){FB.Facebook.get_sessionState().waitUntilReady(function(session){var is_now_logged_into_facebook=session?true:false;});});}}
function js_facebook_waitinit(){if(!js_facebook_init()){setTimeout(function(){js_facebook_waitinit()},100);}}
function js_getdomain(){if(js_app_domain.length>0)
return js_app_domain;var js_protocol=(("https:"==document.location.protocol)?"https://":"http://");js_app_domain=js_protocol+document.domain;return js_app_domain;}
function js_facebook_publish_fbcoupon(totalscore,result,testtitle,couponformurl,resultlogosrc,fbfirstname,publishcontent){totalscore=js_replace_tags(totalscore);var templatetitle=testtitle;var testresult=result;var templatecouonformurl=couponformurl;var orlogo=js_getdomain()+'/Images/Marketing/FBConnectCoupon/orlogo_fbpublish.gif?'+js_trackquery;var orurl=js_getdomain()+'/restaurant/index.htm?'+js_trackquery;var resultlogo=resultlogosrc;var templatebody='<br/>'+publishcontent;var template_data={"templatebody":templatebody,"testtitle":templatetitle,"testresult":testresult,"couponform":templatecouonformurl,"images":[{"src":orlogo,"href":orurl},{"src":resultlogo,"href":templatecouonformurl}]};js_facebook_publish_feed_story(132786576962,template_data);}
function js_facebook_publish_flashgame(level,score,ranking,gametitle,flashgameurl,resultlogosrc,fbpublishbody){var level=level;var score=score;var gametitle=gametitle;var flashgameurl=js_getdomain()+'/info/10th/game/game.html';var resultlogosrc=resultlogosrc;var orlogo=js_getdomain()+'/info/10th/images/orlogo.gif?'+js_trackquery;var orurl=js_getdomain()+'/restaurant/index.htm?'+js_trackquery;var resultlogo=resultlogosrc;var templatebody='<br/>'+fbpublishbody;var template_data={"flashgameurl":flashgameurl,"gametitle":gametitle,"level":level,"score":score,"templatebody":templatebody,"images":[{"src":orlogo,"href":orurl},{"src":resultlogo,"href":flashgameurl}]};js_facebook_publish_feed_story(136614890793,template_data);}