// LITK Slideshow - by Edmond Belliveau <edmond.belliveau@gmail.com>

	var child=0; 		//this needs to stay - it's what defines which slide of the 3 custom slides the page will load first
	var childmax = 2; 	//this defines the maximum number of slides existent on a page ([2] = {0,1,2} = |3|)
	var menus = 5; 		//this defines the number of side menus 

	var interval = 0;			//don't touch these 
	var intervalPause = 0;  	//


	 
	//Add the definitions for mouseover and mouseout for each of your items you wish to display on the side.
	//Each should have a definition in the litk-slideshow.css file.


	
	
	
//Pretty much everything below here is hands-off. 


	function callback(id, directCall) {
		if(directCall == true) {
			//fade everything else out
			for(var i=0; i<=5;i++) {
				if(i != id) {
					$("#sschild"+i).fadeOut("fast");
				}
			}
			for(var i=0; i<=2; i++) {
				if(i != child) {
					$("#custom"+i).fadeOut("fast");
				}
			}
			//pause for a sec
			window.clearInterval(interval);
			window.clearInterval(intervalPause);
			interval = setInterval("", 1337);
			
			//display the requested id
			$("#sschild"+id).fadeIn("slow");
			return true;
		}else {
			//fade everything else out
			for(var i=0; i<=5;i++) {
				$("#sschild"+i).fadeOut("fast");
			}
			for(var i=0; i<=2; i++) {
				$("#custom"+i).fadeOut("fast");
			}
			//pause for a sec
			window.clearInterval(interval);
			window.clearInterval(intervalPause);
			intervalPause = setInterval("", 1337);
			
			//display the next item
			
			$("#custom"+child).fadeIn("slow");
			
			//increment the child id
			
			if(child == childmax) {
				child=0;
			}else {
				child+=1;
			}
			interval = setInterval("callback(" + child + ", false)", 3000);
			return true;
		}
	}
	
	$(document).ready(function(){
		$("#item0").mouseover(function() {
			callback(0, true);
		});
		
		$("#item0").mouseout(function() {
			interval = setInterval("callback(" + child + ", false)", 3000);
		});
		
		$("#item1").mouseover(function() {
			callback(1, true);
		});
		$("#item1").mouseout(function() {
			interval = setInterval("callback(" + child + ", false)", 3000);
		});
		
		$("#item2").mouseover(function() {
			callback(2, true);
		});
		$("#item2").mouseout(function() {
			interval = setInterval("callback(" + child + ", false)", 3000);
		});
		
		$("#item3").mouseover(function() {
			callback(3, true);
		});
		$("#item3").mouseout(function() {
			interval = setInterval("callback(" + child + ", false)", 3000);
		});
		
		$("#item4").mouseover(function() {
			callback(4, true);
		});
		$("#item4").mouseout(function() {
			interval = setInterval("callback(" + child + ", false)", 3000);
		});
		
		$("#last").mouseover(function() {
			callback(5, true);
		});
		$("#last").mouseout(function() {
			interval = setInterval("callback(" + child + ", false)", 3000);
		});
	});

