var CommentPollerProfiler={_entry_id:false,_refeshing_comments:false,monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],ymd:false,entry_id:function()
{if(CommentPollerProfiler._entry_id)
return CommentPollerProfiler._entry_id;if((urlBits=window.location.href.match(/_[nb]_(\d+)/))&&urlBits.length>0)
{return urlBits.pop()}
else
{return false;}},check:function(entry_id)
{comments_top=D.getY('comments_inner');top=(document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop);vpH=D.getViewportHeight();view=parseInt(vpH+top);if((new Date()).getDay()==3)
{if(view>comments_top)
{entry_id=CommentPollerProfiler.entry_id();if(urchinTracker)
urchinTracker('/devy/new_polling');}
if(HuffCookies.getUserName())
setTimeout("CommentPollerProfiler.check();",30000);else
setTimeout("CommentPollerProfiler.check();",60000);}
else
{if(view>comments_top)
{if(urchinTracker)
urchinTracker('/devy/new_polling_2');}
if(HuffCookies.getUserName())
setTimeout("CommentPollerProfiler.check();",45000);else
setTimeout("CommentPollerProfiler.check();",90000);}},init:function()
{if(!CommentPollerProfiler.entry_id())
return false;if((urlBits=window.location.href.match(/(\d{4}\/\d{2}\/\d{2}\/)/))&&urlBits.length>0)
{CommentPollerProfiler.ymd=urlBits.pop();}
else
{if((dt=D.getElementsByClassName('comments_datetime','DIV','blog_title')))
{if(dates=dt[0].innerHTML.match(/Posted ([A-Za-z]+) (\d+), (\d{4})/))
{CommentPollerProfiler.ymd=dates[3]+"/"+(CommentPollerProfiler.monthNames.arrayPos(dates[1])+1)+"/"+dates[2];}}}
if((new Date()).getDay()==3)
{if(HuffCookies.getUserName())
setTimeout("CommentPollerProfiler.check();",5000);else
setTimeout("CommentPollerProfiler.check();",30000);}
else
{if(HuffCookies.getUserName())
setTimeout("CommentPollerProfiler.check();",30000);else
setTimeout("CommentPollerProfiler.check();",180000);}}}
var previewComment=function()
{comment_body=$('comment_preview_inner');comment_author=$('preview_name');body_text=$('root_comment_text').value;re=/<\S[^>]*>/g;body_text=body_text.replace(re,"");comment_body.innerHTML=body_text.replace(/\r|\n/g,'<br \/>');HuffPoUtil.show('comment_preview');HuffPoUtil.hide('comment_meta');};var previewCommentForReply=function(cmt_id)
{comment_body=$('comment_preview_inner_'+cmt_id);comment_author=$('preview_name_'+cmt_id);body_text=$('comment_text_'+cmt_id).value;re=/<\S[^>]*>/g;body_text=body_text.replace(re,"");comment_body.innerHTML=body_text.replace(/\r|\n/g,'<br \/>');HuffPoUtil.show('comment_preview_'+cmt_id);HuffPoUtil.hide('comment_meta_'+cmt_id);};var Comments={maxWords:350,collapseComment:function(id){$('cmt_txt_wrap_expand_'+id).style.display='inline';$('cmt_txt_wrap_collapse_'+id).style.display='none';$('cmt_txt_wrap_'+id).style.display='none';$('comment_children_'+id).style.display='none';},expandComment:function(id){$('cmt_txt_wrap_expand_'+id).style.display='none';$('cmt_txt_wrap_collapse_'+id).style.display='inline';$('cmt_txt_wrap_'+id).style.display='block';$('comment_children_'+id).style.display='block';},lengthOkay:function(el){over=0;this.trimmed=$(el).value;if(this.trimmed.match(/\S/))
{this.trimmed=this.trimmed.replace(/^[\s._\-*+&?\/\\]+/,'');this.trimmed=this.trimmed.replace(/[\s._\-*+&?\/\\]$/,'');}
this.chunkedText=this.trimmed.split(/[\s._\-*+&?\/\\]+/);if(this.chunkedText.length>this.maxWords)
return(this.chunkedText.length-this.maxWords);else if(this.trimmed==''||!$(el).value||$(el).value=='')
return-1;else
return 0;},alertEmpty:function(){alert("Your comment is empty. Please type a comment, then click POST again.");},alertTooLong:function(over){alert("Your comment is too long by "+over+" "+(over==1?'word':'words')+". The maximum length is "+this.maxWords+" words. Please edit your comment and click POST again.");},addComment:function(){var over=this.lengthOkay('root_comment_text');if(over==0){$('post_button_new').disabled=true;HuffPoUtil.hide('post_button_new');D.setStyle('post_spinner_new','display','inline');YAHOO.util.Connect.setForm('comments_form_new');var co=YAHOO.util.Connect.asyncRequest('POST','/comment/postComment.php',this);}else if(over>0){this.alertTooLong(over);}else if(over<0)
this.alertEmpty();},addCommentAsReply:function(parent_id){var over=this.lengthOkay('comment_text_'+parent_id);if(over==0){$('post_button_'+parent_id).disabled=true;HuffPoUtil.hide('post_button_'+parent_id);D.setStyle('post_spinner_'+parent_id,'display','inline');YAHOO.util.Connect.setForm('comments_form_'+parent_id);var co=YAHOO.util.Connect.asyncRequest('POST','/comment/postComment.php',this);}else if(over>0){this.alertTooLong(over);}else if(over<0)
this.alertEmpty();},scrollToComment:function(id){scrollToAnchor('comment_'+id);},scrollToParent:function(id){this.scrollToComment(id);Fat.fade_element('comment_'+id,30,1000);},success:function(o){splits=o.responseText.split(':::');new_html=splits[0];is_new=splits[1]=='new'?true:false;if(!is_new)
var cmt_parent_id=Math.floor(splits[1])+0;cmt_id=splits[2];if(!is_new){var el=$('comment_children_'+cmt_parent_id);$('post_button_'+cmt_parent_id).disabled=false;$('comment_text_'+cmt_parent_id).value='';D.setStyle('post_button_'+cmt_parent_id,'display','inline');D.setStyle('post_spinner_'+cmt_parent_id,'display','none');HuffPoUtil.hide('reply_'+cmt_parent_id);HuffPoUtil.hide('comment_preview_'+cmt_parent_id);Fat.fade_element('comment_children_'+cmt_parent_id);}else{var el=$('comments_inner');$('post_button_new').disabled=false;$('root_comment_text').value='';D.setStyle('post_button_new','display','inline');D.setStyle('post_spinner_new','display','none');Fat.fade_element('comment_'+cmt_id);}
el.innerHTML+=new_html;this.scrollToComment(cmt_id);HuffPoUtil.hide('comment_preview');},displayReplyBox:function(comment_id,entry_id,cur_level)
{el=$('reply_ajax_for_'+comment_id);el.innerHTML='<br /><p><img src="/images/v/spinner.gif" alt="loading" /> Loading...</p>';var co=YAHOO.util.Connect.asyncRequest('GET','/comment/commentForm.php?entry_id='+entry_id+'&comment_id='+comment_id+'&level='+cur_level,ReplyBoxCallbacks);return false;},displayPostBox:function(entry_id)
{el=$('ajax_post_form_for_root');el.innerHTML='<br /><p><img src="/images/v/spinner.gif" alt="loading" /> Loading...</p>';var co=YAHOO.util.Connect.asyncRequest('GET','/comment/rootCommentForm.php?entry_id='+entry_id,RootBoxCallbacks);return false;}}
var ReplyBoxCallbacks={success:function(o)
{var splits=o.responseText.split(':::');var new_html=splits[0];var cmt_id=Math.floor(splits[1])+0;var el=$('reply_ajax_for_'+cmt_id);el.innerHTML=new_html;}}
var RootBoxCallbacks={success:function(o)
{var splits=o.responseText.split(':::');var new_html=splits[0];var cmt_id=Math.floor(splits[1])+0;var el=$('ajax_post_form_for_root');el.innerHTML=new_html;}}
var Fat={make_hex:function(r,g,b)
{r=r.toString(16);if(r.length==1)r='0'+r;g=g.toString(16);if(g.length==1)g='0'+g;b=b.toString(16);if(b.length==1)b='0'+b;return"#"+r+g+b;},fade_all:function()
{var a=document.getElementsByTagName("*");for(var i=0;i<a.length;i++)
{var o=a[i];var r=/fade-?(\w{3,6})?/.exec(o.className);if(r)
{if(!r[1])r[1]="";if(o.id)Fat.fade_element(o.id,null,null,"#"+r[1]);}}},fade_element:function(id,fps,duration,from,to)
{if(!fps)fps=30;if(!duration)duration=3000;if(!from||from=="#")from="#FFFF33";if(!to)to=this.get_bgcolor(id);var frames=Math.round(fps*(duration/1000));var interval=duration/frames;var delay=interval;var frame=0;if(from.length<7)from+=from.substr(1,3);if(to.length<7)to+=to.substr(1,3);var rf=parseInt(from.substr(1,2),16);var gf=parseInt(from.substr(3,2),16);var bf=parseInt(from.substr(5,2),16);var rt=parseInt(to.substr(1,2),16);var gt=parseInt(to.substr(3,2),16);var bt=parseInt(to.substr(5,2),16);var r,g,b,h;while(frame<frames)
{r=Math.floor(rf*((frames-frame)/frames)+rt*(frame/frames));g=Math.floor(gf*((frames-frame)/frames)+gt*(frame/frames));b=Math.floor(bf*((frames-frame)/frames)+bt*(frame/frames));h=this.make_hex(r,g,b);setTimeout("Fat.set_bgcolor('"+id+"','"+h+"')",delay);frame++;delay=interval*frame;}
setTimeout("Fat.set_bgcolor('"+id+"','"+to+"')",delay);},set_bgcolor:function(id,c)
{var o=document.getElementById(id);o.style.backgroundColor=c;},get_bgcolor:function(id)
{var o=document.getElementById(id);while(o)
{var c;if(window.getComputedStyle)c=window.getComputedStyle(o,null).getPropertyValue("background-color");if(o.currentStyle)c=o.currentStyle.backgroundColor;if((c!=""&&c!="transparent")||o.tagName=="BODY"){break;}
o=o.parentNode;}
if(c==undefined||c==""||c=="transparent")c="#FFFFFF";var rgb=c.match(/rgb\s*\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)/);if(rgb)c=this.make_hex(parseInt(rgb[1]),parseInt(rgb[2]),parseInt(rgb[3]));return c;}}
var scrollInt;var scrTime,scrSt,scrDist,scrDur,scrInt;function scrollPage()
{scrTime+=scrInt;if(scrTime<scrDur){window.scrollTo(0,easeInOut(scrTime,scrSt,scrDist,scrDur));}else{window.scrollTo(0,scrSt+scrDist);clearInterval(scrollInt);}}
function scrollToAnchor(aname)
{var anchors,i,ele;if(!document.getElementById)
return;anchors=document.getElementsByTagName("div");for(i=0;i<anchors.length;i++){if(anchors[i].id==aname){ele=anchors[i];i=anchors.length;}}
if(window.scrollY)
scrSt=window.scrollY;else if(document.documentElement.scrollTop)
scrSt=document.documentElement.scrollTop;else
scrSt=document.body.scrollTop;scrDist=ele.offsetTop-scrSt;scrDur=100;scrTime=0;scrInt=10;clearInterval(scrollInt);scrollInt=setInterval(scrollPage,scrInt);}
function easeInOut(t,b,c,d)
{return c/2*(1-Math.cos(Math.PI*t/d))+b;}