function dropDownListChanger(element)
{
	var values = "";
	if (document.getElementById){

		var dropdownIndex = document.getElementById(element).selectedIndex;
		var dropdownValue = document.getElementById(element)[dropdownIndex].value;
		var dropdownText = document.getElementById(element)[dropdownIndex].text;		
		document.getElementById('resources').innerHTML = "";
		values = dropdownValue;

		dropDownListQueryTheme(dropdownValue);

	}
}


function dropDownListQueryTheme(theme) {
    //make a connection to the server ... specifying that you intend to make a GET request 
    //to the server. Specifiy the page name and the URL parameters to send
    http.open('get', 'http://erc.epa.ie/safer/ajax_getResourcesByTheme.jsp?theme='+theme);
	
    //assign a handler for the response
    http.onreadystatechange = processDropDownListQueryTheme;
	
    //actually send the request to the server
    http.send(null);
}

function processDropDownListQueryTheme() {
    //check if the response has been received from the server
    if(http.readyState == 4){
	
        //read and assign the response from the server
        var response = http.responseText;
		
	if (response != null)
	{
		var currentText = document.getElementById('resources').text;
		document.getElementById('resources').innerHTML = response;
	}	

    }
}

