
MW_postbox.dom_expand=YAHOO.util.Dom.get('expand');MW_postbox.dom_collapse=YAHOO.util.Dom.get('collapse');MW_postbox.dom_submitBtn=YAHOO.util.Dom.get('submitBtn');MW_postbox.dom_gcontent=YAHOO.util.Dom.get('gcontent');MW_postbox.dom_glog_post=YAHOO.util.Dom.get('glog_post');MW_postbox.dom_glog_text=YAHOO.util.Dom.get('glog_text');MW_postbox.dom_problemPosting=YAHOO.util.Dom.get('problemPosting');MW_postbox.dom_sbGlogWrap=YAHOO.util.Dom.get('sbGlogWrap');MW_postbox.dom_postBox=YAHOO.util.Dom.get('postBox');MW_postbox.dom_postForm=YAHOO.util.Dom.get('postForm');MW_postbox.dom_pleaseWait=YAHOO.util.Dom.get('pleaseWait');MW_postbox.dom_allglog=YAHOO.util.Dom.get('allglog');MW_postbox.dom_old_allglog=YAHOO.util.Dom.get('old_allglog');MW_postbox.dom_cbsglog=YAHOO.util.Dom.get('cbsglog');MW_postbox.dom_old_cbsglog=YAHOO.util.Dom.get('old_cbsglog');MW_postbox.dom_pageNav=YAHOO.util.Dom.get('pageNav');MW_postbox.expand_comments=new YAHOO.util.Anim(MW_postbox.dom_gcontent,{height:{to:MW_postbox.global.height.comments_tall,unit:MW_postbox.global.unit}},0.1,YAHOO.util.Easing.easeBoth);MW_postbox.collapse_comments=new YAHOO.util.Anim(MW_postbox.dom_gcontent,{height:{to:MW_postbox.global.height.comments_short,unit:MW_postbox.global.unit}},0.1,YAHOO.util.Easing.easeBoth);MW_postbox.expand=new YAHOO.util.Anim('postBox',{height:{to:MW_postbox.global.height.tall,unit:MW_postbox.global.unit},opacity:{to:MW_postbox.global.opacity.dark}},1.5,YAHOO.util.Easing.elasticBoth);MW_postbox.expand.onComplete.subscribe(function(){YAHOO.util.Dom.setStyle("control_hide",'display','block');YAHOO.util.Dom.setStyle("control_post",'display','none');MW_postbox.collapse_comments.animate();});MW_postbox.collapse=new YAHOO.util.Anim('postBox',{height:{to:MW_postbox.global.height["short"]},opacity:{to:MW_postbox.global.opacity.light}},1.5,YAHOO.util.Easing.elasticBoth);MW_postbox.collapse.onComplete.subscribe(function(){YAHOO.util.Dom.setStyle("control_hide",'display','none');YAHOO.util.Dom.setStyle("control_post",'display','block');MW_postbox.expand_comments.animate();});MW_postbox.problem_msg_fade_in=new YAHOO.util.Anim('problemPosting',{opacity:{to:MW_postbox.global.opacity.error}},5,YAHOO.util.Easing.backOut);MW_postbox.problem_msg_fade_out=new YAHOO.util.Anim('problemPosting',{opacity:{to:MW_postbox.global.opacity.invisible}},3,YAHOO.util.Easing.easeIn);MW_postbox.callback={success:function(data){clearTimeout(MW_postbox.fetch_timeout);var dataDump=data.responseText.split('<!-');var jReply=eval('('+dataDump[0]+')');MW_postbox.global.disable=jReply.disable;if(MW_postbox.global.disable==1){YAHOO.util.Event.removeListener([MW_postbox.dom_allglog,MW_postbox.dom_old_allglog]);YAHOO.util.Dom.setStyle("old_gSwitcher",'display','none');MW_postbox.reinstate_original_glog();return;}
MW_postbox.global.is_internal=(jReply.is_internal?1:0);if(jReply.gameabbrev==MW_postbox.global.gameabbrev){MW_postbox.allow_posting=jReply.allow_posting;if(MW_postbox.allow_posting){YAHOO.util.Dom.setStyle(MW_postbox.dom_postForm,'display','block');YAHOO.util.Dom.setStyle("postlink",'display','inline');}
else{YAHOO.util.Dom.setStyle(MW_postbox.dom_postForm,'display','none');MW_postbox.collapse.animate();YAHOO.util.Dom.setStyle("postlink",'display','none');}
MW_postbox.global.waitMillisecs=jReply.delay_for_post;if(jReply.fetchMillisecs){MW_postbox.global.fetchMillisecs=jReply.fetchMillisecs}
if(jReply.content){if(MW_postbox.last_mccid<jReply.mccid){MW_postbox.last_mccid=jReply.mccid;}
MW_postbox.save_and_display_page(jReply);}
if(jReply.spln_glogger_id!=null){MW_postbox.spln_glogger_id=jReply.spln_glogger_id;}
if(jReply.obscene==1){MW_postbox.display_problem_msg('in','This glog was not posted due to offensive language. Such behavior is a violation of CBS\' Terms of Service.');}
else if(MW_postbox.posting){MW_postbox.dom_glog_post.value='';}
if(MW_postbox.posting==0){if(YAHOO.util.Dom.getStyle("MWIDGET_postbox",'display')=='none'||YAHOO.util.Dom.getStyle(MW_postbox.dom_sbGlogWrap,'display')=='block'){YAHOO.util.Dom.setStyle(MW_postbox.dom_sbGlogWrap,'display','none');YAHOO.util.Dom.setStyle("MWIDGET_postbox",'display','block');YAHOO.util.Dom.setStyle(MW_postbox.dom_postBox,'display','block');if(!(MW_postbox.follow+'').match(/^\d+$/)&&MW_postbox.global.display_pages==1){YAHOO.util.Dom.setStyle(MW_postbox.dom_pageNav,'display','block');}}}
else{MW_postbox.timeout=self.setTimeout("MW_postbox.togglePleaseWait('hide')",MW_postbox.global.waitMillisecs);}}
else{MW_postbox.togglePleaseWait('hide');if(jReply.post==1){MW_postbox.display_problem_msg('in','')}}
if((MW_postbox.follow+'').match(/^\d+$/)){MW_postbox.dom_allglog.checked=false;if(MW_postbox.follow==MW_postbox.spln_glogger_id){MW_postbox.dom_cbsglog.checked=true}}
else{MW_postbox.allglogg_timeout=setTimeout("MW_postbox.dom_allglog.checked = true",100);}
MW_postbox.posting=0;if(MW_postbox.current_page==MW_postbox.page_count||MW_postbox.current_page==0){MW_postbox.fetch_timeout=self.setTimeout("MW_postbox.fetch()",MW_postbox.global.fetchMillisecs);}},failure:function(data){clearTimeout(MW_postbox.fetch_timeout);if(MW_postbox.posting){MW_postbox.togglePleaseWait('hide');MW_postbox.display_problem_msg('in','');MW_postbox.posting=0;}
MW_postbox.fetch_timeout=self.setTimeout("MW_postbox.fetch()",MW_postbox.global.fetchMillisecs);},timeout:MW_postbox.global.timeoutMillisecs,argument:['gameabbrev','delay_for_post']};MW_postbox.goto_page=function(e,obj){MW_postbox.current_page=parseFloat(obj.getAttribute('goto_page'));if(MW_postbox.content[MW_postbox.current_page]==null||MW_postbox.current_page==MW_postbox.page_count){clearTimeout(MW_postbox.fetch_timeout);MW_postbox.fetch();}
else{MW_postbox.set_page_numbers();MW_postbox.re_render_content();}}
MW_postbox.follow_author_event=function(e,obj){authorid=parseFloat(obj.getAttribute('authorid'));MW_postbox.follow_author(authorid);}
MW_postbox.remove_mccid=function(e,obj){var mccid=parseFloat(obj.getAttribute('mccid'));if(mccid+''!=""&&MW_postbox.global.is_internal){MW_postbox.mccid_to_remove=mccid;MW_postbox.set_page_numbers();var breakIt=0;if(MW_postbox.content){for(var pg in MW_postbox.content){for(var i in MW_postbox.content[pg]){if(MW_postbox.content[pg][i].mccid==MW_postbox.mccid_to_remove){MW_postbox.content[pg][i].status='D';MW_postbox.content[pg][i].content='(This entry has been removed by the administrator)';i=MW_postbox.content[pg].length;pg=MW_postbox.content.length;breakIt=1;break;}
if(breakIt)break;}}}
MW_postbox.re_render_content();MW_postbox.fetch();}}
MW_postbox.follow_author=function(authorid){if(authorid+''!=""&&authorid+''!=MW_postbox.follow+''){MW_postbox.follow=authorid;MW_postbox.last_mccid=0;MW_postbox.content=null;MW_postbox.set_page_numbers();MW_postbox.re_render_content();MW_postbox.fetch();}}
MW_postbox.save_and_display_page=function(jReply){if((jReply.total_pages||MW_postbox.global.add_mode=='refresh')&&jReply.content){if(MW_postbox.global.add_mode=='refresh'){MW_postbox.current_page=0;MW_postbox.content=null;}
if(MW_postbox.current_page==MW_postbox.page_count||MW_postbox.current_page==0){if(MW_postbox.current_page<parseFloat(jReply.total_pages)){if(MW_postbox.current_page!=null&&MW_postbox.current_page>0&&MW_postbox.content!=null){MW_postbox.content[MW_postbox.current_page]=null
clearTimeout(MW_postbox.fetch_timeout);MW_postbox.fetch();}
MW_postbox.dom_glog_text.innerHTML='';}
MW_postbox.current_page=parseFloat(jReply.total_pages);}
MW_postbox.page_count=jReply.total_pages;MW_postbox.set_page_numbers();}
if(MW_postbox.current_page<MW_postbox.page_count){MW_postbox.set_page_content(MW_postbox.current_page,jReply.content);MW_postbox.re_render_content();}
else{MW_postbox.add_page_content(MW_postbox.current_page,jReply.content);MW_postbox.re_render_content();}}
MW_postbox.re_render_content=function(){MW_postbox.dom_glog_text.innerHTML='';if(MW_postbox.content){for(i in MW_postbox.content[MW_postbox.current_page]){MW_postbox.insertContent(MW_postbox.content[MW_postbox.current_page][i]);}}}
MW_postbox.set_page_content=function(page,content){MW_postbox.content[page]=content;}
MW_postbox.add_page_content=function(page,content){if(MW_postbox.content==null){MW_postbox.content={};}
if(MW_postbox.content[page]==null){MW_postbox.content[page]=new Array;}
for(var i=0;i<content.length;i++)
{MW_postbox.content[page].push(content[i]);}}
MW_postbox.insertContent=function(content){var newDD=document.createElement("dd");newDD.innerHTML=content.content;MW_postbox.dom_glog_text.insertBefore(newDD,MW_postbox.dom_glog_text.firstChild);newDD=null;newDT=document.createElement("dt");{var newS=document.createElement("span");newS.innerHTML=content.game_period_time;newDT.appendChild(newS);newS=null;var newDv=document.createElement("div");newDv.innerHTML=content.author.links;if(MW_postbox.global.is_internal==1&&content.author.cbsglogger!=1&&content.status==''){var newA=document.createElement("a");newA.href='#';newA.innerHTML='remove entry ';YAHOO.util.Dom.addClass(newA,'remove');newA.setAttribute('mccid',content.mccid);YAHOO.util.Event.on(newA,'click',MW_postbox.remove_mccid,newA);newDv.innerHTML+='&nbsp;';newDv.appendChild(newA);newA=null;}
{if((MW_postbox.follow+'').match(/^\d+$/)==null&&MW_postbox.global.show_view_only_this==1){var newA=document.createElement("a");newA.href='#';newA.innerHTML='View only this Glogger';YAHOO.util.Dom.addClass(newA,'viewonly');newA.setAttribute('authorid',content.author.authorid);YAHOO.util.Event.on(newA,'click',MW_postbox.follow_author_event,newA);newDv.appendChild(newA);newA=null;}
newDT.appendChild(newDv);if(content.author.cbsglogger==1){YAHOO.util.Dom.addClass(newDT,'cbsglogger')}}
newDv=null;MW_postbox.dom_glog_text.insertBefore(newDT,MW_postbox.dom_glog_text.firstChild);while(MW_postbox.global.display_pages==0&&MW_postbox.global.comments_per_page>0&&MW_postbox.dom_glog_text.childNodes.length>(MW_postbox.global.comments_per_page*2)){MW_postbox.dom_glog_text.removeChild(MW_postbox.dom_glog_text.lastChild);MW_postbox.dom_glog_text.removeChild(MW_postbox.dom_glog_text.lastChild);}}
newDT=null;}
MW_postbox.display_problem_msg=function(what,error_msg){YAHOO.util.Dom.setStyle(MW_postbox.dom_problemPosting,'display','block');if(what=='in'){if(error_msg){var newLI=document.createElement("li");newLI.innerHTML=error_msg;var ul=MW_postbox.dom_problemPosting.getElementsByTagName('ul')[0];while(ul.hasChildNodes()){ul.removeChild(ul.firstChild)}
ul.appendChild(newLI);newLI=null;}
if(!MW_postbox.problem_msg_fade_out.isAnimated()&&!MW_postbox.problem_msg_fade_out.isAnimated()){YAHOO.util.Dom.setStyle(MW_postbox.dom_problemPosting,'opacity',0);MW_postbox.problem_msg_fade_in.onComplete.subscribe(function(){MW_postbox.display_problem_msg('out','');});MW_postbox.problem_msg_fade_in.animate();}}
else{if(!MW_postbox.problem_msg_fade_out.isAnimated()&&!MW_postbox.problem_msg_fade_out.isAnimated()){MW_postbox.problem_msg_fade_out.onComplete.subscribe(function(){var ul=MW_postbox.dom_problemPosting.getElementsByTagName('ul')[0];while(ul.hasChildNodes()){ul.removeChild(ul.firstChild)}
YAHOO.util.Dom.setStyle(MW_postbox.dom_problemPosting,'display','none');});MW_postbox.problem_msg_fade_out.animate();}}}
MW_postbox.togglePleaseWait=function(mode){var display=YAHOO.util.Dom.getStyle(MW_postbox.dom_pleaseWait,'display');if(mode=='show'&&display=='none'){YAHOO.util.Dom.setStyle(MW_postbox.dom_problemPosting,'display','none');YAHOO.util.Dom.setStyle(MW_postbox.dom_postForm,'display','none');YAHOO.util.Dom.setStyle(MW_postbox.dom_pleaseWait,'display','block');}
else if(display=='block'){YAHOO.util.Dom.setStyle(MW_postbox.dom_postForm,'display','block');YAHOO.util.Dom.setStyle(MW_postbox.dom_pleaseWait,'display','none');}}
MW_postbox.request=function(){var glog_post=YAHOO.util.Dom.get("glog_post").value;if(!glog_post){return};if(glog_post.length>500){MW_postbox.display_problem_msg('in','Comments can\'t be more than 500 characters long, please adjust.');return;}
clearTimeout(MW_postbox.fetch_timeout);MW_postbox.posting=1;var pg_num=MW_postbox.current_page;if(MW_postbox.current_page==MW_postbox.page_count){pg_num=null;}
var postData="post=1&gameabbrev="+escape(MW_postbox.global.gameabbrev)+"&last_mccid="+MW_postbox.last_mccid;postData+="&per_pg="+MW_postbox.global.comments_per_page+"&pg_num="+pg_num;postData+="&follow="+MW_postbox.follow;var aDate=new Date();var stamp=aDate.getTime();postData+="&cache="+stamp;postData+="&CACHE_OVERRIDE=1";postData+="&glog_post="+escape(glog_post);YAHOO.util.Dom.setStyle(MW_postbox.dom_problemPosting,'display','none');MW_postbox.togglePleaseWait('show');YAHOO.util.Connect.asyncRequest('POST',MW_postbox.global.target,MW_postbox.callback,postData);};MW_postbox.fetch=function(){if(MW_postbox.posting){return};var pg_num=MW_postbox.current_page;if(MW_postbox.current_page==MW_postbox.page_count){pg_num=null;}
var postData="get=1&gameabbrev="+escape(MW_postbox.global.gameabbrev)+"&last_mccid="+MW_postbox.last_mccid;postData+="&per_pg="+MW_postbox.global.comments_per_page+"&pg_num="+pg_num;postData+="&follow="+MW_postbox.follow;if(MW_postbox.global.is_internal==1&&MW_postbox.mccid_to_remove){postData+="&remove="+MW_postbox.mccid_to_remove;}
var aDate=new Date();var stamp=aDate.getTime();postData+="&cache="+stamp;postData+="&CACHE_OVERRIDE=1";YAHOO.util.Connect.asyncRequest('GET',MW_postbox.global.target+'?'+postData,MW_postbox.callback);};MW_postbox.set_page_numbers=function(){if(MW_postbox.follow==null){MW_postbox.follow=''}
if(MW_postbox.page_count<=1||(MW_postbox.follow+'').match(/^\d+$/)||MW_postbox.global.display_pages==0){if(MW_postbox.dom_pageNav){var ul=MW_postbox.dom_pageNav.getElementsByTagName('ul')[0];ul.innerHTML='';}}
else{YAHOO.util.Dom.setStyle(MW_postbox.dom_pageNav,'display','block');var ul=MW_postbox.dom_pageNav.getElementsByTagName('ul')[0];ul.innerHTML='';if(MW_postbox.current_page>1){var newLI=document.createElement("li");var newA=document.createElement("a");newA.href='#';newA.innerHTML='&laquo; PREV';newLI.appendChild(newA);newLI.innerHTML=newLI.innerHTML+' &middot; ';newLI.setAttribute('goto_page',MW_postbox.current_page-1);ul.appendChild(newLI);YAHOO.util.Event.on(newLI,'click',MW_postbox.goto_page,newLI);newA=null;newLI=null;}
else{var newLI=document.createElement("li");newLI.innerHTML='&laquo; PREV &middot; ';ul.appendChild(newLI);newLI=null;}
for(var p=1;p<=MW_postbox.page_count;p++){var prefix='';var suffix='';var display=1;if(MW_postbox.page_count>12){if(MW_postbox.current_page<=10){if(p>10&&p<MW_postbox.page_count){display=0}
else if(p==MW_postbox.page_count){prefix='...'}}
else if(MW_postbox.current_page>=MW_postbox.page_count-10){if(p>1&&p<MW_postbox.page_count-10){display=0}
else if(p==1){suffix='...'}}
else{if(p==1||(p>=(MW_postbox.current_page-4)&&(p<=(MW_postbox.current_page+4)))||p==MW_postbox.page_count)
{display=1}else{display=0}
if(p==MW_postbox.page_count){prefix='...'}
if(p==1){suffix='...'}}}
if(display){var newLI=document.createElement("li");if(p!=MW_postbox.current_page){var newA=document.createElement("a");newA.href='#';newA.innerHTML=p;newLI.appendChild(newA);newA=null;}
else{YAHOO.util.Dom.addClass(newLI,'current');newLI.innerHTML=p;}
newLI.innerHTML+=' &middot; ';newLI.setAttribute('goto_page',p);newLI.innerHTML=prefix+newLI.innerHTML+suffix;ul.appendChild(newLI);if(p!=MW_postbox.current_page){YAHOO.util.Event.on(newLI,'click',MW_postbox.goto_page,newLI)}
newA=null;newLI=null;}}
if(MW_postbox.current_page<MW_postbox.page_count){var newLI=document.createElement("li");var newA=document.createElement("a");newA.href='#';newA.innerHTML='NEXT &raquo;';newLI.appendChild(newA);newLI.setAttribute('goto_page',MW_postbox.current_page+1);ul.appendChild(newLI);YAHOO.util.Event.on(newLI,'click',MW_postbox.goto_page,newLI);newA=null;newLI=null;}
else{var newLI=document.createElement("li");newLI.innerHTML='NEXT &raquo;';ul.appendChild(newLI);newLI=null;}}};MW_postbox.pause=function(){if(MW_postbox.paused==0){clearTimeout(MW_postbox.fetch_timeout);MW_postbox.paused=1;YAHOO.util.Dom.setStyle("control_pause",'display','none');YAHOO.util.Dom.setStyle("control_play",'display','block');}};MW_postbox.play=function(){if(MW_postbox.paused==1){YAHOO.util.Dom.setStyle("control_pause",'display','block');YAHOO.util.Dom.setStyle("control_play",'display','none');MW_postbox.fetch_timeout=self.setTimeout("MW_postbox.fetch()",MW_postbox.global.fetchMillisecs);MW_postbox.paused=0;}};MW_postbox.reinstate_original_glog=function(){if(MW_postbox.spln_glogger_id!=null){MW_postbox.follow_author(MW_postbox.spln_glogger_id);}};MW_postbox.show_all_gloggers=function(){if((MW_postbox.follow+'').match(/^\d+$/)||YAHOO.util.Dom.getStyle(MW_postbox.dom_sbGlogWrap,'display')=='block'){YAHOO.util.Dom.setStyle(MW_postbox.dom_sbGlogWrap,'display','none');YAHOO.util.Dom.setStyle(MW_postbox.dom_postBox,'display','block');YAHOO.util.Dom.setStyle('gcontent','display','block');if(MW_postbox.global.display_pages==1){YAHOO.util.Dom.setStyle('pageNav','display','block');}
MW_postbox.last_mccid=0;MW_postbox.current_page=0;MW_postbox.page_count=0;MW_postbox.follow='';MW_postbox.content=null;MW_postbox.dom_glog_text.innerHTML='';clearTimeout(MW_postbox.fetch_timeout);MW_postbox.fetch();}};YAHOO.util.Event.on(MW_postbox.dom_collapse,'click',MW_postbox.collapse.animate,MW_postbox.collapse,true);if("$form_mode"=='expanded'){MW_postbox.expand.animate();}
YAHOO.util.Event.on(MW_postbox.dom_expand,'click',MW_postbox.expand.animate,MW_postbox.expand,true);YAHOO.util.Event.on(MW_postbox.dom_submitBtn,'click',function(){MW_postbox.request('click')});YAHOO.util.Dom.setStyle(MW_postbox.dom_problemPosting,'opacity',MW_postbox.global.opacity.error);YAHOO.util.Dom.setStyle(MW_postbox.dom_postBox,'opacity',MW_postbox.global.opacity.light);YAHOO.util.Dom.setStyle("control_pause",'display','block');YAHOO.util.Dom.setStyle("control_play",'display','none');YAHOO.util.Event.on(['cbsglog','old_cbsglog'],'click',function(){MW_postbox.reinstate_original_glog()});YAHOO.util.Event.on(['allglog','old_allglog'],'click',function(){MW_postbox.show_all_gloggers()});if(MW_postbox.global.pause_on_hover==1){YAHOO.util.Event.on("MWIDGET_postbox",'mouseover',function(){clearTimeout(MW_postbox.play_timeout);MW_postbox.pause();});YAHOO.util.Event.on("MWIDGET_postbox",'mouseout',function(){MW_postbox.play_timeout=self.setTimeout("MW_postbox.play()",500);});}
YAHOO.util.Event.onAvailable('MWIDGET_postbox',function(){MW_postbox.fetch()});