$(function() {
	
	$('div#content h1').sifr(
		{ strSWF: 'flash/mrs-eaves-allcaps.swf', strColor: '#140b01', strLinkColor: '#140b01', strHoverColor: '#140b01', strWmode: 'transparent', intPadding: [0, 0, 0, 0], strFlashVars: 'textalign=left&letterSpacing=2&', strCase: 'upper' },
		{ expressInstall: true }
	);

	$('div#title-wrapper h2').sifr(
		{ strSWF: 'flash/mrs-eaves-allcaps.swf', strColor: '#140b01', strLinkColor: '#140b01', strHoverColor: '#140b01', strWmode: 'transparent', intPadding: [0, 0, 0, 0], strFlashVars: 'textalign=left&letterSpacing=2&', strCase: 'upper' },
		{ expressInstall: true }
	);


	// JS to replace buttons with images
	
	$("div.item-wrapper input[@type=submit]").after('<input type="image"  name="add_to_cart" src="images/layout/btn-add-to-cart.jpg" class="add-to-cart-btn" />').remove();
	$("#featured-item-form input[@type=submit]").after('<input type="image" name="add_to_cart" src="images/layout/btn-add-to-cart.jpg" class="add-to-cart-btn" />').remove();
	$("td.citemupdate input[@type=submit]").after('<input type="image" src="images/layout/btn-update.jpg" class="update-btn" />').remove();
	
	
	
	//$("input[@value=Continue Shopping]").after('<a onclick="' + $("input[@value=Continue Shopping]").attr('onclick') + '" href="#"><img src="images/layout/btn-continue-shopping.jpg" alt="Continue Shopping" /></a>').remove();

	//console.log($("input[@value=Continue Shopping]")); //.attr('onclick'));
	inputContinueShopping = $('<a/>').attr('href','#').html('<img src="images/layout/btn-continue-shopping.jpg" alt="Continue Shopping" />').click(function(e){e.preventDefault(); window.location.href='index.php?op=view';});
	$("input[@value=Continue Shopping]").each(function(){$(this).after(inputContinueShopping).remove();});

	inputEditCart = $('<a/>').attr('href','#').html('<img src="images/layout/btn-edit-cart.jpg" alt="Edit Cart" />').click(function(e){e.preventDefault(); window.location.href='index.php?op=viewcart';});
	$("input[@value=Edit Cart]").each(function(){$(this).after(inputEditCart).remove();});


	$("input[@value=Search]").after('<input name="checkout" type="image" src="images/layout/btn-search.jpg" class="search-btn" />').remove();
	$("input[@value=Proceed to Shipping]").after('<input name="checkout" type="image" src="images/layout/btn-proceed-shipping.jpg" class="proceed-btn" />').remove();
	$("input[@value=Checkout]").after('<input name="checkout" type="image" src="images/layout/btn-checkout.jpg" class="checkout-btn" />').remove();
	$("input[@value=Proceed to Address Information]").after('<input name="proceed_address_information" type="image" src="images/layout/btn-proceed-address-info.jpg" class="edit-cart-btn" />').remove();

	// Remove javascript warning
	
	$("div#browser-warning").hide();

	// JS hack to get rid of the duplicate #content wrappers
	
	$("div#content").each( function() {
		var x = $(this);
		$("div#content", x).attr({id:"inner-content"});
	});

	// Sub category JS
	
	$("#sub-categories-wrapper").each( function() {
		var x = $(this);
		$("div#sub-categories-middle", x).hide();
		/*$("a#select-category", x).hover( function() {
			$("ul#sub-categories", x).slideDown();
		});*/
		$("a#select-category").removeClass("close").addClass("open");
		$("a#select-category").toggle( function() {
			$("div#sub-categories-middle", x).slideDown();
			$(this).html("Hide categories").removeClass("open").addClass("close");
			return false;
			}, function() {
			$(this).html("Select a category").removeClass("close").addClass("open");
			$("div#sub-categories-middle", x).slideUp();
		});
	});
	
	// JS hack to change the inline style width on the update coloumn on the cart pages
	
	$("td.citemupdate").each( function() {
		$(this).css("width","150px");
	});

		$("div#masthead").flash(
			{src:"flash/shop-masthead.swf",
			 width:763,
			 height:309,
			 wmode:"transparent",
			 quality:"high"},
			 {version:"8"});


});