var moz=document.getElementById&&!document.all
var mozHeightOffset=20

function resize_iframe(frameid){
  if (!frameid || !document.getElementById(frameid)) return;
  document.getElementById(frameid).height=100 // required for Moz bug, value can be "", null, or integer
  document.getElementById(frameid).height=window.frames[frameid].document.body.scrollHeight+(moz?mozHeightOffset:0)
  document.getElementById(frameid).width=100 // required for Moz bug, value can be "", null, or integer
  document.getElementById(frameid).width=window.frames[frameid].document.body.scrollWidth+(moz?mozHeightOffset:0)
}

function do_multicruft(dog) {
  document.write(' <a href="javascript:HaloScanTB(\''+dog+'\');" target="_self">');
  postCountTB(dog);
  document.write('</a> <a href="javascript:HaloScan(\''+dog+'\');" target="_self">');
  postCount(dog);
  document.write('</a>');
}

function do_singlecruft(dog) {
  document.write('<a href="'+dog.substr(0,6)+'/'+dog.substr(6)+
    '.htm">Permalink</a> <a href="javascript:HaloScanTB(\''+dog+'\');" target="_self">');
  postCountTB(dog);
  document.write("</a> <b>");
  postCount(dog);
  document.write('</b><br><iframe width="100%" height="5000" frameborder=0 src="http://www.haloscan.com/comments.php?user=dirtydingus&comment='+dog+'"></iframe>');
}

function may_hide() {
  var broom;
  with (location) {
    if (search) broom = search.substr(1).match(/(\d{8}[a-z]?)/)[0];
    if (broom){
      var url=protocol+"//"+host+(port?(":"+port):"")+"/"+broom.substr(0,6)+"/"+broom.substr(6)+".htm";
      //alert (url);
      replace(url);
    }
  }
  resize_iframe("cideroutsider");
}

function do_mane() {
//   document.write('<p align="center"><a style="font-style: italic;" href="http://danhardie.wordpress.com/2007/07/22/we-cant-turn-them-away/"><img src="200708/iraq-campaign-priceless1.gif"></a></p>'); -->
  document.write('<a href="http://di2.nu/vhost/savethedragons/"><img src="http://di2.nu/vhost/savethedragons/blogad.jpg" align="left"></a><p align="center"><a style="font-style: italic;" href="http://www.threatstop.com/"><img src="http://threatstop.com/sites/all/themes/ts_subtheme/images/logo.png" align = "left">Avoiding DDOS attacks thanks to ThreatSTOP</a></p>');
  document.write('<iframe src="http://rcm.amazon.com/e/cm?t=lombredeloliv-20&o=1&p=13&l=ur1&category=books&banner=1N4P1140VP34Z6816KR2&f=ifr" width="468" height="60" scrolling="no" border="0" marginwidth="0" style="border:none;" frameborder="0"></iframe>');
// document.write('<p align="center"><a style="font-style: italic;" href="http://www.di2.nu/200702/01.htm">The GuardUno device scam blogged about here</a></p>'); -->
//  document.write('<p align="center"><a href="http://www.savexp.com"><object width="460" height="140"><param name="movie"'+
//   ' value="http://weblog.infoworld.com/enterprisedesktop/archives/saveXP_header1.swf"><embed '+
//   'src="http://weblog.infoworld.com/enterprisedesktop/archives/saveXP_header1.swf" width="460" height="140"></embed></object></a></p>');
//  var d=new Date(); d=d.getSeconds()%2;
//  if (d==1) {
//    document.write('<p align="center"><a style="font-style: italic;" href="http://www.sarahahoyt.com/musketeers/dom/excerpt.htm"><img alt="Death of a Musketeer by Sarah D\'Almeida" src="pix/DOAMBannerAd.gif" style="border: 0px solid ; width: 468px; height: 60px;"><br>Death of a Musketeer</a></p>');
//  } else {
//    document.write('<p align="center"><a href="http://www.webscription.net/chapters/1416520929/1416520929.htm?blurb"><img alt="Draw One in the Dark by Sarah Hoyt" src="pix/DOITDBannerAd.gif" style="border: 0px solid ; width: 468px; height: 60px;"></a><br>'+
// '<a href="http://www.amazon.com/Draw-One-Dark-Sarah-Hoyt/dp/1416520929/sr=1-3/qid=1158313078/ref=pd_bbs_3/104-6555552-1814319?ie=UTF8&s=books">Pre order at Amazon.com</a><img src="http://www.assoc-amazon.com/e/ir?t=lombredeloliv-20&amp;l=ur2&amp;o=1" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /> -~oOo~- <a href="http://www.webscription.net/chapters/1416520929/1416520929.htm?blurb">Extract</A> -~oOo~- <a href="http://www.di2.nu/200609/15b.htm">Review</a></p>');
//  }
}

