var lastSectionWasMultiple;

function showLayer( layerId, changeBkgd, multipleImages, noAltTag){
	
	if( layerId == currentLayerId )
		return false
	var newLayer = document.getElementById(layerId);
	newLayer.style.display='inline';
	
	var currentLayer = document.getElementById( currentLayerId );
	currentLayer.style.display='none';
	currentLayerId = layerId;
	
	if(lastSectionWasMultiple == true){
		//Removes thumbnails
		var d = document.getElementById('mainContent');
		var olddiv = document.getElementById('uiWrapper');
  		d.removeChild(olddiv);
		
		lastSectionWasMultiple = false;
	}
	// replaces 
	//alert($(".dummyBevelTop").css('background-image'));
	$(".dummyBevelTop").css({'background-image':'url("../img/static/gradient_top.png")'});
	//changes bkgd image
	if(changeBkgd == null || changeBkgd == true){
		$('.section').css({'background-image': "none"});
	}
	if(changeBkgd == false){
		//alert("doingNothing");
	}
	// end of bkgd image change
	
	// GALLERY
	if(multipleImages == true){
		lastSectionWasMultiple = true;
		// this is for the case in the photography section when we don't want the altTag typo to appear
		if(noAltTag == true){
			$(".dummyBevelTop").css({'background-image':'none'});
			$("div#"+layerId).slideViewerPro({ 
				whichLayerId: layerId,
				galBorderWidth: 0,
				thumbsBorderWidth: 1,
				thumbsBorderColor: "#444", // the border color of the thumbnails but not the current one 
				thumbsActiveBorderColor: "#ff0000", // the border color of the current thumbnail 
				thumbs: 10, // the number of visible thumbnails 
				easeTime: 500, // the time it takes a slide to move to its position 
				//asTimer: 8000, // if autoslide is true, this is the interval between each slide 
				//autoslide: true,
				thumbsPercentReduction: 8, // the percentual reduction of the thumbnails in relation to the original 
				//thumbsVis: true, // with this option set to false, the whole UI (thumbs and buttons) are not visible 
			});	
		}
		else{	
			$("div#"+layerId).slideViewerPro({ 
				whichLayerId: layerId,
				galBorderWidth: 0,
				thumbsBorderWidth: 1,
				thumbsBorderColor: "#444", // the border color of the thumbnails but not the current one 
				thumbsActiveBorderColor: "#ff0000", // the border color of the current thumbnail 
				thumbs: 5, // the number of visible thumbnails 
				easeTime: 500, // the time it takes a slide to move to its position 
				//asTimer: 8000, // if autoslide is true, this is the interval between each slide 
				//autoslide: true,
				typo: true,
				typoFullOpacity: .8, // the opacity for typographic info. 1 means fully visible. 
				
				thumbsPercentReduction: 8, // the percentual reduction of the thumbnails in relation to the original 
				thumbsVis: true, // with this option set to false, the whole UI (thumbs and buttons) are not visible 
				
			});
		}
		$("a[title=Get Adobe Flash player]").find('img').attr("src", "img/static/Flash_icon.jpg");
	}
	
	/*
	// slideViewerPro options (defaults) 
	galBorderWidth: 6,  // the border width around the main images 
	thumbsTopMargin: 3, // the distance that separates the thumbnails and the buttons from the main images 
	thumbsRightMargin: 3, // the distance of each thumnail respect to the next one 
	thumbsBorderWidth: 3, // the border width of each thumbnail. Note that the border in reality is above, not around 
	buttonsWidth: 20, // the width of the prev/next buttons that commands the thumbnails 
	galBorderColor: "#ff0000", // the border color around the main images 
	thumbsBorderColor: "#d8d8d8", // the border color of the thumbnails but not the current one 
	thumbsActiveBorderColor: "#ff0000", // the border color of the current thumbnail 
	buttonsTextColor: "#ff0000", //the color of the optional text in leftButtonInner/rightButtonInner 
	thumbsBorderOpacity: 1.0, // could be 0, 0.1 up to 1.0 
	thumbsActiveBorderOpacity: 1.0, // could be 0, 0.1 up to 1.0 
	easeTime: 750, // the time it takes a slide to move to its position 
	asTimer: 4000, // if autoslide is true, this is the interval between each slide 
	thumbs: 5, // the number of visible thumbnails 
	thumbsPercentReduction: 12, // the percentual reduction of the thumbnails in relation to the original 
	thumbsVis: true, // with this option set to false, the whole UI (thumbs and buttons) are not visible 
	leftButtonInner: "-", //could be an image "<img src='images/larw.gif' />" or an escaped char as "&larr"; 
	rightButtonInner: "+", //could be an image or an escaped char as "&rarr"; 
	autoslide: false, // by default the slider do not slides automatically. When set to true REQUIRES the jquery.timers plugin 
	typo: false, // the typographic info of each slide. When set to true, the ALT tag content is displayed 
	typoFullOpacity: 0.9, // the opacity for typographic info. 1 means fully visible. 
	shuffle: false // the LI items can be shuffled (randomly mixed) when shuffle is true 
	*/
	
	//END GALLERY
	
	return false;
}// JavaScript Document
