
$(document).ready(function(){
    
    /* customise the previous and next links. 
    // remove pipes that are output by storefront
    $("#productNavLinks").html($("#productNavLinks").html().replace(/\|/g,""));
    // add angle brackets and css classes to anchor tags
    $("#productNavLinks a:first").wrap('<div style="position:absolute; left:0;"></div>').before('&lt;&nbsp;');
    $("#productNavLinks a:last").wrap('<div style="position:absolute; right:10px; top:0;"></div>').after("&nbsp;&gt;");
    */
    /* wire up a click event to the giftregistry link */
    $("#addToGiftRegistryLink").click(function(){
        $("#IsGiftRegistry").val(1);
        $("#addToCartForm form").submit();
        return false;
    });
    
    // Tabs
	$("#prodTabs").tabs({
		select: function(event, ui){
			var url = String(ui.tab.href);
			var tabSelected = url.split('#')[1];
			// tabs to hide upsell
			var tabs = new Array('tab_review');
			for (i=0; i < tabs.length; i++){
				if (tabs[i] === tabSelected){
					$('div.upsellColumn').hide();
					$('#prodContent').addClass('upsell-hidden');
					$('#BVCustomerRatings').hide();
					return true;
				}
			}
			$('div.upsellColumn').show();
			$('#prodContent').removeClass('upsell-hidden');
			$('#BVCustomerRatings').show();
			return true;
		}
	});
	
	// Fix styling issue
	var colour = $('#Color')
	var size = $('#Size');
	if (colour.length && size.length) {
	    size.css('clear','left');
	    if($.browser.msie && $.browser.version <= 7){
	        colour.css('position', 'relative')
	            .css('top','24px')
	            .css('right','80px');
	    }
	}
	else if (colour.length) {
	    colour.css('clear','left');
	}
	else if (size.length) {
	    size.css('clear','left');
	}
});