function do_entry(text, comments) {
  for (var i=0; i<posts.length && posts[i]<0; i ++);// alert(i+" "+posts[i])
  witch = posts[i]; posts[i]=-1;
  if (witch<0 || witch>=entries.length) {
    alert ("oops "+witch+" "+i+" "+posts.length)
    return;
  } // else { alert(witch + " "+entries[witch] +" "+text.length)}

  var date = new Date(entries[witch].substr(0,4),entries[witch].substr(4,2)-1,entries[witch].substr(6,2));
  var breaklink;
  var iframesrc="";
  if (location.search) {
    var prev, next;
    if (location.search.indexOf('_') >0) {
      if ((witch%5)==0) {
	next = (witch<(entries.length-5)?('<a href="'+location.pathname+'?_'+(witch+5)+'">Older</a>'):'');
	prev = (witch>0?('<a href="'+location.pathname+((witch>5)?('?_'+(witch-5)+'">Newer</a>'):'">Current</a>')):'');
      } else {
	next=prev='';
      }
      breaklink = breaker.replace('<p>','<p>'+prev+'<a href="'+location.pathname+'?'+entries[witch]+'">').replace('</p>','</a>'+next+'</p>');
    } else {
      next = (witch<(entries.length-1)?('<a href="'+location.pathname+'?'+entries[witch+1]+'">Older</a>'):'');
      prev = (witch>0?('<a href="'+location.pathname+'?'+entries[witch-1]+'">Newer</a>'):'');
      iframesrc='<br><iframe width="100%" height="5000" frameborder=0 src="http://www.haloscan.com/comments.php?user=dirtydingus&comment='+entries[witch]+'"></iframe>';
      //for (i=0; i<comments.length; i++)style="visibility:hidden"
	//document.writeln(breaker+comments[i]);
      breaklink = breaker.replace('<p>','<p>'+prev+'<a href="'+location.pathname+'">').replace('</p>','</a>'+next+'</p>');
    }
  }
  else breaklink = breaker.replace('<p>','<p><a href="'+location.pathname+'?'+entries[witch]+'" title="Permalink">').
    replace('</p>',date.toLocaleString().substr(0,date.toLocaleString().length -8)+'</a></p>');
  document.writeln(breaklink+text+'<br><a href="'+location.pathname+'?'+entries[witch]+'" title="Permalink">Permalink</a>');
  document.write(' <a href="javascript:HaloScanTB(\''+entries[witch]+'\');" target="_self">');
  postCountTB(entries[witch]);
  document.write("</a>");
  // alert("written"+witch + " "+entries[witch] +" "+text.length)
  document.writeln(iframesrc?'<b>': ('<a href="javascript:HaloScan(\''+entries[witch]+'\');">'));
  postCount(entries[witch]);
  document.write(iframesrc? '</b>'+iframesrc :'</a><br><img height="170" width="500" src="pix/olivebreak.png">');
//  if (location.search) {
//    for (i=0; i<comments.length; i++)
//      document.writeln(breaker+comments[i]);
//  }
}
//<a href="javascript:HaloScan('Name');" target="_self"><script type="text/javascript">postCount('Name');</script></a> | <a href="javascript:HaloScanTB('Name');" target="_self"><script type="text/javascript">postCountTB('Name'); </script></a>

