//------------------------------------------------------------------------------------------------------------------//
//	TOGGLE LAYER
//	Original Author: Wilbert N. Ng (wilbertng@gmail.com)
// 
//	Last Modification Date: 01/26/2010
//	Last Modified By: Wilbert N. Ng (wilbertng@gmail.com)
//
//	Description: 
//		Toggles the visibility of an area of the page.  Compares value of currently selected field to a given value for hiding layer.
//
//	Usage: 
//		- You can use the ff. code for the toggle link: 
//			<a href="javascript:toggleLayer(this.value, 'passed_value', 'exp_menu_image_gallery');" title="Toggle Gallery">Toggle Gallery</a>
//
//		- You can use the ff. code to mark the starting and ending areas that can be hidden
//			<div id="exp_menu_image_gallery">
//			Place your codes here to contain layout that can be hidden etc.
//			</div>
//
//		- You can use the ff. code for the CSS Style after javascript
//			<style>div#exp_menu_image_gallery { display: none; }</style>
//------------------------------------------------------------------------------------------------------------------//


function toggleLayer(field, passedvalue, whichLayer)
{	

	if (field == passedvalue) {

		if (document.getElementById)
		{
			// this is the way the standards work
			var style2 = document.getElementById(whichLayer).style;
			//style2.display = style2.display? "":"block";
			style2.display = "block";			
		}
		else if (document.all)
		{
			// this is the way old msie versions work
			var style2 = document.all[whichLayer].style;
			//style2.display = style2.display? "":"block";
			style2.display = "block";			
		}
		else if (document.layers)
		{
			// this is the way nn4 works
			var style2 = document.layers[whichLayer].style;
			//style2.display = style2.display? "":"block";
			style2.display = "block";			
		}
	
	} else {
		
		if (document.getElementById)
		{
			// this is the way the standards work
			var style2 = document.getElementById(whichLayer).style;
			style2.display = "";
		}
		else if (document.all)
		{
			// this is the way old msie versions work
			var style2 = document.all[whichLayer].style;
			style2.display = "";
		}
		else if (document.layers)
		{
			// this is the way nn4 works
			var style2 = document.layers[whichLayer].style;
			style2.display = "";
		}		
		
	}
	
}