<!--
// Along for the ride
// By Mar Matthias Darin
// Copyright (C) 2009 All Rights Reserved

var AFTRtimer;
var AFTRPostimer;
var AFTRstartTime;
var AFTRendTime;

var AFTRx1=0, AFTRx2=0;
var AFTRy1=0, AFTRy2=0;
var AFTRh=0, AFTRw=0;

function AFTRFixPrecision(num)
  {
    var stringNum = String(num);

    if (stringNum.indexOf('.')==-1)
      return stringNum+'.00';

    var newNum = stringNum.split('.');

    newNum[1]=(newNum[1].length>2)?newNum[1].subString(0,2):newNum[1];

    if (newNum[1].length==1)
      newNum[1]+='0';

    return newNum[0]+'.'+newNum[1];
  }

function AFTRStopTime()
  {
    AFTRendTime=new Date();

    var a='Loaded: '+AFTRFixPrecision((AFTRendTime-AFTRstartTime)/1000)+'s';

    document.getElementById('AFTRendTime').innerHTML=a;
  }

function AFTRSetSize()
  {
    var mx=0, my=0, tx=0, ty=0;
    var scrOfX=0, scrOfY=0;

    if(typeof(window.innerWidth) == 'number')
      {
        mx = window.innerWidth - 16;
        my = window.innerHeight;
      }
    else if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) 
      {
        mx = document.documentElement.clientWidth;
        my = document.documentElement.clientHeight;
      }
    else if(document.body && (document.body.clientWidth || document.body.clientHeight))
      {
        mx = document.body.clientWidth;
        my = document.body.clientHeight;
      }

    if(typeof(window.pageYOffset) == 'number')
      {
        scrOfY = window.pageYOffset;
        scrOfX = window.pageXOffset;
      }
    else if(document.body && (document.body.scrollLeft || document.body.scrollTop))
      {
        scrOfY = document.body.scrollTop;
        scrOfX = document.body.scrollLeft;
      }
    else if(document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop))
      {
        scrOfY = document.documentElement.scrollTop;
        scrOfX = document.documentElement.scrollLeft;
      }

    tx=parseInt(mx/10);
    ty=parseInt(my/10);
    AFTRx1=tx;
    AFTRy1=ty;
    AFTRx2=mx-tx;
    AFTRy2=my-ty;
    AFTRw=AFTRx2-tx;
    AFTRh=AFTRy2-ty;
  }

function AFTRShow()
  {
    document.getElementById("AFTRendTime").innerHTML="Loading...";
    AFTRstartTime=new Date();
    var o=document.getElementById('AFTR');
    var o=document.getElementById('AFTR');
    var fs=o.style.height;

    AFTRSetSize();
    o.style.top=AFTRy1 + 'px';
    o.style.left=AFTRx1 + 'px';
    o.style.width=AFTRx2 + 'px';
    o.style.height=AFTRy2 + 'px';

    document.getElementById('AFTRBody').style.width=AFTRw + 'px';
    document.getElementById('AFTRBody').style.height=(AFTRh-60) + 'px';
    document.getElementById('AFTRLink').href = "http://shydub-simplehappylife.blogspot.com";
    document.getElementById('AFTRAd').src = "http://matthiaschronicles.tanaya.net/AFTR/TopAd.html";
    document.getElementById('AFTRBody').src = "http://shydub-simplehappylife.blogspot.com#aftrInUse";
    document.getElementById('aftrCounter').src = "http://matthiaschronicles.tanaya.net/cgi-bin/aftrCounter.cgi?91382";

    o.style.display='inline';
  }

function AFTRHide()
  {
    var o=document.getElementById('AFTR');

    o.style.display='none';
    clearTimeout(AFTRPostimer);
  }

function AFTRposition(srch,name)
  {
    var l=srch.length;
    var t=name.length;
    var e=t-l+1;
    var done=-1;

    for(var i=0;i<e && done<0;i++)
      {
        var sub=name.substring(i,i+l);
        if(sub==srch)
          done=i;
      }
    return(done);
  }

document.writeln('<div ID="AFTRlogo" OnClick="AFTRShow();" style="width:125px; height: 125px; line-height: normal; padding: normal; margin: normal; color: #ffffff; font-weight: bold; font-family: Verdana,Geneva,Arial,Sans-serif; background-image: url(http://matthiaschronicles.tanaya.net/AFTR/Images/AlongForTheRide-BG475.gif);">');
document.writeln('<center><span style="color: #ffffff; font-size: 24px;">Along for the Ride!</span>');
document.writeln('<p><span ID="AFTRMOmsg" style="color: #ffffff; padding: 3px; font-size: 12px;">Click on this box for an interesting blog!</span>');
document.writeln('</center></div>');

if(AFTRposition('aftrInUse',location.href)<0) { document.writeln('<div id="AFTR" style="display: none; z-index: 50; position: fixed; font-size: 16px; font-weight: bold; font-family: Verdana,Geneva,Arial,Sans-serif;">');
document.writeln('<table style="background-color: #aeaeff;" width=645>');
document.writeln('<tr height=80><td valign="center"><center>');
document.writeln('Along For The Ride!<br><span id="AFTRendTime">Loading...</span><br>');
document.writeln('<img id="aftrCounter" src="#" border=0 height=1 width=1>');
document.writeln('<a target="_blank" href="http://whos.amung.us/stats/vkhrlhtdwxxw/"><img src="http://whos.amung.us/swidget/vkhrlhtdwxxw.png" width="80" height="15" border="0" title="Visitors" /></a>');
document.writeln('</center></td><td><center>');
document.writeln('<a id="AFTRLink" target="_blank" href="#">Open</a>');
document.writeln('</center></td><td><center>');
document.writeln('<a target="_blank" href="http://matthiaschronicles.tanaya.net/AFTR/">Join!</a>');
document.writeln('</center></td><td><center>');
document.writeln('<a href="#" OnClick="AFTRHide();" style="color: #640000;">Close</a>');
document.writeln('</center></td><td><center>');
document.writeln('<iframe id="AFTRAd" src="#" width=300 height=60 scrolling=no marginwidth=0 frameborder=0></iframe>');
document.writeln('</center></td></tr><tr><td colspan=5>');
document.writeln('<iframe id="AFTRBody" src="#" onload="AFTRStopTime();" width=640 height=200></iframe>');
document.writeln('</td><tr></table>');
document.writeln('</div>'); }

-->
