jQuery(document).ready(function() {
//Slider Function
	function rotatePic(){
		
		// Set New Active
		jQuery("#pic_cont .previous").addClass('deactive');
		jQuery("#pic_cont .deactive").removeClass('previous');
		jQuery("#pic_cont .active").addClass('previous');
		jQuery("#pic_cont .previous").removeClass('active');
		jQuery("#pic_cont .previous").animate({ paddingLeft:'740px'},1500);
		$activePic.addClass('active'); //Add active class (the $active is declared in the rotateSwitch function)
		jQuery("#pic_cont .active").removeClass('deactive');
		// Slide Active from the Left
		jQuery("#pic_cont .active").animate({marginLeft:'0px'},1500);
		jQuery("#pic_cont .deactive").animate({marginLeft:'-740px', paddingLeft:'0px'},1);
	};
	function rotateTxt (){
	
		jQuery("#text_cont .previous").addClass('deactive');
		jQuery("#text_cont .deactive").removeClass('previous');
		jQuery("#text_cont .active").addClass('previous');
		jQuery("#text_cont .previous").removeClass('active');
		$activeTxt.addClass('active'); //Add active class (the $active is declared in the rotateSwitch function)
		jQuery("#text_cont .active").removeClass('deactive');
		jQuery("#text_cont .previous").animate( {height:'0px'},1500 );
		jQuery("#text_cont .active").animate( {height:'40px'},1500);
	}; 
	
	
	//Rotation and Timing Event - Pictures
	function rotatePictures (){
		play = setInterval(function(){ //Set timer - this will repeat itself 
			$activePic = jQuery('[id^=pic_con_].active').next(); //Move to the next div
			if ( $activePic.length === 0) { //If counter reaches the end, go back to first
				$activePic = jQuery('[id^=pic_con_]:first'); 
			}
			rotatePic(); //Trigger the slider function
		}, 7000); //Timer speed 
	};
	//Rotation  and Timing Event - Text
	function rotateText(){
		play = setInterval(function(){ //Set timer - this will repeat itself 
			$activeTxt = jQuery('[id^=txt_con_].active').next(); //Move to the next div
			if ( $activeTxt.length === 0) { //If counter reaches the end, go back to first
				$activeTxt = jQuery('[id^=txt_con_]:first'); 
			}
			rotateTxt(); //Trigger the slider function
	
		}, 7000); //Timer speed 
	};
	
	rotatePictures(); //Run function on launch
	rotateText();
	
});
