// Flash Sidebar scripts
// Used  to show/hide various div objects
// Requires variable showItem (the id of the div you wish to display)


// display pop-out box, add 'show' CSS styling to popout box 
function openFlashBox(caseStudy) {
	document.getElementById("sidebarFlashboxPopout").className = "show";
	initImage(caseStudy);
}


// hide pop-out box, add 'hide' CSS styling to popout box 
function closeFlashBox() {
	document.getElementById("sidebarFlashboxPopout").className = "hide";
}


// fade-in functionality
function initImage(caseStudy) {
	imageId = 'popoutPhoto';
	image = document.getElementById(imageId);
	image.src= caseStudy;
	setOpacity(image, 0);
	image.style.visibility = 'visible';
	fadeIn(imageId,0);		
}

// fade-in browser constraiints
function setOpacity(obj, opacity) {
	opacity = (opacity == 100)?99.999:opacity;
	  
	// IE/Win
	obj.style.filter = "alpha(opacity:"+opacity+")";
	  
	// Safari<1.2, Konqueror
	obj.style.KHTMLOpacity = opacity/100;
	  
	// Older Mozilla and Firefox
	obj.style.MozOpacity = opacity/100;
	  
	// Safari 1.2, newer Firefox and Mozilla, CSS3
	obj.style.opacity = opacity/100;
}

// fade-in opacity speed
function fadeIn(objId,opacity) {
	if (document.getElementById) {
		obj = document.getElementById(objId);
		if (opacity <= 100) {
			setOpacity(obj, opacity);
			opacity += 20;
			window.setTimeout("fadeIn('"+objId+"',"+opacity+")", 100);
		}
	}
}