(function($){

	$.fn.promevoSlider = function(options){

		var defaults = {
		
			slideDuration: 500,
			slideEasing: "swing"
				
			
			
			
		};

		options = $.extend(defaults, options);
		
		

		this.each(function(){
			
			



			//Bind controls
			$("#slider-nav a.trigger").live("click", function(event){
				element = $(this);
				slideTour(element, event);
				$('html,body').animate({ scrollTop: 440 }, { duration: 'slow', easing: 'swing' });
				
				
			});


	$("#slider-nav2 a.trigger").live("click", function(event){
				element = $(this);
				slideTour(element, event);
				$('html,body').animate({ scrollTop: 440 }, { duration: 'slow', easing: 'swing' });
				
				
			});

	




			
			//Functions
			function slideTour(element, event){
				event.preventDefault();
				$("#slider-nav a").removeClass("active");
				currentTab = element.attr("href").replace("#","");
				$("#slider-nav ."+currentTab).addClass("active");
				animateTour(currentTab);
			}
			
			function animateTour(currentTab){

				slideSize = 0;
				
				if(currentTab == "intro") {
					slideSize = "0";
				}
				
			
				
				if(currentTab == "gapps") {
					slideSize = "-" + $(window).width() + "px";
				}
				
				if(currentTab == "gproducts") {
					slideSize = "-" + $(window).width() * 2 + "px";
				}
				
				if(currentTab == "postini") {
					slideSize = "-" + $(window).width() * 3 + "px";
				}
				
				if(currentTab == "services") {
					slideSize = "-" + $(window).width() * 4 + "px";
				}



			}

			(function(){

				//Load page to a specific section
				if(window.location.hash){
					currentTab = window.location.hash.replace(/#*\//g,"");
					animateTour(currentTab);
					$("#slider-nav a").removeClass("active");
					$("." + currentTab).addClass("active");
				}else{
					$(".section").css("height","1px");
					$("#gapps").css("height","auto");
				}

			})();

		});

	};

})(jQuery);

//Instantiate plugin
$(document).ready(function() {
	$(document).promevoSlider();
});
