var xmlHttp;

function search_now(str, root_url, page, sess_params)
{
    xmlHttp=GetXmlHttpObject();
    if (xmlHttp==null || str.length < 3)
    {
        return;
    }    
    var url= root_url + "search.php?keywords="+str+"&page="+page+"&rand="+Math.random();
    if (sess_params != null)
    {
        url=url+"&"+sess_params;
    }
    xmlHttp.onreadystatechange=stateChanged;
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
} 

function stateChanged() 
{ 
    if (xmlHttp.readyState==4)
    { 
        document.getElementById("dynamic-zone").innerHTML=xmlHttp.responseText;
        document.getElementById("ajax-loader").style.display = "none";
        filterFix();
    }
    else
    {
    	document.getElementById("ajax-loader").style.display = "inline";
    }
}

function GetXmlHttpObject()
{
    var xmlHttp=null;
    try
    {
        xmlHttp=new XMLHttpRequest();
    }
    catch (e)
    {
        try
        {
            xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e)
        {
            xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
    }
    return xmlHttp;
}