//-----------------------------------------------------------
//--- DROPDOWN FUNCTIONS ------------------------------------
//-----------------------------------------------------------
function FillDropdowns(oElem,oTarget,qryresult){
    var url = '../Map_ListingsXMLDD.aspx';
    var strParams = "f=" + oTarget.form.name + "&e=" + oTarget.name + 
        "&sel=" + qryresult + "&se=" + oElem.name;   
    for(var i=0;i<oElem.options.length;i++)
        {
        if(oElem.options[i].selected)
            {
            strParams += "&q=" + oElem.options[i].value;
            }                                     
        }   
    var loader1 = new net.ContentLoader(url,FillDropdownResult,null,"POST",strParams);                           
}

function FillDropdownResult(){
    var xmlDoc = this.req.responseXML.documentElement;                                      

    var xSel = xmlDoc.getElementsByTagName('selectElement')[0];
    var strFName = xSel.childNodes[0].firstChild.nodeValue;
    var strEName = xSel.childNodes[1].firstChild.nodeValue;

    var objDDL = document.forms[strFName].elements[strEName];                                         
    objDDL.options.length = 0;                                   
        
    var xRows = xmlDoc.getElementsByTagName('entry');                               
    for(i=0;i<xRows.length;i++){                                   
      var theText = xRows[i].childNodes[0].firstChild.nodeValue;                      
      var theValue = xRows[i].childNodes[1].firstChild.nodeValue;                      
      var theSelect = xRows[i].childNodes[2].firstChild.nodeValue; 
      if (theSelect=='True'){
        var option = new Option(theText, theValue, true, true);                           
      }
      else{
        var option = new Option(theText, theValue, false, false);                           
      }                     
	  
	  objDDL.options[i] = option;
    
	} 
                                                            
}
function addThatThing(x) {
	var lastChar = x.length - 1;
	
	if (x.charAt(lastChar)!="&") {
		x += "&";
	}
	
	return x;
}
