/*global $ */
window.Alienware = window.Alienware || {};
Alienware.com = Alienware.com || {};
Alienware.com.microsite = Alienware.com.microsite || {};
Alienware.com.microsite.Landings = function(params) {
    this.initialize();
}

Alienware.com.microsite.Landings.prototype = {
    initialize: function() {
        
		$this = this;
		
		$this.initTabs();
		//$this.initLightBox();
		//$this.initGallery();
		//$this.initSubmitPopup();
        	
    },
	
	initTabs: function() {

		// CHANGE BELOW PAGE STARTS WHEN ADDING NEW ICONS/PAGES
		var page1start = 0;
		var page2start = -444;
		
		function setupTabs(){
			var currentPage = null;
			
			if ( $("#btn_prev").parent().hasClass("page1") == true ) {
				currentPage = 1;
			} else if ( $("#btn_prev").parent().hasClass("page2") == true ) {
				currentPage = 2;
			} // Add more else-if cases if a new page is to be added to the icon-set
			
			$("#btn_prev a").click(function(e){
				e.preventDefault();
				if ( currentPage !== 1) { // LOWEST ICON PAGE AVAILABLE
					currentPage = 1;
					$('#viewable ul').animate({
						left: page1start
					}, 500, function() {
						$(".tabZone").removeClass("page2").addClass("page1");
					});
				}
			});

			$("#btn_next a").click(function(e){
				e.preventDefault();
				if ( currentPage !== 2) { // HIGHEST ICON PAGE AVAILABLE
					currentPage = 2;
					$('#viewable ul').animate({
						left: page2start
					}, 500, function() {
						$(".tabZone").removeClass("page1").addClass("page2");
					});
				} 
			});
		}
		
		setupTabs();
	},
	
	initGallery: function() {
		/*
		$(".gallery .galleryThumbs a").click(function(e){
			e.preventDefault();
			var mainImg = $(".gallery #mainImg img");
			var newImg = $(this).attr("href") || mainImg.attr("src");
			mainImg.attr("src", newImg);
		});
		*/
	},
	
	initLightBox: function() {
		//$('#Map area').lightBox();
		//$('#Map2 area').lightBox();
		//$('#perfChart').lightBox();
	}
	
};

$(document).ready(function() {

	new Alienware.com.microsite.Landings({});
	
});

