/*

	# -------------------------------------------------------------------------------------------- #
	#																			#
	# SlideShow.class.js															#
	#																			#
	# MySpinalCord.com																#
	# Copyright 2011 Thommy Morgan													#
	# All Rights Reserved															#
	#																			#
	# -------------------------------------------------------------------------------------------- #
	
		
*/


DC.Layer.prototype.clip = function(left, top, width, height) {
	this.obj.style.position = "absolute";
	var clipstring = "rect(" + top + "px, " + width + "px, " + height + "px, " + left + "px)";
	this.obj.style.clip = clipstring;
}


enumerate([
	"ClipAnimationSlideInFromLeft",
	"ClipAnimationSlideInFromRight",
	"ClipAnimationSlideInFromTop",
	"ClipAnimationSlideInFromBottom", 
	"ClipAnimationSlideOutToLeft",
	"ClipAnimationSlideOutToRight",
	"ClipAnimationSlideOutToTop",
	"ClipAnimationSlideOutToBottom",
	"ClipAnimationWipeInFromLeft",
	"ClipAnimationWipeInFromRight",
	"ClipAnimationWipeInFromTop",
	"ClipAnimationWipeInFromBottom",
	"ClipAnimationWipeOutFromLeft",
	"ClipAnimationWipeOutFromRight",
	"ClipAnimationWipeOutFromTop",
	"ClipAnimationWipeOutFromBottom",
	"ClipAnimationFadeOut",
	"ClipAnimationFadeIn",
]);


// Clip a layer object;
DC.Layer.prototype.animateClipAction = function(action, t) {
	
	this.makeRelative();
	
	var animationInterval = null;
	
	if(!action) action = ClipAnimationSlideInFromLeft;
	
	var tl	= 0;
	var fl	= 0;
	var tt 	= 0;
	var ft	= 0;
	var tw	= 0;
	var fw	= 0
	var th 	= 0;
	var fh	= 0;
	
}


/*
# ----------------------------------------------------------------------------- #
# SlideShow class constructor											#
# ----------------------------------------------------------------------------- #*/


DC.Layer.SlideShow = function() {
	
	this.timeBetweenSlides = 5000; // 5 seconds between slides
	
	
}


DC.Layer.SlideShow.animate = function(slideshow_container) {

	slides = $(slideshow_container).children;
	
	var slide = 0;
	var max_slides = slides.length;
	
	animate_slide = function() {
		
		old_slide = new DC.Layer(slides[slide]);
		new_slide = new DC.Layer(slides[((slide < max_slides-1) ? slide + 1 : 0)]);
		
		new_slide.moveTo(new_slide.getWidth(), 0);
		
		old_slide.floatTo(-old_slide.getWidth(), 0, 60);
		old_slide.fade();
		new_slide.floatTo(0, 0, 60);
		new_slide.fadeIn();
			
		slide = (slide < max_slides-1) ? slide + 1 : 0;
		
	}
	
	setInterval(animate_slide, 5000);
	
}
