var xmlHttp;

function createXMLHttpRequest() {
    if (window.ActiveXObject) {
        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
    } 
    else if (window.XMLHttpRequest) {
        xmlHttp = new XMLHttpRequest();
    }
}

function new_combo_request(passstr) {
	combo_request(passstr);
	document.getElementById("combobox").innerHTML = '<h4>Narrow your search</h4>';
	show_hide_menu();
}


// ===========================================================


var i=30
var c=0
var intHide
var speed=10
function show_hide_menu()
{
if (c==0)
	{
	c=1
	clearInterval(intHide)
	intShow=setInterval("show()",10)
	}
else
	{
	c=0
	clearInterval(intShow)
	intHide=setInterval("hide()",10)
	}
}


// Cool sliding animation  //

function show(){
	if (i<120){
		i=i+speed
        var newheight = i+'px';
		document.getElementById('combobox').style.height=newheight;
	}else{
		document.getElementById('combobox').style.height='360px';
	}
}
function hide(){
	if (i>30){
		i=i-speed;
		var newheight = i+'px';
		document.getElementById('combobox').style.height=newheight;
	}
}



// This is the Ajax XMLHttpRequest Connection //





function combo_request(passstr) {
	createXMLHttpRequest();
	var postedurl = "../plants/search_bar_combo.php?combotype=narrow&"+passstr;
	//alert(postedurl);
	xmlHttp.onreadystatechange = combo_change;
    xmlHttp.open("GET", postedurl, true);
    xmlHttp.send(null);
}
    
function combo_change() {
    if(xmlHttp.readyState == 4) {
        if(xmlHttp.status == 200) {
            document.getElementById("combobox").innerHTML = xmlHttp.responseText;
        }
    }
}

	



