	//global vars
	var current = 0;
	var maxLength = 0;
	var objMantleWidth = 0;
	var objMantleImage = new Object();
	var objMantleNext = new Object();
	var objMantlePrev = new Object();
	var myTimer;

	jQuery(document).ready(function() {

		//this is a prototype 
		maxLength = jQuery('div#mantle-slider div.mantle-item').length;
		objMantleWidth = jQuery('div#mantle-slider').width();
		objMantleImage = jQuery("div#mantle-images");
		objMantleNext = jQuery('.mantle-nav-right');
		objMantlePrev = jQuery('.mantle-nav-left');
		var objMantleBack = jQuery('div#mantle-nav-text-back');
		var objMantleNav = jQuery('div#mantle-nav li');
		
		objMantleBack.fadeTo(0, 0.9);

		//get the first data
		textChange(current);

		objMantleNav.click(function(){
			current = objMantleNav.index(this);
			textChange(current);
			window.clearInterval(myTimer); 
			mantleSwitch();
		});
		
		objMantleNext.click(function(){
			if(current != (maxLength - 1)){
				textChange(++current);
				window.clearInterval(myTimer); 
				mantleSwitch();
			} 
		});

		objMantlePrev.click(function(){
			if(current != 0){
				textChange(--current);
				window.clearInterval(myTimer); 
				mantleSwitch();
			} 
		});
		
		mantleSwitch = function(){
			myTimer = setInterval(function(){
				current++;
				if(current > (maxLength -1)){
					current = 0;
				}
				textChange(current);
			},8000);
		}
		
		mantleSwitch();
		
	});

	function textChange(index){

		var objMantleURL = jQuery('div#mantle-images span.temp-mantle-link:eq('+ index +')');
		var objMantleTitle = jQuery('div#mantle-images span.temp-mantle-title:eq('+ index +')');
		var objMantleSubTitle = jQuery('div#mantle-images span.temp-mantle-subtitle:eq('+ index +')');
		var objMantleDate = jQuery('div#mantle-images span.temp-mantle-date:eq('+ index +')');
		var objMantlePhotoby = jQuery('div#mantle-images span.temp-mantle-photoby:eq('+ index +')');
		var objMantleNavList = jQuery('div#mantle-nav li');
		
		var objActiveURL = jQuery("h1.mantle-title a:eq(0)");
		var objActiveDate = jQuery("h3.mantle-date:eq(0)");
		var objActiveSubTitle = jQuery("h3.mantle-subtitle:eq(0)");
		var objActivePhotoby = jQuery("div.mantle-photoby span:eq(0)");

		objActiveURL.attr('href', objMantleURL.html());
		
		objActiveURL.html(objMantleTitle.html());
		
		objActiveDate.html(objMantleDate.html());
		
		objActiveSubTitle.html(objMantleSubTitle.html());
		
		objActivePhotoby.html(objMantlePhotoby.html());
		
		objMantleNavList.fadeTo(0, 0.5);
		objMantleNavList.eq(index).fadeTo(0, 1);
		
		objMantleImage.animate({left:-objMantleWidth * index});
		
		if(index == (maxLength - 1)){
			objMantleNext.fadeTo(0, 0.5);
			objMantlePrev.fadeTo(0, 1);
		} else if(index == 0){
			objMantlePrev.fadeTo(0, 0.5);
			objMantleNext.fadeTo(0, 1);
		} else {
			objMantleNext.fadeTo(0, 1);
			objMantlePrev.fadeTo(0, 1);
		}
		
		return index;
	}
