// Created on 19 Au 2007
//by rott
var timerID = null;
var nowLoading = false;
var request = false;
try {
  request = new XMLHttpRequest();
} catch (trymicrosoft) {
  try {
    request = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (othermicrosoft) {
    try {
      request = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (failed) {
      request = false;
    }  
  }
}
if (!request)
  alert("Error initializing XMLHttpRequest!");

function aj(id) {
	if (!(nowLoading)){
	nowLoading = true;
	document.getElementById("loading").style.width="0px";
	document.getElementById("loading").style.visibility = "visible"; 
	timerID = setTimeout("showSpin(2)", 10);
	var url = "content.php?id="+id;
	request.open("GET", url, true);
	request.onreadystatechange = updatePage;
	request.send(null);
	}
}

function updatePage() {
 if (request.readyState == 4) {
   if (request.status == 200) {
	document.getElementById("loading").style.visibility = "hidden";	
	var response = request.responseText;
	document.getElementById("body").innerHTML = response;
	ai=0;
	nowLoading = false;
   }
 }
}
function showSpin(newWidth){
	if (nowLoading){
		document.getElementById("loading").style.width=newWidth+"px";
		newWidth=(newWidth%352)+2;
		timerID = setTimeout("showSpin("+newWidth+")", 10);
	} else {
		clearTimeout (timerID);
	}
}
var ai=0;
function ci(imgindex) {
	newpos =-(imgindex*525);
	document.getElementById("content").style.left=newpos+"px";
	document.getElementById("ai"+ai).style.color="black";
	document.getElementById("ai"+imgindex).style.color="red";
	ai=imgindex;
}