function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
	{
	c_start=c_start + c_name.length+1;
	c_end=document.cookie.indexOf(";",c_start);
	if (c_end==-1) c_end=document.cookie.length;
	return unescape(document.cookie.substring(c_start,c_end));
	}
  }
return "";
}

function setCookie(c_name,value,expiredays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}


function findreplace(el, find, rep) {
	try{$(el).html($(el).html().replace(find, rep))}catch(e){};
}


domReady(function(){

		$('#Table71').parent().attr('valign','top').attr('height','100%')
		$('#ShopLayOut_Content_TD').attr('valign','top').attr('height','100%')
		

//PRODUCTMENU

		// Loader productmenu
		cn_init_menu(document.getElementById('ProductMenu_Table'),1)

//PRODUCTMENU

		findreplace('#ShopLayOut_Topmenu_TD','[SP]','</a><a class="TopMenuSpace">');
		// Sætter stk. ind ved antal
		findreplace('#BUYSECTION','&nbsp;&nbsp;','stk.');
		// Laver mellemrum i topmenu
//		findreplace('#ProductInfo','[[split]]','</div></div><div class="BoxLeft 2cend"><div>');
		// Laver mellemrum i topmenu
		findreplace('.left',/\[[b]\]/g,'<span class="bull">&nbsp;</span>');

		// Sætter stk. ind ved antal
		findreplace('#COLUMNLIST table','</tr><tr>','');



		$('.BackGroundColor1_OrderStep4 a:parent').css('display', 'none');











		$('a[rel=ProductInfo_MagixZoomPlus] img').each(function(){
			$(this).css('width','76px').css('margin-left','4px').css('margin-right','4px').css('margin-top','8px')
		});















/*
		$('#ShopMainLayOutTable').css('display', 'block');

		$('#COLUMNLIST a').each(function(){
			$(this).html($(this).html().replace('>','><div>'))
		});
		$('#COLUMNLIST a').each(function(){
			$(this).html($(this).html().replace('</a>','</div></a>'))
		});
*/



		// Fjerner billeder fra produktmenu
		$('.SubCategory1_Productmenu, .SubCategory2_Productmenu, .SubCategory3_Productmenu, .SubCategory4_Productmenu, .SubCategory5_Productmenu').each(function() {
			LinkNivs = $(this).find('a[title==\'\']')
			LinkNivsVal = $(this).find('.niv1, .niv2, .niv3, .niv4').attr('class')
			$(this).html('<a href="'+ LinkNivs.attr('href') +'" title="'+ LinkNivs.attr('title') +'" class="'+ LinkNivs.attr('class') +'"><div class="'+ LinkNivsVal +'">'+ LinkNivs.text() +'</div></a>')
			
		})
		
		$('#ShopMainLayOutTable .SubCats_Prodlink').each(function(){
			ThisPic  = $(this).find('img').attr('src');
			ThisText = $(this).text();
			$(this).html('<span class="pic"><img align="absmiddle" src="'+ ThisPic +'" border="0"></span><span class="text">'+ ThisText +'</span>');
			$(this).next('br').remove();
		});


		$('#ShopMainLayOutTable .SubCats_Prodlink').each(function(){
			ThisHref = $(this).attr('href');
			$(this).find('img').wrap('<a href="'+ ThisHref +'"></a>');
		});


		//cn_load();
		$('#ShopLayOut_Topmenu_TD a').show();

		var i = 1;
		$('#ShopLayOut_Topmenu_TD a').each(
			function() {
				if (this.className != 'TopMenuSpace') $(this).attr('id', 'menu'+i++);
			}
		)
	
		var RootCat = document.getElementById('RootCatagory').value;
		
		if (RootCat==1410065443){
		$('#menu1').css('background-image', 'url(../design/bull.gif)');
		document.getElementById('triangle').innerHTML = '<img src="../design/toppic-indedoerslamper.png" width="551" height="277">';
		}
		if (RootCat==1410065447){
		$('#menu2').css('background-image', 'url(../design/bull.gif)');
		document.getElementById('triangle').innerHTML = '<img src="../design/toppic-udelamper.png" width="551" height="277">';
		}
		if (RootCat==1410065444){
		$('#menu3').css('background-image', 'url(../design/bull.gif)');
		document.getElementById('triangle').innerHTML = '<img src="../design/toppic-ledlamper.png" width="551" height="277">';
		}
		if (RootCat==1410065446){
		$('#menu4').css('background-image', 'url(../design/bull.gif)');
		document.getElementById('triangle').innerHTML = '<img src="../design/toppic-tilbehoer.png" width="551" height="277">';
		}
		if (RootCat==12){
		$('#menu5').css('background-image', 'url(../design/bull.gif)');
		document.getElementById('triangle').innerHTML = '<img src="../design/billede1.png" width="551" height="277">';
		}
		if (RootCat==11){
		$('#menu6').css('background-image', 'url(../design/bull.gif)');
		document.getElementById('triangle').innerHTML = '<img src="../design/billede2.png" width="551" height="277">';
		}
		
		if (location.href=='http://1686844.shop13.dandomain.dk/shop/cms-13.html'){
		$('#menu7').css('background-image', 'url(../design/bull.gif)');
		document.getElementById('triangle').innerHTML = '<img src="../design/billede3.png" width="551" height="277">';
		}
		if (location.href=='http://1686844.shop13.dandomain.dk/shop/cms-14.html' || location.href=='http://1686844.shop13.dandomain.dk/shop/cms-15.html'){
		$('#menu8').css('background-image', 'url(../design/bull.gif)');
		document.getElementById('triangle').innerHTML = '<img src="../design/billede4.png" width="551" height="277">';
		}
		
		if (document.getElementById('triangle').innerHTML == ''){
		document.getElementById('triangle').innerHTML = '<img src="../design/toppic-indedoerslamper.png" width="551" height="277">';
		}






















		if ($('#ContentFrom').html() != ''){
		$('#ContentTo').html($('#ContentFrom').html())
		$('#ContentFrom').html('')
		$('#ContentFrom').css('display', 'none');
		}

		// For skjule print på kvitering
		$('.BackGroundColor1_OrderStep4 a:parent').css('display', 'none');

		// Produktliste - Float
		$('#ShopMainLayOutTable .Frontpage_Custom_TBL tr, #ShopMainLayOutTable .ProductList_Custom_TBL tr, #ShopMainLayOutTable .Related_Custom_TBL tr').each(function(){
			$(this).find('div.ProductList:first').css({'float':'left', 'display':'inline'});
			$(this).find('div.ProductList:last').css({'float':'right', 'display':'inline'});
			$(this).find('div.ProductList').css('display', 'block');
		});
		
		
		// Giv niv's en ekstra class i tilfælde af u-tag
		$('.RootCategory_Productmenu a u').each(function(){
			$(this).parent().addClass('specialniv');
		})

		// Infokort bytter om på billedeposion
		/*if (ProductNumber  != ''){
			if (document.getElementById('Canvas').innerHTML == ''){
			document.getElementById('Canvas').innerHTML = document.getElementById('moveimage').innerHTML
			document.getElementById('moveimage').innerHTML = ''
			$('#Canvas div').css('display', 'none');
			}
		}*/

		// Overskrift til nyheder
		if	(location.href.indexOf('news-ALL-1.html') != -1){
			$('#ProductList_TD h1').text('Nyheder');
		}

		// Overskrift til tilbud
		if	(location.href.indexOf('specialoffer-ALL-1.html') != -1){
			$('#ProductList_TD h1').text('Tilbud');
		}


			Keyword=Keyword.replace('&#2;','');
			Keyword=Keyword.replace('&#3;','');
			Keyword=Keyword.replace('&#4;','');
			Keyword=Keyword.replace('&#5;','');
			Keyword=Keyword.replace('&#6;','');
			Keyword=Keyword.replace('&#7;','');
			Keyword=Keyword.replace('&#8;','');
			Keyword=Keyword.replace('&#14;','');
			Keyword=Keyword.replace('&#15;','');
			Keyword=Keyword.replace('&#16;','');
			Keyword=Keyword.replace('&#17;','');
			Keyword=Keyword.replace('&#18;','');
			Keyword=Keyword.replace('&#19;','');
			Keyword=Keyword.replace('&#20;','');
			Keyword=Keyword.replace('&#21;','');
			Keyword=Keyword.replace('&#22;','');
			Keyword=Keyword.replace('&#23;','');
			Keyword=Keyword.replace('&#24;','');
			Keyword=Keyword.replace('&#25;','');
			Keyword=Keyword.replace('&#26;','');
			Keyword=Keyword.replace('&#27;','');
			Keyword=Keyword.replace('&#33;','!');
			Keyword=Keyword.replace('&#34;','""');
			Keyword=Keyword.replace('&#35;','#');
			Keyword=Keyword.replace('&#36;','$');
			Keyword=Keyword.replace('&#37;','%');
			Keyword=Keyword.replace('&#38;','&');
			Keyword=Keyword.replace('&#40;','(');
			Keyword=Keyword.replace('&#41;',')');
			Keyword=Keyword.replace('&#42;','*');
			Keyword=Keyword.replace('&#43;','+');
			Keyword=Keyword.replace('&#44;',',');
			Keyword=Keyword.replace('&#45;','-');
			Keyword=Keyword.replace('&#46;','.');
			Keyword=Keyword.replace('&#47;','/');
			Keyword=Keyword.replace('&#48;','0');
			Keyword=Keyword.replace('&#49;','1');
			Keyword=Keyword.replace('&#50;','2');
			Keyword=Keyword.replace('&#51;','3');
			Keyword=Keyword.replace('&#52;','4');
			Keyword=Keyword.replace('&#53;','5');
			Keyword=Keyword.replace('&#54;','6');
			Keyword=Keyword.replace('&#55;','7');
			Keyword=Keyword.replace('&#56;','8');
			Keyword=Keyword.replace('&#57;','9');
			Keyword=Keyword.replace('&#58;',':');
			Keyword=Keyword.replace('&#59;',';');
			Keyword=Keyword.replace('&#60;','<');
			Keyword=Keyword.replace('&#61;','=');
			Keyword=Keyword.replace('&#62;','>');
			Keyword=Keyword.replace('&#63;','?');
			Keyword=Keyword.replace('&#64;','@');
			Keyword=Keyword.replace('&#65;','A');
			Keyword=Keyword.replace('&#66;','B');
			Keyword=Keyword.replace('&#67;','C');
			Keyword=Keyword.replace('&#68;','D');
			Keyword=Keyword.replace('&#69;','E');
			Keyword=Keyword.replace('&#70;','F');
			Keyword=Keyword.replace('&#71;','G');
			Keyword=Keyword.replace('&#72;','H');
			Keyword=Keyword.replace('&#73;','I');
			Keyword=Keyword.replace('&#74;','J');
			Keyword=Keyword.replace('&#75;','K');
			Keyword=Keyword.replace('&#76;','L');
			Keyword=Keyword.replace('&#77;','M');
			Keyword=Keyword.replace('&#78;','N');
			Keyword=Keyword.replace('&#79;','O');
			Keyword=Keyword.replace('&#80;','P');
			Keyword=Keyword.replace('&#81;','Q');
			Keyword=Keyword.replace('&#82;','R');
			Keyword=Keyword.replace('&#83;','S');
			Keyword=Keyword.replace('&#84;','T');
			Keyword=Keyword.replace('&#85;','U');
			Keyword=Keyword.replace('&#86;','V');
			Keyword=Keyword.replace('&#87;','W');
			Keyword=Keyword.replace('&#88;','X');
			Keyword=Keyword.replace('&#89;','Y');
			Keyword=Keyword.replace('&#90;','Z');
			Keyword=Keyword.replace('&#91;','[');
			Keyword=Keyword.replace('&#93;',']');
			Keyword=Keyword.replace('&#94;','^');
			Keyword=Keyword.replace('&#95;','_');
			Keyword=Keyword.replace('&#96;','`');
			Keyword=Keyword.replace('&#97;','a');
			Keyword=Keyword.replace('&#98;','b');
			Keyword=Keyword.replace('&#99;','c');
			Keyword=Keyword.replace('&#100;','d');
			Keyword=Keyword.replace('&#101;','e');
			Keyword=Keyword.replace('&#102;','f');
			Keyword=Keyword.replace('&#103;','g');
			Keyword=Keyword.replace('&#104;','h');
			Keyword=Keyword.replace('&#105;','i');
			Keyword=Keyword.replace('&#106;','j');
			Keyword=Keyword.replace('&#107;','k');
			Keyword=Keyword.replace('&#108;','l');
			Keyword=Keyword.replace('&#109;','m');
			Keyword=Keyword.replace('&#110;','n');
			Keyword=Keyword.replace('&#111;','o');
			Keyword=Keyword.replace('&#112;','p');
			Keyword=Keyword.replace('&#113;','q');
			Keyword=Keyword.replace('&#114;','r');
			Keyword=Keyword.replace('&#115;','s');
			Keyword=Keyword.replace('&#116;','t');
			Keyword=Keyword.replace('&#117;','u');
			Keyword=Keyword.replace('&#118;','v');
			Keyword=Keyword.replace('&#119;','w');
			Keyword=Keyword.replace('&#120;','x');
			Keyword=Keyword.replace('&#121;','y');
			Keyword=Keyword.replace('&#122;','z');
			Keyword=Keyword.replace('&#123;','{');
			Keyword=Keyword.replace('&#124;','|');
			Keyword=Keyword.replace('&#125;','}');
			Keyword=Keyword.replace('&#126;','~');
			Keyword=Keyword.replace('&#128;','€');
			Keyword=Keyword.replace('&#130;','‚');
			Keyword=Keyword.replace('&#131;','ƒ');
			Keyword=Keyword.replace('&#132;','„');
			Keyword=Keyword.replace('&#133;','…');
			Keyword=Keyword.replace('&#134;','†');
			Keyword=Keyword.replace('&#135;','‡');
			Keyword=Keyword.replace('&#136;','ˆ');
			Keyword=Keyword.replace('&#137;','‰');
			Keyword=Keyword.replace('&#138;','Š');
			Keyword=Keyword.replace('&#139;','‹');
			Keyword=Keyword.replace('&#140;','Œ');
			Keyword=Keyword.replace('&#142;','Ž');
			Keyword=Keyword.replace('&#145;','‘');
			Keyword=Keyword.replace('&#146;','’');
			Keyword=Keyword.replace('&#147;','“');
			Keyword=Keyword.replace('&#148;','”');
			Keyword=Keyword.replace('&#149;','•');
			Keyword=Keyword.replace('&#150;','–');
			Keyword=Keyword.replace('&#151;','—');
			Keyword=Keyword.replace('&#152;','˜');
			Keyword=Keyword.replace('&#153;','™');
			Keyword=Keyword.replace('&#158;','ž');
			Keyword=Keyword.replace('&#159;','Ÿ');
			Keyword=Keyword.replace('&#161;','¡');
			Keyword=Keyword.replace('&#162;','¢');
			Keyword=Keyword.replace('&#163;','£');
			Keyword=Keyword.replace('&#164;','¤');
			Keyword=Keyword.replace('&#165;','¥');
			Keyword=Keyword.replace('&#166;','¦');
			Keyword=Keyword.replace('&#167;','§');
			Keyword=Keyword.replace('&#168;','¨');
			Keyword=Keyword.replace('&#169;','©');
			Keyword=Keyword.replace('&#170;','ª');
			Keyword=Keyword.replace('&#171;','«');
			Keyword=Keyword.replace('&#172;','¬');
			Keyword=Keyword.replace('&#173;','­');
			Keyword=Keyword.replace('&#174;','®');
			Keyword=Keyword.replace('&#175;','¯');
			Keyword=Keyword.replace('&#176;','°');
			Keyword=Keyword.replace('&#177;','±');
			Keyword=Keyword.replace('&#178;','²');
			Keyword=Keyword.replace('&#179;','³');
			Keyword=Keyword.replace('&#180;','´');
			Keyword=Keyword.replace('&#181;','µ');
			Keyword=Keyword.replace('&#182;','¶');
			Keyword=Keyword.replace('&#183;','·');
			Keyword=Keyword.replace('&#184;','¸');
			Keyword=Keyword.replace('&#185;','¹');
			Keyword=Keyword.replace('&#186;','º');
			Keyword=Keyword.replace('&#187;','»');
			Keyword=Keyword.replace('&#188;','¼');
			Keyword=Keyword.replace('&#189;','½');
			Keyword=Keyword.replace('&#190;','¾');
			Keyword=Keyword.replace('&#191;','¿');
			Keyword=Keyword.replace('&#192;','À');
			Keyword=Keyword.replace('&#193;','Á');
			Keyword=Keyword.replace('&#194;','Â');
			Keyword=Keyword.replace('&#195;','Ã');
			Keyword=Keyword.replace('&#196;','Ä');
			Keyword=Keyword.replace('&#197;','Å');
			Keyword=Keyword.replace('&#198;','Æ');
			Keyword=Keyword.replace('&#199;','Ç');
			Keyword=Keyword.replace('&#200;','È');
			Keyword=Keyword.replace('&#201;','É');
			Keyword=Keyword.replace('&#202;','Ê');
			Keyword=Keyword.replace('&#203;','Ë');
			Keyword=Keyword.replace('&#204;','Ì');
			Keyword=Keyword.replace('&#205;','Í');
			Keyword=Keyword.replace('&#206;','Î');
			Keyword=Keyword.replace('&#207;','Ï');
			Keyword=Keyword.replace('&#208;','Ð');
			Keyword=Keyword.replace('&#209;','Ñ');
			Keyword=Keyword.replace('&#210;','Ò');
			Keyword=Keyword.replace('&#211;','Ó');
			Keyword=Keyword.replace('&#212;','Ô');
			Keyword=Keyword.replace('&#213;','Õ');
			Keyword=Keyword.replace('&#214;','Ö');
			Keyword=Keyword.replace('&#215;','×');
			Keyword=Keyword.replace('&#216;','Ø');
			Keyword=Keyword.replace('&#217;','Ù');
			Keyword=Keyword.replace('&#218;','Ú');
			Keyword=Keyword.replace('&#219;','Û');
			Keyword=Keyword.replace('&#220;','Ü');
			Keyword=Keyword.replace('&#221;','Ý');
			Keyword=Keyword.replace('&#222;','Þ');
			Keyword=Keyword.replace('&#223;','ß');
			Keyword=Keyword.replace('&#224;','à');
			Keyword=Keyword.replace('&#225;','á');
			Keyword=Keyword.replace('&#226;','â');
			Keyword=Keyword.replace('&#227;','ã');
			Keyword=Keyword.replace('&#228;','ä');
			Keyword=Keyword.replace('&#229;','å');
			Keyword=Keyword.replace('&#230;','æ');
			Keyword=Keyword.replace('&#231;','ç');
			Keyword=Keyword.replace('&#232;','è');
			Keyword=Keyword.replace('&#233;','é');
			Keyword=Keyword.replace('&#234;','ê');
			Keyword=Keyword.replace('&#235;','ë');
			Keyword=Keyword.replace('&#236;','ì');
			Keyword=Keyword.replace('&#237;','í');
			Keyword=Keyword.replace('&#238;','î');
			Keyword=Keyword.replace('&#239;','ï');
			Keyword=Keyword.replace('&#240;','ð');
			Keyword=Keyword.replace('&#241;','ñ');
			Keyword=Keyword.replace('&#242;','ò');
			Keyword=Keyword.replace('&#243;','ó');
			Keyword=Keyword.replace('&#244;','ô');
			Keyword=Keyword.replace('&#245;','õ');
			Keyword=Keyword.replace('&#246;','ö');
			Keyword=Keyword.replace('&#247;','÷');
			Keyword=Keyword.replace('&#248;','ø');
			Keyword=Keyword.replace('&#249;','ù');
			Keyword=Keyword.replace('&#250;','ú');
			Keyword=Keyword.replace('&#251;','û');
			Keyword=Keyword.replace('&#252;','ü');
			Keyword=Keyword.replace('&#253;','ý');
			Keyword=Keyword.replace('&#254;','þ');
			Keyword=Keyword.replace('&#255;','ÿ');
			
			// Hvis søgesting ikke er tom gemmer den, den i en cookie
			if (Keyword != ''){setCookie('seekform',Keyword,365);};
			var SeekCookie = getCookie('seekform');
			// Sætter string ind i formen på siden
			if (SeekCookie != ''){document.getElementById('Keyword').value = SeekCookie;};
			// Hvis Formen bliver sendt tom eller med standart-text sendes brugern til forsiden
			if (CurrencyReturnUrl == '/shop/search-1.html?keyword=' || CurrencyReturnUrl == '/shop/search-1.html?keyword=S&#248;g%20efter%20produkt'){setCookie('seekform','',-1);location.href = '/';};

			// Overskrift til søgning
			if	(Keyword  != ''){
				$('#ProductList_TD h1').text('Søgning: '+Keyword);
			}





















});



