// JavaScript Document
function passSearch() {
	var mySearch = document.getElementById('zoom_query').value;	
	location.href='exodus.htm?search&sitesearch&' + mySearch;
}

function passReturnSearch() {
	if(event.keyCode == 13){	
	var mySearch = document.getElementById('zoom_query').value;
	location.href='exodus.htm?search&sitesearch&' + mySearch;	
	}
}

function passMediaRoomSearch() {	
	location.href='exodus.htm?search&Press release';
}

function passedSearch(){
	
	//Calls the search PHP when the user has entered search data on the exodus_frontpage.htm
	searchString = location.search.slice(1);
		searchString = unescape(searchString);
		//Converts + signs to a space
		formString = searchString.replace(/\+/g, " ");
		//Converts / to an &
		formString = formString.replace(/\//g, "&");
		data = formString.split(/[&=]/g);
		
		var myselection = data[0];
		var subselection = data[1];
		var searchItem = data[2];
		
		switch (myselection + '_' + subselection) {
			case "search_Press release": mediaRoomSearch(); break;
			case "search_latest_news": archiveSearch(); break;
			case "search_sitesearch": siteSearch(); break;
			default: null;
			}
}

function mediaRoomSearch(){	
	document.mySearch.zoom_query.value = 'Press release';
	//Set results to sort by date
	document.mySearch.zoom_sort.value = '1';
	document.mySearch.action = '../search/search.php';	
	document.mySearch.submit();
	document.mySearch.zoom_query.value = 'Search here';	
}

function archiveSearch(){
	document.mySearch.zoom_query.value = 'News item:';
	//Set results to sort by date
	document.mySearch.zoom_sort.value = '1';
	document.mySearch.action = '../search/search.php';
	document.mySearch.submit();
	document.mySearch.zoom_query.value = 'Search here';
}

function siteSearch(){
	searchString = location.search.slice(1);
	searchString = unescape(searchString);
	//Converts + signs to a space
	formString = searchString.replace(/\+/g, " ");
	//Converts / to an &
	formString = formString.replace(/\//g, "&");
	data = formString.split(/[&=]/g);
	
	var searchItem = data[2];
	document.mySearch.action = '../search/search.php';
	document.mySearch.zoom_query.value = searchItem; 
	document.mySearch.submit();		
}