$(document).ready(function() {
	$(".productImage").supersleight();

    $("#PrimaryContentContainer").prepend($("#ProductImageContainer").html());

    // Add resource center tab
    // alert($("#resourceCenterTabContainer li").length);
    if ($("#resource_center").length > 0) {
    	if($("#ContentLanguageID").val() == "1033"){
    		$("<li><a href='#resource_center'><span>Resource Center</span></a></li>").appendTo("#tabs ul:first");
    	}
    	else{	//french
    		$("<li><a href='#resource_center'><span>Centre de documentation</span></a></li>").appendTo("#tabs ul:first");
    	}
        
        $("#resource_center").appendTo("#tabs");
    }

    // Set up tabs
    // Using fx causes the page to jump to the top on tab click
    $("#tabs").tabs(); // { fx: { opacity: "toggle", duration: "fast"} });

    // Space images inside tabs based on their alignment (e.g. give left-aligned images a right-margin and vice versa)
    $(".ui-tabs .ui-tabs-panel img[align='left']").each(function() { $(this).css("margin-right", "20px").css("float", "left"); });
    $(".ui-tabs .ui-tabs-panel img[align='right']").each(function() { $(this).css("margin-left", "20px").css("float", "right"); });
    
    if(window.location.href.toLowerCase().indexOf("/cooking/rotisseries/") > -1){
    	$.getScript("/js/rotisseriecalc.js");
    }

});

function selectTab(idx) {
    $("#tabs").tabs("select", idx);
}

function playVideo(ekid) {

}