/* 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#slides > div:eq("+current+") > div:first")[0].innerHTML;
		
		//$("#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();
		
		if($("div#slides > div:eq("+current+") > img:first").length > 0) {
			
			newImg = document.createElement("img");
			newImg.src = $("div#slides > div:eq("+current+") > img:first")[0].src;
			//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;
				}
			
				if($("div#slides > div:eq("+current+") a:first").length > 0) {
					$("#pic")[0].href = $("div#slides > div:eq("+current+") a:first")[0].href;
				}
			
				//$("#pic")[0].href = $("a.slink:eq("+current+")")[0].href;
			
				mTimer = setTimeout("nextShowcase()",lapseTime);
			});
			
		} else {
			
			$("#buttonPrev")[0].onclick = function() {
				previousShowcase(); return false;
			}
			$("#buttonNext")[0].onclick = function() {
				nextShowcase(); return false;
			}
			mTimer = setTimeout("nextShowcase()",lapseTime);
			
		}
	});
   	
   	
   	if(current == $("div#slides > div").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#slides > div").length-1;
   	} else {
   		current--;
   	}
   	
   	$("#captionn").hide("drop", {}, transitionSpeed, function(){
		
		$("#captionn")[0].innerHTML = $("div#slides > div:eq("+current+") > div:first")[0].innerHTML;
		
		//$("#captionn")[0].innerHTML = $("div.cap:eq("+current+")")[0].innerHTML;
		
		$("#captionn").show("drop", {}, transitionSpeed);
	});	
	
	$("#pic").hide("slide", {direction:"down"}, transitionSpeed, function(){
	
		$("#pic").empty();
		
		if($("div#slides > div:eq("+current+") > img:first").length > 0) {
	
			newImg = document.createElement("img");
			newImg.src = $("div#slides > div:eq("+current+") > img:first")[0].src;
			//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;
				}
			
				if($("div#slides > div:eq("+current+") a:first").length > 0) {
					$("#pic")[0].href = $("div#slides > div:eq("+current+") a:first")[0].href;
				}
			
				//$("#pic")[0].href = $("a.slink:eq("+current+")")[0].href;
			
				mTimer = setTimeout("nextShowcase()",lapseTime);
			})
		
		} else {
			
			$("#buttonPrev")[0].onclick = function() {
				previousShowcase(); return false;
			}
			$("#buttonNext")[0].onclick = function() {
				nextShowcase(); return false;
			}
			mTimer = setTimeout("nextShowcase()",lapseTime);
			
		}
	});
}
