		var ShopWindow = {
			contentOffset : 0,
			width : 0,
			
			animation : {
				active : false,
				duration : 1500,
				easing: "easeInOutQuart"
			},
			
			dom : {
				current : null,
				items : null,
				contents : null,
				toggler : null,
				container : null,
			},
			
			init : function() {
				ShopWindow.dom.container = $("div.shop_window");
				ShopWindow.dom.toggler = ShopWindow.dom.container.find("div.toggler");
				ShopWindow.dom.toggler.children().first().addClass("active");
				ShopWindow.dom.items = ShopWindow.dom.container.find("div.item");
				ShopWindow.dom.contents = ShopWindow.dom.container.find("div.content");
				ShopWindow.dom.currentId = "i1";
				ShopWindow.width = ShopWindow.dom.container.width();
			},
			
			activate : function(domNode, id) {
				if(ShopWindow.animation.active) {
					return;
				}
	   
				var curItem = ShopWindow.dom.items.filter("div." + ShopWindow.dom.currentId);
				var newItem = ShopWindow.dom.items.filter("div." + id);
	
				if(newItem.index() == curItem.index()) {
					return;
				}   
	
				ShopWindow.animation.active = true;
				ShopWindow.dom.toggler.children().removeClass("active");
				$(domNode).addClass("active");
				
				var reversed = newItem.index() < curItem.index();
				var curContent = ShopWindow.dom.contents.filter("div." + ShopWindow.dom.currentId);
				var newContent = ShopWindow.dom.contents.filter("div." + id);
				
				if(reversed) {
					newContent.css("left", -ShopWindow.width + ShopWindow.contentOffset);
					curContent.animate({left: -ShopWindow.width + ShopWindow.contentOffset}, ShopWindow.animation.duration, ShopWindow.animation.easing);
				}
				else {
					newContent.css("left", ShopWindow.width + ShopWindow.contentOffset);
					curContent.animate({left: -ShopWindow.width + ShopWindow.contentOffset}, ShopWindow.animation.duration, ShopWindow.animation.easing);
				}
					
					
				
							
				window.setTimeout(function() {
					if(reversed) {
						newItem.css("left", -ShopWindow.width);
						curItem.animate({left:ShopWindow.width}, ShopWindow.animation.duration, ShopWindow.animation.easing);
					}
					else {
						newItem.css("left", ShopWindow.width);
						curItem.animate({left:-ShopWindow.width}, ShopWindow.animation.duration, ShopWindow.animation.easing);
					}
					newContent.animate({left:ShopWindow.contentOffset}, ShopWindow.animation.duration, ShopWindow.animation.easing);
					newItem.animate({left:0}, ShopWindow.animation.duration, ShopWindow.animation.easing, function() {
						ShopWindow.dom.currentId = id;
						ShopWindow.animation.active = false;
					});
			
				}, ShopWindow.animation.duration *0.2);
			}
		};
		
		
		

		
		 var timeout = window.setInterval(function() {
					 var nextIndex = parseInt(ShopWindow.dom.currentId.substr(1, 1));
					 var buttons = ShopWindow.dom.toggler.children();
					 if(nextIndex >= buttons.size()) {
					   nextIndex = 0;
					 }
					 ShopWindow.dom.toggler.children().eq(nextIndex).click();
				   }, 16000);
			
				 

		 
		 
	    
	    jQuery.extend({    
			easing : {
				easeInOutQuart :function(c,a,b,d,e) {
					if((a/=e/2)<1) {
						return d/2*a*a*a*a+b;
					}
					return -d/2*((a-=2)*a*a*a-2)+b;
				}
			}
	    });
	    
	    $(document).ready(ShopWindow.init);











