/*****

$(document).ready(function () {
	category = [];
	category[38] = {name: 'Streamline', products: [
		{id: 65, image: 'yellow-on-black2.jpg', size: 524, large: 1653, medium: 1654, small: 1655, xsmall: 1656},
		{id: 77, image: 'yellow-on-black.jpg', size: 523, large: 1649, medium: 1650, small: 1651, xsmall: 1652},
		{id: 76, image: 'white-on-red.jpg', size: 522, large: 1645, medium: 1646, small: 1647, xsmall: 1648},
		{id: 75, image: 'white-on-pink.jpg', size: 521, large: 1641, medium: 1642, small: 1643, xsmall: 1644},
		{id: 74, image: 'white-on-blue.jpg', size: 520, large: 1637, medium: 1638, small: 1639, xsmall: 1640},
		{id: 73, image: 'white-on-black.jpg', size: 519, large: 1633, medium: 1634, small: 1635, xsmall: 1636},
		{id: 49, image: 'red-on-black2.jpg', size: 527, large: 1665, medium: 1666, small: 1667, xsmall: 1668},
		{id: 72, image: 'red-on-black.jpg', size: 518, large: 1629, medium: 1630, small: 1631, xsmall: 1632},
		{id: 71, image: 'pink-on-white.jpg', size: 517, large: 1625, medium: 1626, small: 1627, xsmall: 1628},
		{id: 70, image: 'pink-on-trans.jpg', size: 516, large: 1621, medium: 1622, small: 1623, xsmall: 1624},
		{id: 69, image: 'pink-on-black.jpg', size: 515, large: 1617, medium: 1618, small: 1619, xsmall: 1620},
		{id: 68, image: 'orange-on-blue.jpg', size: 514, large: 1613, medium: 1614, small: 1615, xsmall: 1616},
		{id: 67, image: 'orange-on-black.jpg', size: 513, large: 1609, medium: 1610, small: 1612, xsmall: 1613},
		{id: 66, image: 'lightgreen-on-green.jpg', size: 512, large: 1605, medium: 1606, small: 1607, xsmall: 1608},
		{id: 63, image: 'camo-02.jpg', size: 471, large: 1441, medium: 1442, small: 1443, xsmall: 1444},
		{id: 64, image: 'camo-01.jpg', size: 511, large: 1601, medium: 1602, small: 1603, xsmall: 1604},
		{id: 60, image: 'blue-on-trans.jpg', size: 504, large: 1573, medium: 1574, small: 1575, xsmall: 1576},
		{id: 62, image: 'blue-on-black2.jpg', size: 503, large: 1569, medium: 1570, small: 1571, xsmall: 1572},
		{id: 61, image: 'blue-on-black.jpg', size: 502, large: 1565, medium: 1566, small: 1567, xsmall: 1568},
		{id: 59, image: 'black-on-white.jpg', size: 501, large: 1561, medium: 1562, small: 1563, xsmall: 1564},
		{id: 58, image: 'black-on-trans.jpg', size: 500, large: 1557, medium: 1558, small: 1559, xsmall: 1560},
		{id: 57, image: 'black-on-green.jpg', size: 499, large: 1553, medium: 1554, small: 1555, xsmall: 1556}
	]};
	category[39] = {name: 'Aggressive', products: [
		{id: 50, image: 'pc_yellow-on-black.jpg', size: 506, large: 1581, medium: 1582, small: 1583, xsmall: 1584},
		{id: 56, image: 'pc_white-on-black.jpg', size: 507, large: 1585, medium: 1586, small: 1587, xsmall: 1588}
	]};
	category[40] = {name: 'Charity', products: [
		{id: 51, image: 'pc_pink.jpg', size: 508, large: 1589, medium: 1590, small: 1591, xsmall: 1592}
	]};
	category[41] = {name: 'Designer', products: [
		{id: 54, image: 'pc_babalu.jpg', price: 44.99, size: 510, large: 1597, medium: 1598, small: 1599, xsmall: 1600},
		{id: 53, image: 'pc_eddiealvarez.jpg', price: 44.99, size: 509, large: 1593, medium: 1594, small: 1595, xsmall: 1596}	
	]};
	$('#categoryIds').empty();
	for (cid in category) {
		$('#categoryIds').append('<option value="'+cid+'">'+category[cid].name+'</option>');
	}
	$('#categoryIds').change(function () {
		cid = $(this).val();
		folder = category[cid].name.toLowerCase();
		$('#smallShopImageWrapper').empty();
		for (i in category[cid].products) {
			product = category[cid].products[i];
			$('#smallShopImageWrapper').append('<img rel="pid_'+i+'" src="images/home-shop/small/'+product.image+'" width="52" height="37" />');
		}
		$('#smallShopImageWrapper img').bind("contextmenu", function(e){
			return false;
		});
		$('#smallShopImageWrapper').css('overflow', 'auto');
		$('#smallShopImageWrapper img').each(function () {
			$(this).click(function () {
				parts = $(this).attr('rel').split('_');
				pid = parts[1];
				$('#sizeIds').empty();
				$('#sizeIds').append('<option value="'+category[cid].products[pid].large+'">Large (8in)</option>');
				$('#sizeIds').append('<option value="'+category[cid].products[pid].medium+'">Medium (7.5in)</option>');
				$('#sizeIds').append('<option value="'+category[cid].products[pid].small+'">Small (6.9in)</option>');
				$('#sizeIds').append('<option value="'+category[cid].products[pid].xsmall+'">X-Small (6.3in)</option>');
				$('#sizeIds').attr('name', 'option['+category[cid].products[pid].size+']');
				$('#mainShopImage').attr('src', 'images/home-shop/large/'+category[cid].products[pid].image);
				if (category[cid].products[pid].price) {
					$('#itemPrice').text(category[cid].products[pid].price);
				} else {
					$('#itemPrice').text(39.99);
				}
				$('input[name="product_id"]').attr('value', category[cid].products[pid].id);
			});
		});
		$('#smallShopImageWrapper img:first').click();
	});
	$('#categoryIds').change();
	$('input[name="redirect"]').attr('value', location.href);
});

document.write('<form action="http://www.powercoreusa.com/store/index.php?route=checkout/cart" method="post" enctype="multipart/form-data">\
<div id="mainShopImageWrapper">\
<img id="mainShopImage" alt="" src="images/home-shop/large/yellow-on-black2.jpg" width="285" height="205" /></div>\
<div id="shopOptionsWrapper">\
Style: <select id="categoryIds"></select> Size: <select id="sizeIds" name="option[]"></select></div>\
<div id="smallShopImageWrapper"></div>\
<div id="shopAddToCart">\
Qty: <input type="text" name="quantity" size="1" value="1" /> $<span id="itemPrice"></span> (ea)\
<input type="image" src="images/home-shop/add-to-cart.gif" alt="Add to Cart" style="vertical-align:middle; margin-left:15px" onmouseover="swapImg(this)" onmouseout="swapImg(this)" />\
<input id="cartRedirect" type="hidden" name="redirect" value="http://www.powercoreusa.com/" />\
<input type="hidden" name="product_id" value="" />\
<input type="hidden" name="redirect" value="" /></div>\
</form>');

*****/

