//------------------------------------
//	ROQSTA.JS
//	Author: 	Christian Thomas
//	Requires:	jQuery 1.x
//------------------------------------


////////////////////////////
// BEGIN JQUERY

$(function() {

	var mooseBan = false;

	///////////////////////
	// LIGHTBOX

	if($('.lightbox').length) $('.lightbox a').lightBox();


	///////////////////////
	// READ MORE BUTTON
	
	$('.read-more').click(function(e){

		e.preventDefault();

		if(!mooseBan) {

			mooseBan = true;

			if(!$(this).next('.hidden').is(':visible')) {

				$(this).text('- Close').next('.hidden').slideDown('slow', 'easeInOutExpo', function(){
					mooseBan = false;
				});

			}else {

				$(this).text('Read More +').next('.hidden').slideUp('slow', 'easeInOutExpo', function(){
					mooseBan = false;
				});

			}

		}

	});
	
	///////////////////////
	// ANYTHING SLIDER
	
	$('.anythingSlider').anythingSlider({
		easing: "easeInOutExpo",        // Anything other than "linear" or "swing" requires the easing plugin
		autoPlay: true,                 // This turns off the entire FUNCTIONALY, not just if it starts running or not.
		delay: 5000,                    // How long between slide transitions in AutoPlay mode
		startStopped: false,            // If autoPlay is on, this can force it to start stopped
		animationTime: 600,             // How long the slide transition takes
		hashTags: true,                 // Should links change the hashtag in the URL?
		buildNavigation: true,          // If true, builds and list of anchor links to link to each slide
		pauseOnHover: true,             // If true, and autoPlay is enabled, the show will pause on hover
		startText: "Go",                // Start text
		stopText: "Stop",               // Stop text
		navigationFormatter: formatText // Details at the top of the file on this use (advanced use)
	});
            
	$("#slide-jump").click(function(){
		$('.anythingSlider').anythingSlider(6);
	});

});

function formatText(index, panel) {
	
	return index + "";
	
}


//////////////////////////
// EASING
 
jQuery.extend( jQuery.easing,{
	easeInOutExpo: function (x, t, b, c, d){
		if (t==0) return b;
		if (t==d) return b+c;
		if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
		return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
	},
	easeInOutQuart: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
		return -c/2 * ((t-=2)*t*t*t - 2) + b;
	},
	easeOutQuart: function (x, t, b, c, d) {
		return -c * ((t=t/d-1)*t*t*t - 1) + b;
	},
	easeOutExpo: function (x, t, b, c, d) {
		return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
	},
	easeInExpo: function (x, t, b, c, d) {
		return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
	}
});
