// JavaScript Document
var xmlHttp
var xmlHttp_2

function showCatInfo(id)
{ 
	document.getElementById("browse_cat").href = "index.php?page_id=4&cat_id="+id;
	xmlHttp=GetXmlHttpObject();
	xmlHttp_2=GetXmlHttpObject();
	if (xmlHttp==null || xmlHttp_2==null)
	  {
		  alert ("Your browser does not support AJAX!");
		  return;
	  } 
	//var url="index.php?page_id=4";
	var url="/snippets/ajax/catagories.php";
	url=url+"?cat_id="+id;
	url=url+"&sid="+Math.random();
	//url = 'http://www.deonviljoen.com/'+url;
	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
	
	var url_2="/snippets/ajax/catagories.php";
	url_2=url_2+"?img_cat_id="+id;
	url_2=url_2+"&sid="+Math.random();
	//url_2 = 'http://www.deonviljoen.com/'+url_2;
	xmlHttp_2.onreadystatechange=stateChanged;
	xmlHttp_2.open("GET",url_2,true);
	xmlHttp_2.send(null);
	
}

function stateChanged() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		//document.getElementById("first_info").style.display="none";
		//document.getElementById("cat_info").style.display="block";
		document.getElementById("first_info").innerHTML=xmlHttp.responseText;
	}
	if (xmlHttp_2.readyState==3 || xmlHttp_2.readyState=="complete")
	{ 
		//document.getElementById("first_info").style.display="none";
		//document.getElementById("cat_info").style.display="block";
		document.getElementById("first_info").innerHTML='<img src="images/loading.gif" />';
	}
	if (xmlHttp_2.readyState==4 || xmlHttp_2.readyState=="complete")
	{ 
		//document.getElementById("first_info").style.display="none";
		//document.getElementById("cat_info").style.display="block";
		document.getElementById("cat_img").innerHTML=xmlHttp_2.responseText;
	}
}



function GetXmlHttpObject()
{
	var xmlHttp=null;
	try
	  {
	  // Firefox, Opera 8.0+, Safari
	  xmlHttp=new XMLHttpRequest();
	  }
	catch (e)
	  {
	  // Internet Explorer
	  try
		{
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
	  catch (e)
		{
		xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	  }
	return xmlHttp;
}




