/* En hurtig funktion til at vise/gemme et element */
function change_state(element) {
	aa = document.getElementById(element);
	if (aa.style.display == "block") {
		aa.style.display="none";
	} else {
		aa.style.display="block";
	}
}


function popup(theURL,winName,features)
{ win = window.open(theURL,winName,features); }


var ie = document.all  && document.getElementById;
function Switch(divName) {
	var divObjContent = getDiv(divName);
	if (divObjContent.style.display != "none") {
		divObjContent.style.display = "none";
	}else{
		divObjContent.style.display = "block";
	}
	divObjContent = null;
	return false;
}
function getDiv(nomeDiv) {
	if(ie)
		return eval("document.all." + nomeDiv);
	else
		return document.getElementById(nomeDiv);
}




/* AJAX GOODNESS */
var farveValg = function(value,type) {
	var url = "/_custom/shop_tailor/farvevalg.php";
	var params = "type=" + value + "&get=" + type;
	var ajax = new Ajax.Updater(
		{success: 'colors'},
		url,
		{
			method: 'get', 
			parameters: params, 
			onFailure: reportError,
			onComplete: showResponse
		}
	);
}
var reportError = function() {
	$('colors').innerHTML = "Error";
}
var showResponse = function() {
	var imageArray = new Array;
	initLightbox();
}



function createSubMenu(){
	var subMenu = document.createElement("div");
			  
	subMenu.id = "submenu";
	subMenu.style.cssText = "position: absolute; top: 10px; right: 14px; z-index: 100;";
	
	subMenu.innerHTML = "<ul style=\"margin: 0; padding: 0;\">"
	subMenu.innerHTML +=	"<li style=\"margin: 0; padding: 0 2px 0 0; list-style: none; background: url(http://kejserensklaeder.dk/upload_dir/design/tp003_theme004/menu_seperator.gif) no-repeat 100% 50%; float: left;\"><a style=\"color: #000; text-decoration: none; float: left; padding: 0 8px;\" href=\"/erhverv/\" onMouseOver=\"this.style.color = '#e6af05'\" onMouseOut=\"this.style.color = '#000'\">Erhverv</a></li>"
	subMenu.innerHTML +=	"<li style=\"margin: 0; padding: 0 2px 0 0; list-style: none; background: url(http://kejserensklaeder.dk/upload_dir/design/tp003_theme004/menu_seperator.gif) no-repeat 100% 50%; float: left;\"><a style=\"color: #000; text-decoration: none; float: left; padding: 0 8px;\" href=\"/find-os/\" onMouseOver=\"this.style.color = '#e6af05'\" onMouseOut=\"this.style.color = '#000'\">Find butik</a></li>"
	subMenu.innerHTML +=	"<li style=\"margin: 0; padding: 0 2px 0 0; list-style: none; background: url(http://kejserensklaeder.dk/upload_dir/design/tp003_theme004/menu_seperator.gif) no-repeat 100% 50%; float: left;\"><a style=\"color: #000; text-decoration: none; float: left; padding: 0 8px;\" href=\"/kundeservice1/\" onMouseOver=\"this.style.color = '#e6af05'\" onMouseOut=\"this.style.color = '#000'\">Kundeservice</a></li>"
	subMenu.innerHTML +=	"<li style=\"margin: 0; padding: 0 2px 0 0; list-style: none; background: url(http://kejserensklaeder.dk/upload_dir/design/tp003_theme004/menu_seperator.gif) no-repeat 100% 50%; float: left;\"><a style=\"color: #000; text-decoration: none; float: left; padding: 0 8px;\" href=\"/presse/\" onMouseOver=\"this.style.color = '#e6af05'\" onMouseOut=\"this.style.color = '#000'\">Presse</a></li>"
	subMenu.innerHTML +=	"<li style=\"margin: 0; padding: 0 2px 0 0; list-style: none; background: url(http://kejserensklaeder.dk/upload_dir/design/tp003_theme004/menu_seperator.gif) no-repeat 100% 50%; float: left;\"><a style=\"color: #000; text-decoration: none; float: left; padding: 0 8px;\" href=\"/job/\" onMouseOver=\"this.style.color = '#e6af05'\" onMouseOut=\"this.style.color = '#000'\">Job</a></li>"
	subMenu.innerHTML +=	"<li style=\"margin: 0; padding: 0; list-style: none; background: url(http://kejserensklaeder.dk/upload_dir/design/tp003_theme004/menu_seperator.gif) no-repeat 100% 50%; float: left;\"><a style=\"color: #000; text-decoration: none; float: left; padding: 0 0 0 8px\" href=\"/om-os/\" onMouseOver=\"this.style.color = '#e6af05'\" onMouseOut=\"this.style.color = '#000'\">Om os</a></li>"
	subMenu.innerHTML += "</ul>";
	
	document.getElementById("Top").style.position = "relative";
	document.getElementById("Top").appendChild(subMenu);
};


function start(){
	blur_link();
	createSubMenu();
}
