
	function loadRegions(stateId) {
		var xml = getXMLObject();
		var lstSearchType = window.document.getElementById("ctl00$lstSearchType");
		var txtSearchName = window.document.getElementById("ctl00$txtSearchName");
		var divRegions = window.document.getElementById("divRegions");
	
		if(lstSearchType.selectedIndex > 0){
		    if(lstSearchType.selectedIndex == 1){
                if(xml) {
                    xml.open("post", "supplierInfo.aspx?cmd=getRegions&sId=0&lstSearchType=" + lstSearchType.value + "&id=" + stateId, false);
                    xml.send("");
    				
                    var node = xml.responseXML.childNodes[0].attributes;
    					
                    if(node.getNamedItem("status").value != "ok") {
                        alert(node.getNamedItem("message").value);
                    } else {
    			
                        var nodes = xml.responseXML.childNodes[0].childNodes;
                        var regions = "";
                        
                        for(var i = 0; i < nodes.length; i++) {
                            regions += '<li><a href="websearch.aspx?btnSearch=Search&map=t&lstSearchType=' + lstSearchType.value;
                            regions += '&txtSearchName=' + txtSearchName.value;
                            regions += '&lstState=' + stateId;
                            regions += '&lstRegion=' + nodes[i].attributes.getNamedItem("RegionID").value;
                            regions += '">' + nodes[i].attributes.getNamedItem("Title").value;
                            regions += ' (' + nodes[i].attributes.getNamedItem("count").value;
                            regions += ')</a></li>'; 
                        }
                        divRegions.innerHTML =  regions ;
                    }
		        }
			}
            else{
          
            window.location = 'websearch.aspx?btnSearch=Search&map=t&lstSearchType='  + lstSearchType.value + '&txtSearchName=' + txtSearchName.value + '&lstState=' + stateId; ;   
            }
		} else {
			alert("Please select an offer type first." + lstSearchType.selectedIndex);
		}
	}
	
//********************* SHOW MAP *******************************************
    function showMap(){
       var button = window.document.getElementById("ctl00$btnMapSearch").value;
       var lstSearchType = window.document.getElementById("ctl00$lstSearchType");
       
       if(button == 'Hide Map'){
           window.document.getElementById("trState").style.display = 'block';
	       window.document.getElementById("trRegion").style.display = 'block';
	       window.document.getElementById("tblMap").style.display = 'none';
	       window.document.getElementById("ctl00_imgsection4").style.display = 'block';
	       window.document.getElementById("ctl00$btnMapSearch").value = 'Search by Map';
       }
       else{
           window.document.getElementById("trState").style.display = 'none';
	       window.document.getElementById("trRegion").style.display = 'none';
	       window.document.getElementById("tblMap").style.display = 'block';
	       window.document.getElementById("ctl00_imgsection4").style.display = 'none';
	       window.document.getElementById("ctl00$btnMapSearch").value = 'Hide Map';
	   }
	   
	   if(window.document.getElementById('hdnState') != null && lstSearchType == 1){
	        loadRegions(window.document.getElementById('hdnState').value);     
	   }
    }