function searchByCriteria2(page,searchString) {
        document.getElementById('over_body').style.display ='block';
	var searchURL = searchString;
        var ajaxRequest;

        try{
                // Opera 8.0+, Firefox, Safari
                ajaxRequest = new XMLHttpRequest();
        } catch (e){
                // Internet Explorer Browsers
                try{
                        ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
                } catch (e) {

                        try{
                                ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
                        } catch (e){
                                // Something went wrong
                                alert("Your browser broke!");
                                return false;
                        }
                }
        }
        // Create a function that will receive data sent from the server
        ajaxRequest.onreadystatechange = function(){
                if(ajaxRequest.readyState == 4){
                        responseTxt =  ajaxRequest.responseText;
                        if ( responseTxt != "nothingfound") {
                                document.getElementById('mainpropcon_div').innerHTML = responseTxt;
                                document.getElementById('over_body').style.display ='none';
                        } else {
                        	document.getElementById('mainpropcon_div').innerHTML = "<div class='noprops'>Sorry, no properties found<br /><br />Please refine your search or view all properties <a href='../pages/search.php' style='color:#8ac106;'>here</a></div>";
                                document.getElementById('over_body').style.display ='none';
                        }
                }
        }
        ajaxRequest.open("GET", "../vanspage/searchPropsCriteria.php?page="+page+"&"+searchURL, true);
        ajaxRequest.send(null);
}

function searchByCriteria() {
        document.getElementById('over_body').style.display ='block';
        var criteria = document.listby.searchcriteria.value;
        var ascdesc = document.listby.ascdesc.value;

        var province = document.searchForm.propdesc.value;
        var make = document.searchForm.province.value;
        var model = document.searchForm.area.value;
        var pricerange = document.searchForm.pricerange.value;
        var modelyear = document.searchForm.modelyear.value;
        
	var ajaxRequest;

        try{
                // Opera 8.0+, Firefox, Safari
                ajaxRequest = new XMLHttpRequest();
        } catch (e){
                // Internet Explorer Browsers
                try{
                        ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
                } catch (e) {

                        try{
                                ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
                        } catch (e){
                                // Something went wrong
                                alert("Your browser broke!");
                                return false;
                        }
                }
        }
        // Create a function that will receive data sent from the server
        ajaxRequest.onreadystatechange = function(){
                if(ajaxRequest.readyState == 4){
                        responseTxt =  ajaxRequest.responseText;
                        if ( responseTxt != "nothingfound") {
                                document.getElementById('mainpropcon_div').innerHTML = responseTxt;
                                document.getElementById('over_body').style.display ='none';
                        } else {
                        	document.getElementById('mainpropcon_div').innerHTML = "<div class='noprops'>Sorry, no properties found<br /><br />Please refine your search or view all properties <a href='../pages/search.php' style='color:#8ac106;'>here</a></div>";
                                document.getElementById('over_body').style.display ='none';
                        }
                }
        }
        ajaxRequest.open("GET", "../vanspage/searchPropsCriteria.php?propdesc="+province+"&province="+make+"&area="+model+"&pricerange="+pricerange+"&modelyear="+modelyear+"&criteria="+criteria+"&ascdesc="+ascdesc, true);
        ajaxRequest.send(null);
}


function gotoSearchProps(tosend) {
	document.getElementById('over_body').style.display ='block';
	var ajaxRequest;

        try{
                // Opera 8.0+, Firefox, Safari
                ajaxRequest = new XMLHttpRequest();
        } catch (e){
                // Internet Explorer Browsers
                try{
                        ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
                } catch (e) {
                        try{
                                ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
                        } catch (e){
                                // Something went wrong
                                alert("Your browser broke!");
                                return false;
                        }
                }
        }
        // Create a function that will receive data sent from the server
        ajaxRequest.onreadystatechange = function(){
                if(ajaxRequest.readyState == 4){
                        responseTxt =  ajaxRequest.responseText;
                        if ( responseTxt != "nothingfound") {
				document.getElementById('mainpropcon_div').innerHTML = responseTxt;
				document.getElementById('over_body').style.display ='none';
                        } else {
                        	document.getElementById('mainpropcon_div').innerHTML = "<div class='noprops'>Sorry, no properties found<br /><br />Please refine your search or view all properties <a href='../pages/search.php' style='color:#8ac106;'>here</a></div>";
				document.getElementById('over_body').style.display ='none';
			}
                }
        }
        ajaxRequest.open("GET", "../vanspage/searchProps.php?"+tosend, true);
        ajaxRequest.send(null);
}

