//----------------------------------------------
// Functions for gray search box dropdown
//----------------------------------------------

// Toggle list of links for gray search box 
function toggle_more(){

	var more_list = document.getElementById('hidden_list');
	
	if (more_list.style.display == "" || more_list.style.display == "none"){
		more_list.style.display = "block";
	}
	else {
		more_list.style.display = "none";
	}
	
}

// close all dropdown lists if user clicks anywhere outside of dropdown
document.onclick = function(event){
	if (!event) var event = window.event;
	
	// check which element was clicked
	obj = event.target || event.srcElement;
	
	if (obj.addEventListener){
		// for mozilla and safari browsers
		obj.addEventListener("click", hide_more(obj), false);
	}
	/*
	else if (document.attachEvent){
		// for internet explorer
		document.attachEvent("onclick", hide_more_ie);
	}
	*/
}

// loop through all lists within hidden_lists array and close them (for FF/Safari)
function hide_more(obj){

	if (obj.className != "show_more"){
		if (document.getElementById('hidden_list').style.display == "block"){
			document.getElementById('hidden_list').style.display = "none";
		}
	}
}

// loop through all lists within hidden_lists array and close them (for IE)
/*
function hide_more_ie(event){
	if (!event) var event = window.event;
	
	// check which element was clicked
	obj = event.target || event.srcElement;

	if (obj.className != "show_more"){
		for (var i=0; i<hidden_lists.length; i++){
			if (document.getElementById(hidden_lists[i]).style.display == "block"){
				document.getElementById(hidden_lists[i]).style.display = "none";
			}
		}
	}
}
*/


// this is so that IE can use indexOf for arrays.
// access by calling "theArray.indexOf(value);"
if(!Array.indexOf){
	Array.prototype.indexOf = function(obj){
		for(var i=0; i<this.length; i++){
			if(this[i]==obj){
				return i;
			}
		}
		return -1;
	}
}


//----------------------------------------------
// Functions for gray search box dropdown (end)
//----------------------------------------------