
 function go2(strUri) { document.location.href=strUri; }

 function writeFlash() {
  var c=document.getElementById('blogMain'), k=0, h='', s=0, e=0, f=''; // container, kounter, html, start, end, filename
  while((k<10)&&(c.innerHTML.indexOf('src="/_img/image/flash.gif"'))>0) { // k is a safeguard
   h=c.innerHTML; k++; // get html, inc kounter
   s=h.lastIndexOf('<', h.indexOf('src="/_img/image/flash.gif"')); e=h.indexOf(">", s)+1; src=h.substr(s, e-s);   // get the whole image tag
   s=src.indexOf("alt=")+4;    e=src.indexOf(" ", s);   f=src.substr(s, e-s).replace('"', '').replace('"', '');   // get the file name
   dst=src.replace('<IMG', '<img').replace('<img', '<embed').replace('src="/_img/image/flash.gif"', 'src="'+f+'"').replace('>', '></embed>'); // replace
   c.innerHTML = h.replace(src, dst); // update the HTML
  }
 }


 function isMail(email) {
  return email.search(/^[\.\w_'-]+@[\w_'-]+\.[\w_-]+(\.[\w_-]+)*$/)==-1 ? false : true;
 }
 
 
 function commentFormSubmit() {
  var cf = document.getElementById('commentform'), de = 0;
  if((de==0)&&(cf.name.value.length<4))   { de=1; alert('What\'s your name?'); cf.name.focus(); }
  if((de==0)&&(!isMail(cf.email.value)))  { de=2; alert('BOINK! Invalid Email?'); cf.email.focus(); }
  if((de==0)&&(cf.words.value.length<10)) { de=3; alert('Press more buttons, kthx.'); cf.words.focus(); }
  if(de==0) { cf.submit(); }
 }
 

 function commentResponse(r) {
  var cf = document.getElementById('commentform');
  var res = new Array(
   '<h2>Gah!</h2>Honestly, how hard is it to get this right?<br/>All you have to do is enter your name, email address and a few non-spammy words.<br/>It\'s not rocket science!'
  ,'<h2>Thanks!</h2>Comment posted - if it\'s not spam it should be live soon.<br/>If it\'s not live soon, I\'m probably asleep.'
  );
  cf.innerHTML = '<div style="width:600px; height:50px; border:1px solid #aaaaaa; padding:8px;">'+res[r]+'</div>';
 }

 function findPos(obj) {
  var curleft=0;
  var curtop =0;
  if(obj.offsetParent) {
   curleft=obj.offsetLeft;
   curtop =obj.offsetTop;
   while(obj=obj.offsetParent) {
    curleft+=obj.offsetLeft;
    curtop +=obj.offsetTop;
   }
  }
  return [curleft,curtop];
 } 
 

 var twitterScrollSpeed=1;

 function twitterScroll() {
  var f1=document.getElementById('twitterFeed1');
  var f2=document.getElementById('twitterFeed2');
  var vm=findPos(document.getElementById('tweetFin'))[1] - findPos(f1)[1], y1=0, y2=0;
  if(!f1.style.top) {
   f1.style.top = '0px';
   f2.style.top = vm+'px';
   f2.innerHTML = f1.innerHTML;
  } else { 
   y1=parseInt(f1.style.top); y1 = y1<(0-vm) ? vm : y1-twitterScrollSpeed; f1.style.top = y1+'px';
   y2=parseInt(f2.style.top); y2 = y2<(0-vm) ? vm : y2-twitterScrollSpeed; f2.style.top = y2+'px';
  }
  twitterScroller = setTimeout('twitterScroll()', 55);
 }