function searchProps2(page,searchString) {
	document.getElementById('over_body').style.display ='block';
	var searchURL = searchString;
        var ajaxRequest;
        try{
                // Opera 8.0+, Firefox, Safari
                ajaxRequest = new XMLHttpRequest();
        } catch (e){
                // Internet Explorer Browsers
                try{
                        ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
                } catch (e) {
                        try{
                                ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
                        } catch (e){
                                // Something went wrong
                                alert("Your browser broke!");
                                return false;
                        }
                }
        }
        // Create a function that will receive data sent from the server
        ajaxRequest.onreadystatechange = function(){
                if(ajaxRequest.readyState == 4){
                        responseTxt =  ajaxRequest.responseText;
                        if ( responseTxt != "nothingfound") {
				document.getElementById('mainpropcon_div').innerHTML = responseTxt;
				document.getElementById('over_body').style.display ='none';
                        } else {
                        	document.getElementById('mainpropcon_div').innerHTML = "<div class='noprops'>Sorry, no vehicles found<br /><br />Please refine your search</a></div>";
				document.getElementById('over_body').style.display ='none';
			}
                }
        }
        ajaxRequest.open("GET", "../vanspage/searchProps.php?page="+page+"&"+searchURL, true);
        ajaxRequest.send(null);
}

function searchProps() {
	var province = document.searchForm.propdesc.value;
	var make = document.searchForm.province.value;
	var model = document.searchForm.area.value;
	var pricerange = document.searchForm.pricerange.value;
	var modelyear = document.searchForm.modelyear.value;
        var ajaxRequest;
        try{
                // Opera 8.0+, Firefox, Safari
                ajaxRequest = new XMLHttpRequest();
        } catch (e){
                // Internet Explorer Browsers
                try{
                        ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
                } catch (e) {
                        try{
                                ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
                        } catch (e){
                                // Something went wrong
                                alert("Your browser broke!");
                                return false;
                        }
                }
        }
        // Create a function that will receive data sent from the server
        ajaxRequest.onreadystatechange = function(){
                if(ajaxRequest.readyState == 4){
                        responseTxt =  ajaxRequest.responseText;
                        if ( responseTxt != "nothingfound") {
				document.getElementById('mainpropcon_div').innerHTML = responseTxt;
				document.getElementById('over_body').style.display ='none';
                        } else {
                        	document.getElementById('mainpropcon_div').innerHTML = "<div class='noprops'>Sorry, no vehicles found<br /><br />Please refine your search and try again</div>";
				document.getElementById('over_body').style.display ='none';
			}
                }
        }
        ajaxRequest.open("GET", "../vanspage/searchProps.php?propdesc="+province+"&province="+make+"&area="+model+"&pricerange="+pricerange+"&modelyear="+modelyear+"&from=search", true);
        ajaxRequest.send(null);
}

function getAreas(){
        var ajaxRequest;
        var prov = document.searchForm.province.value;

        try{
                // Opera 8.0+, Firefox, Safari
                ajaxRequest = new XMLHttpRequest();
        } catch (e){
                // Internet Explorer Browsers
                try{
                        ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
                } catch (e) {
                        try{
                                ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
                        } catch (e){
                                // Something went wrong
                                alert("Your browser broke!");
                                return false;
                        }
                }
        }
        // Create a function that will receive data sent from the server
        ajaxRequest.onreadystatechange = function(){
                if(ajaxRequest.readyState == 4){
                        responseTxt =  ajaxRequest.responseText;
                        if ( responseTxt == "noareas") {
                                document.getElementById('area_div').innerHTML = '<select class="input2" name="area" id="area"><option value="all">All</option></select>';
                        } else {
                                document.getElementById('area_div').innerHTML = '<select class="input2" name="area" id="area">'+responseTxt+'</select>';
                        }
                }
        }
        ajaxRequest.open("GET", "../propadmin/getareas.php?prov="+prov, true);
        ajaxRequest.send(null);
}

function getModels(){
        var ajaxRequest;
        var prov = document.searchForm.province.value;

        try{
                // Opera 8.0+, Firefox, Safari
                ajaxRequest = new XMLHttpRequest();
        } catch (e){
                // Internet Explorer Browsers
                try{
                        ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
                } catch (e) {
                        try{
                                ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
                        } catch (e){
                                // Something went wrong
                                alert("Your browser broke!");
                                return false;
                        }
                }
        }
        // Create a function that will receive data sent from the server
        ajaxRequest.onreadystatechange = function(){
                if(ajaxRequest.readyState == 4){
                        responseTxt =  ajaxRequest.responseText;
                        if ( responseTxt == "noareas") {
                                document.getElementById('area_div').innerHTML = '<select class="input2" name="area" id="area"><option>No Area</option></select>';
                        } else {
                                document.getElementById('area_div').innerHTML = '<select class="input2" name="area" id="area">'+responseTxt+'</select>';
                        }
                }
        }
        ajaxRequest.open("GET", "../propadmin/getareas.php?prov="+prov, true);
        ajaxRequest.send(null);
}
