    var xmlHttp

    function getModels(manufacturer)
    { 
        show_element("indicator")
        xmlHttp=GetXmlHttpObject();
        if (xmlHttp==null) {
            document.location.href = "/cat-top/";
            return;
        } else if(manufacturer == "more") {
            document.location.href = "/cat-top/";
        }
        
        var url="/ajax-get-phone-models.php";
        url=url+"?manufacturer="+manufacturer;
        url=url+"&sid="+Math.random();
        xmlHttp.onreadystatechange=stateChanged;
        xmlHttp.open("GET",url,true);
        xmlHttp.send(null);
    }

    function stateChanged() { 
        if (xmlHttp.readyState==4)
        { 
            hide_element("indicator")
            document.getElementById("models").innerHTML=xmlHttp.responseText;
        }
    }

    function GetXmlHttpObject()
    {
        var xmlHttp=null;
        try
        {
            // Firefox, Opera 8.0+, Safari
            xmlHttp=new XMLHttpRequest();
        }
        catch (e)
        {
            // Internet Explorer
            try
            {
                xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
            }
            catch (e)
            {
                xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
            }
        }
        return xmlHttp;
    }
    
    function show_element(show) {
        var toShow = document.getElementById(show);
        toShow.innerHTML="<img src='/graphics/indicator.gif'> Loading... please wait!";
        toShow.style.color = "black";
        toShow.style.display = "block";
        
        //var opt = document.getElementById(options);
        //opt.innerHTML = "<a href=\"#\" onclick=\"hide_element('"+show+"', '"+options+"'); return false;\">Hide the XML</a>";
    }
    
    function hide_element(hide) {
        var toHide = document.getElementById(hide);
        toHide.style.display = "none";
        
        //var opt = document.getElementById(options);
        //opt.innerHTML = "<a href=\"#\" onclick=\"show_element('"+hide+"', '"+options+"'); return false;\">View the XML</a>";
    }
    
    function previewWindow(id) {
       mywindow = window.open ("feature-preview.php?id=" +id,
       "mywindow","status=1,scrollbars=1,width=1000,height=300");
       mywindow.moveTo(0,0);
    } 
