try 
{
	http = new XMLHttpRequest(); /* e.g. Firefox */
} 
catch(e) 
{
	try 
	{
    	http = new ActiveXObject("Msxml2.XMLHTTP"); 
  	}
	catch (e) 
	{
    	try 
		{
    		http = new ActiveXObject("Microsoft.XMLHTTP");  /* some versions IE */
    	} 
		catch (E) 
		{
			http = false;
		} 
	} 
}

function ChangeStatus(url, status, id) // url = xyz.php?mode=
{
	var url_str = url+"&";
	var myRandom=parseInt(Math.random()*99999999);  // cache buster

	http.open("GET", url_str +"status="+status+"&id="+id+"&rand=" + myRandom, true);
	//alert(url_str +"status="+status+"&id="+id);
	http.onreadystatechange = handleHttpStatusResponse;
	http.send(null);
}

function handleHttpStatusResponse()	// return type flag~id~display string
{
	if (http.readyState == 4)
	{
		//alert(':'+http.responseText);
		if(http.responseText!='false') // only if successful...
		{
			results = http.responseText.split("~");

			var id = results[1];
			var img_str = results[2];
			var result_str = results[3];
	
			document.getElementById("status_"+id).innerHTML=img_str;
			JQueryNotify(result_str,'warning',false);
		}
  	}
}

function UpdateRank(str,rank, id)
{
	//var rank = obj.value;
	var url_str = '../includes/ajax.inc.php?response='+str+'_RANK&id='+id+'&rank='+rank;
	var myRandom=parseInt(Math.random()*99999999);  // cache buster

	//alert(url_str);
	http.open("POST", url_str+"&rand=" + myRandom, true);
	http.onreadystatechange = handleHttpSilentResponse;
	http.send(null);	// */
}
function handleHttpSilentResponse() // success! now don't do nething!
{
	if (http.readyState == 4) 
	{
		 //alert(http.responseText);
  	}
}
function ChangeStatusFeat(url, status, id) // url = xyz.php?mode=
{
	var url_str = url+"&";
	var myRandom=parseInt(Math.random()*99999999);  // cache buster

	//alert(url_str+"status="+status+"&id="+id+"&rand=" + myRandom);
	http.open("POST", url_str +"status="+status+"&id="+id+"&rand=" + myRandom, true);
	http.onreadystatechange = handleHttpStatusFeatResponse;
	http.send(null);
}

function handleHttpStatusFeatResponse()	// return type flag~id~display string
{	
	if (http.readyState == 4)
	{
		//alert(http.responseText);
		results = http.responseText.split("~");
		result_len = results.length;

		if(results[0]==1) // only if successful...
		{
			var id = results[1];
			var img_str = results[2];
			var mode = (result_len >= 4)? results[3]+"_": "";
	
			//if(results[0])	//SUCCESFULL IN UPDATING
			document.getElementById(mode+"status_"+id).innerHTML=img_str;
		}
  	}
}
function PostToFB(message) // 
{
	//message = message.replace(/'/g,'');
	//alert(message);
	var myRandom = parseInt(Math.random()*99999999);  // cache buster	
	var content = "access_token=AAADqsTLo4ZB4BAHIBQjoTIpsXhV2W2doQOmexFX7vDXSqokd4AXwiYSKqZBlxXZBV98C2nUHb2qfhOf8OMOz87RouP6wWB1jyyZAtAX60wZDZD&message="+message;
	var url = "https://graph.facebook.com/240828429303398/feed?rand=" + myRandom;

	http.open("POST", url, true);
	http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	http.setRequestHeader("Content-length", content.length);
	http.setRequestHeader("Connection", "close");
	http.onreadystatechange = handleHttpSilentResponse;
	http.send(content);
}
