function getXMLHTTP() { //fuction to return the xml http object
	var xmlhttp=false;	
	try{
		xmlhttp=new XMLHttpRequest();
	}
	catch(e)	{		
		try{			
			xmlhttp= new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(e){
			try{
			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch(e1){
				xmlhttp=false;
			}
		}
	}
	return xmlhttp;
}
	
function jGetCat( category )
{
	var req = getXMLHTTP();
	//alert("bonjour");
	//alert(category);
	if( req ){
		req.onreadystatechange = function()
     	{
			//alert( req.readyState );
			if( req.readyState == 4 )
      		{
				// only if "OK"
				//alert( req.status );
				if ( req.status == 200){
					// Enter Scouting map from left side menu
					var response = req.responseText;
					var display = response.split("blabla");
					var i = 1;
					var j = 1;
					//alert( display[1] + " --- " + display[2] + " --- " + display[3] + " --- " + display[4] );
					
						/*while( display[j] ){
							alert( j+"----"+display[j]+"\n\n"+display[j+1] );
							j=j+2;
						}*/
					
					if( display[1] == "NOTLOGGED" ){
						window.location = display[2];
					}else if( display[3] == "INPASIDERA" ){
						window.location = display[4];
					}else if( display[1] == "INPASIDERA" ){
						window.location = display[2];
					}else if( display[3] == "FIGHT" ){
						window.location = display[4];
					}else{
						while( display[i] ){
							document.getElementById(display[i]).innerHTML = display[i+1];
							i = i + 2;
						}
						//document.getElementById('rtimer').innerHTML = "Blabla<script type=\"text/javascript\">clearTimeout(timerid);</script>";
					}
	 			}else{
					alert("There was a problem while using XMLHTTP:\n" + req.statusText);
				}
			}
		}
		// Set Up the WHOLE map
		if( category == 11 || category == 12 ){
			var step = category - 10;
			var strURL = "pasidera/explore.php?step=" + step;
		// Call only the function to move and update the map
		}else if( category == 32 || category == 33 ){
			var step = category - 31;
			var strURL = "pasidera/lucky.php?step=" + step;
		}else if( category == "gods" ){
			//alert("blip");
			var strURL = "shared/gods.php?loc=0";
		}
		req.open("GET", strURL, true);	
		req.send(null);
	}
} 