document.write('<div id="sidebox_banners" style="text-align:center; padding-top: 30px">\
<a href="store"><img src="images/sidebox/shownow.jpg" alt=""></a><br />\
<!-- <a href="#"><img src="images/sidebox/difference.jpg" width="289" height="163" alt=""></a><br /> -->\
<a href="become_dealer"><img src="images/sidebox/dealer.jpg" width="289" height="163" alt=""></a><br />\
<a href="fundraising"><img src="images/sidebox/fundraising.jpg" width="289" height="163" alt=""></a>\
</div>');

$(document).ready(function() {
	//preload images
	var preloadedImages = new Array();
	$('#sidebox_banners img').each(function(i) {
		preloadedImages[i] = new Image();
		var ext = $(this).attr('src').split('.').pop();
		preloadedImages[i].src = $(this).attr('src').split('.' + ext).join('-hover.' + ext);
	});
	//rollover effect
	$('#sidebox_banners a').hover(function() {
		var ext = $(this).find('img').attr('src').split('.').pop();
		$(this).find('img').attr('src', $(this).find('img').attr('src').split('.' + ext).join('-hover.' + ext));
	}, function() {
		var ext = $(this).find('img').attr('src').split('.').pop();
		$(this).find('img').attr('src', $(this).find('img').attr('src').split('-hover.' + ext).join('.' + ext));
	});
});
