﻿function loadAdvance( sToDiv, sUrl, sLoadingImage ){
    var ajaxObject = new qtek_ajax(sUrl + "&rd="+Math.random(), "GET");
    var oToDiv = getDocumentObject( sToDiv );
    ajaxObject.responseContainer = oToDiv;
    oToDiv.innerHTML = "<img src='"+sLoadingImage+"' />"
    ajaxObject.onComplete = function(){
    };
    ajaxObject.execute(null);
} 

function loadAjaxSearchDirectory( sToDiv, sUrl, divLoading){
    if (getDocumentObject(divLoading) != null)
        getDocumentObject(divLoading).style.height = document.body.offsetHeight + 'px';
    
    //setOpacity(sToDiv);    
    show(divLoading);
    
    var ajaxObject = new qtek_ajax(sUrl + "&rd="+Math.random(), "GET");
    var oToDiv = getDocumentObject( sToDiv );
    ajaxObject.responseContainer = oToDiv;
    
    ajaxObject.onComplete = function(){ hide(divLoading); updateOnComplete(); }  ;
    ajaxObject.execute(null);
}

function setLocation(sLoc, byLocType)
{
    scrollTo(0,0);
    if(sLoc == "")
            return ;
        if(byLocType == 0)
        {
            document.getElementById("hid_sByCountry").value = sLoc;
            document.getElementById("hid_sByState").value = "";
            document.getElementById("hid_sByCity").value = "";
        }
        else if(byLocType == 1)
        {
            document.getElementById("hid_sByState").value = sLoc;
            document.getElementById("hid_sByCity").value = "";
        }
        else if(byLocType == 2)
        {
            if(document.getElementById("hid_sByCity").value != "")
            {
                var sCityName = document.getElementById("hid_sByCity").value ;
                if(document.getElementById('li_' + sCityName ) != null)
                {
                    document.getElementById('li_' + sCityName ).style.fontWeight = "normal";   
                    document.getElementById('li_' + sCityName ).style.backgroundColor = "";
                }
            }
            //if select city then that city is bold & just load list, not load location list again
            if(document.getElementById('li_' + sLoc) != null) 
            {   
                document.getElementById('li_' + sLoc).style.fontWeight = "bold" ;
                document.getElementById('li_' + sLoc).style.backgroundColor = "#EAF0F7";
            }
            
            document.getElementById("hid_sByCity").value = sLoc;                
        }
        
        if( document.getElementById("selectRadius") == null ){
            document.getElementById("hid_Radius").value = "";
        }
}

	function getSelectedDropdownlist(dropdownListId)
	{
	   var dropdownlist = document.getElementById(dropdownListId);	   
	   if(dropdownlist != null)
	        return dropdownlist.value;
	        
	   return "";     
	}
	
	function getValueFromTextField(textFieldId)
	{
	   var textFieldControl = document.getElementById(textFieldId);
	   return textFieldControl.value;	 
	}
	 function GetQueryParam(ParamName, Value)
    {
        try{
            if (Value != null)
                return "&" + ParamName + "=" + Value;                    
        }        
        catch(e)
        {
            return "";
        }
        
        return "";
    }

function LoadPageAjax(pagenum)
{
    scrollTo(0,0);

    if(getDocumentObject('hid_PageNum') != null)
        getDocumentObject('hid_PageNum').value = pagenum;
}
