$(document).ready(function () {
     
    $('#nav li').hover(
        function () {
            //show its submenu
            $('ul', this).slideDown(100);
 
        },
        function () {
            //hide its submenu
            $('ul', this).slideUp(100);        
        }
    );

	if ( $.browser.msie ) {
		$("#prodmenuBorder").parent().css({
			"padding" : "15px 0px 0px 15px",
			"background" : "none"
		});
	} else {
		$("#prodmenuBorder").parent().css({
			"padding" : "15px 0px 15px 15px",
			"background" : "none"
		});
	}
	
	$("#ShopMainLayOutTable .SubmitButton_Customer:first").css({
		"background" : "url('/images/design/da/ordersteps/load.png')",
		"border" : "none",
		"cursor" : "pointer",
		"height" : "22px",
		"width" : "50px"
	});
	if($("#ShopMainLayOutTable .SubmitButton_Customer").length > 1){
		$("#ShopMainLayOutTable .SubmitButton_Customer:last").css({
			"background" : "url('/images/design/da/send2.png')",
			"border" : "none",
			"cursor" : "pointer",
			"height" : "22px",
			"width" : "50px"
		});
	}
	
	if($(".SubMenu_Productmenu_Table").length > 0){
		$(".SubMenu_Productmenu_Table").parent().css("background", "none");
		$(".SubMenu_Productmenu_Table").parent().parent().prev().children().css("background", "url('/images/design/Da/productmenu/arrowActive.png') no-repeat 15px 8px");
		
	}
	
	if($(".prodlistPaging").length > 0){
		$(".prodlistPaging").each(function(){
			html = $(this).html();
			html = jQuery.trim(html);
			html = html.replace(/&nbsp;/g,'');
			$(this).html(html)
		});
	}
	if($(".PriceStriked_Productlist").length > 0){
		$(".PriceStriked_Productlist").each(function(){
			$(this).after("<br>");
			tmp = $(this).html();
			newhtml = "Før "+tmp;
			$(this).html(newhtml);
		});
	}
	
	if($("#videoBox .Description_Productinfo").length > 0 ){
		if($("#videoBox .Description_Productinfo").html().length == 0 ){
			 $("#videoBox").html("");
		} else {
			if($("#videoBox .Description_Productinfo").html().length < 2){
				//$("#videoBox").next().attr("colspan", "2");
				$("#videoBox").html($("#videoBox").parent().next().find("td:first").html());
				$("#videoBox").parent().next().find("td:first").html("&nbsp;");
			} 
		}
	}
	
	if($(".prodPrice").length > 0){
		$(".prodPrice").each(function(){
			if($(this).find(".frontpagePriceBefore").text().length > 0){
				before = $(this).find(".price").html();
				now = $(this).find(".frontpagePriceBefore").text()
				$(this).find(".frontpagePriceBefore").html("Før "+before);
				$(this).find(".price").html(now)
			}
		});
	}
	
	var elmCounter = 1;
	if($("#imgSelector").length > 0){
		$("#imgSelector img").each(function(index){
			if(elmCounter < 4){
				$(this).css({
					"border-top" : "1px solid #dfe3e4",
					"border-bottom" : "1px solid #dfe3e4",
					"border-left" : "1px solid #dfe3e4",
					"margin" : "0px 0px 4px 0px",
					"height" : "73px"
				});
				elmCounter++;
			} else {
				$(this).css({
					"border" : "1px solid #dfe3e4",
					"margin" : "0px 0px 4px 0px",
					"height" : "73px"
				});
				elmCounter = 1;
			}
		})
	}
	
	if($(".SubCats_Categories_TABLE").length > 0){
		catCounter = 1;
		
		$("#ShopMainLayOutTable .SubCats_Categories_TABLE .SubCats_Categories_TD").each(function(){
			if(catCounter == 2){
				$(this).css("padding", "0px 20px");
			}
			if(catCounter == 3){
				catCounter = 1;
			} else {
				catCounter++;
			}
		});
	}
	
	if($(".PriceBefore_ProductInfo_TD").text().length < 3){
		$(".PriceBefore_ProductInfo_TD").remove();
	}
	if($("#likeWrapper").length > 0){
		url = escape(location.href);
		time = new Date();
		$("#likeWrapper").load("/includes/like.asp?relid="+url+"&_="+time.getTime(),	function(){
			setTimeout("changeFbTxt()", 400);	
		});
	}
	
	if($(".frontpageProdsHolder").length > 0){
		$(".frontpageProdsHolder").parent().attr("align", "left")
	}
	
});
function changeFbTxt(){
	$(".FBConnectButton_Text").html("<img src='/images/design/Da/prodcard/share.png' border='0' >");
}