$(document).ready(function(){




});






// Denne funktion sørger for automatisk at tilpasse indholdet er en menu
function cn_init_menu(menu,level){
	// Hent indhold i menuen
	var list=menu.rows;
	var i=list.length; var j=i;

	// Gennemgå punkterne
	if(i>0)do{
		// Hent en reference til punktet
		var tmp=list[j-i].cells; tmp=tmp[tmp.length-1];

		// Tjek om det er en undermenu
		var x=tmp.getElementsByTagName('table')[0];
		if(x){
			cn_init_menu(x,level+1);
			continue;
		}

		// Tjek om det er et almindeligt punkt
		tmp=tmp.getElementsByTagName('a');
		var x=tmp[0];
		var y=tmp[1];
		
		if (tmp.length>2)
		{
			tilfoej = '';
			if (tmp[2].innerHTML.substring(0,3)=='<u>') tilfoej = 'specialniv'
			tmp[2].innerHTML='<div class="niv'+level+' '+tilfoej+'">'+tmp[2].innerHTML+'</div>';
		}
		if(y&&x&&y.parentNode==x.parentNode) 
		{
			if (tmp.length<3)
			{
				tilfoej = '';
				if (y.innerHTML.substring(0,3)=='<u>') tilfoej = 'specialniv'
				y.innerHTML='<div class="niv'+level+' '+tilfoej+'">'+y.innerHTML+'</div>';
			}
		}
		else if(x)
		{
			tilfoej = '';
			if (x.innerHTML.substring(0,3)=='<u>') tilfoej = 'specialniv'
			x.innerHTML='<div class="niv'+level+' '+tilfoej+'">'+x.innerHTML+'</div>';		
		}
	}while(--i);
}

