var overlay = null;

function displayOverlay(overlayId){
	overlay = new Overlay({width: 620, height: 660, addClass: "imageOverlay"});
	overlay.setContentHolderId(overlayId);
	overlay.display();
}

function hideOverlay(){
	overlay.hide();
}

function boundHide(switcherId, hidableIds, hideSwitcher, threshold){
	if(hideSwitcher != false){
		hideSwitcher = true;
	}
	
	if(threshold == null || threshold == 'undefined'){
		threshold = 3;
	}
	
	var switcher = document.getElementById(switcherId);
	var displayMode = "none";
	
	if(switcher.innerHTML.length > threshold){
		displayMode = "block";
	}
	
	switcher.style.display = displayMode;
		
	for(var i = 0; i < hidableIds.length; i++){
		document.getElementById(hidableIds[i]).style.display = displayMode;
	}
}

sfHover = function() {
	if(document.getElementById("searchResults")){
		var sfEls = document.getElementById("searchResults").getElementsByTagName("div");
		for (var i=0; i<sfEls.length; i++) {
			sfEls[i].onmouseover=function() {
				this.className+=" sfhover";
			}
			sfEls[i].onmouseout=function() {
				this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
			}
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);
