// display/hide search pane
var showSearch = function(sp,arrow){					
		var spid = "sp_"+sp;
		var sbid = "bt_"+sp;
		var sbdid = "btDis_"+sp;
		var said = "arrow_"+sp;
		var sadid = "arrowDis_"+sp;
		var e = document.getElementById(spid);
		
		e.style.zIndex = '5001';

		for(var spn = 0; spn < splist.length; spn++){ // loop through each anim menu
			var filterId = "sp_"+splist[spn]; // construct this menu id
			var thisList = document.getElementById(filterId); // get this menu object
			if(thisList){
				if(splist[spn]!=sp && thisList.style.display=="block"){ // if this menu object is open and visible...
					var arrow = (splist[spn]!="zoomto"?true:false);
					if(browserIE()){
						thisList.style.display="none";
						hideSearch(splist[spn],arrow);
					}else{
						var SPName = splist[spn];
						$("#"+filterId).animate({ height: 'hide', opacity: 'hide' }, 125, function(){hideSearch(SPName,arrow);});
					}
				}
			}
		}
		if(browserIE()){e.style.display="block";setMenuHeight(spid);}
		else{
				var newSPHeight = $("#"+spid).attr("scrollHeight")+"px";
				$("#"+spid).animate({ height: 'show', opacity: 'show' }, 200, function(){setMenuHeight(spid);});
			/*var thisList_In = new FadeSlide(spid, {from: "0px", to: e.scrollHeight + "px", finish: function(){thisList_In = null;}});
			thisList_In.start();*/
		}
		document.getElementById(sbid).style.display="none";
		document.getElementById(sbdid).style.display="block";
		if(arrow){
			document.getElementById(said).style.display="none";
			document.getElementById(sadid).style.display="block";
		}
		
		 
}
// Determine height of open filter menu and add scrollbar if necessary
var setMenuHeight = function(spid){
	//var optionListHeight = $('#'+spid+'_options').innerHeight();
	var optionListHeight = 0;
	$('#'+spid+'_options div.option').each(function(n){
		optionListHeight += $(this).innerHeight();												
	});
	var padding = parseInt($('#'+spid+'_options').css("padding-top")) + parseInt($('#'+spid+'_options').css("padding-bottom"));
	if(optionListHeight>500){
		$('#'+spid+'_options').animate({ height: '500px' }, 200);
		
	}else{
		$('#'+spid+'_options').animate({ height:optionListHeight+padding+"px"}, 200);
	}	
}
// sp = search pane token name
// arrow = sp list has a secondary image trigger (arrow) - true/false
var hideSearch = function(sp,arrow){
	var spid = "sp_"+sp;
	var e = document.getElementById(spid);
	//e.style.zIndex='0';
	//e.style.display="none";
	var sbid = "bt_"+sp;
	var sbdid = "btDis_"+sp;
	document.getElementById(sbid).style.display="block";
	document.getElementById(sbdid).style.display="none";
	if(arrow){
		var said = "arrow_"+sp;
		var sadid = "arrowDis_"+sp;
		document.getElementById(said).style.display="block";
		document.getElementById(sadid).style.display="none";
	}
}


