var xmlHttp_change_sorting

function change_sorting(option,page)
{
xmlHttp_change_sorting=GetXmlHttpObject_change_sorting()
//if (xmlHttp_change_sorting==null)
//{
//alert ("Browser does not support HTTP Request")
//return
//}

document.getElementById("newscontrols_loading").innerHTML=' | جارى تحديث الاخبار';

var url="change_sorting.php"
url=url+"?op="+option+"&page="+page
url=url+"&sid="+Math.random()
xmlHttp_change_sorting.onreadystatechange=stateChanged_change_sorting
xmlHttp_change_sorting.open("GET",url,true)
xmlHttp_change_sorting.send(null)




document.getElementById("sort_by_time").style.background="white";
document.getElementById("sort_by_time").style.color="blue";

document.getElementById("sort_by_visites").style.background="white";
document.getElementById("sort_by_visites").style.color="blue";

document.getElementById("sort_by_comments").style.background="white";
document.getElementById("sort_by_comments").style.color="blue";

if(option=='visites')
{
document.getElementById("sort_by_visites").style.background="green";
document.getElementById("sort_by_visites").style.color="white";
}else if(option=='comments')
{
document.getElementById("sort_by_comments").style.background="green";
document.getElementById("sort_by_comments").style.color="white";
}else
{
document.getElementById("sort_by_time").style.background="green";
document.getElementById("sort_by_time").style.color="white";
}

}

function stateChanged_change_sorting() 
{ 
if (xmlHttp_change_sorting.readyState==4 || xmlHttp_change_sorting.readyState==0)
{
document.getElementById("newscol").innerHTML=xmlHttp_change_sorting.responseText
document.getElementById("newscontrols_loading").innerHTML='';


} 
}

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