init = 0;

function updatepage (str) 
{
  var thumbdiv = document.getElementById("thumbshots");
  var invthumbdiv = document.getElementById("invthumbshots");
  if (thumbdiv)
  {
	if (init > 1) 
  	{
		thumbdiv.innerHTML = invthumbdiv.innerHTML;
        	$('thumbshots').fade({ duration: 10.0, from: 0, to: 1 });
  	}
	invthumbdiv.innerHTML = str;
  }

  if (init > 1)
 	window.setTimeout("thumbshots()", 30000);
  else 
  	window.setTimeout("thumbshots()", 5000);
  init++;
}

function thumbshots () 
{
    var xmlHttpReq = false;
    var self = this;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReq.open('GET', "http://fadeout.de/lastthumb.php", true);
    // self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.onreadystatechange = function() {
        if (self.xmlHttpReq.readyState == 4) {
            updatepage(self.xmlHttpReq.responseText);
        }
    }
    self.xmlHttpReq.send('');
}

window.setTimeout("thumbshots()", 100);

