// JavaScript Document
var xmlHttp=new Array();
function startAjax(){
var ajax;
  try // Firefox, Opera 8.0+, Safari
    {ajax=new XMLHttpRequest();
	return ajax;
    } catch (e) {
		try// Internet Explorer
      		{ajax=new ActiveXObject("Msxml2.XMLHTTP");
	  		return ajax;
      		} catch (e) {
      			try
        			{ajax=new ActiveXObject("Microsoft.XMLHTTP");
					return ajax;
        			} catch (e) {
        				alert("Your browser does not support AJAX!");
        				return null;
        				}
      			}
    	}
}

function ajaxRequest(div, url){
	xmlHttp[div]=startAjax();
	xmlHttp[div].onreadystatechange=function(){ 
	if (xmlHttp[div].readyState==4){
		//alert(xmlHttp[div].responseText+" from "+url+" into "+div);
		document.getElementById(div).innerHTML=xmlHttp[div].responseText;
		document.getElementById("loader").style.visibility = "hidden";
	}else{
		document.getElementById("loader").style.visibility = "visible";
	}
}
	//alert(url);
	xmlHttp[div].open("GET",url,true);
	xmlHttp[div].send(null);
}

function getNav(tab){
	ajaxRequest("nav", "/nav.php?tab="+tab);
	getContent(tab,'main');
}

function getContent(tab,nav){
	ajaxRequest("content", "/content.php?tab="+tab+"&nav="+nav);
	//getSide(tab,nav);
}

function getSide(tab,nav){
	ajaxRequest("sidebar", "/side.php?tab="+tab+"&nav="+nav);
}

function changeColor(id, color) {
	element = document.getElementById(id);
	element.style.background = color;
} 