function xmlhttpPost(strURL) {
    var xmlHttpReq = false;
    var self = this;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    else if (window.ActiveXObject) {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReq.open('POST', strURL, true);
	document.getElementById("load_div").style.display = "block";
	document.getElementById("content").style.display = "none";
    self.xmlHttpReq.onreadystatechange = function() {
        if (self.xmlHttpReq.readyState == 4) {
            updatepage(self.xmlHttpReq.responseText);
        }
    }
    self.xmlHttpReq.send("");
}

function updatepage(str){
	document.getElementById("load_div").style.display = "none";
    document.getElementById("content").innerHTML = str;
	document.getElementById("content").style.display = "block";
	document.getElementById("img_head").src = "images/header" + randomNumber(3) + ".jpg";
}

function randomNumber(limit){
	var ret = Math.floor(Math.random()*limit) + 1;
	if (ret == 0)
		ret = 1;
		
  	return ret;
}

function ChangePic(stat)
{
	var img = document.getElementById("invPic");
	if (stat=="over")
	{
		img.src = "images/trb_inv.gif";
	} else {
		img.src = "images/trb_inv_down.gif";
	}
}
 
// Example:
// simplePreload( '01.gif', '02.gif' ); 

function simplePreload()
{ 
  var args = simplePreload.arguments;
  document.imageArray = new Array(args.length);
  for(var i=0; i<args.length; i++)
  {
    document.imageArray[i] = new Image;
    document.imageArray[i].src = args[i];
  }
}
simplePreload( 'images/trb_inv.gif');

function PrintThis(uu)
{
	popUpWindow("print.php?p=" + uu, 0,0,50,50);
}

var popUpWin=0;
function popUpWindow(URLStr, left, top, width, height)
{
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}


