$(document).ready(function(){

	$('.tabContentBox').addClass('js');

	$("#tabBox div").click(function () { 
			$('#tabBox div').removeClass('active');
			$(this).addClass('active');

			if( $(this).attr('id') == 'tab1' ) {
				$('.tabContentBox .tabContent').removeClass('active');
				$('#tab1Content').addClass('active');
			}
			
			if( $(this).attr('id') == 'tab2' ) {
				$('.tabContentBox .tabContent').removeClass('active');
				$('#tab2Content').addClass('active');
			}
		});
		
    $('ul.gallery').galleria({
			history   : false, // leave off,  history breaks chrome. activates the history object for bookmarking, back-button etc.
			clickNext : true, // helper for making the image clickable
			insert    : '#myBox', // the containing selector for our main image
			onImage   : function(image,caption) { // let's add some image effects for demonstration purposes
				
				// fade in the image & caption
				if(! ($.browser.mozilla && navigator.appVersion.indexOf("Win")!=-1) ) { // FF/Win fades large images terribly slow
					image.css('display','none').fadeIn(1000);
				}
				caption.css('display','none').fadeIn(600);
			}		
		});
  
  	$('.media').media();
  
	var play = true;
	var timeVar = 6000;
	var timeSlider = function() {
		$.timer(timeVar , function (timer) {
			if (play) {
				$.galleria.next()
				timer.reset(timeVar)
			}
			else {
				timer.stop();
			}
		});
	};
	
	timeSlider();
	$('.pauseClick').click(function() {
		play = false;
		$(this).addClass('hideMe');
		$('.playClick').removeClass('hideMe');
	});
	
	$('.playClick').click(function() {
		play = true;
		$(this).addClass('hideMe');
		$('.pauseClick').removeClass('hideMe');
		timeSlider();
	});

});