// JavaScript Document
var xmlHttp; // global AJAX Object
var selectId; // global select id




function plantSearch(formObj)
{
	formObj.action = "plantsearch.php";
}



/*
* Name: GetXmlHttpObject
*
* Purpose: create the xmlHttpRequest object
*/
/*function GetXmlHttpObject()
{
	xmlHttp=null;
	try
	{
	  // Firefox, Opera 8.0+, Safari
	  xmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{
		// Internet Explorer
		try
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	return xmlHttp;
}*/



/*
* Name: stateChanged
*
* Purpose: actions to execute when state of xmlHttpRequest changes
*/
/*function stateChanged() 
{
	if(xmlHttp.readyState == 4) // state 4 = finished
	{
		if(xmlHttp.responseText.match("Error") != null) // error inserting values
		{
			alert(xmlHttp.responseText);
		}
		else
		{
			document.getElementById(selectId).innerHTML = xmlHttp.responseText;
			document.getElementById(selectId).focus();
		}
	}
}*/



/*function updateFamList(xmlHttp,groupId)
{
	selectId = "family";
	var url = "get_tabledata.php";
	url += "?t=families&o=family_name&wf=plant_group&wv="+groupId;
	
	alert(url);
	//url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange = stateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}*/



/*function updateGenusList(xmlHttp,groupId)
{
	selectId = "genus";
	var url = "get_tabledata.php";
	url += "?t=genera&o=genus_name&wf=plant_group&wv="+groupId;
	
	//alert(url);
	//url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange = stateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);	
}
*/

/*function updateSpeciesList(xmlHttp,groupId)
{
	selectId = "species";
	var url = "get_tabledata.php";
	url += "?t=species&o=species_name&wf=plant_group&wv="+groupId;
	
	//alert(url);
	//url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange = stateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);	
}*/


/*function updateRepstateList(xmlHttp,groupId)
{
	selectId = "repstate";
	var url = "get_tabledata.php";
	url += "?t=repstates&o=repstate_name&wf=plant_group&wv="+groupId;
	
	alert(url);
	//url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange = stateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);	
}*/



/*
*	Name: updatePlantGroup()
*
*	Purpose: updates the choices for genera, species and reproductive state depending on the plant group chosen
*
*	Paramaters: 
*/
/*function updateLists(groupId)
{
	var xmlHttp = GetXmlHttpObject();
	
	if (xmlHttp == null) // couldnt get an xmlHttp object
	{
	  alert("Your browser does not support AJAX!");
	  return;
	}
	updateRepstateList(xmlHttp,groupId);
	updateFamList(xmlHttp,groupId);
	updateGenusList(xmlHttp,groupId);
	updateSpeciesList(xmlHttp,groupId);
}*/



