/*--------------Copyright 2011 Casey Govero Design 
Feel free to use this plugin, but do not remove this header.

Contact me:
http://caseygovero.com

----------------------*/

jQuery(function(){
				
//LoadWIndow();

//TIMER > IF DESIRED UNCOMMENT	------------------------------------------------------------------------------------------
StartTimer()
var TimerOn = true;
var int;

InitHide();

var counter=0;


function StartTimer(){
	
	int=self.setInterval(NextPicture, 4000);
	TimerOn = true;
	
	
}

function StopTimer(){
		
	TimerOn = false;
		
	window.clearInterval(int);
		
}

function InitHide(){
	//jQuery('#slider img').hide();		
	//Hide posts over 4		  
	
	jQuery('#slider img:gt(0)').hide();	
	jQuery('#slider .Caption:gt(0)').hide();	
		jQuery('#slider .Caption').css("left", "300px");

//jQuery('#slider .Caption').animate({marginLeft:"+=50px"}, 1500 );				
			
	}

/*jQuery('.ContentPost img').click(function() { 
											 
	var grabbedimg = jQuery(this).attr('src').toString(); 
	var CharLength = grabbedimg.length - 10;
	//alert(grabbedimg);

	var grabbedimgsplit = grabbedimg.slice(0,CharLength)
//jQuery('#LargeWindow img').fadeOut();
jQuery('#LargeWindow img').attr("src", grabbedimgsplit+".jpg").fadeIn('fast');;
		//jQuery('#LargeWindow img').attr("src", grabbedimg);
										 
});//End Click Function*/

	
function NextPicture(){

counter = counter+1;

var countersubtractone = counter-1;

jQuery('#slider img:eq('+counter+')').fadeIn();	
jQuery('#slider img:eq('+countersubtractone+')').fadeOut();	

jQuery('#slider .Caption:eq('+counter+')').show();	
jQuery('#slider .Caption:eq('+countersubtractone+')').hide();	
	
	
var slidetitle = jQuery('#slider img:eq('+counter+')').attr('title');

//alert(slidetitle);

if(counter==4){
	
	counter=0;
	jQuery('#slider img:eq(0)').show();
	jQuery('#slider .Caption:eq(0)').show();
	jQuery('#slider .Caption').css("left", "300px");
	jQuery('#slider .Caption').css("top", "60px");

};

if(counter==1){
jQuery('#slider .Caption').css("left", "100px");

}
if(counter==2){
jQuery('#slider .Caption').css("left", "320px");
jQuery('#slider .Caption').css("top", "20px");

}


}


});//End Doc Ready
