$(document).ready(function() {
	resetScrollPage();
	//pressureScrollPage();
	$('.scrollPage').click(function() {
		$('.scrollPage').removeClass('active');
		$(this).stop(true,true).addClass('active')
		navigateSection($(this));
		var linkTitle = $(this).attr("title");
		//Record Analytics Clicks
		//recordOutboundLink($(this), 'Nav Links', linkTitle);
		//return false;	
	});
	//init right photoModule 
	$("#photoModule_rightWrap").scrollable({size: 1,easing: "swing",clickable: false}).circular().autoscroll({autoplay: true,api: true,interval: 3500});
	//init left photoModule
	$("#photoModule_leftWrap").scrollable({size: 1,easing: "swing",clickable: false}).circular().autoscroll({autoplay: true,api: true,interval: 3500});
	
	$(".colorBoxLink").colorbox({width:"80%", height:"80%", iframe:true});
	$(".menuColorBoxLink").colorbox({innerWidth:"850px", innerHeight:"450px", iframe:true});
	$(".billiardColorBoxLink").colorbox({innerWidth:"634px", innerHeight:"490px", iframe:true});
	$(".galleryBoxLink").colorbox({innerWidth:"850px", innerHeight:"570px", iframe:true});
	
	// select #flowplanes and make it scrollable. use circular and navigator plugins
	$("#pressurePanel").scrollable({size: 1, clickable: false}).circular().navigator({
		navi: "#pressureTabs",
		naviItem: 'a',
		activeClass: 'current'
	});	
	
	$('#menuSlider').nivoSlider({
		effect:'fold', //Specify sets like: 'fold,fade,sliceDown'
		slices:15,
		animSpeed:500,
		pauseTime:3000,
		startSlide:0, //Set starting Slide (0 index)
		directionNav:true, //Next & Prev
		directionNavHide:true, //Only show on hover
		controlNav:false, //1,2,3...
		controlNavThumbs:false, //Use thumbnails for Control Nav
      	controlNavThumbsFromRel:false, //Use image rel for thumbs
		controlNavThumbsSearch: '.jpg', //Replace this with...
		controlNavThumbsReplace: '_thumb.jpg', //...this in thumb Image src
		keyboardNav:true, //Use left & right arrows
		pauseOnHover:true, //Stop animation while hovering
		manualAdvance:false, //Force manual transitions
		captionOpacity:0.8, //Universal caption opacity
		beforeChange: function(){},
		afterChange: function(){},
		slideshowEnd: function(){} //Triggers after all slides have been shown
	});
	
	$('#billiardSlider').nivoSlider({
		effect:'fold', //Specify sets like: 'fold,fade,sliceDown'
		slices:15,
		animSpeed:500,
		pauseTime:3000,
		startSlide:0, //Set starting Slide (0 index)
		directionNav:true, //Next & Prev
		directionNavHide:true, //Only show on hover
		controlNav:false, //1,2,3...
		controlNavThumbs:false, //Use thumbnails for Control Nav
      	controlNavThumbsFromRel:false, //Use image rel for thumbs
		controlNavThumbsSearch: '.jpg', //Replace this with...
		controlNavThumbsReplace: '_thumb.jpg', //...this in thumb Image src
		keyboardNav:true, //Use left & right arrows
		pauseOnHover:true, //Stop animation while hovering
		manualAdvance:false, //Force manual transitions
		captionOpacity:0.8, //Universal caption opacity
		beforeChange: function(){},
		afterChange: function(){},
		slideshowEnd: function(){} //Triggers after all slides have been shown
	});	
	
});


function recordOutboundLink(link, category, action) {
  try {
    var pageTracker=_gat._getTracker("UA-XXXXX-X");
    pageTracker._trackEvent(category, action);
    setTimeout('document.location = "' + link.href + '"', 100)
  }catch(err){}
}


navigateSection = function(element) {
	var thisElement = element;
	var elementClicked = element.attr("rel");
	var elementTitle = element.attr("title");
   	var destination = $(elementClicked).offset().top;
	$("html,body").stop(true,true).animate({scrollTop: destination}, 3500, 'easeOutQuint');
}

//Reset Scroll Page Functionality
resetScrollPage = function() {$("html:not(:animated),body:not(:animated)").animate({ scrollTop: 0});return false;};




