function shopStory(targetDiv)
{
	this.targetDiv = targetDiv;
	this.timer = '';

	oStory = this;
	
	this.scrollup = function()
	{
		this.timer = setInterval('oStory.action(-20)',100);
	}

	this.scrolldown = function()
	{
		this.timer = setInterval('oStory.action(+20)',100);
	}

	this.action = function(value)
	{
		$(this.targetDiv).scrollTop = $(this.targetDiv).scrollTop + value;
	}

	this.kill = function()
	{
		clearInterval(this.timer);
	}
}

function cartControls(cartDiv,cartNumberSpan,loadingImg,AddImg)
{	
	this.cartDiv = cartDiv;
	this.cartNumberSpan = cartNumberSpan;
	this.loadingImg = loadingImg;
	this.AddImg = AddImg;

	this.buttonID = '';

	oCart = this;

	this.start = function(targetID)
	{		
		$(targetID).blur();
		$(targetID).src = loadingImg;		
		oCart.buttonID = targetID;		
	}

	this.stop = function()
	{
		$(oCart.buttonID).src = AddImg;		
	}

	this.success = function(request,itemID)
	{		
		//alert(request.responseText);
		cartData = eval("(" + request.responseText + ")");
		new Effect.Highlight(oCart.cartDiv, {startcolor:'#800203', endcolor:'#faf1ce', duration: 1.0});
		$(this.cartNumberSpan).innerHTML = cartData.cart_size;
		$('numberOfItemsInCart2').innerHTML = cartData.cart_size;
		$("item_qty_"+itemID).value = '';
		
		if ($('product_checkout_button').visible() != true) {
			new Effect.SlideDown('product_checkout_button');
		}
		
		oCart.stop();
	}

	this.failed = function(request)
	{
		alert('Failed: '+request.responseText);
		oCart.stop();
	}

}

function storeLandingNav(targetDiv)
{
	oNav = this;

	this.targetDiv = targetDiv;

	this.defaultText = '';
	this.texts = new Array();

	this.timer = '';

	this.addText = function(incText)
	{				
		oNav.texts[incText.id] = incText.content;
	}

	this.addDefault = function(defaultText)
	{
		oNav.defaultText = defaultText;
	}

	this.showDefault = function()
	{
		$(oNav.targetDiv).innerHTML = oNav.defaultText;
	}

	this.over = function(arrayTarget)
	{
		if( oNav.timer )
		{
			clearTimeout(oNav.timer);
		}

		$(oNav.targetDiv).innerHTML = oNav.texts[arrayTarget];
	}

	this.out = function()
	{
		oNav.timer = setTimeout("oNav.showDefault()",700);
	}
}