var xmlhttp;
/** get action from onclick **/
function DoAction(str)
{	
	/* check if section should be closed */
	if(str == "close")
	{
		document.getElementById("content").innerHTML = "<!-- nothing -->";
		return false;
	}
	/* get the xml object thingy */
  	xmlhttp=GetXmlHttpObject();
  	if (xmlhttp==null)
    {
 		alert ("Your Browser is old and stinky! No XML for you!");
    	return;
    }
    /** target script and variables to pass **/
  	var url="./ajax/categories.php";
  	url=url+"?q="+str;
  	/** this is where the magic happens **/
  	xmlhttp.onreadystatechange=stateChanged;
  	xmlhttp.open("GET",url,true);
  	xmlhttp.send(null);
}
/** fill the target section with content **/
function stateChanged()
{
	/** display loading while content is being loaded, image can be used too **/
	if(xmlhttp.readyState < 4)
  	{
  		document.getElementById("content").innerHTML= "<ul class=category><li>Loading........</li></ul>";
  	}
  	/** put output from script source into html section **/
  	if(xmlhttp.readyState == 4 || xmlhttp.readyState == 'complete')
  	{
    	document.getElementById("content").innerHTML=xmlhttp.responseText;
  	}
}
function GetXmlHttpObject()
{
	if (window.XMLHttpRequest)
  	{
  		// code for IE7+, Firefox, Chrome, Opera, Safari
  		return new XMLHttpRequest();
  	}
	if (window.ActiveXObject)
	{
		// code for IE6, IE5
  		return new ActiveXObject("Microsoft.XMLHTTP");
	}
	return null;
} 
function bookmarksite(title, url)
{
	if (document.all)
	{
		window.external.AddFavorite(url, title);
	}
	else if (window.sidebar)
	{
		window.sidebar.addPanel(title, url, "");
	}
}
function VoteWindow(idc)
{
	myWindow=window.open('./ajax/vote.php?idc='+idc,'Vote','width=450,height=170,status=no,location=no,titlebar=no');
	myWindow.focus();
}
function ReviewWindow(idc)
{
	myWindow=window.open('./ajax/review.php?idc='+idc,'Review','width=550,height=530,status=no,location=no,titlebar=no');
	myWindow.focus();
}