$(document).ready(function(){

	/////////////////////////////////////
	/// Set Class for background image
	/////////////////////////////////////
	var activeBranch = $("#swMenuTreeDiv #swMenuTree > .swMenuItem > a");
	var activeIndex = 0;
	activeBranch.each(function(index){
		if($(this).hasClass("active")) {
			activeIndex = index;
		}
	});
	
	$("body").addClass("background" + activeIndex);
	
	/////////////////////////////////////
	/// remove dotted line in checkout
	/////////////////////////////////////
	$(".swCommerceShowBasket tr td[background='/sw/gfx/line2.gif']").hide()


	/////////////////////////////////////
	/// hide additional cells below e-com item
	/////////////////////////////////////
	$(".commerce-show-prices").parents("tr").eq(0).prev().hide();
	$(".commerce-show-prices").parents("tr").eq(0).next().hide();

	/////////////////////////////////////
	/// Move price table to content
	/////////////////////////////////////
	$("#swItemSpec").append($(".commerce-show-prices"));

	/////////////////////////////////////
	/// Move attributes below price table
	/////////////////////////////////////
	$("#swItemSpec").append($(".commerce-show-feature"));
	$("#swItemSpec").append($(".swItemFeatureDropDown"));


	/////////////////////////////////////
	/// Get first clearfloat and float it
	/////////////////////////////////////
	$(".swClearBoth").eq(0).addClass("first");

	/////////////////////////////////////
	/// Add link to header of related item
	/////////////////////////////////////
	var relatedItems = $(".swCommerceRelatedProductLink");
	relatedItems.each(function(){
		var theHref = $(this).find("a").attr("href");
		var theHeader = $(this).find(".commerce-show-imagetext");
		theHeader.wrapInner("<a class='headerLink' href='"+theHref+"' />");
	});

	/////////////////////////////////////
	/// Add link to header of frontpage item
	/////////////////////////////////////
	var relatedItems = $(".swCommerceRows");
	relatedItems.each(function(){
		var theHref = $(this).find("a").attr("href");
		var theHeader = $(this).find(".commerce-show-imagetext");
		theHeader.wrapInner("<a class='headerLink' href='"+theHref+"' />");
	});

	/////////////////////////////////////
	/// Add odd even class to list
	/////////////////////////////////////
	
	$(".swCommerceListTemplate:even").addClass("even");
	$(".swCommerceListTemplate:odd").addClass("odd");
	
});