// Execute the following code only when the DOM loads:
$(function() {

    // The top_menu background animation
    $('div.top_menu a,div.bottom_menu a')
	.each(function() {
	    if (!$(this).hasClass("selected")) {
	        $(this).css("background-position", "0 0");
	    }
	})
	.hover(
		function() {
		    if (!$(this).hasClass("selected")) {
		        $(this).stop().animate(
					{ backgroundPosition: "(0 -32px)" },
					{ duration: 300 }
				)
		    }
		},
		function() {
		    if (!$(this).hasClass("selected")) {
		        $(this).stop().animate(
					{ backgroundPosition: "(0 0)" },
					{ duration: 300, complete: function() { $(this).css({ backgroundPosition: "0 0" }) } }
				)
		    }
		}
	)

    // The mini basket "ruler" on hover
    $('div.mini_basket tr').hover(
		function() {
		    $(this).css('background-color', '#FFF');
		},
		function() {
		    $(this).css('background', 'none');
		}
	);


    // the "why email" functionality
    $('div.why_email_link a').click(function() {
        $('div.why_email').toggle();
    });
    $('div.why_register_link a').click(function() {
        $('div.why_register').toggle();
    });


    // Hide the "why_email" explanatory text
    $('div.why_email,div.why_register').hide();



});