var xmlhttp;
window.onload = initAll;
function initAll()
{
	DoAction("index");
}
/** fixing the non script execution **/
function evalScripts(scripts)
{	try
	{	if(scripts != '')	
		{	var script = "";
			scripts = scripts.replace(/<script[^>]*>([\s\S]*?)<\/script>/gi, function(){
	       	                         if (scripts !== null) script += arguments[1] + '\n';
 	        	                        return '';});
			if(script) (window.execScript) ? window.execScript(script) : window.setTimeout(script, 0);
		}
		return false;
	}
	catch(e)
	{	alert(e)
	}
}
/** get action from onclick **/
function DoAction(str)
{	
	/* 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="webmaster.php";
  	url=url+"?q="+str;
  	/** this is where the magic happens **/
  	xmlhttp.onreadystatechange=stateChanged;
  	xmlhttp.open("GET",url,true);
  	xmlhttp.send(null);
  	/** extra IE shit **/
  	return 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)
  	{
  		var ContentId = document.getElementById("content");
  		if(ContentId != null)
  		{
  			document.getElementById("content").innerHTML= "<img src=\"../images/loading_wm.gif\" />";
		}
  	}
  	/** put output from script source into html section **/
  	if(xmlhttp.readyState == 4 || xmlhttp.readyState == 'complete')
  	{
  		var result = xmlhttp.responseText;
    	document.getElementById("content").innerHTML=result;
    	evalScripts( result );
  	}
}
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;
}