function topOfElement(elementId){
var obj=document.getElementById(elementId);
if(!obj){
return 0;}
var offset=0;
while(obj.offsetParent){
offset+=obj.offsetTop;
obj=obj.offsetParent;}
return(offset);}
var BlogDisplay={
"ScrollToArchives":function BlogDisplay_ScrollToArchives(){
scrollTo(0,topOfElement('archivesTop')-10);
if(window.domain===-1||window.domain===5){
return false;}
else{
return true;}},
"toggleArchive":function toggleArchive(premiumBlogID,year,month){
var id;
var imageId;
if(!!month){
id=year+'_'+month+'_postList';
imageId=year+'_'+month+'_imageTag';}
else{
id=year+'_postList';
imageId=year+'_imageTag';}
var ele=document.getElementById(id);
if(!!ele){
if(ele.style.display=='none'){
var image=document.getElementById(imageId);
if(!!month&&ele.innerHTML===''){
var params={};
params['pblogid']=premiumBlogID;
params['year']=year;
params['month']=month;
new Ajax.Updater(id,'ArchiveBlogListHandler.ashx',{
"method":"post",
"parameters":params,
"onSuccess":function(){ele.style.display='block';image.className="icon_arrow_blue_down";}});}
else{
ele.style.display='block';
if(image){
image.className="icon_arrow_blue_down";}}}
else{
ele.style.display='none';
var image=document.getElementById(imageId);
if(image){
image.className="icon_arrow_blue_up";}}}},
"scrollToPreview":function scrollToPreview(element){
window.scrollTo(0,topOfElement(element));},
"scrollToMogu":function(postId){
if(typeof isPOPopped!="undefined"&&!!isPOPopped){
document.getElementById('BlogPurchasedEventLandmark').nextSibling.nextSibling.value=postId;
AnimObject.showOptin();
BlogDisplay.ShowModalCurtain();
var curtain=window.document.getElementById("ModalCurtain");
curtain.style.background="#000";
curtain.style.opacity="0.5";
curtain.style.filter="alpha(opacity=50)";}
return false;},
"GoToSA":function GoToSA(url){
window.location=url;
parent.browser.bringToFocus();},
"CloseBlog":function BlogDisplay_CloseBlog(){
if(window==window.top){
window.location="http://www.fanbox.com/socnet/Desktop.aspx?skipSplash=1&opg=http%3A%2F%2Fprofile.fanbox.com%2FPremiumBlogs%2FAPB_SA.aspx";}
else{
var windowID=BlogDisplay.GetCurrentWindowID();
if(!(isNaN(windowID))){
window.parent.setfocus('',false);
window.parent.WindowManager.GetWindowByWindowID(windowID).Close();}
else{
var problem=new Error();
problem.message="The window cannot be closed because the window ID is absent.";
throw problem;}}},
"TryCloseBlog":function BlogDisplay_TryCloseBlog(){
if(userHasRated){
return true;}
else{
BlogDisplay.ShowRatingDiv(true);
return false;}},
"GetCurrentWindowID":function BlogDisplay_GetCurrentWindowID(){
var windowName=window.name;
var windowIndex=windowName.indexOf("frm");
if(windowIndex!==-1){
return parseInt(windowName.substr(windowIndex+3),10);}
else{
return NaN;}},
"UpdateDesktopWindowTitleBar":function BlogDisplay_UpdateDesktopWindowTitleBar(title){
if((window!=window.top)&&(!!window.parent.WindowManager)){
var windowID=BlogDisplay.GetCurrentWindowID();
if(!(isNaN(windowID))){
window.parent.WindowManager.GetWindowByWindowID(windowID).SetTitle(title);}
else{
var problem=new Error();
problem.message="The window title cannot be changed because the window ID is absent.";
throw problem;}}},
"ShowPosts":function BlogDisplay_ShowPosts(){
window.document.getElementById("BlogPostsSection").style.display="block";
window.document.getElementById("ShopperBlogPreviewShowSection").style.display="none";
window.document.getElementById("ShopperBlogPreviewHideSection").style.display="block";
window.document.getElementById("showPreview").style.display="none";
window.document.getElementById("hidePreview").style.display="block";
window.document.getElementById("BlogTagSection").style.display="block";
window.document.getElementById("ArchiveContainer").style.display="block";
window.document.getElementById("BlogPostsVisibleLandmark").nextSibling.checked=true;
return false;},
"HidePosts":function BlogDisplay_HidePosts(){
window.document.getElementById("BlogPostsSection").style.display="none";
window.document.getElementById("ShopperBlogPreviewShowSection").style.display="block";
window.document.getElementById("ShopperBlogPreviewHideSection").style.display="none";
window.document.getElementById("showPreview").style.display="block";
window.document.getElementById("hidePreview").style.display="none";
window.document.getElementById("BlogTagSection").style.display="none";
window.document.getElementById("ArchiveContainer").style.display="none";
window.document.getElementById("BlogPostsVisibleLandmark").nextSibling.checked=false;
return false;},
"ShowRatingDiv":function BlogDisplay_ShowRatingDiv(closeAfter){
var currentRating=parseInt(window.document.getElementById("ParticipantBlogPersonalRatingCurrentScore").value,10);
if(currentRating===0){
window.document.getElementById("ParticipantBlogPersonalRatingNewIntroduction").style.display="block";
window.document.getElementById("ParticipantPersonalBlogRatingNewLabel").style.display="inline";
window.document.getElementById("ParticipantBlogPersonalRatingExistingIntroduction").style.display="none";
window.document.getElementById("ParticipantBlogPersonalRatingExistingInstruction").style.visibility="hidden";}
else{
window.document.getElementById("ParticipantBlogPersonalRatingNewIntroduction").style.display="none";
window.document.getElementById("ParticipantPersonalBlogRatingNewLabel").style.display="none";
window.document.getElementById("ParticipantBlogPersonalRatingExistingIntroduction").style.display="block";
window.document.getElementById("ParticipantBlogPersonalRatingExistingInstruction").style.visibility="visible";}
window.document.getElementById("ParticipantBlogPersonalReviewSection").style.display="none";
if(window.document.getElementById("ParticipantBlogPersonalRatingReviewAllowed").value==="1"){
window.document.getElementById("ParticipantBlogPersonalReviewInvitationLink").style.display="block";
window.document.getElementById("ParticipantBlogPersonalReviewClosedMessage").style.display="none";}
else{
window.document.getElementById("ParticipantBlogPersonalReviewInvitationLink").style.display="none";
window.document.getElementById("ParticipantBlogPersonalReviewClosedMessage").style.display="block";}
window.document.getElementById("ParticipantBlogPersonalReview").value="";
window.document.getElementById("ParticipantBlogPersonalReviewFeedback").firstChild.data="";
window.document.getElementById("ParticipantBlogPersonalRatingCurtainBackdrop").style.height="162px";
this.ChooseRating(currentRating);
var dialog=window.document.getElementById("ParticipantBlogPersonalRatingChild").parentNode;
dialog.style.display="block";
this.ShowModalCurtain();
BlogDisplay.ShowRating=!!closeAfter;
window.closeAfter=!!closeAfter
return false;},
"HideRatingDiv":function BlogDisplay_HideRatingDiv(){
var dialog=window.document.getElementById("ParticipantBlogPersonalRatingChild").parentNode;
dialog.style.display="none";
this.HideModalCurtain();
if(!!window.closeAfter){
BlogDisplay.CloseBlog();}
return false;},
"ShowReadReviewDiv":function BlogDisplay_ShowReadReviewDiv(){
var dialog=window.document.getElementById("reviewCollectionDiv");
dialog.style.display="block";
window.document.getElementById("reviewCollectionIframe").src="/ReviewCollection.aspx?pbid="+blogId+"&page="+page+"&link="+link+"&src="+src+"&pageno=1";
this.ShowModalCurtain();
return false;},
"HideReadReviewDiv":function BlogDisplay_HideReadReviewDiv(){
var dialog=window.document.getElementById("reviewCollectionDiv");
dialog.style.display="none";
window.document.getElementById("reviewCollectionIframe").src="about:blank";
this.HideModalCurtain();
return false;},
"SetDefaultRating":function BlogDisplay_SetDefaultRating(rating){
window.document.getElementById("ParticipantBlogPersonalRatingExistingMeterFilling").style.width=(Math.round(rating*100/5)).toString()+"%";},
"ChooseRating":function BlogDisplay_ChooseRating(rating){
window.document.getElementById("ParticipantBlogPersonalRatingNewScore").value=rating.toString();
this.SetDefaultRating(rating);
return false;},
"SaveRating":function BlogDisplay_SaveRating(premiumBlogID,rating,review,formToken,successFunction,failureFunction){
var ratingProvided=(rating>0);
var reviewProvided=(review.length!==0);
var transportPlacebo={"responseText":""};
if(ratingProvided){
new Ajax.Request("BlogDisplay.ashx",{
"method":"post",
"parameters":"action=rate&pbid="+encodeURIComponent(premiumBlogID.toString())+"&rating="+encodeURIComponent(rating.toString())+"&review="+encodeURIComponent(review)+"&token="+encodeURIComponent(formToken),
"onSuccess":successFunction,
"onFailure":failureFunction});}
else{
if(reviewProvided){
transportPlacebo.responseText="You must enter a rating with your review.";}}
if(!!failureFunction){
failureFunction(transportPlacebo);}},
"ShowPersonalReviewSection":function BlogDisplay_ShowPersonalReviewSection(){
window.document.getElementById("ParticipantBlogPersonalRatingCurtainBackdrop").style.height="278px";
window.document.getElementById("ParticipantBlogPersonalReviewSection").style.display="block";
window.document.getElementById("ParticipantBlogPersonalReviewInvitationLink").style.display="none";
window.document.getElementById("ParticipantBlogPersonalReview").focus();
return false;},
"ShowModalCurtain":function BlogDisplay_ShowModalCurtain(){
var ele=window.document.getElementById("reviewCollectionDiv");
if(ele!=null){
window.document.body.appendChild(ele);}
var curtain=window.document.getElementById("ModalCurtain");
curtain.style.display="block";
if(curtain.offsetHeight<20){
curtain.style.height=Math.max(window.document.documentElement.scrollHeight,window.document.documentElement.offsetHeight)+"px";
curtain.style.width=Math.max(window.document.documentElement.scrollWidth,window.document.documentElement.clientWidth)+"px";}
var frames=window.document.getElementsByName("mogubox");
if(frames.length!==0){
var field=window.document.createElement("INPUT");
field.className="offscreen";
window.document.body.appendChild(field);
field.focus();
window.document.body.removeChild(field);}
HideClipboards();},
"HideModalCurtain":function BlogDisplay_HideModalCurtain(){
window.document.getElementById("ModalCurtain").style.display="none";
ShowClipboards();},
"ClickFollow":function(e){
var targ=jQuery('#'+followSection);
targ.click(function(){});
var params={}
if(targ.hasClass('xmg_new')){
params['action']='follow';}
else{
params['action']='unfollow';}
if(!!pageType&&!!tpc){
params['bts']=pageType;
params['tpc']=tpc;}
params['blogid']=blogId;
jQuery.ajax({
type:'post',
url:'followblog.ashx',
data:params,
dataType:'json',
success:BlogDisplay.ClickFollowCallback});},
"ClickFollowCallback":function(jsonData){
if(jsonData.success){
BlogDisplay.ShowFollowPopUp(jsonData.action);
BlogDisplay.ToggleFollowBtn();}},
"ToggleFollowBtn":function(){
var newClass,oldClass,newVal,newTitle;
var btn=jQuery('#'+followBtn);
var container=jQuery('#'+followSection);
if(container.hasClass('xmg_new')){
oldClass='xmg_new';
newClass='xag_new';
newVal='Unfollow this blog';
newTitle='No longer receive posts from this blog via email';}
else{
oldClass='xag_new';
newClass='xmg_new';
newVal='Follow this blog';
newTitle='New posts from this blog will be sent to you via email';}
container.removeClass(oldClass).addClass(newClass).click(BlogDisplay.ClickFollow);
btn.attr('title',newTitle).val(newVal);},
"ShowFollowPopUp":function(action){
if(showFollowPopUp){
if(action=='follow'){
jQuery('#followPopUpText').text('You will receive new posts from this blog via email.');}
else{
jQuery('#followPopUpText').text('You will no longer receive new posts from this blog via email.');}
jQuery('#followPopUp').show();
BlogDisplay.PopUpTimer=setTimeout(BlogDisplay.AnimateHideFollowPopUp,3000);}},
"HideFollowPopUp":function(checkBox){
if(!isNaN(BlogDisplay.PopUpTimer)){
clearTimeout(BlogDisplay.PopUpTimer);}
if(!!checkBox&&jQuery('#followPopUpdonotshowagain').attr('checked')){
var rn=Math.random()*10000000;
var tempscript=document.createElement("script");
tempscript.src='http://www.fanbox.com/socnet/handlers/FeatureHandler.ashx?fid=12&stts=0&r='+rn;
window.document.body.appendChild(tempscript);
showFollowPopUp=false;}
jQuery('#followPopUp').fadeTo(0,100).hide();},
"AnimateHideFollowPopUp":function(){
jQuery('#followPopUp').fadeTo(1000,0,BlogDisplay.HideFollowPopUp)},
"ShowDraftPopUp":function(action){
jQuery('#whyDraft').show();},
"HideDraftPopUp":function(checkBox){
jQuery('#whyDraft').hide();}};
var GetQS=GetQS||function(){
if(!!window.document){
return window.document.location.search;}
else{
return window.location.search;}};
if(!window.domain){
var loc=GetQS().indexOf('domain=');
if(loc!==-1){
var value=GetQS().substring(loc+7);
if(value.indexOf('&')!==-1){
value=value.substring(0,value.indexOf('&'));}
window.domain=parseInt(value,10);}
else{
window.domain=-1;}}
var PBlogs={
"ShowShareDiv":function PBlogs_ShowShareDiv(){
if(window.domain!==-1&&window.domain!==5){
document.getElementById('divShare').style.display='block';
ShowModalCurtain();}
else{
BlogDisplay.ShowModalCurtain();
try{
if(window!=window.top){
window.top.coverPageWithDarkness();}}
catch(problem){}
if(!PBlogs._shareDiv){
var ifr=document.createElement('script');
ifr.type='text/javascript';
ifr.src='http://files.fbstatic.com/'+$('MasterVersion').value+'/socnet/ajaxdivs/pblog_ShareDiv.js';
document.getElementsByTagName('head')[0].appendChild(ifr);}
if(!!PBlogs._shareDiv){
PBlogs._finishShareDiv();}}},
"_finishShareDiv":function PBlogs_FinishShareDiv(){
if(window.domain===-1||window.domain===5){
PBlogs._uniqueURLInput.value=$("BlogDisplayURL").value;
PBlogs._shareDiv.style.visibility='visible';
PBlogs._shareDiv.style.zIndex=100000;}
else{
return;}},
"HideShareDiv":function(){
if(window.domain!==-1&&window.domain!==5){
HideModalCurtain();
document.getElementById('divShare').style.display='none';}
else{
BlogDisplay.HideModalCurtain();
try{
if(window!=window.top){
if(!!window.top.uncoverPageFromDarkness){
window.top.uncoverPageFromDarkness()}}}
catch(problem){}
PBlogs._shareDiv.style.visibility='hidden';}},
"ShowLearnMoreDiv":function PBlogs_ShowLearnMoreDiv(state,pblogid){
if(state!='import'&&state!='promote'){
return;}
PBlogs.LearnMoreDivState=state;
PBlogs.PBlogId=pblogid;
PBlogs.ShareURL=$("BlogDisplayURL").value;
BlogDisplay.ShowModalCurtain();
try{
if(window!=window.top){
window.top.coverPageWithDarkness();}}
catch(problem){}
if(!PBlogs._learnMoreDiv){
var ifr=document.createElement('script');
ifr.type='text/javascript';
ifr.src='http://files.fbstatic.com/'+$('MasterVersion').value+'/socnet/ajaxdivs/pblog_LearnMoreDiv.js';
document.getElementsByTagName('head')[0].appendChild(ifr);}
if(!!PBlogs._learnMoreDiv){
PBlogs._finishLearnMoreDiv();}},
"_finishLearnMoreDiv":function PBlogs_FinishLearnMoreDiv(){
if(PBlogs.LearnMoreDivState=='import'){
Blogs._learnMoreShadow.style.height='430px';
PBlogs._learnMoreTitle.innerHTML='Import your blog';
PBlogs._learnMoreImportContent.style.display='block';
PBlogs._learnMorePromoteContent.style.display='none';}
else{
PBlogs._learnMoreShadow.style.height='450px';
PBlogs._learnMoreTitle.innerHTML='Promote your blog!';
PBlogs._learnMoreURL.innerHTML=PBlogs.ShareURL;
PBlogs._learnMoreImportContent.style.display='none';
PBlogs._learnMorePromoteContent.style.display='block';}
PBlogs._learnMoreDiv.style.visibility='visible';
PBlogs._learnMoreDiv.style.zIndex=100000;},
"HideLearnMoreDiv":function(){
BlogDisplay.HideModalCurtain();
try{
if(window!=window.top){
if(!!window.top.uncoverPageFromDarkness){
window.top.uncoverPageFromDarkness()}}}
catch(problem){}
PBlogs._learnMoreDiv.style.visibility='hidden';},
"ShowSettingsDiv":function(PBlogId,link,source,pageid,fb){
if(window.location.pathname.toLowerCase().indexOf('editor')>=0||PBlogId>0){
try{
PBlogs.PBlogId=PBlogId;
PBlogs.SettingsLink=link;
PBlogs.SettingsSrc=source;
PBlogs.SettingsPgid=pageid;
PBlogs.fb=fb;
if(!PBlogs._SettingsDiv){
var ifr=document.createElement('script');
ifr.type='text/javascript';
var source='http://files.fbstatic.com/';
if(window.domain==-1||window.domain==5){
source+=top.$('MasterVersion').value;}
else{
recordActionStatistic(1,19);
source+=document.getElementById('MasterVersion').value;}
source+='/socnet/ajaxdivs/pblog_SettingsDiv.js'
ifr.src=source;
document.getElementsByTagName('head')[0].appendChild(ifr);}
else{
PBlogs._finishSettingsDiv();}}
catch(e){
HideModalCurtain();}}
else{
window.open('http://blogs.fanbox.com/Editor.aspx?elid=108&mode=LW&domain='+window.domain,'_blank');}},
"_finishSettingsDiv":function(){
if(!PBlogs._SettingsDiv){
return;}
var ifr=document.getElementById('SettingsDivIFrame');
var ifrsrc="http://www.fanbox.com/PremiumBlogs/SettingsDiv.aspx?currStep=0&nextStep=1&PBlogId="+PBlogs.PBlogId+"&lkid="+PBlogs.SettingsLink+"&src="+PBlogs.SettingsSrc+"&pageid="+PBlogs.SettingsPgid+"&fb="+PBlogs.fb;
if(window.domain>-1){
var qString=window.location.search;
ifrsrc+="&domain="+window.domain;
if(window.domain===2&&!!window.getViewerID){
var errorDiv=document.getElementById('tooManyBlogsDiv');
ifrsrc+='&euserid='+getViewerID();
if(!!errorDiv){
errorDiv.style.visibility='hidden';}
PBlogs._SettingsDiv.style.top='200px';
PBlogs._SettingsDiv.style.marginTop='0px';
if(!!viewerInfo){
ifrsrc+='&viewername='+viewerInfo.name;}}
else if(window.domain===3&&!!window.FB_RequireFeatures){
FB_RequireFeatures(["Api"],function(){
var api=new FB.ApiClient(api_key,'channel.htm',null);
ifrsrc+='&euserid='+api.get_session().uid;
var errorDiv=document.getElementById('tooManyBlogsDiv');
if(!!errorDiv){
errorDiv.style.visibility='hidden';}
PBlogs._SettingsDiv.style.top='200px';
PBlogs._SettingsDiv.style.marginTop='0px';
ifrsrc+='&viewername='+window.senderName;});}}
ifr.src=ifrsrc;
PBlogs._SettingsDiv.style.visibility='visible';
ShowModalCurtain();},
"HideSettingsDiv":function(){
PBlogs._SettingsDiv.style.visibility='hidden';
var ifr=document.getElementById('SettingsDivIFrame');
ifr.src="";
HideModalCurtain();},
"RemoveSettingsSrc":function(){
var ifr=document.getElementById('SettingsDivIFrame');
ifr.src="about:blank";},
"ShowTooManyBlogsError":function(){
CanvasHeaderCall(null,true);},
"DeletePrompt_BlogId":-1,
"DeletePrompt_Ticket":'',
"Show_DeletePrompt_Initial":function(title,blogId){
title=title||'';
PBlogs.DeletePrompt_BlogId=blogId;
if(!PBlogs._DeletePrompt_Initial){
PBlogs._DeletePrompt_Initial=document.createElement('div');
PBlogs._DeletePrompt_Initial.id='pblogs_DeletePrompt_Initial';
PBlogs._DeletePrompt_Initial.style.visibility='hidden';
PBlogs._DeletePrompt_Initial.style.zIndex='11003';
PBlogs._DeletePrompt_Initial.style.position='absolute';
PBlogs._DeletePrompt_Initial.style.left='50%';
PBlogs._DeletePrompt_Initial.style.marginLeft='-200px';
PBlogs._DeletePrompt_Initial.style.width='394px';
PBlogs._DeletePrompt_Initial.style.height='199px';
if(window.domain===2||window.domain===3){
PBlogs._DeletePrompt_Initial.style.top='200px';
PBlogs._DeletePrompt_Initial.style.marginTop='0px';
document.getElementById('content_wrapper').appendChild(PBlogs._DeletePrompt_Initial);}
else{
$('MasterDiv').appendChild(PBlogs._DeletePrompt_Initial);}}
PBlogs._DeletePrompt_Initial.innerHTML='<div style="position: absolute; top: 0; left: 0; width: 394px; z-index: 0; filter: alpha(opacity=50); -moz-opacity: 0.5; opacity: 0.5; zoom: 100%;"><div style=""><b class="dwtop"><b class="dw1"></b><b class="dw2"></b><b class="dw3"></b><b class="dw4"></b><b class="dw5"></b></b></div><div style="background-color: #434343; height: 196px;"></div><div style=""><b class="dwbottom"><b class="dw5"></b><b class="dw4"></b><b class="dw3"></b><b class="dw2"></b><b class="dw1"></b></b></div></div><div style="position: absolute; top: 10px; left: 0; width: 394px; z-index: 1;"><div class="border_blk" style="width:372px; margin: 0 auto; border-width:0px 1px 1px 1px; background-color: #fff;"><div align="left" class="widget_header" style="border-width: 1px 0;"><div class="text_12_drk_bold" style="float: left;">Are You Sure?</div><div class="btn btn_close"><a href="#" onclick="PBlogs.Hide_DeletePrompt_Initial();"><img src="http://profile.fanbox.com/themes/_images/tpxl.gif" border="0" /></a></div><div class="div_clear"></div></div><div style="padding: 14px 14px; zoom: 100%; height: 130px; text-align: left;"><div class="text_18_drk" style="font-weight:bold;color:#333;font-size:18px;text-align: center; margin-bottom: 14px;overflow:hidden;height:42px;width:344px;">You are about to delete<br />##TITLE##.</div><div class="text_18_drk" style="font-weight:bold;color:#333;font-size:18px;text-align: center;">Are you sure?</div><div style="width: 234px; margin: 20px auto 0;"><div class="btnsq" style="width: 112px; margin-right: 10px;"><input type="button" onclick="PBlogs.DeletePrompt_Initial_YesClick();" class="btn_grn_sq_m" value="YES (Delete)" style="width: 112px;" /></div><div class="btnsq" style="width: 112px;"><input type="button" class="btn_gry_sq_m" value="NO (Do not delete)" style="width: 112px;" onclick="PBlogs.Hide_DeletePrompt_Initial();" /></div><div class="div_clear"></div></div></div></div></div>'.replace('##TITLE##',title);
PBlogs._finish_DeletePrompt_Initial();},
"_finish_DeletePrompt_Initial":function(){
ShowModalCurtain();
PBlogs._DeletePrompt_Initial.style.visibility='visible';},
"Hide_DeletePrompt_Initial":function(){
PBlogs._DeletePrompt_Initial.style.visibility='hidden';
PBlogs._finishSettingsDiv();},
"DeletePrompt_Initial_YesClick":function(){
PBlogs._DeletePrompt_Initial.style.visibility='hidden';
ajaxGo('/PBLogHandler.ashx?cmd=AttemptDeleteBlog&pbid='+PBlogs.DeletePrompt_BlogId,PBlogs.DeletePrompt_Detailed_Show);},
"DeletePrompt_Detailed_Show":function(response){
if(response.readyState!==4){
return;}
var data;
if(window.domain===2){
data=gadgets.json.parse(response.responseText);}
else{
eval("data = "+response.responseText);}
var args={},
subscribers=((+data.subscriberCount)||0),
shoutouts=((+data.shoutoutCount)||0),
ticket=((data.ticket)||'');
if(shoutouts===0&&subscribers===0){
if(window.domain===2||window.domain===3){
HideModalCurtain();
CanvasHeaderCall();}
else{
top.browser.changeSrc('http://profile.fanbox.com/PremiumBlogs/Manage.aspx?delete=true');}
return;}
else{
args.truncatedTitle=data.truncatedTitle;
PBlogs.DeletePrompt_Ticket=ticket;
if(shoutouts>0){
var som='<span>&bull; <span>##COUNT##</span>&nbsp;Shout-Out##PLURAL##</span>';
args.shoutoutsMarkup=som.replace('##COUNT##',shoutouts).replace('##PLURAL##',(shoutouts===1?'':'s'));}
var sm;
if(subscribers>0&&subscribers<6){
sm='<span>&bull; <span>##COUNT##</span>&nbsp;Subscriber##PLURAL##</span>';
args.subscribersMarkup=sm.replace('##COUNT##',subscribers).replace('##PLURAL##',(subscribers===1?'':'s'));}
else if(subscribers>=6){
args.subscribersMarkup='<span>&bull; More than 5 </span> <span>Subscribers</span>';}
else{
args.subscribersMarkup='';}
if(subscribers>0&&shoutouts>0){
args.separator='<br />';}}
if(!PBlogs._DeletePrompt_Detailed){
PBlogs._DeletePrompt_Detailed=document.createElement('div');
PBlogs._DeletePrompt_Detailed.id='pblogs_DeletePrompt_Detailed';
PBlogs._DeletePrompt_Detailed.style.visibility='hidden';
PBlogs._DeletePrompt_Detailed.style.zIndex='11003';
PBlogs._DeletePrompt_Detailed.style.position='absolute';
PBlogs._DeletePrompt_Detailed.style.top='50%';
PBlogs._DeletePrompt_Detailed.style.left='50%';
PBlogs._DeletePrompt_Detailed.style.marginTop='-120px';
PBlogs._DeletePrompt_Detailed.style.marginLeft='-205px';
PBlogs._DeletePrompt_Detailed.style.width='394px';
PBlogs._DeletePrompt_Detailed.style.height='199px';
if(window.domain===2||window.domain===3){
PBlogs._DeletePrompt_Detailed.style.top='200px';
PBlogs._DeletePrompt_Detailed.style.marginTop='0px';
document.getElementById('content_wrapper').appendChild(PBlogs._DeletePrompt_Detailed);}
else{
$('MasterDiv').appendChild(PBlogs._DeletePrompt_Detailed);}}
var markup='<div style="position:absolute;top:0;margin-top:0;left:0;margin-left:0;width: 394px;"><div style="position: absolute; top: 0; left: 0; width: 394px; height: 230px; z-index: 0; filter: alpha(opacity=50); -moz-opacity: 0.5; opacity: 0.5; zoom: 100%;"><div style=""><b class="dwtop"><b class="dw1"></b><b class="dw2"></b><b class="dw3"></b><b class="dw4"></b><b class="dw5"></b></b></div><div style="background-color: #434343; height: 220px;"></div><div style=""><b class="dwbottom"><b class="dw5"></b><b class="dw4"></b><b class="dw3"></b><b class="dw2"></b><b class="dw1"></b></b></div></div><div style="position: absolute; top: 10px; left: 0; width: 394px; height: 210px; z-index: 1;"><div class="border_blk" style="width:372px; margin: 0 auto; border-width:0px 1px 1px 1px; background-color: #fff;"><div align="left" class="widget_header" style="border-width: 1px 0;"><div class="text_12_drk_bold" style="float: left;">Are You Sure?</div><div class="btn btn_close"><a href="#" onclick="PBlogs.DeletePrompt_Detailed_Hide();"><img src="http://files.fbstatic.com/themes/_images/tpxl.gif" border="0" /></a></div><div class="div_clear"></div></div><div style="padding: 14px 14px; zoom: 100%; height: 157px; text-align: left;"><div class="text_18_drk" style="font-weight:bold;color:#333;font-size:18px;text-align: center; margin-bottom: 14px;"><div id="detailed_title" style="overflow:hidden;width:344px;">##TITLE##</div> currently has:</div><div class="text_18_drk" style="font-weight:bold;color:#333;font-size:18px;text-align: left; margin: 0 0 14px 100px;">##SHOUTOUTS####SEPARATOR####SUBSCRIBERS##</div><div class="text_18_drk" style="font-weight:bold;color:#333;font-size:18px;text-align: center;">Are you sure you want to delete?</div><div style="width: 234px; margin: 5px auto 0;"><div class="btnsq" style="width: 112px; margin-right: 10px;"><input onclick="PBlogs.DeletePrompt_Detailed_YesClick();" type="button" class="btn_grn_sq_m" value="YES (Delete)" style="width: 112px;" /></div><div class="btnsq" style="width: 112px;"><input onclick="PBlogs.DeletePrompt_Detailed_Hide();" type="button" class="btn_gry_sq_m" value="NO (Do not delete)" style="width: 112px;" /></div><div class="div_clear"></div></div></div></div></div></div>';
PBlogs._DeletePrompt_Detailed.innerHTML=markup.replace('##TITLE##',args.truncatedTitle||'').replace('##SHOUTOUTS##',args.shoutoutsMarkup||'').replace('##SEPARATOR##',args.separator||'').replace('##SUBSCRIBERS##',args.subscribersMarkup||'');
PBlogs.DeletePrompt_Detailed_Finish();},
"DeletePrompt_Detailed_Finish":function(){
if(window.domain===2||window.domain===3){
ShowModalCurtain();}
else{
PBlogs.ShowModalCurtain();}
PBlogs._DeletePrompt_Detailed.style.visibility='visible';
var titleDiv=document.getElementById('detailed_title');
if(parseInt(titleDiv.parentElement.offsetHeight,10)>42){
titleDiv.style.height='21px';}},
"DeletePrompt_Detailed_Hide":function(){
PBlogs._DeletePrompt_Detailed.style.visibility='hidden';
PBlogs._finishSettingsDiv();},
"DeletePrompt_Detailed_YesClick":function(){
PBlogs._DeletePrompt_Detailed.style.visibility='hidden';
var params={
cmd:'ConfirmDeleteBlog',
pbid:PBlogs.DeletePrompt_BlogId,
'ticket':PBlogs.DeletePrompt_Ticket};
if(window.domain===2){
HideModalCurtain();
CanvasHeaderCall();
ajaxGo('/PBLogHandler.ashx?cmd=ConfirmDeleteBlog&pbid='+PBlogs.DeletePrompt_BlogId+'&ticket='+PBlogs.DeletePrompt_Ticket);}
else if(window.domain===3){
HideModalCurtain();
CanvasHeaderCall();
ajaxGo('/PBLogHandler.ashx?cmd=ConfirmDeleteBlog&pbid='+PBlogs.DeletePrompt_BlogId+'&ticket='+PBlogs.DeletePrompt_Ticket);}
else{
new Ajax.Request('http://www.fanbox.com/socnet/handlers/PBLogHandler.ashx',{
method:'post',
parameters:params});
top.browser.changeSrc('http://profile.fanbox.com/PremiumBlogs/Manage.aspx?delete=true');}}};
function tagClicked(tagName){
if(window.domain===2){
parent.tagName=tagName;
parent.DisplayMSTabs('apb_wrapper');}
else if(window.domain===3){
parent.tagName=tagName;
parent.DisplayTabs('apb_wrapper');}
else{
var url='http://www.fanbox.com/PremiumBlogs/PostSearch.aspx?search='+encodeURIComponent(tagName)+'&source=blogcontenttag'
ProfileLink_Click(url);}}
function tagClickStat(tagName,tagId,blogId){
var params={};
params['blogid']=blogId;
params['tagid']=tagId;
params['source']='BlogCanvas';
new Ajax.Request('PBlogTagStatHandler.ashx',{
'method':'post',
'parameters':params});}
function Post_SelectStart(eventDetails){
eventDetails=eventDetails||window.event;
var originElement=eventDetails.target||eventDetails.srcElement;
switch(originElement.tagName){
case "INPUT":
case "BUTTON":
case "SELECT":
case "TEXTAREA":
return true;
default:
if(!!eventDetails.preventDefault){
eventDetails.preventDefault();}
return false;}}
function Post_ContextMenu(eventDetails){
eventDetails=eventDetails||window.event;
var originElement=eventDetails.target||eventDetails.srcElement;
switch(originElement.tagName){
case "INPUT":
case "BUTTON":
case "SELECT":
case "TEXTAREA":
return true;
default:
if((eventDetails.ctrlKey)&&(eventDetails.shiftKey)){
return true;}
else{
if(!!eventDetails.preventDefault){
eventDetails.preventDefault();}
return false;}}}
function Post_KeyDown(eventDetails){
eventDetails=eventDetails||window.event;
var originElement=eventDetails.target||eventDetails.srcElement;
switch(originElement.tagName){
case "INPUT":
case "BUTTON":
case "SELECT":
case "TEXTAREA":
return true;
default:
if((eventDetails.ctrlKey)&&(eventDetails.keyCode===65)){
if(!!eventDetails.preventDefault){
eventDetails.preventDefault();}
return false;}
else{
return true;}}}
function hideAboutDiv(){
var show=document.getElementById('blogDescriptionTrunc');
var hide=document.getElementById('blogDescriptionFull');
if(!!hide&&!!show){
hide.style.display='none';
show.style.display='block';}}
function showAboutDiv(){
var hide=document.getElementById('blogDescriptionTrunc');
var show=document.getElementById('blogDescriptionFull');
if(!!hide&&!!show){
show.style.display='block';
hide.style.display='none';}}
function ShrinkBlogTitle(){
var blogTitleBookmark=window.document.getElementById("BlogTitleBookmark");
if(blogTitleBookmark!==null){
var blogTitleElement=blogTitleBookmark.nextSibling;
var targetWidth=430;
blogTitleElement.style.maxWidth="none";
for(var fontSize=37;fontSize>=12;fontSize--){
blogTitleElement.style.fontSize=fontSize.toString()+"px";
if(blogTitleElement.offsetWidth<=targetWidth){
break;}}
blogTitleElement.style.maxWidth=targetWidth.toString()+"px";
blogTitleElement.parentNode.style.visibility="visible";}}
function ProfileLink_Click(url){
var link=false;
if(!url){
url=this.href;
link=true;}
var browser;
try{
browser=window.top.browser;}
catch(problem){}
if(!!browser){
browser.openBrowser(url);
browser.bringToFocus();
return false;}
else if(link&&(window.domain===-1||window.domain===5)){
this.href=url;
this.target="_top";
return true;}
else if(!link&&(window.domain===-1||window.domain===5)){
top.window.location=url;}
else if(window.domain!==-1&&window.domain!==5){
url+='&domain='+window.domain;
var qs=GetQS();
var start=qs.indexOf('euserid=');
var end=qs.indexOf('&',start);
if(end===-1){
end=qs.length;}
url+='&euserid='+qs.slice(start,end);
if(link){
window.open(url,VL2GoController.NewWindowId||top.VL2GoController.NewWindowId);
return false;}
else{
this.href=url;
this.target="_top";
return true;}}}
function RatingFormSaveButton_Click(){
var blogID=parseInt(window.document.getElementById("ParticipantBlogPersonalRatingBlogID").value,10);
var rating=parseInt(window.document.getElementById("ParticipantBlogPersonalRatingNewScore").value,10);
var review=window.document.getElementById("ParticipantBlogPersonalReview").value;
var token=window.document.getElementById("ParticipantBlogPersonalRatingFormToken").value;
this.disabled=true;
var feedbackTextNode=window.document.getElementById("ParticipantBlogPersonalReviewFeedback").firstChild;
feedbackTextNode.data="";
BlogDisplay.SaveRating(blogID,rating,review,token,RatingFormSave_Succeeded,RatingFormSave_Failed);}
function RatingFormSave_Succeeded(transport){
window.document.getElementById("ParticipantBlogPersonalRatingCurrentScore").value=transport.responseText;
var review=window.document.getElementById("ParticipantBlogPersonalReview").value;
userHasRated=true;
BlogDisplay.HideRatingDiv();
EnableRatingForm();
if(review!=""){
window.document.getElementById("ParticipantBlogPersonalRatingReviewAllowed").value="0";
BlogDisplay.ShowReadReviewDiv();}}
function RatingFormSave_Failed(transport){
var feedbackTextNode=window.document.getElementById("ParticipantBlogPersonalReviewFeedback").firstChild;
feedbackTextNode.data=transport.responseText;
EnableRatingForm();}
function EnableRatingForm(){
window.document.getElementById("ParticipantBlogPersonalReviewSaveButton").disabled=false;}
function RepaintBlogRatingIE6(){
this.style.display="none";
this.style.display="inline-block";}
function ConfigureBlogRatingRepaintingIE6(){
if((window.navigator.appName==="Microsoft Internet Explorer")&&(window.navigator.appVersion.indexOf("MSIE 6.")!==-1)){
var links=window.document.links;
for(var index=0;index<links.length;index++){
var link=links[index];
if(link.className.indexOf("BlogRating")!==-1){
link.onmouseout=link.onblur=RepaintBlogRatingIE6;}}}}
var Clipboards=[];
function ConfigureExportToClipboardButtons(){
var exportLandmarks=window.document.getElementsByName("BlogPostExportLandmark");
if(exportLandmarks.length!==0){
if(!!window.addEventListener){
window.addEventListener("resize",ResizeClipboards,false);}
else if(!!window.attachEvent){
window.attachEvent("onresize",ResizeClipboards);}
for(var buttonIndex=0;buttonIndex<exportLandmarks.length;buttonIndex++){
var exportLandmark=exportLandmarks[buttonIndex];
var exportButton=exportLandmark.nextSibling;
var exportTextHolder=exportButton.nextSibling;
var clipboard=new ZeroClipboard.Client();
Clipboards.push(clipboard);
clipboard.BlogDiplayTargetID=exportButton.id;
clipboard.setText(exportTextHolder.value);
clipboard.addEventListener("onLoad",Clipboard_Loaded);
clipboard.addEventListener("onComplete",Clipboard_Copied);
clipboard.glue(BuildDecoyElementForClipboard(exportButton));}}}
function BuildDecoyElementForClipboard(element){
return{
"id":element.id,
"className":element.className,
"style":{
"zIndex":element.zIndex},
"width":element.offsetWidth,
"height":element.offsetHeight,
"offsetLeft":element.offsetLeft,
"offsetTop":element.offsetTop,
"offsetParent":element.offsetParent};}
function Clipboard_Loaded(clipboard){
var exportButton=window.document.getElementById(clipboard.BlogDiplayTargetID);
exportButton.disabled=false;
exportButton.title="";}
function Clipboard_Copied(clipboard){
window.document.getElementById(clipboard.BlogDiplayTargetID).click();}
function ResizeClipboards(){
for(var clipboardIndex=0;clipboardIndex<Clipboards.length;clipboardIndex++){
var clipboard=Clipboards[clipboardIndex];
var exportButton=window.document.getElementById(clipboard.BlogDiplayTargetID);
clipboard.reposition(BuildDecoyElementForClipboard(exportButton));}}
function HideClipboards(){
for(var clipboardIndex=0;clipboardIndex<Clipboards.length;clipboardIndex++){
var clipboard=Clipboards[clipboardIndex];
clipboard.hide();}}
function ShowClipboards(){
for(var clipboardIndex=0;clipboardIndex<Clipboards.length;clipboardIndex++){
var clipboard=Clipboards[clipboardIndex];
clipboard.show();}}
function ConfigureDesktopWindowFocus(){
if(window!=window.top){
if(!!window.addEventListener){
window.document.documentElement.addEventListener("mousedown",FocusDesktopWindow,false);}
else if(!!window.attachEvent){
window.document.documentElement.attachEvent("onmousedown",FocusDesktopWindow);}}}
function FocusDesktopWindow(){
var windowID=BlogDisplay.GetCurrentWindowID();
if(!(isNaN(windowID))){
window.parent.WindowManager.GetWindowByWindowID(windowID).BringToFront();}}
function BlogDisplayPageLoad(){
ConfigureExportToClipboardButtons();
var ratingMeter=window.document.getElementById("BlogRatingMeter");
if(ratingMeter!==null){
ConnectInlineHTMLTooltipTargetEvents(ratingMeter);}
ratingMeter=window.document.getElementById("PurchasingBlogRatingMeter");
if(ratingMeter!==null){
ConnectInlineHTMLTooltipTargetEvents(ratingMeter);}
ConfigureDesktopWindowFocus();
WrapComments();
if(!!window.ScrollToComments&&typeof(ScrollToComments)==='function'){
window.ScrollToComments();}
var qstring=GetQS();
if(qstring.indexOf('&comment=')>-1){
qstring=qstring.substring(qstring.indexOf('&comment=')+9);
if(qstring.indexOf('new')==0){
BlogDisplay.scrollToPreview('pb_blogcomment_textarea');}
else if(qstring.indexOf('view')==0){
BlogDisplay.scrollToPreview('pb_blogcomments_header');}}
ConfigureBlogRatingRepaintingIE6();
if(typeof isPOPopped!="undefined"&&!!isPOPopped){
window.AnimObject=new OptDivAnimator();
document.getElementById('optinboxWin').onclick=function(){window.optinDivClicked=true;};
if(!!window.document.addEventListener){
window.addEventListener("scroll",
function(){
if(AnimObject.optinShowFlag){
AnimObject.scrollWithWindow();}},
false);}
else if(!!window.document.attachEvent){
window.attachEvent("onscroll",
function(){
if(AnimObject.optinShowFlag){
AnimObject.scrollWithWindow();}});}}
if(window.document.getElementById("submitDesc")!==null){
window.aboutText=jQuery('.aboutTextArea').autogrow().focus(aboutTextFocus).blur(aboutTextBlur).keyup(aboutTextKeyUp);
jQuery('#submitDesc input').click(submitAboutText);
if(window.aboutText.length>0){
aboutTextKeyUp();
aboutTextBlur();}}
ShrinkBlogTitle();
AlignAdvertisePostSection_PageLoaded();}
function aboutTextFocus(){
if(window.aboutText.val()=='Enter a description of your blog...'){
window.aboutText.val('');}
jQuery('#submitDesc').show();}
function aboutTextBlur(){
if(window.aboutText.val()==''){
window.aboutText.val('Enter a description of your blog...');
jQuery('#submitDesc').hide();
jQuery('#aboutTextChars').text(250);}}
function aboutTextKeyUp(){
var len=window.aboutText.val().length;
if(len>250){
window.aboutText.val(window.aboutText.val().substr(0,250));}
if(len==249){
jQuery('#aboutTextChars').text('1 character');}
else{
jQuery('#aboutTextChars').text((250-window.aboutText.val().length)+' characters');}}
function submitAboutText(){
var len=window.aboutText.val().length;
if(len>250){
window.aboutText.val(window.aboutText.val().substr(0,250));}
var params={};
var ajaxSettings={};
params['blogId']=blogId;
params['text']=window.aboutText.val();
ajaxSettings['data']=params;
ajaxSettings['url']='DescUpdate.ashx';
ajaxSettings['type']='post';
ajaxSettings['dataType']='json';
ajaxSettings['success']=submitAboutTextCallback;
jQuery.ajax(ajaxSettings)
jQuery('#aboutTextError').hide();
jQuery('#submitDesc input').attr('disabled','disabled');}
function submitAboutTextCallback(data){
if(data.success){
jQuery('#submitDesc').hide();}
else{
jQuery('#aboutTextError').text(data.error).show();}
jQuery('#submitDesc input').removeAttr('disabled');}
if(!!window.addEventListener){
window.addEventListener("load",BlogDisplayPageLoad,false);}
else if(!!window.attachEvent){
window.attachEvent("onload",BlogDisplayPageLoad);}
try{
if(!!window.parent.BlogApplicationWindow_ManualLoadTriggered){
window.parent.BlogApplicationWindow_ManualLoadTriggered(window.name);}}
catch(problem){}
function ResizeModalCurtain(){
var curtain=window.document.getElementById("curtain");
var curtainBacking=window.document.getElementById("curtainBacking");
var fullWidth=0;
var fullHeight=0;
if(!window.domain||window.domain==-1||window.domain==5){
fullWidth=window.document.documentElement.scrollWidth;
fullHeight=window.document.documentElement.scrollHeight;}
else if(window.domain==3){
return;}
else{
var top_earners_wrapper=window.document.getElementById('iframe_wrapper');
fullWidth=top_earners_wrapper.scrollWidth;
fullHeight=top_earners_wrapper.scrollHeight;}
curtain.style.width=fullWidth+"px";
curtain.style.height=fullHeight+"px";
curtainBacking.style.width=fullWidth+"px";
curtainBacking.style.height=fullHeight+"px";}
var FeatureManager={
updateFeature:function(featureId,isEnabled,byPassChecked){
if(!!byPassChecked||window.document.getElementById('donotshowagain').checked){
var isEnabledParam=isEnabled?1:0;
var rn=Math.random()*10000000;
var tempscript=document.createElement("script");
tempscript.src='http://www.fanbox.com/socnet/handlers/FeatureHandler.ashx?fid='+featureId+'&stts='+isEnabledParam+'&r='+rn;
window.document.body.appendChild(tempscript);}}}
function ShowModalCurtain(){
var curtain=window.document.getElementById("curtain");
curtain.style.display="block";
var curtainBacking=window.document.getElementById("curtainBacking");
if(!!curtainBacking){
curtainBacking.style.display="block";
ResizeModalCurtain();}}
function HideModalCurtain(){
var curtain=window.document.getElementById("curtain");
curtain.style.display="none";
curtain.style.width="100%";
curtain.style.height="100%";
var curtainBacking=window.document.getElementById("curtainBacking");
if(!!curtainBacking){
curtainBacking.style.display="none";
curtainBacking.style.width="100%";
curtainBacking.style.height="100%";}}
function showNewBlogDiv(){
var createdDivShow=document.getElementById("newBlogDiv");
createdDivShow.style.display="";}
function hideNewBlogDiv(){
var createdDivShow=document.getElementById("newBlogDiv");
createdDivShow.style.display="none";}
function hideReminder(){
FeatureManager.updateFeature(10,0);
var shoutoutreminder=document.getElementById("ShoutoutReminder");
shoutoutreminder.style.display="none";
HideModalCurtain();}
function hideReminderShout(prodId){
var rn=Math.random()*10000000;
var tempscript=document.createElement("script");
tempscript.src='http://www.fanbox.com/socnet/handlers/FeatureHandler.ashx?fid=10&stts=0&r='+rn;
window.document.body.appendChild(tempscript);
window.open('http://developer.fanbox.com/WidgetWizard/Shoutout/Manage.aspx?appid='+prodId+'','_blank');
var shoutoutreminder=document.getElementById("ShoutoutReminder");
shoutoutreminder.style.display="none";
DeveloperAction.RecordStat(2,37,-1);
HideModalCurtain();}
var LastTextArea=null;
var LastTextAreaLimit=NaN;
var TextAreaTimer=NaN;
function LimitedTextArea_KeyPress(){
var checkNow;
if(isNaN(TextAreaTimer)){
checkNow=true;}
else if(LastTextArea!==this){
window.clearTimeout(TextAreaTimer);
TextAreaTimer=NaN;
TrimLastLimitedTextAreaToLength();
checkNow=true;}
else{
checkNow=false;}
if(checkNow){
LastTextAreaLimit=parseInt(this.getAttribute("maxlength"),10);
LastTextArea=this;
if(this.value.length<LastTextAreaLimit){
TextAreaTimer=window.setTimeout(TrimLastLimitedTextAreaToLength,250);}
else{
TextAreaTimer=window.setTimeout(TrimLastLimitedTextAreaToLength,0);}}}
function LimitedTextArea_Change(){
LastTextAreaLimit=parseInt(this.getAttribute("maxlength"),10);
LastTextArea=this;
TrimLastLimitedTextAreaToLength();}
function TrimLastLimitedTextAreaToLength(){
var currentValue=LastTextArea.value;
if(currentValue.length>LastTextAreaLimit){
LastTextArea.value=currentValue.substr(0,LastTextAreaLimit);}
TextAreaTimer=NaN;
var lengthUpdateFunctionName=LastTextArea.getAttribute("fbonlengthupdate");
if(lengthUpdateFunctionName!==null){
window[lengthUpdateFunctionName].call(LastTextArea);}}
function ResizePhotos(){
var images=[window.document.getElementById("ParticipantBlogAuthorPhoto")];
for(var imageIndex=0;imageIndex<images.length;imageIndex++){
var image=images[imageIndex];
if(image!==null){
ResizePhoto(image,parseInt(image.maxWidth,10),parseInt(image.maxHeight,10));}}}
function ResizePhoto(imgRef,maxWidth,maxHeight){
if(imgRef){
if(imgRef.width){
if(imgRef.width>maxWidth||imgRef.height>maxHeight){
var maxRatio=maxWidth/maxHeight;
var imgRatio=imgRef.width/imgRef.height;
if(maxRatio<imgRatio){
var temph=Math.round(((maxWidth)/imgRef.width)*imgRef.height);
if(temph>2){
imgRef.height=temph;
imgRef.width=maxWidth;}}
else{
var tempw=Math.round(((maxHeight)/imgRef.height)*imgRef.width);
if(tempw>2){
imgRef.width=tempw;
imgRef.height=maxHeight;}}}}
else{
imgRef.height=maxHeight;}}
imgRef.style.visibility="visible";}
function WrapComments(){
var elementIDs=window.commentBodyClientIDs;
if(!!elementIDs){
for(i=0;i<elementIDs.length;i++){
var elementID=elementIDs[i];
var commentContainer=window.document.getElementById(elementID);
if(commentContainer.offsetWidth>518){
var textNodes=[];
for(var cursor=commentContainer.firstChild;cursor!==null;cursor=cursor.nextSibling){
if(cursor.nodeType===3){
textNodes.push(cursor);}}
for(var textNodeIndex=0;textNodeIndex<textNodes.length;textNodeIndex++){
WordBreakDisplayTextWidth(commentContainer,450,textNodes[textNodeIndex]);}}}}}
var DeveloperAction=DeveloperAction||{};
DeveloperAction.RecordStat=function(action,eventLocationId,assocIntData){
var args={
vlsid:-1,
ac:action,
elid:eventLocationId,
aid:assocIntData};
new Ajax.Request('DeveloperActionStat.ashx',{
method:'post',
parameters:args});}
function GetScrollTop(){
if(typeof document.documentElement.scrollTop!=='undefined'){
return document.documentElement.scrollTop;}
if(typeof window.pageYOffset!=='undefined'){
return window.pageYOffset;}
else{
return document.body.scrollTop;}}
var AnimObject;
function OptDivAnimator(){
this.optinwinmaxwid=560;
this.optinwinmaxhgt=320;
this.optinwincontentmaxhgt=320;
this.optinShowFlag=false;
this.optinwin=document.getElementById('optinboxWin');
this.optinwincontent=document.getElementById('optinboxWinContent');
this.optincon=document.getElementById('optinContent');
this.windowmaxwid=window.document.body.clientWidth;
this.windowmaxhgt=window.document.body.clientHeight;
this.offsetleftmax=(this.windowmaxwid/2)-280;
this.offsettopmax=(this.windowmaxhgt/2)-160;
this.intervalhgt=this.optinwinmaxhgt/6;
this.intervalwid=this.optinwinmaxwid/6;
this.intervalcontenthgt=this.optinwincontentmaxhgt/6;
this.regularStepIncrement=75;
this.lastStepTime=null;
this.alreadyOpted=false;
this.stepSliddinAway=false;
this.startAnim=function(){
if(this.alreadyOpted===true&&this.optinShowFlag===false){
return;}
if(this.optinShowFlag){
this.stepDown();}
else if(!this.stepSliddinAway){
this.stepSliddinAway=true;
this.stepSlide();}};
this.scrollWithWindow=function(){
this.optinwin.style.marginTop=(-1*(parseInt(this.optinwin.style.height)/2)+GetScrollTop())+"px";};
this.stepSlide=function(){
if(this.optinShowFlag===false){
this.lastStepTime=null;}
var stepIncrement=this.setStep();
if(parseInt(this.optinwin.style.bottom)>=40){
this.optinwin.style.marginBottom='';
this.optinwin.style.bottom="";
this.optinwin.style.top="50%";
this.optinwin.style.left="50%";
this.optinwin.style.height="384px";
this.optinwincontent.style.height="364px";
this.optinwin.style.width="560px";
this.optinwin.style.marginLeft="-"+(parseInt(this.optinwin.style.width)/2)+"px";
this.optinwin.style.marginTop=(-1*(parseInt(this.optinwin.style.height)/2)+GetScrollTop())+"px";
if(this.optinShowFlag===false){
this.showOptin();}}
else{
this.optinwin.style.top="";
this.optinwin.style.marginTop="";
this.optinwin.style.width=(parseInt(this.optinwin.style.width)+(stepIncrement*this.intervalwid))+"px";
this.optinwin.style.height=(parseInt(this.optinwin.style.height)+(stepIncrement*this.intervalhgt))+"px";
this.optinwincontent.style.height=((parseInt(this.optinwincontent.style.height)+(stepIncrement*this.intervalcontenthgt))-10)+"px";
this.optinwin.style.bottom=(parseInt(this.optinwin.style.bottom)+(stepIncrement*10))+"%";
this.optinwin.style.marginLeft="-"+(parseInt(this.optinwin.style.width)/2)+"px";
this.optinwin.style.marginBottom="-"+((parseInt(this.optinwin.style.height)/2)+GetScrollTop())+"px";
window.setTimeout(function(){AnimObject.stepSlide();},75);}};
this.stepDown=function(){
if(this.optinShowFlag===true){
this.showOptin();}
var stepIncrement=this.setStep();
if(parseInt(this.optinwin.style.bottom)<=10){
this.optinwin.style.top="";
this.optinwin.style.marginTop="";
this.optinwin.style.bottom="-10%";
this.optinwin.style.left="50%";
this.optinwin.style.height="0";
this.optinwincontent.style.height="0";
this.optinwin.style.width="0";
this.optinwin.style.marginLeft="-"+(parseInt(this.optinwin.style.width)/2)+"px";
this.optinwin.style.marginBottom="-"+((parseInt(this.optinwin.style.height)/2)+GetScrollTop())+"px";}
else{
try{
this.optinwin.style.top="";
this.optinwin.style.marginTop="";
this.optinwin.style.width=(parseInt(this.optinwin.style.width)-(stepIncrement*this.intervalwid))+"px";
this.optinwin.style.height=(parseInt(this.optinwin.style.height)-(stepIncrement*this.intervalhgt))+"px";
this.optinwincontent.style.height=((parseInt(this.optinwincontent.style.height)-(stepIncrement*this.intervalcontenthgt))-10)+"px";
if(isNaN(parseInt(this.optinwin.style.bottom,10))){
this.optinwin.style.bottom='50%';}
this.optinwin.style.bottom=(parseInt(this.optinwin.style.bottom)-(stepIncrement*10))+"%";
this.optinwin.style.marginLeft="-"+(parseInt(this.optinwin.style.width)/2)+"px";
this.optinwin.style.marginBottom="-"+((parseInt(this.optinwin.style.height)/2)+GetScrollTop())+"px";}
catch(e){
this.optinwin.style.bottom="9px";}
window.setTimeout(function(){AnimObject.stepDown();},75);}};
this.showOptin=function(){
if(this.optincon.style.display=="none"){
this.optincon.style.display="block";
this.optinShowFlag=true;
this.stepSliddinAway=false;
var optinLocationField=window.document.getElementById("mogubox_location");
if(optinLocationField!==null){
window.document.getElementsByName("mogubox")[0].src=optinLocationField.value;
if(optinLocationField.value.indexOf('ReopenChallenge=1')===-1){
optinLocationField.value+='&ReopenChallenge=1';}}
this.scrollWithWindow();}
else{
this.optincon.style.display="none";
this.optinShowFlag=false;}};
this.hideOptin=function(){
var curtain=window.document.getElementById("ModalCurtain");
curtain.style.background="";
curtain.style.opacity="0";
curtain.style.filter="alpha(opacity=0)";
BlogDisplay.HideModalCurtain();
this.showOptin();}
this.scaleOptinDown=function(){
this.optinwin.style.marginTop="-242px";
this.optinwin.style.height="485px";
this.optincon.style.height="485px";};
this.scaleOptinUp=function(){
this.optinwin.style.marginTop="-297px";
this.optinwin.style.height="594px";
this.optincon.style.height="594px";};
this.setStep=function(){
if(!this.lastStepTime){
this.lastStepTime=new Date();
return 1;}
else{
var tempTime=new Date();
var ms=(tempTime.getTime()-this.lastStepTime.getTime());
this.lastStepTime=tempTime;
return ms/this.regularStepIncrement;}}}
function addPageTimer(obj){
var atr;
var toAdd='PageTimer_Request='+(new Date()).getTime();
if(obj.nodeName==="a"||obj.nodeName==="A"){
atr="href";}
else if(obj.nodeName==="form"||obj.nodeName==="FORM"){
atr="action";}
else{
return;}
var reg=obj[atr].replace(/([?&])PageTimer_Request=[^&#]+/g,('$1'+toAdd))
if(reg!==obj[atr]){
obj[atr]=reg;
return;}
var hashStart=obj[atr].indexOf("#");
var queryStringStart=obj[atr].indexOf("?");
if(queryStringStart<0){
toAdd='?'+toAdd;}
else{
toAdd='&'+toAdd;}
if(hashStart<0){
obj[atr]+=toAdd;}
else{
obj[atr]=obj[atr].substring(0,hashStart)+toAdd+obj[atr].substring(hashStart);}}
function tagInputStartup(){
return tagInputStartupWithAutoCompleteURL('AutoCompleteHandler.ashx');}
function tagInputStartupWithAutoCompleteURL(autoCompleteURL){
var inputContainer=document.getElementById('tagInputContainer');
var tagInput=inputContainer.firstChild;
var counter=0;
while(!!tagInput){
AutoComplete.AddControl(tagInput.id,autoCompleteURL,null,tagInputValidator);
counter++;
tagInput=tagInput.nextSibling;}
ConnectInlineHTMLTooltipTargetEvents(document.getElementById('tagInputHelp'));}
function tagInputValidator(e){
var
e=e||window.event,
keyCode=e.which||e.keyCode,
evSource=e.target||e.srcElement;
if(keyCode===23&&!!evSource&&evSource.value.match(/^\s*$/gm)){
return false;}
return true;}
function tagInputFocus(input){
if(input.className=='tagsInput'){
input.value='';}
input.className='tagsInput tagsInputFilled';}
function tagInputBlur(input){
if(input.value==''){
input.value='One term per box';
input.className='tagsInput';}}
function tagInputSubmit(input){
var inputContainer=document.getElementById('tagInputContainer');
var tagInput=inputContainer.firstChild;
var counter=0;
var params={};
params['postId']=document.getElementById('PostTagInsertId').value;
while(!!tagInput){
if(tagInput.className=='tagsInput tagsInputFilled'){
params['tag_'+counter]=tagInput.value;}
counter++;
tagInput=tagInput.nextSibling;}
new Ajax.Request('PostTag.ashx',{
'method':'post',
'parameters':params,
'onSuccess':function(response){input.disabled=false;tagInputSubmitCallback(response)},
'onFailure':function(){input.disabled=false;}});
input.disabled=true;
return false;}
function tagInputSubmitCallback(response){
var data=response.responseText.evalJSON(false);
if(!!data.success){
document.getElementById('PostTagInsert').style.visibility='hidden';
if(!!data.tagHtml){
var tagContainer=document.getElementById('pblogTagList');
tagContainer.innerHTML=data.tagHtml;
tagContainer.parentNode.parentNode.style.display='block';}
return;}
var textField=document.getElementById('tagInputMessage');
textField.firstChild.data=data.error;
textField.className='inlineBlockElement text_sm_red';
textField.style.marginTop='16px';
var inputContainer=document.getElementById('tagInputContainer');
var tagInput=inputContainer.firstChild;
var counter=0;
while(!!tagInput){
if(!!data['tag_'+counter]){
tagInput.className='tagsInput tagsInputFilled tagsInputError';}
counter++;
tagInput=tagInput.nextSibling;}}
function hideTagInput(){
if(!!window.Mogu&&!!Mogu.pBlogs){
Mogu.pBlogs.Editor.PreviewPressed=false;}
if(!!DeveloperAction){
DeveloperAction.RecordStat(74,116,postId);}
document.getElementById('PostTagInsert').style.display='none';
document.getElementById('noTagError').style.display='none';
window.document.getElementById("centerContainer").style.height="255px";
return false;}
var PBlogCreate=PBlogCreate||{};
PBlogCreate._finishEduDiv=function(){
PBlogCreate._eduDiv.style.visibility='visible';
PBlogCreate._eduDiv.style.display='block';
PBlogs._SettingsDiv.style.visibility='hidden';};
PBlogCreate.OpenEditor=function(){
PBlogCreate._eduDiv.style.visibility='hidden';
PBlogCreate._eduDiv.style.display='none';
if(!PBlogs||!PBlogs.HideModalCurtain){
SelectedBlogController.LaunchEditor(PBlogCreate.NewBlogId);}
else{
PBlogs.HideModalCurtain();
LaunchEditor(PBlogCreate.NewBlogId,PBlogCreate.NewBlogId,6,10,1,'&bts=8',2);}};
function ShowRelatedPost(tag){
jQuery.get("ShowRelatedPost.ashx",{tag:tag},ShowRelatedPost_Success,"json");
return false;}
function ShowRelatedPost_Success(data){
if(data){
if(data.found){
window.top.LaunchPBlogAndProfile(
data.blogid,
32,
data.postid,
data.profileUrl);}
else{
var noBlogsPopup=jQuery("#BelieveItDiv");
if(noBlogsPopup.length){
jQuery("#BelieveItErrors").css("display","none");
noBlogsPopup.find(".believeit-tagname").text(data.tag);
noBlogsPopup.find(".believeit-search").val(data.tag);
jQuery("#ModalCurtain").show();
noBlogsPopup.css("display","block");
noBlogsPopup.css("margin-top",(window.document.documentElement.scrollTop||window.document.body.scrollTop).toString()+"px");}}}
return false;}
function BelieveItDiv_AutoComplete_Load(){}
function BelieveItDiv_KeyPress(e){
var keycode;
if(window.event)keycode=e.keyCode;
else if(e.which)keycode=e.which;
if(keycode===3||keycode===13){
BelieveItDiv_Search();
return false;}
else{
return true;}}
function BelieveItDiv_Search(){
var tag=jQuery("#BelieveItSearch").val();
jQuery("#BelieveItErrors").css("display","none");
BelieveItDiv_Hide();
jQuery.get("Validate.ashx",{text:tag},BelieveItDiv_Search_Validate,"json");}
function BelieveItDiv_Search_Validate(data){
if(data){
var searchtext;
var oncomplete=undefined;
var action;
if(data.isvalid){
jQuery("#BelieveItErrors").css("display","none");
oncomplete=function(){
window.top.location="http://www.fanbox.com/PremiumBlogs/BlogEditor.aspx?tag="+encodeURIComponent(data.text)+"&src=believeit";}
searchtext=data.text;
action="believe-it-search";}
else{
jQuery("#BelieveItErrors").css("display","block");
jQuery("#BelieveItDiv").css("display","block");
jQuery("#ModalCurtain").show();
searchtext="";
action="believe-it-search-error";}
jQuery.ajax({
url:"/QuickSearchUsage.ashx",
type:"POST",
data:{
action:action,
search:searchtext,
blog:0,
post:0},
complete:oncomplete});}}
function BelieveItDiv_Hide(){
jQuery("#BelieveItDiv").css("display","none");
jQuery("#ModalCurtain").css("display","none");
return false;}
function BlogBubbleLoad(){
var hasBlogPromotions=!!window.document.getElementById("blogPromotions");
var hasPeopleSuggestions=window.document.getElementById("peopleSuggestions");
if(hasBlogPromotions||hasPeopleSuggestions){
PageTimer.AddPlaceholderSession(62);
new Ajax.Request("/PeopleSuggestions.ashx",{
"method":"post",
"parameters":"&showbb="+hasBlogPromotions+"&blogId="+window.blogId+"&postId="+window.postId,
"onSuccess":BlogBubbleShow});}}
function BlogBubbleShow(transport){
if(transport.status!==0){
var peopleSuggestionsList=window.document.getElementById("peopleSuggestions");
var blogPromotionsList=window.document.getElementById("blogPromotions");
var seenSuggestionsField=window.document.getElementById("SuggestedEntityIds");
var container=window.document.createElement("DIV");
container.innerHTML=transport.responseText;
for(var containerSection=container.firstChild;containerSection!==null;containerSection=container.firstChild){
if(containerSection.nodeType===1&&containerSection.id==="sponsoredPosts"){
PageTimer.ConnectToSession(window,62,"");
PageTimer.DefineProgressCounters(window,["BlogBubblesRetrieved"]);
var pendingImageCount=0;
for(var entry=containerSection.firstChild;entry!==null;entry=containerSection.firstChild){
blogPromotionsList.appendChild(entry);
if(jQuery(entry).attr("isplaceholder")){
BBClose(entry,{});}
else{
pendingImageCount+=BlogBubbleAttachIllustrationLoadingFunctions(entry);}}
BBShowHideSponsoredPosts();
var imageCounters=new Array(pendingImageCount);
for(var pendingImageIndex=0;pendingImageIndex<pendingImageCount;pendingImageIndex++){
imageCounters[pendingImageIndex]="BlogBubbleIllustrationLoaded";}
PageTimer.ExchangeProgressCounters(window,"BlogBubblesRetrieved",imageCounters);}
else if(containerSection.nodeType===1&&containerSection.id==="displayUsageUrl"){
var displayUsageUrl=containerSection.attributes['value'].value;
BBRecordLand(displayUsageUrl);}
container.removeChild(containerSection);}
AlignAdvertisePostSection_BubblesLoaded();}}
function BlogBubbleAttachIllustrationLoadingFunctions(node){
var attachCount=0;
if(node.nodeType===1){
if(node.tagName==="IMG"){
if(!(node.complete)){
node.onload=BlogBubbleIllustrationLoaded;
attachCount++;}}
var children=node.childNodes;
var childCount=children.length;
for(var childIndex=0;childIndex<childCount;childIndex++){
var child=children[childIndex];
attachCount+=BlogBubbleAttachIllustrationLoadingFunctions(child);}}
return attachCount;}
function BlogBubbleIllustrationLoaded(){
PageTimer.FulfillProgressCounter(window,"BlogBubbleIllustrationLoaded");}
function BBShowHideSponsoredPosts(){
var blogBubbleContainer=jQuery("#blogBubbleContainer");
var blogPromotions=jQuery("#blogPromotions").children(".BlogBubble").not("[placeholder]");
if(blogPromotions.length>0){
blogBubbleContainer.show();}
else{
blogBubbleContainer.hide();}}
function BBClose(o,e){
e=e||window.event;
if(e.preventDefault){
e.preventDefault();}
else{
e.returnValue=false;}
var blogBubble=jQuery(o).closest(".BlogBubble");
var newBlogBubble=jQuery('<div placeholder="1" style="text-align: center;">'+
'<span style="display: inline-block; vertical-align: middle; width: 0px; height: 100%">&nbsp;</span>'+
'<img src="//files.fbstatic.com/Themes/_images/Loading_bar_2.gif" alt="Loading..." height="6" width="'+(blogBubble.width()-12)+
'" /></div>');
newBlogBubble.attr("id",blogBubble.attr("id"));
newBlogBubble.attr("class",blogBubble.attr("class"));
newBlogBubble.css("height",blogBubble.height());
var otherBubbleIds=[];
jQuery("#blogPromotions > .BlogBubble").not(blogBubble).each(function(){otherBubbleIds.push(jQuery(this).attr("id"));});
var otherbbs=otherBubbleIds.join(',');
blogBubble.replaceWith(newBlogBubble);
var bubbleId=blogBubble.attr("id");
var bbposition=blogBubble.attr("bbposition");
jQuery.ajax({url:"/blogbubble.ashx",
type:"post",
data:{bbid:bubbleId,bbposition:bbposition,blogId:blogId,postId:postId,otherbbs:otherbbs},
dataType:"json",
success:BBSwapBubble,
error:BBSwapBubble_Error});}
function BBRecordLand(url){
jQuery.post(url,null,BBRecordLand_Success);}
function BBRecordLand_Success(data){
if(data){
var dataobj=jQuery("<div>");
dataobj.html(data);
var statids=dataobj.find("#statids > input")
for(var i=0;i<statids.length;i++){
var statidinput=statids[i];
var bbid=statidinput.id;
var statid=statidinput.value;
jQuery("#"+bbid).attr("statid",statid);}}}
function BBRecordUsage(url){
var statid=jQuery(this).closest(".BlogBubble").attr("statid");
if(!!statid){
statid=encodeURIComponent(statid);
if(url.indexOf('?')>=0){
url+='&bubble='+statid;}
else{
url+='?bubble='+statid;}}
jQuery.post(url);}
function BBStopBubble(o,e){
if(!!window.event&&window.event.cancelBubble!==undefined){
window.event.cancelBubble=true;}
else{
e.stopPropagation();}}
function BBSwapBubble(response){
if(response&&response.oldbbid){
var oldbb=jQuery("#"+response.oldbbid);
oldbb.empty();
if(response.success&&response.count>0&&response.html){
var newbb=jQuery(response.html);
var newbbid=newbb.attr("id");
newbb.attr("class",oldbb.attr("class"));
if(jQuery("#"+newbbid).length){
var bbposition=newbb.attr("bbposition");
var otherBubbleIds=[];
jQuery("#blogPromotions > .BlogBubble").not(oldbb).each(function(){otherBubbleIds.push(jQuery(this).attr("id"));});
var otherbbs=otherBubbleIds.join(',');
jQuery.ajax({url:"/blogbubble.ashx",
type:"post",
data:{bbid:response.oldbbid,bbposition:bbposition,blogId:blogId,postId:postId,otherbbs:otherbbs},
dataType:"json",
success:BBSwapBubble,
error:BBSwapBubble_Error});}
else{
oldbb.replaceWith(newbb);
if(response.displayusageurl){
BBRecordLand(response.displayusageurl);}}}
else{
oldbb.removeAttr("id");}}
BBShowHideSponsoredPosts();}
function BBSwapBubble_Error(){
jQuery(".BlogBubble").filter("[placeholder]").empty();
BBShowHideSponsoredPosts();}
if(!!window.jQuery){
jQuery(document).ready(function(){
BlogBubbleLoad();});}
function LaunchBlogBubble(pblogid,blogtime,postid,profileUrl,extraQS){
try{
if(window!=top&&!!top.LaunchPBlog&&!!window.name&&!!top.WindowManager){
var windowId=window.name.substring(3);
var myContainer=top.WindowManager.GetWindowByWindowID(windowId).FrameElement;
var left=parseInt(myContainer.style.left,10);
if(top.document.body.clientWidth>900){
var step=Math.round((top.document.body.clientWidth-800)/6.0);
left+=step;
left=left%(top.document.body.clientWidth-800);}
top.LaunchPBlog(pblogid,pblogid,0,0,'',extraQS,0,false,false,'',postid,left);
return false;}}catch(e){}
var curTimer=new Date().getTime();
var pageSuffix="SinglePost.aspx?PageTimer_Request="+curTimer+"&pbid=";
var queryFrag="&post="+postid.toString()+extraQS;
var baseurl='http://blogs.fanbox.com/'+pageSuffix;
var url=baseurl+pblogid+'&link=0&page=0&src=0&soflow=0&'+queryFrag;
top.window.location=url;
return false;}
function facebookLike(postId,e,src){
var loginLink=fbLoginUrl;
if(loginLink==="0"){
return;}
else if(!!loginLink){
if(e.preventDefault){e.preventDefault();}else{e.returnValue=false;}
if(loginLink.indexOf('?')==-1){
loginLink+='?';}
else{
loginLink+='&';}
loginLink+='post='+encodeURIComponent(postId);
window.open(loginLink,"_blank");
loginLink='';}
else{
FanBoxLike(postId,e);}
if(!!src){
jQuery.post('usage.ashx?usage=click-tofacebook');}}
function tweetPost(postId,e,src){
var loginLink=twitterLoginUrl;
if(loginLink==="0"){
return;}
else if(!!loginLink){
if(e.preventDefault){e.preventDefault();}else{e.returnValue=false;}
if(loginLink.indexOf('?')==-1){
loginLink+='?';}
else{
loginLink+='&';}
loginLink+='post='+encodeURIComponent(postId);
window.open(loginLink,"_blank");
loginLink='';}
else{
FanBoxLike(postId,e);}
if(!!src){
jQuery.post('usage.ashx?usage=click-totwitter');}}
function FanBoxLike(postId,e){
if(e.preventDefault){e.preventDefault();}else{e.returnValue=false;}
jQuery.post('Like.ashx',{postId:postId},FanBoxLikeReturn,'json');}
function FanBoxUnlike(postId,e){
if(e.preventDefault){e.preventDefault();}else{e.returnValue=false;}
jQuery.post('UnLike.ashx',{postId:postId},FanBoxUnlikeReturn,'json');}
function LikeOnFanBox_Like_Success(){
jQuery("#likeOnFanBox").addClass("unlikeBtn").removeClass("likeBtn");
jQuery("#likeOnFanboxTwo").addClass("unlikeBtn").removeClass("likeBtn");}
function LikeOnFanBox_Unlike_Success(){
jQuery("#likeOnFanBox").addClass("likeBtn").removeClass("unlikeBtn");
jQuery("#likeOnFanboxTwo").addClass("likeBtn").removeClass("unlikeBtn");}
function FanBoxLikeReturn(jsonData){
if(!!jsonData.postId){
jQuery("#likeOnFanBox_"+jsonData.postId).addClass("unlikeBtn").removeClass("likeBtn");
jQuery("#likeOnFanboxTwo_"+jsonData.postId).addClass("unlikeBtn").removeClass("likeBtn");
if(applyStatus(jsonData)){
curClick='';
if(!isNaN(timerObj)){
window.clearInterval(timerObj);
timerObj=NaN;}
jQuery.post('usage.ashx?usage=land-facebook-connect');
var popUp=jQuery('#connectDialog');
var popUpMarginTop=(-(popUp.innerHeight()/2)+jQuery(window).scrollTop())+"px";
popUp.css("display","block").css('top','50%').css("margin-top",popUpMarginTop).show();
jQuery('#connectUrlSuffix').val('?post='+jsonData.postId);}}}
function FanBoxUnlikeReturn(jsonData){
if(!!jsonData.postId){
jQuery("#likeOnFanBox_"+jsonData.postId).addClass("likeBtn").removeClass("unlikeBtn");
jQuery("#likeOnFanboxTwo_"+jsonData.postId).addClass("likeBtn").removeClass("unlikeBtn");}}
var parse_url=function(uri){
if(typeof uri=='undefined'){
uri=location.href;}
else if(uri[0]=='/'){
uri=location.host+uri;}
var url=uri.match(/^([^:]*:\/\/)?([^:]*:[^@]*@)?([^\/:]*\.[^\/:]*)?(:[^\/]*)?(\/[^?#]*)?(\?[^#]*)?(#.*)?$/i);
delete url.input;
url.protocol=((url[1])?url[1]:'http://').split('://')[0];
url.user=(url[2])?url[2].split(':')[0]:undefined;
url.password=(url[2])?url[2].split(':')[1].split('@')[0]:undefined;
url.host=(url[3])?url[3]:location.host;
url.hostname=url.host;
url.port=(url[4])?((isNaN(parseInt(url[4].split(':')[1])))?80:parseInt(url[4].split(':')[1])):80;
url.path=(url[5])?url[5]:'/';
url.pathname=url.path;
url.search=(url[6])?url[6].split('?')[1]:undefined;
url.query=url.search;
url.fragment=(url[7])?url[7].split('#')[1]:undefined;
url.hash=url.fragment;
url.href=''+url.protocol+'://'+((url.user)?url.user+':'+url.password+'@':'')+url.host+((url.port!=80)?':'+url.port:'')+url.path+((url.search)?'?'+url.search:'')+((url.fragment)?'#'+url.fragment:'');
url.generateHref=function(){
return ''+url.protocol+'://'+((url.user)?url.user+':'+url.password+'@':'')+url.host+((url.port!=80)?':'+url.port:'')+url.path+((url.search)?'?'+url.search:'')+((url.fragment)?'#'+url.fragment:'');}
return url;}
function getQueryString(uri){
var QueryVals={};
var query=uri.search;
if(!!query){
var vars=query.split("&");
for(var i=0;i<vars.length;i++){
var pair=vars[i].split("=");
QueryVals[pair[0]]=pair[1];}}
return QueryVals;}
function flattenQuery(QueryVal){
var query='';
var first=true;
for(var key in QueryVal){
if(!first){
query+='&';}
else{
first=false;}
query+=key+'='+QueryVal[key];}
return query;}
function correctBlogLinks(e){
e=e||window.event;
var targ;
if(e.target){
targ=e.target;}
else if(e.srcElement){
targ=e.srcElement;}
if(targ.nodeName=='A'&&!jQuery(targ).attr('blogLinkDone')=='1'&&!!targ.href&&jQuery(targ).parents('.pb_blogpost_container').length>0){
var uri=parse_url(targ.href);
if(uri.host.search(/.*blogs\.fanbox\.com$/i)>=0||
uri.host.search(/posts\.fanbox\.com$/i)>=0){
var query=getQueryString(uri);
query['bts']='46';
query['refId']=sessionId;
uri.search=flattenQuery(query);
if(uri.host.search(/.+blogs\.fanbox\.com$/i)>=0){
uri.host='blogs.fanbox.com'}
targ.target="_top";
targ.href=uri.generateHref();}
jQuery(targ).attr('blogLinkDone','1');}
else if(targ.nodeName=='A'){
jQuery(targ).attr('blogLinkDone','1');}}
function goToFBLoginUrl(){
var suffix=jQuery('#connectUrlSuffix').val();
window.open(fbLoginUrl+suffix,'_blank','menubar=yes, toolbar=yes, personalbar=yes, location=yes, scrollbars=yes, resizable=yes, status=yes');
if(!isNaN(timerObj)){
window.clearInterval(timerObj);
timerObj=NaN;}
curClick='fb';
timerObj=window.setInterval(checkConnectStatus,30000);
var checked=(!!jQuery('#connectNotAgain').attr('checked'))?(1):(0);
DeveloperAction.RecordStat(349,129,checked);}
function goToTwitterLoginUrl(){
var suffix=jQuery('#connectUrlSuffix').val();
window.open(twitterLoginUrl+suffix,'_blank','scrollbars=0,toolbar=0,location=0,resizable=0,width=784,height=554');
if(!isNaN(timerObj)){
window.clearInterval(timerObj);
timerObj=NaN;}
curClick='tw';
timerObj=window.setInterval(checkConnectStatus,30000);
var checked=(!!jQuery('#connectNotAgain').attr('checked'))?(1):(0);
DeveloperAction.RecordStat(358,129,checked);}
var curClick='';
var timerObj=NaN;
function checkConnectStatus(){
jQuery.post('CheckConnect.ashx',applyStatus,'json')}
function applyStatus(data){
if(!data.showFB&&!data.showTwitter){
jQuery('#connectDialog').hide();
var adToGoDiv=jQuery('#EarnMoreDialog');
if(adToGoDiv.length>0){
window.top.location=adToGoDiv[0].href;}
return false;}
if(data.showFB){
jQuery('#fbDiv').show();}
else{
jQuery('#fbDiv').hide();
if(curClick=='fb'){
curClick='';
if(!isNaN(timerObj)){
window.clearInterval(timerObj);
timerObj=NaN;}}}
if(data.showTwitter){
jQuery('#twDiv').show();}
else{
jQuery('#twDiv').hide();
if(curClick=='tw'){
curClick='';
if(!isNaN(timerObj)){
window.clearInterval(timerObj);
timerObj=NaN;}}}
return true;}
function closeConnectDialogue(actionCode){
if(!isNaN(timerObj)){
window.clearInterval(timerObj);
timerObj=NaN;}
jQuery('#connectDialog').hide();
var checked=0;
if(!!jQuery('#connectNotAgain').attr('checked')){
checked=1;
FeatureManager.updateFeature(16,0,1);}
DeveloperAction.RecordStat(actionCode,129,checked);
var adToGoDiv=jQuery('#EarnMoreDialog');
if(adToGoDiv.length>0){
window.top.location=adToGoDiv[0].href;}}
function submitTagRating(clickSelection){
var row=jQuery(this).closest("tr");
if(!!row&&row.length>0){
var postId=jQuery(row).attr("postId");
var tagId=jQuery(row).attr("tagId");
var userCreated=jQuery(row).hasClass("userEnteredRow");
changeTagSelectionImage(tagId,clickSelection);
var userCreated=jQuery(row).hasClass("userEnteredRow");
if(clickSelection===3&&userCreated){
jQuery.ajax({url:"/PostTagQualityHandler.ashx",
type:"post",
data:{flow:"removeTag",postId:postId,tagId:tagId},
dataType:"json"});
DismissInlineHTMLTooltip();
jQuery(this).closest("tbody").remove();
if(window.document.getElementById("PostTagQualityContainerCurrentHiddenIndex")!==null){
PostTagQualityContainerPagingRefresh();}
jQuery("#suggestionContainer").show();}
else{
jQuery.ajax({url:"/PostTagQualityHandler.ashx",
type:"post",
data:{flow:"clickselection",postId:postId,tagId:tagId,clickSelection:clickSelection,userCreated:userCreated},
dataType:"json"});}
if(clickSelection==1){
npsRating_Show.call(this);}
else{
npsRating_HideAll();}}}
function changeTagSelectionImage(tagId,clickSelection){
var checkImg=jQuery("#checkImg_"+tagId);
var questionImg=jQuery("#questionImg_"+tagId);
var xImg=jQuery("#xImg_"+tagId);
jQuery(checkImg).attr("class","checkImg_grey");
jQuery(questionImg).attr("class","questionImg_grey");
jQuery(xImg).attr("class","xImg_grey");
switch(clickSelection){
case 1:
jQuery(checkImg).attr("class","checkImg_color");
break;
case 2:
jQuery(questionImg).attr("class","questionImg_color");
break;
case 3:
jQuery(xImg).attr("class","xImg_color");
break;
default:
break;}}
var searchTermGreyText="What is this post primarily about?";
function clearSearchTermGreyText(){
var greyTextDiv=jQuery("#greyTextDiv");
if(!!greyTextDiv&&greyTextDiv.length>0&&
jQuery(greyTextDiv).text()===searchTermGreyText){
greyTextDiv.text("");}
jQuery("#searchTermSubmit").show();}
function showSearchTermGreyText(){
var greyTextDiv=jQuery("#greyTextDiv");
var searchTermInput=jQuery("#searchTermInput");
if(!!greyTextDiv&&greyTextDiv.length>0&&!!searchTermInput&&searchTermInput.length>0&&
jQuery(searchTermInput).val()===""){
greyTextDiv.html("What is this post <b>primarily</b> about?");}
jQuery("#searchTermSubmit").hide();}
function changeHoverTagName(id,tagName){
jQuery(id).text(tagName);}
function setTextBoxFocus(){
window.setTimeout(focusOnSearchBox,0);}
function focusOnSearchBox(){
jQuery("#searchTermInput").focus();}
function submitNewTag(){
var postIdInput=jQuery("#postId");
if(!!postIdInput&&postIdInput.length>0){
var searchTermInput=jQuery("#searchTermInput");
var tagName=jQuery(searchTermInput).val();
if(tagName!==""){
var postId=jQuery(postIdInput).val();
jQuery.ajax({url:"/PostTagQualityHandler.ashx",
type:"post",
data:{flow:"newTag",postId:postId,tagName:tagName},
dataType:"json",
success:searchTermSubmitted});}
jQuery(searchTermInput).val("");
jQuery(searchTermInput).blur();}}
function searchTermSubmitted(jsonData){
var html=jsonData["html"];
var tagId=jsonData["tagId"];
var limitExd=jsonData["limitExceded"];
var limitReached=jsonData["limitReached"];
if(!!limitExd&&limitExd==="true"){
jQuery("#suggestionContainer").hide();}
else{
if(!!limitReached&&limitReached==="true"){
jQuery("#suggestionContainer").hide();}
var table=jQuery("#PostTagQualityTagTable");
if(!!html){
var newRow=jQuery(html);
if(!!tagId&&tagId>0){
var row=jQuery("#PostTagQualityTagRow_"+tagId);
var rating="";
if(!!row&&row.length>0){
var tagrow=row.children(".postTagTableRow[tagId="+tagId+"]");
rating=tagrow.attr("npsrating");
jQuery(row).remove();}}
newRow.children(".postTagTableRow[tagId="+tagId+"]").attr("npsrating",rating);
jQuery(table).prepend(newRow);
newRow.css("display","block");
if(window.document.getElementById("PostTagQualityContainerCurrentHiddenIndex")!==null){
PostTagQualityContainerPagingRefresh();}
var newTagRow=newRow.find(".postTagTableRow");
if(newTagRow.length){
npsRating_Show.call(newTagRow[0]);}
newTagRow.find(".tagFeedBackLink").each(
function(){
ConnectInlineHTMLTooltipTargetEvents(this);});}}}
function npsRating_Clear(npsrow){
var tagId=npsrow.attr("tagId");
var tagrow=npsrow.parent().children(".postTagTableRow[tagId="+tagId+"]");
var rating=tagrow.attr("npsrating");
if(rating){
var ratingarea=npsrow.find("map").find("area[alt="+rating+"]")[0];
if(ratingarea){
npsRating_Set.call(ratingarea);}
else{
rating=false;}}
else if(!rating){
npsrow.find(".nps-rating-container").css("width","0");}
npsrow.find(".nps-rating-hover").hide();}
function npsRating_Set(){
var coords=this.coords;
var npsrow=jQuery(this).closest("tr");
if(!!coords){
var coordparts=coords.split(',');
if(coordparts.length==4){
var leftpx=parseInt(coordparts[0],10);
var rightpx=parseInt(coordparts[2],10);
var hover=npsrow.find(".nps-rating-hover");
if(this.alt==0||this.alt==10){
hover.hide();}
else{
var hoverpos=(leftpx+rightpx)/2;
hoverpos-=19/2;
hover.text(this.alt);
hover.css("padding-left",hoverpos+"px");
hover.show();}
npsrow.find(".nps-rating-container").css("width",rightpx+"px");}}}
var npsRating_Blur_Timeout=NaN;
function npsRating_Blur(){
var npsrow=jQuery(this).closest("tr");
npsRating_Blur_Timeout=window.setTimeout(function(){npsRating_Clear(npsrow);},0);}
function npsRating_Hover(){
if(npsRating_Blur_Timeout!==NaN){
window.clearTimeout(npsRating_Blur_Timeout);
npsRating_Blur_Timeout=NaN;}
npsRating_Set.call(this);}
function npsRating_Click(){
var npsrow=jQuery(this).closest("tr");
var tagId=npsrow.attr("tagId");
var tagrow=npsrow.parent().children(".postTagTableRow[tagId="+tagId+"]");
tagrow.attr("npsrating",this.alt);
npsRating_Set.call(this);}
function npsRating_Show(){
var tagrow=jQuery(this).closest("tr");
var tagId=tagrow.attr("tagId");
var npsrow=tagrow.parent().children(".tableRowPostQuality[tagId="+tagId+"]");
var rating=tagrow.attr("npsrating");
npsRating_Clear(npsrow);
var othernpsrows=tagrow.closest("table").find(".tableRowPostQuality[tagId]:visible").not(npsrow);
for(var i=0;i<othernpsrows.length;i++){
npsRating_Hide.call(othernpsrows[i]);}
if(npsrow.length){
npsrow.show();
tagrow.addClass("postTagQualityShown");
jQuery.ajax({
url:"/PostTagQualityHandler.ashx",
type:"post",
data:{flow:"npsLand",postId:postId,tagId:tagId,rating:rating},
dataType:"json"});}}
function npsRating_HideAll(){
var npsrows=jQuery("#PostTagQualityTagTable").find(".tableRowPostQuality[tagId]:visible");
npsrows.each(npsRating_Hide);}
function npsRating_Hide(){
var npsrow=jQuery(this).closest("tr");
var tagId=npsrow.attr("tagId");
var tagrow=npsrow.parent().children(".postTagTableRow[tagId="+tagId+"]");
tagrow.removeClass("postTagQualityShown");
npsrow.hide();}
function npsRating_Submit(){
npsRating_Hide.call(this);
var npsrow=jQuery(this).closest("tr");
var tagId=npsrow.attr("tagId");
var tagrow=npsrow.parent().children(".postTagTableRow[tagId="+tagId+"]");
var rating=tagrow.attr("npsrating");
if(rating){
var postId=jQuery(tagrow).attr("postId");
jQuery.ajax({
url:"/PostTagQualityHandler.ashx",
type:"post",
data:{flow:"npsRating",postId:postId,tagId:tagId,rating:rating},
dataType:"json"});}}
function AttachTagFeedBackHovers(){
jQuery(".tagFeedBackLink").each(
function(){
ConnectInlineHTMLTooltipTargetEvents(this);});}
if(!!window.addEventListener){
window.document.documentElement.addEventListener("mousedown",correctBlogLinks,false);
window.addEventListener("load",AttachTagFeedBackHovers,false);}
else if(!!window.attachEvent){
window.document.documentElement.attachEvent("onmousedown",correctBlogLinks);
window.attachEvent("onload",AttachTagFeedBackHovers);}
var PostTagQualityContainerPagingChildNodesPruned=false;
function PostTagQualityContainerPagingSetPageSize(firstHiddenIndex){
var largestCount=0;
if(firstHiddenIndex<0){
firstHiddenIndex=0;}
var collections=[null,window.document.getElementById("PostTagQualityTagTable").tBodies];
var contents=window.document.getElementById("PostTagQualityContentsBody").firstChild;
for(;(contents!==null)&&(contents.nodeType!==1);contents=contents.nextSibling){}
contents=contents.firstChild;
for(;(contents!==null)&&((contents.nodeType!==1)||(contents.tagName!=="UL"));contents=contents.nextSibling){}
contents=contents.childNodes;
collections[0]=contents;
var collectionCount=collections.length;
for(var collectionIndex=0;collectionIndex<collectionCount;collectionIndex++){
var collection=collections[collectionIndex];
var childCount=collection.length;
if(!(PostTagQualityContainerPagingChildNodesPruned)){
for(var childIndex=childCount-1;childIndex>=0;childIndex--){
var child=collection[childIndex];
if(child.nodeType!==1){
child.parentNode.removeChild(child);}}
childCount=collection.length;}
var shownChildIndex;
var hiddenChildIndex;
if(childCount!==0){
if(firstHiddenIndex===0){
shownChildIndex=-1;
hiddenChildIndex=firstHiddenIndex;}
else if(firstHiddenIndex>=childCount){
shownChildIndex=childCount-1;
hiddenChildIndex=childCount;}
else{
shownChildIndex=firstHiddenIndex-1;
hiddenChildIndex=firstHiddenIndex;}
for(;shownChildIndex>=0;shownChildIndex--){
var shownChild=collection[shownChildIndex];
if(shownChild.style.display==="none"){
shownChild.style.display="block";}
else{
break;}}
for(;hiddenChildIndex<childCount;hiddenChildIndex++){
var hiddenChild=collection[hiddenChildIndex];
if(hiddenChild.style.display!=="none"){
hiddenChild.style.display="none";}
else{
break;}}}
if(childCount>largestCount){
largestCount=childCount;}}
PostTagQualityContainerPagingChildNodesPruned=true;
var pagingLinkCount=0;
var pageSize=parseInt(window.document.getElementById("PostTagQualityContainerPageSize").value,10);
if(firstHiddenIndex>pageSize){
window.document.getElementById("PostTagQualityContainerPagingLessLink").style.visibility="visible";
pagingLinkCount++;}
else{
window.document.getElementById("PostTagQualityContainerPagingLessLink").style.visibility="hidden";}
if(firstHiddenIndex<largestCount){
window.document.getElementById("PostTagQualityContainerPagingMoreLink").style.visibility="visible";
pagingLinkCount++;}
else{
window.document.getElementById("PostTagQualityContainerPagingMoreLink").style.visibility="hidden";}
if(pagingLinkCount>1){
window.document.getElementById("PostTagQualityContainerPagingSeparator").style.visibility="visible";}
else{
window.document.getElementById("PostTagQualityContainerPagingSeparator").style.visibility="hidden";}
window.document.getElementById("PostTagQualityContainerCurrentHiddenIndex").value=firstHiddenIndex.toString();}
function PostTagQualityContainerPagingRefresh(){
var currentHiddenIndex=parseInt(window.document.getElementById("PostTagQualityContainerCurrentHiddenIndex").value,10);
PostTagQualityContainerPagingSetPageSize(currentHiddenIndex);}
function PostTagQualityContainerPagingLessLink_Click(){
var currentHiddenIndex=parseInt(window.document.getElementById("PostTagQualityContainerCurrentHiddenIndex").value,10);
var pageSize=parseInt(window.document.getElementById("PostTagQualityContainerPageSize").value,10);
PostTagQualityContainerPagingSetPageSize(currentHiddenIndex-pageSize);
jQuery.post("PostTagQualityHandler.ashx?flow=paginglessclick&postId="+encodeURIComponent(window.document.getElementById("postId").value));
return false;}
function PostTagQualityContainerPagingMoreLink_Click(){
var currentHiddenIndex=parseInt(window.document.getElementById("PostTagQualityContainerCurrentHiddenIndex").value,10);
var pageSize=parseInt(window.document.getElementById("PostTagQualityContainerPageSize").value,10);
PostTagQualityContainerPagingSetPageSize(currentHiddenIndex+pageSize);
jQuery.post("PostTagQualityHandler.ashx?flow=pagingmoreclick&postId="+encodeURIComponent(window.document.getElementById("postId").value));
return false;}
function PostTagQualityContainerCollapseLink_Click(){
var expandLink=window.document.getElementById("PostTagQualityContainerExpandLink");
expandLink.style.display="inline";
expandLink.focus();
window.document.getElementById("PostTagQualityContainerCollapseLink").style.display="none";
window.document.getElementById("PostTagQualityContentsBody").style.display="none";
window.document.getElementById("PostTagQualityTagBody").style.display="none";
window.document.getElementById("PostTagQualityContainerPagingSection").style.display="none";
jQuery.post("PostTagQualityHandler.ashx?flow=containerhide&postId="+encodeURIComponent(window.document.getElementById("postId").value));
return false;}
function PostTagQualityContainerExpandLink_Click(){
var collapseLink=window.document.getElementById("PostTagQualityContainerCollapseLink");
collapseLink.style.display="inline";
collapseLink.focus();
window.document.getElementById("PostTagQualityContainerExpandLink").style.display="none";
window.document.getElementById("PostTagQualityContentsBody").style.display="block";
window.document.getElementById("PostTagQualityTagBody").style.display="block";
window.document.getElementById("PostTagQualityContainerPagingSection").style.display="block";
var pageSize=parseInt(window.document.getElementById("PostTagQualityContainerPageSize").value,10);
PostTagQualityContainerPagingSetPageSize(pageSize);
jQuery.post("PostTagQualityHandler.ashx?flow=containershow&postId="+encodeURIComponent(window.document.getElementById("postId").value));
return false;}
var PostTagQualityScrollTimer=NaN;
function ConnectPostTagQualityScrolling(){
if(!!window.addEventListener){
window.addEventListener("scroll",PostTagQuality_Scroll,false);
window.addEventListener("resize",PostTagQuality_Scroll,false);}
else if(!!window.attachEvent){
window.attachEvent("onscroll",PostTagQuality_Scroll);
window.attachEvent("onresize",PostTagQuality_Scroll);}}
function DisconnectPostTagQualityScrolling(){
if(!(isNaN(PostTagQualityScrollTimer))){
window.clearTimeout(PostTagQualityScrollTimer);
PostTagQualityScrollTimer=NaN;}
if(!!window.addEventListener){
window.removeEventListener("scroll",PostTagQuality_Scroll,false);
window.removeEventListener("resize",PostTagQuality_Scroll,false);}
else if(!!window.attachEvent){
window.detachEvent("onscroll",PostTagQuality_Scroll);
window.detachEvent("onresize",PostTagQuality_Scroll);}}
function PostTagQuality_Scroll(){
if(!(isNaN(PostTagQualityScrollTimer))){
window.clearTimeout(PostTagQualityScrollTimer);
PostTagQualityScrollTimer=NaN;}
PostTagQualityScrollTimer=window.setTimeout(PostTagQuality_ScrollElapsed,100);}
function PostTagQuality_ScrollElapsed(){
PostTagQualityScrollTimer=NaN;
PostTagQuality_ScrollTriggered();}
function PostTagQuality_ScrollTriggered(){
var documentElement=window.document.documentElement;
var visibleTop=documentElement.scrollTop;
if(visibleTop===0){
visibleTop=window.document.body.scrollTop;}
var visibleHeight=documentElement.clientHeight;
if(visibleHeight===0){
visibleHeight=window.document.body.clientHeight;}
var visibleBottom=visibleTop+visibleHeight;
var container=window.document.getElementById("PostTagQualityContainer");
if(container!==null){
var containerTop=0;
for(var cursor=container;cursor!==null;cursor=cursor.offsetParent){
containerTop+=cursor.offsetTop;}
if(visibleBottom>containerTop){
DisconnectPostTagQualityScrolling();
jQuery.post("PostTagQualityHandler.ashx?flow="+encodeURIComponent(window.document.getElementById("PostTagQualityContainerImpressionStatistic").value)+"&postId="+encodeURIComponent(window.document.getElementById("postId").value));}}}
function AdDescription_LengthUpdate(){
var textLength=this.value.length;
var maximumLength=parseInt(this.getAttribute("maxlength"),10);
var remainingLength=maximumLength-textLength;
var lengthSuffix;
if(remainingLength===1){
lengthSuffix=" character left";}
else{
lengthSuffix=" characters left";}
var descriptionCounterId=this.getAttribute("charcounterid");
var descriptionCounter=window.document.getElementById(descriptionCounterId);
var descriptionCounterChild=descriptionCounter.firstChild;
if(descriptionCounterChild===null){
descriptionCounterChild=window.document.createTextNode("");
descriptionCounter.appendChild(descriptionCounterChild);}
descriptionCounterChild.data=remainingLength.toString()+lengthSuffix;}
function AdvertiseThisPostClick(ignoreErrors){
var adFieldContainer=jQuery(this).closest(".pb_widget_advertise_content");
var targeturl=this.getAttribute("href");
if(!targeturl){
targeturl=adFieldContainer.attr("action");}
var adTitle=adFieldContainer.find("[name=AdDesignTitle]").val();
var adBody=adFieldContainer.find("[name=AdDesignBody]:not(.text_11_gry)").val();
var errors=[];
if(!jQuery.trim(adTitle)){
errors.push("required-title");}
if(!jQuery.trim(adBody)){
errors.push("required-body");}
adFieldContainer.find(".error").css("display","none");
if(!ignoreErrors&&errors.length>0){
for(var i=0;i<errors.length;i++){
adFieldContainer.find("[name=AdError_"+errors[i]+"]").css("display","inline");}
jQuery.post("/PBlogHandler.ashx?cmd=AdvertiseThisPostError");
return false;}
else if(!!targeturl){
var fields=adFieldContainer.find("*:not(.text_11_gry)").serialize();
if(fields.length>0){
if(targeturl.indexOf("?")<0){
targeturl+='?';}
else{
targeturl+='&';}
targeturl+=fields;}
var createAdButton=adFieldContainer.find(".btn_grn_xl");
var loadingSection=adFieldContainer.find(".createAdLoading");
if(createAdButton.length&&loadingSection.length){
createAdButton.hide();
loadingSection.show();}
top.location=targeturl;
return false;}}
function AdvertiseThisPostEditClick(){
var editLink=jQuery(this).closest(".BlogBubbleEditLink");
var editField=editLink.siblings(".BlogBubbleEditField");
if(editLink.length&&editField.length){
editLink.css("display","none");
editField.css("display","");
return false;}}
if(window.document.getElementById("PostTagQualityContainer")!==null){
ConnectPostTagQualityScrolling();
PostTagQuality_ScrollTriggered();}
var AlignAdvertisePostSectionPageLoaded=false;
var AlignAdvertisePostSectionBubblesLoaded=false;
var AlignAdvertisePostSectionRun=false;
function AlignAdvertisePostSection_PageLoaded(){
AlignAdvertisePostSectionPageLoaded=true;
if(AlignAdvertisePostSectionPageLoaded&&AlignAdvertisePostSectionBubblesLoaded){
window.setTimeout(AlignAdvertisePostSection,1000);}}
function AlignAdvertisePostSection_BubblesLoaded(){
AlignAdvertisePostSectionBubblesLoaded=true;
if(AlignAdvertisePostSectionPageLoaded&&AlignAdvertisePostSectionBubblesLoaded){
window.setTimeout(AlignAdvertisePostSection,1000);}}
function AlignAdvertisePostSection(){
if(!(AlignAdvertisePostSectionRun)){
var adPositioner=window.document.getElementById("AdvertisePostPositioner");
var adAligner=window.document.getElementById("AdvertisePostAligner");
var contentsAligner=window.document.getElementById("PostContentsAligner");
if((adPositioner!==null)&&(adAligner!==null)&&(contentsAligner!==null)){
var adOffsetHeight=adAligner.offsetHeight;
var adOffsetTop=adOffsetHeight;
for(var cursor=adAligner;cursor!==null;cursor=cursor.offsetParent){
adOffsetTop+=cursor.offsetTop;}
var contentsOffsetTop=contentsAligner.offsetHeight;
for(var cursor=contentsAligner;cursor!==null;cursor=cursor.offsetParent){
contentsOffsetTop+=cursor.offsetTop;}
var positionerOffsetTop=0;
for(var cursor=adPositioner;cursor!==null;cursor=cursor.offsetParent){
positionerOffsetTop+=cursor.offsetTop;}
if(contentsOffsetTop>adOffsetTop){
var marginDifference=contentsOffsetTop-positionerOffsetTop-adOffsetHeight;
if((window.navigator.appName==="Microsoft Internet Explorer")&&((window.document.documentMode===undefined)||(window.document.documentMode===7))){
marginDifference+=2;}
adPositioner.style.marginTop=marginDifference.toString()+"px";
var neighbor=adPositioner.nextSibling;
var parent=adPositioner.parentNode;
parent.removeChild(adPositioner);
parent.insertBefore(adPositioner,neighbor);}}
AlignAdvertisePostSectionRun=true;}}
function OpenHomeFreeWindow(destination,windowName){
var openedWindow=window.open(destination,windowName,"menubar=yes, toolbar=yes, personalbar=yes, location=yes, scrollbars=yes, resizable=yes, status=yes");
if((openedWindow!==null)&&(destination!=="")){
openedWindow.focus();}
return openedWindow;}


