function GetXmlHttpObject(){
	if (window.XMLHttpRequest){
		// code for IE7+, Firefox, Chrome, Opera, Safari
		return new XMLHttpRequest();
	}else{
		// code for IE6, IE5
		return new ActiveXObject("Microsoft.XMLHTTP");
	}
	
	return null;
}

function ajaxtab(id){
	var xmlhttp;
	xmlhttp=GetXmlHttpObject();
	
	if (xmlhttp == null){
		return;
	}
	
	xmlhttp.onreadystatechange = function(){
		if (xmlhttp.readyState==4){
			var posit = xmlhttp.responseText.indexOf("|");
			var tabid = xmlhttp.responseText.substr(0,posit)
			var content = xmlhttp.responseText.slice(posit+1);
			
			document.getElementById('tabcontent').innerHTML=content;
			
			for(i=1;document.getElementById('tab'+i);i++)
			{
				if (i==tabid){
					width = document.getElementById('tab'+i).offsetWidth;
					height = document.getElementById('tab'+i).offsetHeight;
					document.getElementById('tab'+i).style.backgroundImage = 'url(tabs.php?x='+width+'&y='+height+'&sel=1)';
				}else{
					width = document.getElementById('tab'+i).offsetWidth;
					height = document.getElementById('tab'+i).offsetHeight;
					document.getElementById('tab'+i).style.backgroundImage = 'url(tabs.php?x='+width+'&y='+height+'&sel=0)';
				}
			}
		}
	};
	xmlhttp.open('GET','tabcontents.php?id='+id,true);
	
	xmlhttp.send(null);
}
