var npid=0,playtime=0,lgf_comfocus=false,lgf_delcoms=[];function doAjaxShowComments(){if(lgf_comfocus){return false;}lgf_comfocus=true;$('#donewcomments').attr({disabled:true}).addClass('dis');$('div#newcommentslinks').prepend('<img src="loadingw.gif" width="16" height="16">');var lastcom=$('div#commentbucket div[id^=cc]:last');if($(lastcom).length==0){var lastid=0;var lastnum=0;}else{var lastid=$(lastcom).attr('id').substring(2);var lastnum=parseInt($(lastcom).find('.cnum a:first-child').html());}var deljson='["cc0"]';if(lgf_delcoms.length>0){var j=[];for(var i=0;i<lgf_delcoms.length;i++){j.push('"'+lgf_delcoms[i]+'"');}deljson='['+j.join(',')+']';}$.post('/weblog/lgf-ajaxshowcomments.php',{entryid:$('#newcommententrynumber').val(),nextcomnum:lastnum+1,lastcommentid:lastid,newcommenttype:$('#newcommenttype').val(),vidcount:$('#vidcount').val(),emod:$('#entrymodified').val(),delcoms:deljson},function(theResponse){var comments=eval('('+defangJSON(theResponse)+')');if(comments.newbucket){var thenewbucket=$('<div></div>');$(thenewbucket).appendTo('#commentbucket').hide();}for(container in comments){switch(container){case'deleted':var delarray=comments[container];var b=$('#commentbucket');for(var i=0;i<delarray.length;i++){lgf_delcoms.push(delarray[i].id);var d=$(b).find('#'+delarray[i].id);var dnum=$(d).find('.cnum a:first-child').html();$(d).html(delarray[i].c).find('.cnum a:first-child').html(dnum);}break;case'restored':var restobject=comments[container];var b=$('#commentbucket');for(restid in restobject){var r=$(b).find('#'+restid);var rnum=$(r).find('.cnum a:first-child').html();$(r).html(restobject[restid]).find('.cnum a:first-child').html(rnum);for(var i=0;i<lgf_delcoms.length;i++){if(lgf_delcoms[i]==restid){lgf_delcoms.splice(i,1);break;}}}break;case'nav':$('ul.navpanel').each(function(){if(comments[container].u1==''){$(this).find('li.lft').empty();}else{$(this).find('li.lft').html('<a href="/article/'+comments[container].u1+'/comments/" accesskey="p">&laquo; '+comments[container].t1+'</a>');}if(comments[container].u2==''){$(this).find('li.rgt').empty();}else{$(this).find('li.rgt').html('<a href="/article/'+comments[container].u2+'/comments/" accesskey="n">'+comments[container].t2+' &raquo;</a>');}});break;case'entrystring':$('#entrydiv').find('a.imgpop').unbind().end().html(comments[container].theentry).find('a:has(img)').not('.nhov').each(function(){$(this).addClass('nhov');}).end().find('a.imgpop').leviTip({sourceType:'image',source:'rel',imgPath:'http://littlegreenfootballs.com/weblog/pictures/',dropShadow:false,addClass:'idesc',leftOffset:10,hiSensitivity:1});$('#entrymodified').val(comments[container].modified);break;case'newbucket':break;case'vidcount':$('#vidcount').val(comments[container]);break;default:var nextnum=comments[container].thenumber;$('<div id="'+container+'"></div>').appendTo(thenewbucket).html(comments[container].thecomment);}}if(nextnum){var total=nextnum-1;$('#totalcommentnumber').html('<em>'+total+' comments</em>');$(thenewbucket).slideDown('normal',function(){$('#donewcomments').attr('disabled',false).removeClass('dis').find('span').html('');});}else{$('#donewcomments').attr('disabled',false).removeClass('dis').find('span').html('');}$('div#newcommentslinks img').remove();lgf_comfocus=false;});return false;}function doAjaxPostComment(){if($.trim($('#newcommentbody').val())==''||lgf_comfocus){return false;}lgf_comfocus=true;$('#commentsubmit').attr({disabled:true}).addClass('dis');$('#donewcomments').attr({disabled:true}).addClass('dis');$('div#newcommentslinks').prepend('<img src="loadingw.gif" width="16" height="16">');var lastcom=$('div#commentbucket div[id^=cc]:last');if($(lastcom).length==0){var lastid=0;var lastnum=0;}else{var lastid=$(lastcom).attr('id').substring(2);var lastnum=parseInt($(lastcom).find('.cnum a:first-child').html());}var deljson='["cc0"]';if(lgf_delcoms.length>0){var j=[];for(var i=0;i<lgf_delcoms.length;i++){j.push('"'+lgf_delcoms[i]+'"');}deljson='['+j.join(',')+']';}var next=lastnum+1;var params='lastcommentid='+lastid+'&nextcomnum='+next+'&vidcount='+escape($('#vidcount').val())+'&emod='+escape($('#entrymodified').val())+'&delcoms='+escape(deljson)+'&newcommententrynumber='+$('#newcommententrynumber').val()+'&newcommenttype='+$('#newcommenttype').val()+'&newcommentid='+$('#newcommentid').val()+'&newcommentauthor='+escape($('#newcommentauthor').val())+'&newcommentemail='+escape($('#newcommentemail').val())+'&newcommenthomepage='+escape($('#newcommenthomepage').val())+'&newcommentbody='+escape($('#newcommentbody').val().replace(/\+/ig,'&#43;'));$.post('/weblog/lgf-ajaxpostcomment.php',params,function(theResponse){var comments=eval('('+defangJSON(theResponse)+')');if(comments.error){alert(comments.error.reason);$('#donewcomments').attr('disabled',false).removeAttr('style').find('span').html('');$('#markItUpNewcommentbody div.markReturn').remove();}else{$('#newcommentbody').val('');$('#commentForm input.charsleft').val($('#commentForm input[name=maxsize]').val().toString());$('#previewdiv').html('');$.LeviTip.closeLeviTip();if(comments.newbucket){var thenewbucket=$('<div></div>');$(thenewbucket).appendTo('#commentbucket').hide();}for(container in comments){switch(container){case'newid':$('#newcommentid').val(comments[container].theid);break;case'deleted':var delarray=comments[container];for(var i=0;i<delarray.length;i++){lgf_delcoms.push(delarray[i].id);var dnum=$('#'+delarray[i].id).find('.cnum a:first-child').html();$('#'+delarray[i].id).html(delarray[i].c).find('.cnum a:first-child').html(dnum);}break;case'restored':var restobject=comments[container];var b=$('#commentbucket');for(restid in restobject){var r=$(b).find('#'+restid);var rnum=$(r).find('.cnum a:first-child').html();$(r).html(restobject[restid]).find('.cnum a:first-child').html(rnum);for(var i=0;i<lgf_delcoms.length;i++){if(lgf_delcoms[i]==restid){lgf_delcoms.splice(i,1);break;}}}break;case'nav':$('ul.navpanel').each(function(){if(comments[container].u1==''){$(this).find('li.lft').empty();}else{$(this).find('li.lft').html('<a href="/article/'+comments[container].u1+'/comments/" accesskey="p">&laquo; '+comments[container].t1+'</a>');}if(comments[container].u2==''){$(this).find('li.rgt').empty();}else{$(this).find('li.rgt').html('<a href="/article/'+comments[container].u2+'/comments/" accesskey="n">'+comments[container].t2+' &raquo;</a>');}});break;case'entrystring':$('#entrydiv').find('a.imgpop').unbind().end().html(comments[container].theentry).find('a:has(img)').not('.nhov').each(function(){$(this).addClass('nhov');}).end().find('a.imgpop').leviTip({sourceType:'image',source:'rel',imgPath:'http://littlegreenfootballs.com/weblog/pictures/',dropShadow:false,addClass:'idesc',leftOffset:10,hiSensitivity:1});$('#entrymodified').val(comments[container].modified);break;case'newbucket':break;case'vidcount':$('#vidcount').val(comments[container]);break;default:var nextnum=comments[container].thenumber;$('<div id="'+container+'"></div>').appendTo(thenewbucket).html(comments[container].thecomment);}}if(nextnum){var total=nextnum-1;$('#totalcommentnumber').html('<em>'+total+' comments</em>');$(thenewbucket).slideDown('normal',function(){$('#donewcomments').attr('disabled',false).removeClass('dis').find('span').html('');});}else{$('#donewcomments').attr('disabled',false).removeClass('dis').find('span').html('');}}if($('input#repret').is(':checked')){var retid=$('input#repret').val();window.scrollTo(0,$('#cc'+retid).offset().top);$.cookie('REPLYRETURN','yes',{expires:365,path:'/',domain:'.littlegreenfootballs.com',secure:false});}else if($('input#repret').length!==0){$.cookie('REPLYRETURN','no',{expires:365,path:'/',domain:'.littlegreenfootballs.com',secure:false});}$('#markItUpNewcommentbody div.markReturn').remove();$('#commentsubmit').attr('disabled',false).removeClass('dis');$('div#newcommentslinks img').remove();lgf_comfocus=false;});return false;}function doAjaxPreview(){if($.trim($('#newcommentbody').val())===''){$('#previewdiv').html('');return false;}var theText=$('#newcommentbody').val();var params='newcommentbody='+escape(theText.replace(/\+/ig,'&#43;'))+'&vidcount='+escape($('#vidcount').val());$('#previewdiv').html('<p><img src="loadingw.gif" width="16" height="16"> <em>Formatting comment...</em></p>').show();$.post('/weblog/lgf-ajaxpreview.php',params,function(theResponse){var preview=eval('('+defangJSON(theResponse)+')');$.LeviTip.closeLeviTip();if(preview.previewstring){$('#previewdiv').hide().html(preview.previewstring.thecomment).find('.commentpreview').prepend('<input type="button" class="pclose lgfb" value="Close" onclick="$(\'#previewdiv\').slideUp(\'fast\');return false;">').end().slideDown('fast');}else{$('#previewdiv').html('');}});return false;}function openSpellChecker(){var speller=new spellChecker(document.commentForm.newcommentbody);speller.openChecker();}comrateflag=false;function Rate(therating,value){if(comrateflag){return false;}comrateflag=true;var buttonParent=$(therating).parents('.comtop');$(buttonParent).find('a.ipl,a.imi').unbind('click');var id=$(buttonParent).parents('div[id^=cc]').attr('id').substring(2);var originalimage=$(therating).html();var rating=(arguments.length==2)?1:0;$(therating).html('<img src="ajax-loader.gif" width="16" height="16" alt="">').addClass('ibusy');$.post('/weblog/lgf-ajaxrate.php',{c:id,r:rating},function(theResponse){if(theResponse.substr(0,5)=='Error'){$(therating).html(originalimage).removeClass('ibusy');alert(theResponse);comrateflag=false;}else{var theul=$(therating).parents('ul');if(rating==0){if($(theul).find('li a.ipl').hasClass('igray')){$(therating).parent('li').html('<a href="#" class="imi" onclick="return Rate(this)">down</a>').parents('ul').find('li:has(a.ipl)').html('<a href="#" onclick="return Rate(this,1)" class="ipl">up</a>');}else{$(therating).parent('li').html('<a href="#" class="imi igray" onclick="return false">down</a>').parents('ul').find('li:has(a.ipl)').html('<a href="#" onclick="return Rate(this,1)" class="ipl">up</a>');}}else{if($(theul).find('li a.imi').hasClass('igray')){$(therating).parent('li').html('<a href="#" class="ipl" onclick="return Rate(this,1)">up</a>').parents('ul').find('li:has(a.imi)').html('<a href="#" onclick="return Rate(this)" class="imi">down</a>');}else{$(therating).parent('li').html('<a href="#" class="ipl igray" onclick="return false">up</a>').parents('ul').find('li:has(a.imi)').html('<a href="#" onclick="return Rate(this)" class="imi">down</a>');}}var thevalue=parseInt(theResponse);if(thevalue===0){var theclass='rate';}else if(thevalue<0){var theclass='ratedown';}else{var theclass='rateup';}if($.browser.msie){$(theul).find('li.cra a').attr('class',theclass).html(theResponse+'');}else{$(theul).find('li.cra a').hide().attr('class',theclass).html(theResponse+'').fadeIn('slow');}comrateflag=false;}});return false;}function Rating(therating){var id=$(therating).parents('div[id^=cc]').attr('id').substring(2);var oldrating=$(therating).html();$(therating).html('<img src="ajax-loader.gif" class="erateicon" alt="">');$.get('/weblog/lgf-ajaxgetrating.php',{c:id},function(theResponse){var values=eval('('+defangJSON(theResponse)+')');if(values.error){alert(values.error);$(therating).html(oldrating);}else{var thevalue=parseInt(values.rating);if(thevalue===0){var theclass='rate';}else if(thevalue<0){var theclass='ratedown';}else{var theclass='rateup';}$(therating).attr('class',theclass).html(values.rating+'');alert('Rating: '+values.rating+'\nTotal: '+values.total+'\n\nMinus: '+values.minuses+'\n\nPlus: '+values.pluses);}});return false;}function RateEntry(){var therating=this;$(therating).unbind('click').parent('li').siblings('li').children('a.ratebutton').unbind('click');var originalimage=$(therating).html();var rating=$(therating).attr('rel');var entryid=$(therating).parents('ul').siblings('a.therating').attr('rel');$(therating).html('<img src="ajax-loader.gif" width="16" height="16" alt="">').addClass('ibusy');$.post('/weblog/lgf-ajaxrateentry.php',{e:entryid,r:rating},function(entryrating){if(entryrating.substr(0,5)=='Error'){$(therating).html(originalimage).removeClass('ibusy');alert(entryrating);}else{if(rating==0){if($(therating).parents('ul').find('li a.iplus').hasClass('igray')){$(therating).removeClass('ibusy').html(originalimage).click(RateEntry).parents('li').siblings('li').children('a.ratebutton').removeClass('igray').click(RateEntry);}else{$(therating).removeClass('ibusy').html(originalimage).addClass('igray').parents('li').siblings('li').children('a.ratebutton').click(RateEntry);}}else{if($(therating).parents('ul').find('li a.iminus').hasClass('igray')){$(therating).removeClass('ibusy').html(originalimage).click(RateEntry).parents('li').siblings('li').children('a.ratebutton').removeClass('igray').click(RateEntry);}else{$(therating).removeClass('ibusy').html(originalimage).addClass('igray').parents('li').siblings('li').children('a.ratebutton').click(RateEntry);}}var thevalue=parseInt(entryrating);if(thevalue===0){var theclass='rate';}else if(thevalue<0){var theclass='ratedown';}else{var theclass='rateup';}if($.browser.msie){$(therating).parents('ul').siblings('a.therating').hide().attr('class','therating '+theclass).html(entryrating).show();}else{$(therating).parents('ul').siblings('a.therating').hide().attr('class','therating '+theclass).html(entryrating).fadeIn('slow');}}});return false;}function toggleTopRelated(){var related=$('#toprel');if($(related).is(':hidden')){$('p.showtoplink a span').html('&#x25BC; Hide');}if($(related).is(':empty')){var theform=$.ajax({url:'/weblog/lgf-ajaxtoprel.php',data:{form:1},async:false,type:'GET'}).responseText;$(related).html(theform);$('form[name=topform]').submit(function(){return doTopRelated('submit');}).find('select.reldays').change(function(){var prefs=getLinkPrefs();prefs[1]=$(this).val();$.cookie('LINKPREFS',prefs.join('|'),{expires:365,path:'/',domain:'.littlegreenfootballs.com',secure:false});return doTopRelated('');}).end().find('select.numlinks').change(function(){var prefs=getLinkPrefs();prefs[2]=$(this).val();$.cookie('LINKPREFS',prefs.join('|'),{expires:365,path:'/',domain:'.littlegreenfootballs.com',secure:false});return doTopRelated('');}).end().find('input.topdesc').click(function(){var showinput=$('#toprel input[name=showdesc]');var descstate=$(showinput).val();$('#toprel div.thedesc').each(function(i){var thedesc=$(this).parents('div.thelink').find('div.spinlink a[desc]');if($(thedesc).length!==0){if(descstate=='0'){$.LeviTip.closeLeviTip();$(thedesc).unbind();$(thedesc).click(function(){return countLink(this);});$(this).html($(thedesc).attr('desc')).slideDown('fast');}else{$(this).html($(thedesc).attr('desc')).slideUp('fast');$(thedesc).leviTip({source:'desc',dropShadow:false,addClass:'ldesc',leftOffset:10,hiSensitivity:1});}}});$(showinput).val((descstate=='0')?'1':'0');return false;}).end().find('input.toprefresh').click(function(){return doTopRelated('');}).end().find('select.relcategories').change(function(){var prefs=getLinkPrefs();prefs[3]=$(this).val();$.cookie('LINKPREFS',prefs.join('|'),{expires:365,path:'/',domain:'.littlegreenfootballs.com',secure:false});return doTopRelated('');}).end().find('input.topsubshow').click(function(){var thediv=$('form[name=topform] div.topinput');if($(thediv).is(':hidden')){$(thediv).slideDown('fast');$(this).val('hide entry form');}else{$(thediv).slideUp('fast');$(this).val('submit a link');}return false;}).end().find('input[name^=link]').keydown(function(e){return doLinkPreview(this);}).keyup(function(e){return doLinkPreview(this);}).focus(function(e){return doLinkPreview(this);}).end().find('textarea').keydown(function(e){textCounter(this);}).keyup(function(e){textCounter(this);}).focus(function(e){textCounter(this);});}var thelinks=$(related).find('div.linkdiv');var prefs=new Array();if($.cookie('LINKPREFS')){prefs=$.cookie('LINKPREFS').split('|');}if($(related).is(':hidden')){var relform=$(related).find('form.topform');$(relform).find('input.toprefresh,input.topdesc,input.topsubshow').attr('disabled',true).end().find('select.relcategories').html('<option value="">Loading...</option>');$(thelinks).find('a.therating,a.ratebutton,div.spinlink a,a.linkcomnum,a.relpost').unbind();$(relform).find('div.topcontrol').prepend('<img src="bigrotation2.gif">');var daysback=$(relform).find('select.reldays').val();var numlinks=$(relform).find('select.numlinks').val();$(related).slideDown('fast',function(){$.post('/weblog/lgf-ajaxtoprel.php',{cat:$(relform).find('input[name=defaultcat]').val(),days:escape(daysback),num:escape(numlinks)},function(data){var response=eval('('+defangJSON(data)+')');$(thelinks).hide().html(fixEntities(response.links)).find('div.rating').css('visibility','visible').end().find('div.thelink:odd').addClass('thelinkalt').end().find('div.spinlink a').click(function(){return countLink(this);}).end().find('a.therating').click(function(){return showRating(this);}).end().find('a.ratebutton').not('.igray').click(function(){return rateLink(this);});$(thelinks).find('a.linkcomnum').leviTip({source:'rel',leftOffset:-300,dropShadow:false}).end().find('a.relpost').leviTip({source:'rel',leftOffset:-250,dropShadow:false,addClass:'pdesc'});if($(relform).find('input[name=showdesc]').val()=='1'){showDescriptions(thelinks);}else{$(thelinks).find('div.spinlink a').leviTip({source:'desc',dropShadow:false,addClass:'ldesc',leftOffset:10,hiSensitivity:1});}$(thelinks).slideDown('fast');$(relform).find('select.relcategories').html(response.categories).attr({selectedIndex:response.selectedIndex});if(!$.browser.msie){$(relform).find('select.relcategories').find('option[value='+response.selected+']').attr({selected:'selected'});}$(relform).find('div.topcontrol img').remove().end().find('input.toprefresh,input.topdesc,input.topsubshow').attr('disabled',false);});});prefs[0]='1';$.cookie('LINKPREFS',prefs.join('|'),{expires:365,path:'/',domain:'.littlegreenfootballs.com',secure:false});}else{$(related).slideUp('fast',function(){$(thelinks).html('');$('p.showtoplink a span').html('&#x25BA; Show');prefs[0]='0';$.cookie('LINKPREFS',prefs.join('|'),{expires:365,path:'/',domain:'.littlegreenfootballs.com',secure:false});});}return false;}function doTopRelated(mode){var related=$('#toprel');var relform=$(related).find('form.topform');var thelinks=$(related).find('div.linkdiv');if(mode=='submit'&&($(relform).find('input[name=linkurl]').val()==''||$(relform).find('input[name=linktitle]').val()=='')){alert('Link address, title, and category required!');}else if(mode=='submit'&&$(relform).find('select.relcategories').attr('selectedIndex')<4){alert('Please choose a category for your link from the menu.');}else{$(relform).find('input.toprefresh,input.topdesc,input.topsubshow').attr('disabled',true).end().find('input[type=submit]').attr('disabled',true);$(relform).find('div.topcontrol').prepend('<img src="bigrotation2.gif">');var category=$(relform).find('select.relcategories').val();$(relform).find('input[name=defaultcat]').val(category);var daysback=$(relform).find('select.reldays').val();var numlinks=$(relform).find('select.numlinks').val();var description=$(relform).find('textarea[name=linkdesc]').val();description=description.replace(/\+/ig,'&#43;');$.post('/weblog/lgf-ajaxtoprel.php',{cat:escape(category),days:escape(daysback),num:escape(numlinks),u:escape($.trim($(relform).find('input[name=linkurl]').val())),title:escape($(relform).find('input[name=linktitle]').val().replace(/\+/ig,'&#43;')),linkdesc:escape(description),themode:mode},function(data){var response=eval('('+defangJSON(data)+')');if(response.error){$(relform).find('div.topcontrol img').remove();$(relform).find('input[type=submit]').attr('disabled',false);alert(response.error);$(relform).find('input.toprefresh,input.topdesc,input.topsubshow').attr('disabled',false);ratingFlag=false;}else{$(relform).find('select.relcategories').html(response.categories).attr({selectedIndex:response.selectedIndex});if(!$.browser.msie){$(relform).find('select.relcategories').children('option[value='+response.selected+']').attr({selected:'selected'});}$(relform).find('div.topcontrol img').remove().end().find('input[type=submit]').attr('disabled',false).end().find('input.toprefresh,input.topdesc,input.topsubshow').attr('disabled',false);$(thelinks).find('a.therating,a.ratebutton,div.spinlink a,a.linkcomnum,a.relpost').unbind();$.LeviTip.closeLeviTip();$(thelinks).html(fixEntities(response.links)).find('div.rating').css('visibility','visible').end().find('div.thelink:odd').addClass('thelinkalt');if($(relform).find('input[name=showdesc]').val()=='1'){showDescriptions(thelinks);}else{$(thelinks).find('div.spinlink a').leviTip({source:'desc',dropShadow:false,addClass:'ldesc',leftOffset:10,hiSensitivity:1});}$(thelinks).find('a.therating').click(function(){return showRating(this);}).end().find('a.ratebutton').not('.igray').click(function(){return rateLink(this);});$(thelinks).find('div.spinlink a').click(function(){return countLink(this);}).end().find('a.linkcomnum').leviTip({source:'rel',leftOffset:-300,dropShadow:false}).end().find('a.relpost').leviTip({source:'rel',leftOffset:-250,dropShadow:false,addClass:'pdesc'});if(mode=='submit'){$(relform).find('input[name=linkurl],input[name=linktitle]').val('').blur().end().find('textarea').val('').blur().end().find('input.charsleft').val($(relform).find('input[name=maxsize]').val().toString()).end().find('div.spinprev').html('');}ratingFlag=false;}});}return false;}function toggleRelated(id){var related=$('#related'+id);if($(related).is(':empty')){$(related).html($.ajax({url:'/weblog/lgf-ajaxrel.php',data:{form:1,relid:id},async:false,type:'GET'}).responseText);var relform=$(related).find('form.relatedform');$(related).find('form.relatedform').submit(function(){return doRelated($(this).find('input[name=relatedentry]').val());}).find('input[value=Refresh]').click(function(){return doRelated($(this).parents('form').find('input[name=relatedentry]').val(),'show');}).end().find('input[value=Hide]').click(function(){return toggleRelated($(this).parents('form').find('input[name=relatedentry]').val());}).end().find('input[name^=link]').keydown(function(e){return doLinkPreview(this);}).keyup(function(e){return doLinkPreview(this);}).focus(function(e){return doLinkPreview(this);}).end().find('textarea').keydown(function(e){textCounter(this);}).keyup(function(e){textCounter(this);}).focus(function(e){textCounter(this);});}var relform=$(related).find('form.relatedform');var thelinks=$(related).find('div.linkdiv');var heading=$('a.toggle[rel='+id+']').html().substr(1);if($(related).is(':hidden')){$('a.toggle[rel='+id+']').html('&#x25BC;'+heading);$(thelinks).find('a.therating,a.ratebutton,div.spinlink a,a.linkcomnum').unbind().end().html('<div align="center"><img src="bigrotation2.gif" width="32" height="32"></div>');$(relform).find('select[name=relcategories]').html('<option value="">Loading categories...</option>');$(related).slideDown('fast',function(){$.post('/weblog/lgf-ajaxrel.php',{entryid:id,show:'show'},function(data){var response=eval('('+defangJSON(data)+')');$.LeviTip.closeLeviTip();$(thelinks).hide().html(fixEntities(response.links)).find('div.rating').css('visibility','visible').end().find('div.thelink:odd').addClass('thelinkalt').end().find('a.therating').click(function(){return showRating(this);}).end().find('a.ratebutton').not('.igray').click(function(){return rateLink(this);});$(thelinks).find('div.spinlink a').click(function(){return countLink(this);}).end().find('div.spinlink a').leviTip({source:'desc',dropShadow:false,addClass:'ldesc',leftOffset:10}).end().find('a.linkcomnum').leviTip({source:'rel',leftOffset:-200,dropShadow:false}).end().slideDown('fast');$('span.rshow:has(a.refresh[rel='+id+'])').css('display','inline');if(response.linknum){$('a.toggle[rel='+id+'] span.linknum').html(response.linknum);}$(relform).find('select[name=relcategories]').html(response.categories).attr({selectedIndex:0});if(!$.browser.msie){$(relform).find('select[name=relcategories]').children('option:first-child').attr({selected:'selected'});}});});}else{$(related).slideUp('fast');$('span.rshow:has(a.refresh[rel='+id+'])').hide();$('a.toggle[rel='+id+']').html('&#x25BA;'+heading);}return false;}function doRelated(id,mode){var related=$('#related'+id);var relform=$(related).find('form.relatedform');var thelinks=$(related).find('div.linkdiv');if(($(relform).find('input[name=linkurl]').val()==''||$(relform).find('input[name=linktitle]').val()==''||$(relform).find('select[name=relcategories] :selected').val()=='')&&mode!='show'){alert('Link address, title, and category required!');}else{var substat=$(relform).find('input[type=submit]').attr('disabled');var category=$(relform).find('select[name=relcategories] :selected').val();$(relform).find('input[type=submit],input[value=Refresh],input[value=Hide]').attr('disabled',true).end().find('div.relctrl').prepend('<img src="loadingw.gif">');var originalCats=$(relform).find('select[name=relcategories]').html();$(relform).find('select[name=relcategories]').html('<option value="">Loading categories...</option>');$('div.spinshow:has(a.toggle[rel='+id+'])').children('span.rshow').css('display','none').end().prepend('<img src="loadingw.gif">');var description=$(relform).find('textarea[name=linkdesc]').val();description=description.replace(/\+/ig,'&#43;');$.post('/weblog/lgf-ajaxrel.php',{entryid:id,u:escape($.trim($(relform).children('input[name=linkurl]').val())),title:escape($(relform).children('input[name=linktitle]').val()),cat:escape(category),linkdesc:escape(description),show:mode},function(data){var response=eval('('+defangJSON(data)+')');$('div.spinshow:has(a.toggle[rel='+id+'])').find('img').remove().end().children('span.rshow').css('display','inline');if(response.error){$(relform).find('div.relctrl img').remove();alert(response.error);$(relform).find('input[type=submit],input[value=Refresh],input[value=Hide]').attr('disabled',false).end().find('select[name=relcategories]').html(originalCats);ratingFlag=false;}else{if(response.linknum){$('a.toggle[rel='+id+'] span.linknum').html(response.linknum);}$(relform).find('select[name=relcategories]').html(response.categories).attr({selectedIndex:0});if(!$.browser.msie){$(relform).find('select[name=relcategories]').children('option:first-child').attr({selected:'selected'});}$(relform).find('div.relctrl img').remove();if(!substat){$(relform).find('input[type=submit]').attr('disabled',false);}$(relform).find('input[value=Refresh],input[value=Hide]').attr('disabled',false);$.LeviTip.closeLeviTip();$(thelinks).find('a.therating,a.ratebutton,div.spinlink a,a.linkcomnum').unbind().end().html(fixEntities(response.links)).find('div.rating').css('visibility','visible').end().find('div.thelink:odd').addClass('thelinkalt').end().find('a.therating').click(function(){return showRating(this);}).end().find('a.ratebutton').not('.igray').click(function(){return rateLink(this);});$(thelinks).find('div.spinlink a').click(function(){return countLink(this);}).end().find('div.spinlink a').leviTip({source:'desc',dropShadow:false,addClass:'ldesc',leftOffset:10}).end().find('a.linkcomnum').leviTip({source:'rel',leftOffset:-200,dropShadow:false});$(relform).find('input[name=linkurl],input[name=linktitle]').val('').blur().end().find('textarea').val('').blur().end().find('input.charsleft').val($(relform).find('input[name=maxsize]').val().toString()).end().find('div.spinprev').html('');ratingFlag=false;}});}return false;}function showDescriptions(thelinks){$(thelinks).find('div.thedesc').each(function(i){var thedesc=$(this).parents('div.thelink').find('div.spinlink a[desc]');if($(thedesc).length!==0){$(this).html($(thedesc).attr('desc')).show('fast');}});}function countLink(theLink){var theid=$(theLink).attr('rel');$.post('lgf-ajaxlinkclick.php',{id:theid},function(thecount){if(thecount!=''){$(theLink).parent('div.spinlink').find('span.relurl').children('span').html(thecount);}});return true;}function adC(advert){var thedata=$(advert).metadata();$.post('/weblog/lgf-ajaxadclick.php',{id:thedata.id,t:thedata.t},function(){return true;});return true;}function showRating(therating){var oldrating=$(therating).html();$(therating).html('<img src="ajax-loader.gif" class="erateicon" alt="">');$.get('/weblog/lgf-ajaxgetlinkrating.php',{e:$(therating).attr('rel')},function(linkrating){var values=eval('('+defangJSON(linkrating)+')');if(values.error){alert(values.error);$(therating).html(oldrating);}else{var thevalue=parseInt(values.rating);if(thevalue===0){var theclass='rate';}else if(thevalue<0){var theclass='ratedown';}else{var theclass='rateup';}$(therating).attr('class','therating '+theclass).html(values.rating+'');alert('Rating: '+values.rating+'\nTotal: '+values.total+'\n\nMinus: '+values.minuses+'\n\nPlus: '+values.pluses);}});return false;}var ratingFlag=false;function rateLink(therating){if(ratingFlag){return false;}ratingFlag=true;var buttonParent=$(therating).parents('div.rating');$(therating).unbind('click').parent('li').siblings('li').children('a.ratebutton').unbind('click');var originalimage=$(therating).html();var rating=$(therating).attr('rel');var linkid=$(buttonParent).find('a.therating').attr('rel');$(therating).html('<img src="ajax-loader.gif" width="16" height="16" alt="">').addClass('ibusy');$.post('/weblog/lgf-ajaxratelink.php',{e:linkid,r:rating},function(linkrating){if(linkrating.substr(0,5)=='Error'){$(therating).html(originalimage).removeClass('ibusy');alert(linkrating);ratingFlag=false;}else{$(therating).removeClass('ibusy').html(originalimage).addClass('igray').parents('li').siblings('li').children('a.ratebutton').removeClass('igray').click(function(){return rateLink(this);});var thevalue=parseInt(linkrating);if(thevalue===0){var theclass='rate';}else if(thevalue<0){var theclass='ratedown';}else{var theclass='rateup';}$(therating).parents('ul').siblings('a.therating').hide().attr('class','therating '+theclass).html(linkrating).fadeIn('slow',function(){if($(buttonParent).parents('div#toprel').length!==0){doTopRelated('');}else if($(buttonParent).parents('div.related').length!==0){doRelated($(buttonParent).parents('div.related').children('form.relatedform').children('input[name=relatedentry]').val(),'show');}});ratingFlag=false;}});return false;}function doLinkPreview(theinput){var theform=$(theinput).parents('form');$(theform).find('div.spinprev').html('<a href="'+$(theform).find('input[name=linkurl]').val()+'" target="_blank">'+$(theform).find('input[name=linktitle]').val()+'</a>');}function fixEntities(theString){return theString.replace(/%u([A-Fa-f0-9]{4})/g,'&#x$1;');}function FavFront(thefav){var data=$(thefav).parents('div.frontpagediv').metadata();var type='entry';var id=data.e;var parent=0;$(thefav).removeClass('fh');$.post('/weblog/lgf-afavorite.php',{type:type,id:id,parent:parent},function(data){return false;});$(thefav).unbind('click').removeAttr('onclick').attr({style:'cursor:pointer;'}).hide().css('background-image','url(/weblog/favbgreen.png)').fadeIn('slow',function(){$(thefav).click(function(){window.open('/weblog/lgf-favorites.php');return false;});});return false;}function FavEntry(thefav){var type='entry';var id=$(thefav).attr('rel');var parent=0;$.post('/weblog/lgf-afavorite.php',{type:type,id:id,parent:parent},function(data){return false;});$(thefav).unbind('click').removeAttr('onclick').attr({style:'cursor:pointer;'}).hide().css('background-image','url(/weblog/favbgreen.png)').fadeIn('slow',function(){$(thefav).click(function(){window.open('/weblog/lgf-favorites.php');return false;});});return false;}function FavLink(thefav){var type='link';var id=$(thefav).attr('rel');var parent=0;$.post('/weblog/lgf-afavorite.php',{type:type,id:id,parent:parent},function(data){return false;});$(thefav).removeAttr('onClick').attr({href:'javascript:void(0);',style:'cursor:pointer;'}).hide().css('background-image','url(/weblog/favbgreen.png)').fadeIn('slow',function(){$(thefav).click(function(){window.open('/weblog/lgf-favorites.php');return false;});});return false;}function FavCom(thefav){var id=$(thefav).parents('div[id^=cc]').attr('id').substring(2);var data=$('#commentbucket').metadata();var type=(data.t==1)?'linkcom':'entrycom';var parent=data.p;$.post('/weblog/lgf-afavorite.php',{type:type,id:id,parent:parent},function(data){return false;});$(thefav).removeAttr('onClick').attr({href:'javascript:void(0);',style:'cursor:pointer;'}).hide().css('background-image','url(/weblog/favbgreen.png)').fadeIn('slow',function(){$(thefav).click(function(){window.open('/weblog/lgf-favorites.php');return false;});});return false;}function doFavorite(thetype,theid,theparent,thefav){$.post('/weblog/lgf-afavorite.php',{type:thetype,id:theid,parent:theparent},function(data){return false;});$(thefav).unbind('click').removeAttr('onclick').attr({href:'javascript:void(0);',style:'cursor:pointer;'}).find('img').hide().attr('src','favg.png').fadeIn('slow',function(){$(thefav).click(function(){window.open('/weblog/lgf-favorites.php');return false;});});return false;}function Report(report){var id=$(report).parents('div[id^=cc]').attr('id').substring(2);var cnum=$(report).parents('.comtop').find('.cnum a:first-child').html();$(report).parents('.comtop').attr('style','background-color:#F0D0D0').siblings('div.com').attr('style','background-color:#F0D0D0');if($.browser.msie){if(confirm('Report this comment to the administrator?')){$.post('/weblog/lgf-ajaxreport.php',{commentid:id,commentnum:cnum,reason:0},function(theResponse){var response=eval('('+defangJSON(theResponse)+')');alert(response.status);});}$(report).parents('.comtop').removeAttr('style').siblings('div.com').removeAttr('style');return false;}$.blockUI({message:'<div id="rdialog" style="cursor:default"><p>Do you want to <b>report</b> this comment for offensive content, or <b>recommend</b> it to us?</p><p><input type="button" id="repb" value="Report" class="lgfb"> <input type="button" id="recb" value="Recommend" class="lgfb"> <input type="button" id="cancb" value="Cancel" class="lgfb"></p></div>',css:{padding:'5px',width:'300px'}});$('#repb,#recb').click(function(){$('#rdialog').html('<p>Sending ...</p>');var r=($(this).attr('value')=='Report')?0:1;$.post('/weblog/lgf-ajaxreport.php',{commentid:id,commentnum:cnum,reason:r},function(theResponse){var response=eval('('+defangJSON(theResponse)+')');$('#rdialog').html('<p>'+response.status+'</p>');setTimeout(function(){jQuery.unblockUI({onUnblock:function(){$(report).parents('.comtop').removeAttr('style').siblings('div.com').removeAttr('style');}});},1000);});});$('#cancb').click(function(){$.unblockUI({onUnblock:function(){$(report).parents('.comtop').removeAttr('style').siblings('div.com').removeAttr('style');}});});return false;}function RepLink(report){var linkid=$(report).attr('rel');$(report).parents('div.thelink').attr('style','background-color:#F0D0D0');$.blockUI({message:'<div id="rdialog" style="cursor:default;"><p>Do you want to <b>report</b> this link for offensive content, or <b>recommend</b> it to us?</p><p><input type="button" id="repb" value="Report" class="lgfb"> <input type="button" id="recb" value="Recommend" class="lgfb"> <input type="button" id="cancb" value="Cancel" class="lgfb"></p></div>',css:{padding:'5px',width:'300px'}});$('#repb,#recb').click(function(){$('#rdialog').html('<p>Sending ...</p>');var r=($(this).attr('value')=='Report')?0:1;$.post('/weblog/lgf-ajaxreplink.php',{id:linkid,reason:r},function(theResponse){var response=eval('('+defangJSON(theResponse)+')');$('#rdialog').html('<p>'+response.status+'</p>');setTimeout(function(){jQuery.unblockUI({onUnblock:function(){$(report).parents('div.thelink').removeAttr('style');}});},1000);});});$('#cancb').click(function(){$.unblockUI({onUnblock:function(){$(report).parents('div.thelink').removeAttr('style');}});});return false;}function ShowC(comlink){window.open('/showc/'+$(comlink).parents('.comtop').find('.cnum a:first-child').html()+'/'+$(comlink).parents('div[id^=cc]').attr('id').substring(2));return false;}function Profile(profile,ptype){if(arguments.length==2){if(ptype=='top'){var uname=$(profile).next('a').html();}else if(ptype=='link'){var uname=$(profile).next('strong').html();}}else{var uname=$(profile).parents('.comtop').find('.cinf *:first-child').html();}if($.browser.msie){window.open('/user/'+encodeURIComponent(uname));return false;}var w=window.innerHeight-50;$.blockUI({message:'<div id="rdialog" style="cursor:default;max-height:'+w+'px;"><p align="center"><img src="loadingw-g.gif" width="16" height="16"> Getting user information...</p></div>',css:{width:'450px',top:'10px',textAlign:'left',padding:'10px',overflow:'auto'}});$.get('/weblog/lgf-ajaxuser.php','u='+escape(uname.replace(/\#/ig,'&#35;')),function(thedata){$('#rdialog').html(thedata);$('#cancb').click(function(){$(this).attr({disabled:true}).addClass('dis');$.unblockUI();});$('#searchb').click(function(){window.open('/weblog/lgf-search.php?doSearch=search&searchWith=lgf&searchWhat=comments&searchDays=60&searchString='+encodeURIComponent('"user:'+uname+'"'),'_blank');});$('#accb').click(function(){$(this).attr({disabled:true}).addClass('dis');$.unblockUI();parent.location='/weblog/lgf-user-manage.php';});});return false;}function ThreadUsers(id){$('#userdiv').html('<p><img src="loadingw.gif" width="16" height="16"> <em>Getting user list...</em></p>').show();$.get('/weblog/lgf-ajaxthreadusers.php','id='+id,function(thedata){$('#userdiv').hide().html('<p class="comnumber"><span>Users</span></p><div class="commentpreview">'+thedata+'</div>').find('.commentpreview').prepend('<input type="button" class="pclose lgfb" value="Close" onclick="$(\'#userdiv\').slideUp(\'fast\');return false;">').end().slideDown('fast',function(){window.scrollTo(0,$('#userdiv').offset().top);});});return false;}function Reply(reply,quote){var id=$(reply).parents('div[id^=cc]').attr('id').substring(2);var cnum=$(reply).parents('.comtop').find('.cnum a:first-child').html();var uname=$(reply).parents('.cinf').find('*:first-child').html();var txtarea=document.commentForm.newcommentbody;var theText='';var rgt='';if(arguments.length==2){var lft='<em>re: <a href="/showc/'+cnum+'/'+id+'" target="_blank">#'+cnum+'</a> '+uname+'</em>\n\n';var theText=$.trim($(reply).parents('.comtop').siblings('div.com').html());theText=theText.replace(/%u([A-Fa-f0-9]{4})/g,'&#x$1;');theText=theText.replace(/<div class=("comvid"|comvid)([^>]*)>[\s\S]*<\/div>/ig,'[Video]');theText=theText.replace(/\n/ig,'');theText=theText.replace(/<P([^>]*)>/ig,'');theText=theText.replace(/<\/P>/ig,'\n\n');theText=theText.replace(/<EM([^>]*)>/ig,'<em>');theText=theText.replace(/<BLOCKQUOTE([^>]*)>/ig,'<blockquote>');theText=theText.replace(/<STRONG([^>]*)>/ig,'<strong>');theText=theText.replace(/<BR>/ig,'\n');theText=theText.replace(/\n\n\n/ig,'\n\n');theText=theText.replace(/<blockquote>[\s\S]*<\/blockquote>/ig,'');theText=theText.replace(/<em>re:[\s\S]*?<\/em>/i,'');theText=theText.replace(/target=_blank>/ig,'target="_blank">');theText='<blockquote>'+$.trim(theText)+'</blockquote>\n\n';}else{var lft='<em>re: <a href="/showc/'+cnum+'/'+id+'" target="_blank">#'+cnum+'</a> '+uname+'</em>\n\n';}var selLength=txtarea.textLength;var selStart=txtarea.selectionStart;var selEnd=txtarea.selectionEnd;if(selEnd==1||selEnd==2){selEnd=selLength;}var s1=(txtarea.value).substring(0,selStart);var s2=(txtarea.value).substring(selStart,selEnd);var s3=(txtarea.value).substring(selEnd,selLength);txtarea.value=s1+lft+theText+s2+rgt+s3;txtarea.focus();txtarea.selectionEnd=txtarea.value.length;txtarea.selectionStart=txtarea.value.length;var t=parseInt($('#commentForm input[name=maxsize]').val())-txtarea.value.length;$('#commentForm input.charsleft').val(t.toString());var checked=($.cookie('REPLYRETURN')=='yes')?' checked="checked"':'';$('#markItUpNewcommentbody').find('div.markReturn').remove().end().prepend('<div class="smalltext markReturn"><input type="checkbox" name="replyreturn" id="repret" value="'+id+'"'+checked+'><label for="repret">Return after posting reply</label></div>');return false;}function Vid(that){var dim=$(that).metadata();$(that).css('visibility','hidden').parent('.comvid').css('background-color','white').animate({width:dim.width+'px',height:dim.height+'px',padding:'0'},'slow',function(){$(that).media({caption:false});});return false;}function Castup(that){var dim=$(that).metadata();$(that).css('visibility','hidden').parent('.vcent').css('background-color','white').animate({width:dim.width+'px',height:dim.height+'px',padding:'0'},'slow',function(){$(that).media({caption:false});});return false;}function getFeed(reload){var doreload='';if(arguments.length===1&&reload===true){doreload='&reload=1';}var thediv=$('#yfeeddiv');$(thediv).html('<div class="LGFfeeddiv"><ul><li class="LGFtitle" style="padding: 3px 4px 5px 4px;"><img src="loadingw.gif" width="16" height="16"> <em>Loading...</em></li></ul></div>');$.get('/weblog/lgf-agetfeed.php','id='+escape($('#yahoofeeds :selected').val())+'&title='+escape($('#yahoofeeds :selected').html())+doreload,function(feed){$(thediv).hide().html(feed).find('li:odd').addClass('fd2').end().find('a.rssfeed').leviTip({sourceType:'firstchild',leftOffset:20,dropShadow:false,closeDelay:50}).end().fadeIn('slow');});return false;}var voteclick=false;function doVote(votediv,voteform){if(voteclick!==true){$('#'+voteform+' span.votestatus').html('<img src="loadingw.gif" width="16" height="16"> <em>Getting results...</em>&nbsp;&nbsp;');$('#'+voteform+' input[name="showResults"]').attr('disabled',true);$.get('/weblog/lgf-ajaxshowpoll.php','pollName='+escape($('#'+voteform+' input[name="pollName"]').val()),function(votedata){var results=eval('('+defangJSON(votedata)+')');$('#'+voteform+' span.votestatus').html('<img src="1.gif" width="1" height="16" alt="">'+results.total);$('#'+votediv).html(results.thetable);$('#'+voteform+' input[name="showResults"]').attr('disabled',false);$('#'+voteform+' input[name="pollState"]').val('show');});return false;}if($('#'+voteform+' input[name="pollState"]').val()!='vote'){$('#'+voteform+' span.votestatus').html('<img src="loadingw.gif" width="16" height="16"> <em>Getting poll options...</em>&nbsp;&nbsp;');$('#'+voteform+' input[name="submitPoll"],#'+voteform+' input[name="showResults"]').attr('disabled',true);$.get('/weblog/lgf-ajaxshowpoll.php','pollName='+escape($('#'+voteform+' input[name="pollName"]').val())+'&voteflag=1',function(polldata){var results=eval('('+defangJSON(polldata)+')');$('#'+voteform+' span.votestatus').html('<img src="1.gif" width="1" height="16" alt="">'+results.total);$('#'+votediv).html(results.thetable);$('#'+voteform+' input[name="submitPoll"],#'+voteform+' input[name="showResults"]').attr('disabled',false);$('#'+voteform+' input[name="pollState"]').val('vote');});return false;}if(!$('#'+voteform+' :radio:checked').length){alert('No option selected!');return false;}$('#'+voteform+' span.votestatus').html('<img src="loadingw.gif" width="16" height="16"> <em>Casting vote...</em>&nbsp;&nbsp;');$('#'+voteform+' input[name="submitPoll"]').attr('disabled',true);$.post('/weblog/lgf-ajaxvote.php','pollName='+escape($('#'+voteform+' input[name="pollName"]').val())+'&pollOption='+$('#'+voteform+' :radio:checked').val()+'&submitPoll=vote',function(data){var results=eval('('+defangJSON(data)+')');$('#'+voteform+' span.votestatus').html('<img src="1.gif" width="1" height="16" alt="">'+results.total);$('#'+votediv).html(results.thetable);if(results.voteflag){$('#'+voteform+' input[name="submitPoll"]').attr('disabled',false);}$('#'+voteform+' input[name="pollState"]').val('show');});return false;}function textCounter(txtarea){var theform=$(txtarea).parents('form');var thesize=parseInt($(theform).find('input[name=maxsize]').val());if($(txtarea).val().length>thesize){$(txtarea).val($(txtarea).val().substring(0,thesize));}var left=thesize-$(txtarea).val().length;$(theform).find('input.charsleft').val(left.toString());if($(txtarea).val()==''){$('#markItUpNewcommentbody div.markReturn').remove();}}jQuery.cookie=function(name,value,options){if(typeof value!='undefined'){options=options||{};if(value===null){value='';options.expires=-1;}var expires='';if(options.expires&&(typeof options.expires=='number'||options.expires.toUTCString)){var date;if(typeof options.expires=='number'){date=new Date();date.setTime(date.getTime()+(options.expires*24*60*60*1000));}else{date=options.expires;}expires='; expires='+date.toUTCString();}var path=options.path?'; path='+(options.path):'';var domain=options.domain?'; domain='+(options.domain):'';var secure=options.secure?'; secure':'';document.cookie=[name,'=',encodeURIComponent(value),expires,path,domain,secure].join('');}else{var cookieValue=null;if(document.cookie&&document.cookie!=''){var cookies=document.cookie.split(';');for(var i=0;i<cookies.length;i++){var cookie=jQuery.trim(cookies[i]);if(cookie.substring(0,name.length+1)==(name+'=')){cookieValue=decodeURIComponent(cookie.substring(name.length+1));break;}}}return cookieValue;}};function doLogin(thediv){var cookieEnabled=(navigator.cookieEnabled)?'yes':'no';if(cookieEnabled=='no'){alert('You must enable cookies to log in!');return false;}var logdiv='#'+thediv;var thehash=hex_md5($(logdiv+' input[name=seed]').val()+hex_md5($(logdiv+' input[name=lizardpass]').val()));var params='lizardname='+escape($(logdiv+' input[name=lizardname]').val().replace(/\+/ig,'&#43;'))+'&lizardpass='+thehash+'&seed='+$(logdiv+' input[name=seed]').val()+'&cookies='+cookieEnabled;if($(logdiv+' input[name=lizardremember]:checked').length!==0){params=params+'&lizardremember=yes';}var oldform=$(logdiv).html();if(thediv=='commentlogindiv'){$('#commentlogindiv').html('<div class="postingform lform"><p><img src="loadingw.gif" width="16" height="16"> <em>Checking credentials...</em></p></div>');}else{$('#logindiv').html('<div class="smalltext boxie2"><h5>authenticating...</h5><img src="loadingw.gif" width="16" height="16"> <em>Checking credentials...</em></div>');}$.post('/weblog/lgf-ajaxlogin.php',params,function(theResponse){var user=eval('('+defangJSON(theResponse)+')');if(user.loginfailed){alert(user.loginfailed.reason);$(logdiv).html(oldform);$(logdiv+' form').submit(function(){return doLogin(thediv);});}else{$('#thelizardname').html(user.loggedin.username);$('#logindiv').remove();$('#logout').fadeIn('slow');$('.cinf em span').css('display','inline');$('li.ispy').show();if(document.commentForm){$('#namediv').html(user.loggedin.username);$('#commentForm').find('input[name=newcommentauthor]').val(user.loggedin.username).end().find('input[name=lgfemail]').val(user.loggedin.email).end().find('input[name=newcommenthomepage]').val(user.loggedin.url);$('#commentlogindiv').html('').hide();$('#thepostingform').show();}$('form.relatedform input,form.relatedform textarea,form.topform input,form.topform textarea,form.topform input.topsubshow').attr('disabled',false);if($('div#toprel').css('display')!='none'){doTopRelated();}$('div.related:visible input[name=relatedentry]').each(function(i){doRelated($(this).val(),'show');});$.getScript('/lgfjs/lgf-loggedin.js');$('form#logout div.boxie2').append('<em>Some features may not be available until you reload the page...</em>');}});return false;}function getLinkPrefs(){if($.cookie('LINKPREFS')){prefs=$.cookie('LINKPREFS').split('|');}else{prefs=['0','1','10','recent'];}return prefs;}function defangJSON(json){if(json.substring(0,8)=='for(;;);'){json=json.substring(8);}else if(json.substring(0,9)=='while(1);'){json=json.substring(9);}return json;}function Mail(that){var entry=$(that).attr('rel');if($(that).parents('div.frontpagediv').length===0){var title=$('div#entrydiv').find('h2').html().replace(/([\s\S]*Retweet)/i,'');}else{var title=$(that).parents('div.frontpagediv').find('h2').html().replace(/([\s\S]*Retweet)/i,'');}$.blockUI({message:'<div id="rdialog" style="cursor:default"><p align="center"><img src="loadingw.gif" width="16" height="16"> Getting article data...</p></div>',css:{top:'10px',width:'250px',textAlign:'left',padding:'2px 10px 10px 10px'}});$.get('/weblog/lgf-amail-token.php',{t:title},function(token){$('#rdialog').html(token);$('#cancb').click(function(){$.unblockUI();});$('form#amail').submit(function(){$('#emailcomsub').attr('disabled',true);if($('form#amail input[name=to]').val()==''||$('form#amail input[name=from]').val()==''){alert('Error: To and From addresses are required!');$('#emailcomsub').attr('disabled',false);return false;}var params='article='+entry+'&ts='+$('form#amail #emailts').val()+'&emailto='+escape($('form#amail input[name=to]').val().replace(/\+/ig,'&#43;'))+'&emailfrom='+escape($('form#amail input[name=from]').val().replace(/\+/ig,'&#43;'))+'&emailcom='+escape($('form#amail textarea[name=emailcom]').val().replace(/\+/ig,'&#43;'));$.post('/weblog/lgf-amail.php',params,function(thedata){alert(thedata);setTimeout(jQuery.unblockUI,250);});return false;});});return false;}$(document).ready(function(){$.LeviTip.addSourceHandler({type:'image',get:function(levitip){return'<a href="'+$(levitip.target).attr('href')+'" class="imgp" target="_blank"><img src="'+$(levitip.target).attr('href')+'" style="width:450px;height:auto;" alt=""></a>';}});$.LeviTip.addSourceHandler({type:'tags',get:function(levitip){return'<p align="center" class="smalltext" style="margin:60px 0;"><img src="loadingw-y.gif" width="16" height="16"> Getting related tags...</p>';}});$.LeviTip.addSourceHandler({type:'categories',get:function(levitip){return'<p align="center" class="smalltext" style="margin:60px 0;"><img src="loadingw-y.gif" width="16" height="16"> Getting related articles...</p>';}});$('a.ajt').leviTip({sourceType:'tags',source:'rel',dropShadow:false,leftOffset:5,topOffset:1,closeDelay:400,hiSensitivity:1,hiInterval:150,onOpen:function(lt,target){var tag=$(target).html(),thediv=$(lt).find('.innerbox');var ediv=$(target).parents('div.frontpagediv');if(ediv.length>0){var edata=$(ediv).metadata();var entryid=edata.e;var earlier='N';}else if($(target).parents('div#article').length>0){var edata=$(target).parents('div.eclass').metadata();var entryid=edata.e;var earlier='Y';}else{var entryid=0;var earlier='N';}$.get('/weblog/lgf-atagitems.php','t='+escape(tag)+'&e='+escape(entryid)+'&d='+earlier,function(thedata){$(thediv).html(thedata);});}});$('a.ajc').click(function(){return false;}).leviTip({sourceType:'categories',source:'rel',dropShadow:false,leftOffset:5,topOffset:1,closeDelay:400,hiSensitivity:1,hiInterval:150,onOpen:function(lt,target){var cat=$(target).html(),thediv=$(lt).find('.innerbox');var ediv=$(target).parents('div.frontpagediv');if(ediv.length>0){var edata=$(ediv).metadata();var entryid=edata.e;var earlier='N';}else if($(target).parents('div#article').length>0){var edata=$(target).parents('div.eclass').metadata();var entryid=edata.e;var earlier='Y';}else{var entryid=0;var earlier='N';}$.get('/weblog/lgf-acatitems.php','c='+escape(cat)+'&e='+escape(entryid)+'&d='+earlier,function(thedata){$(thediv).html(thedata);});}});$('a.media').each(function(){var that=this;var dim=$(that).metadata();$(that).css('visibility','hidden').parent('.vcent').css({'background-color':'white',width:dim.width+'px',height:dim.height+'px',padding:'0',border:'none'});$(that).media({caption:false});});$('div.frontpagediv a:has(img),div#article a:has(img)').not('.nhov').each(function(){$(this).addClass('nhov');});var leftcol=$('#leftColumn');$(leftcol).find('a.register').click(function(){$.get('/weblog/lgf-aregstat.php',function(stat){if(stat!='open'){alert('Registration is currently closed. Please try again later!');return false;}else{parent.location='/weblog/lgf-register.php';}});return false;});if($(leftcol).find('.jwarn').length>0){$(leftcol).find('.jwarn').hide();$(leftcol).find('a#contactus').click(function(){var heading=$(this).html().substr(1);var theparent=$(this).parent('h4');var content=$(theparent).next('.slider');if($(content).is(':hidden')){$(this).html('&#x25BC;'+heading);$(theparent).prepend('<img src="loadingw.gif" class="flipbusy">');$.get('/weblog/lgf-token.php',function(token){$(theparent).find('img.flipbusy').remove();$('#securecontact').append('<input type="hidden" id="ts" value="'+token+'">');$(content).slideDown('fast',function(){if(!$.browser.msie){$('#contemail').focus();}});});}else{$(this).html('&#x25BA;'+heading);$(content).slideUp('fast');$('#ts').remove();}return false;});$(leftcol).find('#securecontact').submit(function(){var email=$.trim($(leftcol).find('#contemail').val());var subject=$.trim($(leftcol).find('#contsubject').val());var message=$.trim($(leftcol).find('#contmessage').val());if(email==''||subject==''||message==''){alert('Email address, subject and message required.');return false;}$(leftcol).find('#contsubmit').attr('disabled',true);$(leftcol).find('#contstat').html('<img src="loadingw.gif" width="16" height="16">');var params='email='+escape(email.replace(/\+/ig,'&#43;'))+'&subject='+escape(subject.replace(/\+/ig,'&#43;'))+'&ts='+escape($('#ts').val())+'&message='+escape(message.replace(/\+/ig,'&#43;'));$.post('/weblog/lgf-ajaxc.php',params,function(response){var status=eval('('+defangJSON(response)+')');if(status.error){alert(status.error.reason);$(leftcol).find('#contsubmit').attr('disabled',false);}else{$(leftcol).find('#contstat').html('');alert('Thanks for contacting LGF!');$(leftcol).find('#contemail').val('');$(leftcol).find('#contsubject').val('');$(leftcol).find('#contmessage').val('');var heading=$('a#contactus').html().substr(1);$(leftcol).find('a#contactus').html('&#x25BA;'+heading).parent('h4').next('.slider').slideUp('fast');$(leftcol).find('#ts').remove();$(leftcol).find('#contsubmit').attr('disabled',false);}});return false;});}$(leftcol).find('a.flippy').click(function(){var heading=$(this).html().substr(1);var content=$(this).parent('h4').next('.slider');if($(content).is(':hidden')){$(this).html('&#x25BC;'+heading);$(content).slideDown('fast');}else{$(this).html('&#x25BA;'+heading);$(content).slideUp('fast');}return false;});$(leftcol).find('a.aflippy').click(function(){var heading=$(this).html().substr(1);var theparent=$(this).parent('h4');var content=$(theparent).next('.slider,.tagslide');if($(content).is(':hidden')){var thescript=$(this).attr('rel');var url='/weblog/lgf-'+thescript+'.php';$(this).html('&#x25BC;'+heading);$(theparent).prepend('<img src="loadingw.gif" class="flipbusy">');$.get(url,function(thedata){$(theparent).find('img.flipbusy').remove();if(thescript=='atags'){$(content).find('a').unbind().end().html(thedata).find('a').leviTip({source:'rel',leftOffset:10,dropShadow:false,closeDelay:50}).end().slideDown('fast');}else{$(content).hide().html(thedata).slideDown('fast');}});}else{$(this).html('&#x25BA;'+heading);$(content).slideUp('fast');}return false;});$('#rightColumn').find('a.adspot_adurl').each(function(){if((/atlasshrugs2000\.typepad\.com/.test($(this).attr('href')))||(/noisyroom\.net/.test($(this).attr('href')))||(/stoptheaclu\.com/.test($(this).attr('href')))||(/dailypaul\.com/.test($(this).attr('href')))||(/moonbattery\.com/.test($(this).attr('href')))){$(this).parent('li').remove();}});$('#rightColumn').find('a.adspot_adurl').attr('target','_blank');$('#backtotop').click(function(){window.scrollTo(0,0);return false;});$('a.shareb').click(function(){addthis_url='http://littlegreenfootballs.com/article/'+$(this).attr('rel');if($(this).parents('div.frontpagediv').length!==0){addthis_title=$(this).parents('div.frontpagediv').find('h2:first a').html().replace(/([\s\S]*Retweet)/i,'');}else{addthis_title=$('div#entrydiv').find('h2:first').html().replace(/([\s\S]*Retweet)/i,'');}return addthis_click(this);});$('div.postfooter div.rating a.therating').click(function(){var therating=this;var oldrating=$(therating).html();$(therating).html('<img src="loadingw.gif" class="erateicon" alt="">');$.get('/weblog/lgf-ajaxgetentryrating.php',{e:$(therating).attr('rel')},function(getrating){var values=eval('('+defangJSON(getrating)+')');if(values.error){alert(values.error);$(therating).html(oldrating);}else{var thevalue=parseInt(values.rating);if(thevalue===0){var theclass='rate';}else if(thevalue<0){var theclass='ratedown';}else{var theclass='rateup';}$(therating).attr('class','therating '+theclass).html(values.rating+'');alert('Rating: '+values.rating+'\nTotal: '+values.total+'\n\nMinus: '+values.minuses+'\n\nPlus: '+values.pluses);}});return false;});$('div.postfooter div.rating a.ratebutton').not('.igray').click(RateEntry);$('div.rating').css('visibility','visible');$('a.refresh').click(function(){return doRelated($(this).attr('rel'),'show');});$('a.toggle').click(function(){return toggleRelated($(this).attr('rel'));});$('div.spinshow').css('visibility','visible');$('p.showtoplink span').html('<a href="#" class="topspin"><span>&#x25BA; Show</span> top rated links</a>').children('a.topspin').click(function(){return toggleTopRelated();});if($('#entrydiv').length==0){var prefs=getLinkPrefs();var ldata=$('p.showtoplink').metadata();if(prefs[0]=='1'&&ldata.a=='0'){toggleTopRelated();}}$('div.thelink div.rating a.therating').click(function(){return showRating(this);});$('div.thelink div.rating a.ratebutton').not('.igray').click(function(){return rateLink(this);});$('div.thelink div.spinlink a').click(function(){return countLink(this);});$('a.lastcom').leviTip({sourceType:'firstchild',leftOffset:-250,dropShadow:false});$('#lgfstore').click(function(){window.open('http://astore.amazon.com/littlegreenfo-20');return false;});$('#lgfamazon').click(function(){window.open('http://www.amazon.com/gp/redirect.html?ie=UTF8&location=http%3A%2F%2Fwww.amazon.com%2Fgp%2Fhomepage.html%3Fie%3DUTF8%26%252AVersion%252A%3D1%26%252Aentries%252A%3D0&tag=littlegreenfo-20&linkCode=ur2&camp=1789&creative=390957');return false;});var clinks=$('#showclinks');if(clinks.length>0){$(clinks).click(function(){window.open('/weblog/lgf-links.php?entry='+$('#newcommententrynumber').val()+'&title='+$(this).parents('form').find('input[name=posttitle]').val(),'links');});}var delcoms=$('div#commentbucket table.comdel');if(delcoms.length>0){$(delcoms).each(function(){lgf_delcoms.push($(this).parent('div').attr('id'));});}if(document.commentForm){var comform=$('div#thepostingform');$(comform).find('#comlogout').click(function(){parent.location='/weblog/lgf-logout.php';return false;});$(comform).find('#spellcheck').click(openSpellChecker);$(comform).find('#dopreview').click(doAjaxPreview);$(comform).find('#commentForm').submit(doAjaxPostComment);$(comform).find('#showemail').click(function(){if($(this).is(':checked')){$(comform).find('#newcommentemail').val($('#lgfemail').val());}else{$(comform).find('#newcommentemail').val('');}});$(comform).find('#newcommentbody').markItUp(mySettings);$(comform).find('#newcommentbody').keydown(function(e){textCounter(this);}).keyup(function(e){textCounter(this);}).focus(function(e){lgf_comfocus=true;}).blur(function(e){lgf_comfocus=false;});}if(document.forms.loginform){$('#loginform').submit(function(){return doLogin('logindiv');});}if(document.forms.commentloginform){$('#commentloginform').submit(function(){return doLogin('commentlogindiv');});}if(!$.browser.msie){$('#calendarDaily').datepicker({showOn:'button',speed:'fast',buttonText:'daily archives',minDate:new Date(2001,2-1,7),dateFormat:'yy-mm-dd',onSelect:function(thedate){parent.location='/day/'+thedate;}});}$('input.exam').example(function(){return $(this).attr('title');});if($.browser.msie){$('input.stxt,textarea.stxa').focus(function(){$(this).addClass('stxaf');}).blur(function(){$(this).removeClass('stxaf');});}$('#logsub').attr('disabled',false);nowPlaying();setTimeout(getFeed,10);$("#yahoofeeds").change(getFeed);$("#feedreload").click(function(){getFeed(true);});$('div.stripe,ul.stripe').each(function(i){$(this).find('a:even').addClass('lt2');});$('a.imgpop').leviTip({sourceType:'image',source:'href',dropShadow:false,addClass:'idesc',leftOffset:10,hiSensitivity:1});});function nowPlaying(){var comjson='',artid='',divs=$('div.frontpagediv'),combucket=$('div#commentbucket'),h=location.href;if(divs.length>0){var j=new Array();$(divs).each(function(){var edata=$(this).metadata();var lastc=$(this).find('a.lastcom');if($(lastc).length>0){j.push('{"e":'+edata.e+',"c":'+$(lastc).attr('href').replace(/\/article\/(.+?)\/comments\/#cc/i,'')+'}');}else{j.push('{"e":'+edata.e+',"c":0}');}});var comjson='['+j.join(',')+']';}else if(combucket.length>0&&$('#donewcomments').is(':not(:disabled)')){var lastcom=$(combucket).find('div[id^=cc]:last');if($(lastcom).length==0){var lastid=0;}else{var lastid=$(lastcom).attr('id').substring(2);}var edata=$(combucket).metadata();var comid='{"artid":'+edata.p+',"atype":'+edata.t+',"lastid":'+lastid+'}';}var q={ts:playtime};if(comjson!=''){q.json=comjson;}else if(comid!=''){q.artid=comid;}$.post('/weblog/lgf-arepeating.php',q,function(thedata){var reply=eval('('+defangJSON(thedata)+')');var thediv=$('#nowplaydiv');if(reply.none){if($(thediv).is(':visible')){$(thediv).fadeOut('slow').html('<p class="smalltext">No music playing.</p>');}}else if(reply.ts){$(thediv).hide().html(reply.np).fadeIn('slow');playtime=reply.ts;}if(reply.kick){parent.location='/weblog/';}if(reply.num&&$('#donewcomments').is(':not(:disabled)')){if(reply.num>0){var lastcom=$('div#commentbucket div[id^=cc]:last');if($(lastcom).length>0){var lastid=$(lastcom).attr('id').substring(2);if(reply.last!=lastid){$('button#donewcomments span').html(' ('+reply.num+')');}}else{$('button#donewcomments span').html(' ('+reply.num+')');}}}if(reply.coms){var comarray=reply.coms;for(var i=0;i<comarray.length;i++){var c=$('#ent'+comarray[i].e).parents('div.frontpagediv').find('.lcom');$(c).parents('.postinfo').find('a.numcoms').html(comarray[i].n+'');$(c).find('a.lastcom').unbind().end().html(comarray[i].c).find('a.lastcom').leviTip({sourceType:'firstchild',leftOffset:-250,dropShadow:false});}}if(reply.rate){var ratings=reply.rate;for(var i=0;i<ratings.length;i++){var theclass='rate';if(ratings[i].r>0){theclass='rateup';}else if(ratings[i].r<0){theclass='ratedown';}var r=$('#ent'+ratings[i].e).parents('div.frontpagediv').find('div.postfooter a.therating');var s=ratings[i].r.toString();if(s!=$(r).html()){$(r).attr('class','therating '+theclass).html(s);}}}});if($('#autocoms').is(':checked')&&!lgf_comfocus){doAjaxShowComments();}}function jumpToBottom(){if($('#thepostingform').is(':hidden')){window.scrollTo(0,$('#commentlogindiv').offset().top);}else{window.scrollTo(0,$('#thepostingform').offset().top);}return false;}if(top.location!=location){top.location.href=document.location.href;}var addthis_pub="Stinky",addthis_brand='Little Green Footballs',addthis_options='favorites, digg, buzz, newsvine, propeller, reddit, twitter, delicious, myspace, facebook, more';var imgObjects=[],imgNames=['topdivbg5.gif','perm.gif','ratebg.gif','btnw.png','btnwa.png','btnr.png','btnra.png','spy12.png','fav12.png','print.png','spyb.png','emailb.png','printb.png','favbred.png','favbgreen.png','cmb.png','cpb.png','repb.png','lgfu.png','amlogo-76x25.png','storebg.jpg','storebga.jpg','strike.png','bold.png','italics.png','quote.png','link.png','bigrotation2.gif','loadingw.gif','loadingw-y.gif','loadingw-g.gif','ajax-loader.gif','cdcase.jpg'];for(var i=0;i<imgNames.length;i++){imgObjects[i]=new Image();imgObjects[i].src=imgNames[i];}mySettings={markupSet:[{name:'Strike through',key:'S',openWith:'<strike>',closeWith:'</strike>'},{name:'Bold',key:'B',openWith:'(!(<strong>|!|<b>)!)',closeWith:'(!(</strong>|!|</b>)!)'},{name:'Italic',key:'I',openWith:'(!(<em>|!|<i>)!)',closeWith:'(!(</em>|!|</i>)!)'},{name:'Quote',key:'Q',openWith:'<blockquote>',closeWith:'</blockquote>'},{name:'Link',key:'L',openWith:'<a href="[![Link:!:http://]!]" target="_blank"(!( title="[![Title]!]")!)>',closeWith:'</a>',placeHolder:'Your text to link...'}]};var hexcase=0;var b64pad="";var chrsz=8;function hex_md5(s){return binl2hex(core_md5(str2binl(s),s.length*chrsz));}function b64_md5(s){return binl2b64(core_md5(str2binl(s),s.length*chrsz));}function str_md5(s){return binl2str(core_md5(str2binl(s),s.length*chrsz));}function hex_hmac_md5(key,data){return binl2hex(core_hmac_md5(key,data));}function b64_hmac_md5(key,data){return binl2b64(core_hmac_md5(key,data));}function str_hmac_md5(key,data){return binl2str(core_hmac_md5(key,data));}function md5_vm_test(){return hex_md5("abc")=="900150983cd24fb0d6963f7d28e17f72";}function core_md5(x,len){x[len>>5]|=0x80<<((len)%32);x[(((len+64)>>>9)<<4)+14]=len;var a=1732584193;var b=-271733879;var c=-1732584194;var d=271733878;for(var i=0;i<x.length;i+=16){var olda=a;var oldb=b;var oldc=c;var oldd=d;a=md5_ff(a,b,c,d,x[i+0],7,-680876936);d=md5_ff(d,a,b,c,x[i+1],12,-389564586);c=md5_ff(c,d,a,b,x[i+2],17,606105819);b=md5_ff(b,c,d,a,x[i+3],22,-1044525330);a=md5_ff(a,b,c,d,x[i+4],7,-176418897);d=md5_ff(d,a,b,c,x[i+5],12,1200080426);c=md5_ff(c,d,a,b,x[i+6],17,-1473231341);b=md5_ff(b,c,d,a,x[i+7],22,-45705983);a=md5_ff(a,b,c,d,x[i+8],7,1770035416);d=md5_ff(d,a,b,c,x[i+9],12,-1958414417);c=md5_ff(c,d,a,b,x[i+10],17,-42063);b=md5_ff(b,c,d,a,x[i+11],22,-1990404162);a=md5_ff(a,b,c,d,x[i+12],7,1804603682);d=md5_ff(d,a,b,c,x[i+13],12,-40341101);c=md5_ff(c,d,a,b,x[i+14],17,-1502002290);b=md5_ff(b,c,d,a,x[i+15],22,1236535329);a=md5_gg(a,b,c,d,x[i+1],5,-165796510);d=md5_gg(d,a,b,c,x[i+6],9,-1069501632);c=md5_gg(c,d,a,b,x[i+11],14,643717713);b=md5_gg(b,c,d,a,x[i+0],20,-373897302);a=md5_gg(a,b,c,d,x[i+5],5,-701558691);d=md5_gg(d,a,b,c,x[i+10],9,38016083);c=md5_gg(c,d,a,b,x[i+15],14,-660478335);b=md5_gg(b,c,d,a,x[i+4],20,-405537848);a=md5_gg(a,b,c,d,x[i+9],5,568446438);d=md5_gg(d,a,b,c,x[i+14],9,-1019803690);c=md5_gg(c,d,a,b,x[i+3],14,-187363961);b=md5_gg(b,c,d,a,x[i+8],20,1163531501);a=md5_gg(a,b,c,d,x[i+13],5,-1444681467);d=md5_gg(d,a,b,c,x[i+2],9,-51403784);c=md5_gg(c,d,a,b,x[i+7],14,1735328473);b=md5_gg(b,c,d,a,x[i+12],20,-1926607734);a=md5_hh(a,b,c,d,x[i+5],4,-378558);d=md5_hh(d,a,b,c,x[i+8],11,-2022574463);c=md5_hh(c,d,a,b,x[i+11],16,1839030562);b=md5_hh(b,c,d,a,x[i+14],23,-35309556);a=md5_hh(a,b,c,d,x[i+1],4,-1530992060);d=md5_hh(d,a,b,c,x[i+4],11,1272893353);c=md5_hh(c,d,a,b,x[i+7],16,-155497632);b=md5_hh(b,c,d,a,x[i+10],23,-1094730640);a=md5_hh(a,b,c,d,x[i+13],4,681279174);d=md5_hh(d,a,b,c,x[i+0],11,-358537222);c=md5_hh(c,d,a,b,x[i+3],16,-722521979);b=md5_hh(b,c,d,a,x[i+6],23,76029189);a=md5_hh(a,b,c,d,x[i+9],4,-640364487);d=md5_hh(d,a,b,c,x[i+12],11,-421815835);c=md5_hh(c,d,a,b,x[i+15],16,530742520);b=md5_hh(b,c,d,a,x[i+2],23,-995338651);a=md5_ii(a,b,c,d,x[i+0],6,-198630844);d=md5_ii(d,a,b,c,x[i+7],10,1126891415);c=md5_ii(c,d,a,b,x[i+14],15,-1416354905);b=md5_ii(b,c,d,a,x[i+5],21,-57434055);a=md5_ii(a,b,c,d,x[i+12],6,1700485571);d=md5_ii(d,a,b,c,x[i+3],10,-1894986606);c=md5_ii(c,d,a,b,x[i+10],15,-1051523);b=md5_ii(b,c,d,a,x[i+1],21,-2054922799);a=md5_ii(a,b,c,d,x[i+8],6,1873313359);d=md5_ii(d,a,b,c,x[i+15],10,-30611744);c=md5_ii(c,d,a,b,x[i+6],15,-1560198380);b=md5_ii(b,c,d,a,x[i+13],21,1309151649);a=md5_ii(a,b,c,d,x[i+4],6,-145523070);d=md5_ii(d,a,b,c,x[i+11],10,-1120210379);c=md5_ii(c,d,a,b,x[i+2],15,718787259);b=md5_ii(b,c,d,a,x[i+9],21,-343485551);a=safe_add(a,olda);b=safe_add(b,oldb);c=safe_add(c,oldc);d=safe_add(d,oldd);}return Array(a,b,c,d);}function md5_cmn(q,a,b,x,s,t){return safe_add(bit_rol(safe_add(safe_add(a,q),safe_add(x,t)),s),b);}function md5_ff(a,b,c,d,x,s,t){return md5_cmn((b&c)|((~b)&d),a,b,x,s,t);}function md5_gg(a,b,c,d,x,s,t){return md5_cmn((b&d)|(c&(~d)),a,b,x,s,t);}function md5_hh(a,b,c,d,x,s,t){return md5_cmn(b^c^d,a,b,x,s,t);}function md5_ii(a,b,c,d,x,s,t){return md5_cmn(c^(b|(~d)),a,b,x,s,t);}function core_hmac_md5(key,data){var bkey=str2binl(key);if(bkey.length>16)bkey=core_md5(bkey,key.length*chrsz);var ipad=Array(16),opad=Array(16);for(var i=0;i<16;i++){ipad[i]=bkey[i]^0x36363636;opad[i]=bkey[i]^0x5C5C5C5C;}var hash=core_md5(ipad.concat(str2binl(data)),512+data.length*chrsz);return core_md5(opad.concat(hash),512+128);}function safe_add(x,y){var lsw=(x&0xFFFF)+(y&0xFFFF);var msw=(x>>16)+(y>>16)+(lsw>>16);return(msw<<16)|(lsw&0xFFFF);}function bit_rol(num,cnt){return(num<<cnt)|(num>>>(32-cnt));}function str2binl(str){var bin=Array();var mask=(1<<chrsz)-1;for(var i=0;i<str.length*chrsz;i+=chrsz)bin[i>>5]|=(str.charCodeAt(i/chrsz)&mask)<<(i%32);return bin;}function binl2str(bin){var str="";var mask=(1<<chrsz)-1;for(var i=0;i<bin.length*32;i+=chrsz)str+=String.fromCharCode((bin[i>>5]>>>(i%32))&mask);return str;}function binl2hex(binarray){var hex_tab=hexcase?"0123456789ABCDEF":"0123456789abcdef";var str="";for(var i=0;i<binarray.length*4;i++){str+=hex_tab.charAt((binarray[i>>2]>>((i%4)*8+4))&0xF)+hex_tab.charAt((binarray[i>>2]>>((i%4)*8))&0xF);}return str;}function binl2b64(binarray){var tab="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";var str="";for(var i=0;i<binarray.length*4;i+=3){var triplet=(((binarray[i>>2]>>8*(i%4))&0xFF)<<16)|(((binarray[i+1>>2]>>8*((i+1)%4))&0xFF)<<8)|((binarray[i+2>>2]>>8*((i+2)%4))&0xFF);for(var j=0;j<4;j++){if(i*8+j*6>binarray.length*32)str+=b64pad;else str+=tab.charAt((triplet>>6*(3-j))&0x3F);}}return str;}