/* don't edit below this*/

function nextShowcase() {

	//reset timer
	clearTimeout(mTimer)


	//disable prev and next functions
	$("#buttonPrev")[0].onclick = function() {
	
	}
	$("#buttonNext")[0].onclick = function() {
	
	}
	
	$("#pic")[0].href = "";
	
	//fadeout and fade back in caption text
	
	$("#captionn").hide("drop", {}, transitionSpeed, function(){
		
		$("#captionn")[0].innerHTML = $("div.cap:eq("+current+")")[0].innerHTML;
		
		$("#captionn").show("drop", {}, transitionSpeed);
	});
	
	//remove shadow
	//$("div#showcaseImage").removeShadow();
	
	
	//fadeout and fade back in showcase pic
	
	$("#pic").hide("slide", {direction:"up"}, transitionSpeed, function(){
	
		$("#pic").empty();
	
		newImg = document.createElement("img");
		newImg.src = $("img.simg:eq("+current+")")[0].src;
		newImg.alt = "Showcase image";
		newImg.className = "reflect";
		newImg.id = "pp";
		
		$("#pic")[0].appendChild(newImg);
				
		$("#pic").show("slide", {direction:"down"}, transitionSpeed, function(){
		
			$("#pp").reflect({height:reflectionHeight, opacity:reflectionOpacity});
						
			$("#buttonPrev")[0].onclick = function() {
				previousShowcase(); return false;
			}
			$("#buttonNext")[0].onclick = function() {
				nextShowcase(); return false;
			}
			
			$("#pic")[0].href = $("a.slink:eq("+current+")")[0].href;
			
			mTimer = setTimeout("nextShowcase()",lapseTime);
		})
	});
   	
   	
   	if(current == $("div.showcase").length-1) {
   		current = 0;
   	} else {
   		current++;
   	}
	
	
}

function previousShowcase() {

	clearTimeout(mTimer)

	$("#buttonPrev")[0].onclick = function() {
	
	}
	$("#buttonNext")[0].onclick = function() {
	
	}
	
	//$("#showcaseLink")[0].href = "";
	
	if(current == 0) {
   		current = $("div.showcase").length-1;
   	} else {
   		current--;
   	}
   	
   	$("#captionn").hide("drop", {}, transitionSpeed, function(){
		
		$("#captionn")[0].innerHTML = $("div.cap:eq("+current+")")[0].innerHTML;
		
		$("#captionn").show("drop", {}, transitionSpeed);
	});	
	
	$("#pic").hide("slide", {direction:"down"}, transitionSpeed, function(){
	
		$("#pic").empty();
	
		newImg = document.createElement("img");
		newImg.src = $("img.simg:eq("+current+")")[0].src;
		newImg.alt = "Showcase image";
		newImg.id = "pp";
		
		$("#pic")[0].appendChild(newImg);
				
		$("#pic").show("slide", {direction:"up"}, transitionSpeed, function(){
			
			$("#pp").reflect({height:reflectionHeight, opacity:reflectionOpacity});
			
			$("#buttonPrev")[0].onclick = function() {
				previousShowcase(); return false;
			}
			$("#buttonNext")[0].onclick = function() {
				nextShowcase(); return false;
			}
			
			$("#pic")[0].href = $("a.slink:eq("+current+")")[0].href;
			
			mTimer = setTimeout("nextShowcase()",lapseTime);
		})
	});
}