function getSelected()
{
	ob=document.getElementById("idmare_category[]");
	nlength=ob.length;
	

	 tmp='';
	for ( i=0; i<nlength; i++ ) {
		
		if (ob.options[i].selected == true) {
			if (tmp == '' )
			{
				tmp= ob.options[i].value;
			}else{
				tmp=tmp + ',' + ob.options[i].value;
			}
				
		}
		
	
	}

	if (tmp!='') makeRequest('getcategory.php?selCat='+tmp,'showcat');
}

function getSubLocations(locId)
	{
		
	}
	
function getSelected_recr()
{
	ob=document.getElementById("idmare_category[]");
	nlength=ob.length;
	

	 tmp='';
	for ( i=0; i<nlength; i++ ) {
		
		if (ob.options[i].selected == true) {
			if (tmp == '' )
			{
				tmp= ob.options[i].value;
			}else{
				tmp=tmp + ',' + ob.options[i].value;
			}
				
		}
		
	
	}

	if (tmp!='') makeRequest('../getcategory.php?selCat='+tmp,'showcat');
}
function getSubLocation(locId)
{

	document.getElementById('SubLocDiv').innerHTML='&nbsp;';
	
	makeRequest('getsublocation.php?getSubLoc='+locId,'SubLocDiv');
	
}

var showobj;
    function makeRequest(url,obj) {
		showobj=obj;
        var http_request = false;

        if (window.XMLHttpRequest) { // Mozilla, Safari, ...
            http_request = new XMLHttpRequest();
            if (http_request.overrideMimeType) {
                http_request.overrideMimeType('text/xml');
                // See note below about this line
            }
        } else if (window.ActiveXObject) { // IE
            try {
                http_request = new ActiveXObject("Msxml2.XMLHTTP");
            } catch (e) {
                try {
                    http_request = new ActiveXObject("Microsoft.XMLHTTP");
                } catch (e) {}
            }
        }

        if (!http_request) {
            alert('Giving up :( Cannot create an XMLHTTP instance');
            return false;
        }
        http_request.onreadystatechange = function() { alertContents(http_request); };
        http_request.open('GET', url, true);
        http_request.send(null);

    }

    function alertContents(http_request) {

        if (http_request.readyState == 4) {
            if (http_request.status == 200) {
				/*if (  http_request.responseText=='screen') 
				{
					alert('asdf');
				}else{
					
				}*/
				document.getElementById(showobj).innerHTML =  http_request.responseText;
                
            } else {
                alert('There was a problem with the request.');
            }
        }

    }
	
	
	function getcities (val)
	{
			

			var url = "getcities.php?Search="+ val + "&CountryId="+ document.getElementById('countylist').value;

			makeRequest2(url,'searchResults');
			
	}
	var showobj2;
    function makeRequest2(url,obj) {
		showobj2=obj;
        var http_request2 = false;

        if (window.XMLHttpRequest) { // Mozilla, Safari, ...
            http_request2 = new XMLHttpRequest();
            if (http_request2.overrideMimeType) {
                http_request2.overrideMimeType('text/xml');
                // See note below about this line
            }
        } else if (window.ActiveXObject) { // IE
            try {
                http_request2 = new ActiveXObject("Msxml2.XMLHTTP");
            } catch (e) {
                try {
                    http_request2 = new ActiveXObject("Microsoft.XMLHTTP");
                } catch (e) {}
            }
        }

        if (!http_request2) {
            alert('Giving up :( Cannot create an XMLHTTP instance');
            return false;
        }

        http_request2.onreadystatechange = function() { alertContents2(http_request2); };
        http_request2.open('GET', url, true);
        http_request2.send(null);

    }

    function alertContents2(http_request2) {

        if (http_request2.readyState == 4) {
            if (http_request2.status == 200) {
			
				var ss = document.getElementById(showobj2)
				 document.getElementById('searchResults').style.display= "block";
        ss.innerHTML = '';
        
		var str = http_request2.responseText.split("\n");
		
        for(i=0; i < str.length - 1; i++) {
            //Build our element string.  This is cleaner using the DOM, but
            //IE doesn't support dynamically added attributes.
            var suggest = '<div onmouseover="this.className = \'suggest_link_over\'" ';
            suggest += ' onmouseout="this.className = \'suggest_link\'" ';
            suggest += ' onclick="setSearch(\''+ str[i]+ '\')" ';
            suggest += ' class="suggest_link">' + str[i] + '</div>';
			
            ss.innerHTML += suggest;
        }
	   } else {
                alert('There was a problem with the request.');
            }
        }

    }
	
	
	
function setSearch(value) {

    document.getElementById('cityname').value = value;

    document.getElementById('searchResults').innerHTML = '';
	document.getElementById('searchResults').style.display = "none";
}
function hidediv(){ }