var xmlHttp

function getByVicarId(vid)
{
    xmlHttp=GetXmlHttpObject()
    if (xmlHttp==null || vid==-1) return; 
    var url="search.php?vid="+vid;
    xmlHttp.onreadystatechange=telstateChanged 
    xmlHttp.open("GET",url,true)
    xmlHttp.send(null)
} 

function search()
{
    xmlHttp=GetXmlHttpObject();
    if (xmlHttp==null) return; 
    srch=encodeURI(document.getElementById('search').value);
    typ=document.getElementById('type').value;
    var url="search.php?search="+srch+"&type="+typ;
    xmlHttp.onreadystatechange=telstateChanged;
    xmlHttp.open("GET",url,true)
    xmlHttp.send(null)
} 

function telstateChanged() 
{ 
if(xmlHttp.readyState==1)
{
document.getElementById("searchResult").innerHTML='<img src="sabr.gif" style="vertical-align:middle" /> لطفا صبر کنيد...';
}
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("searchResult").innerHTML=xmlHttp.responseText 
 } 
}
