function replaceImg (thumb) {
    document.getElementById("currentphoto").src = thumb.src;
}


function popTipenven(){
    var sURL = window.document.URL.toString();
	newwindow = window.open('/Tipenven/?url=' + sURL,  'schaumann_properties', 'location=0, status=0, scrollbars=0, width=470, height=370');
	if (window.focus) {newwindow.focus()}
	return false;
}

function popUp(url, width, height){
    popwindow = window.open(url, 'schaumann', 'location=0, status=0, scrollbars=0, width=' + width + ', height=' + height );
    if (window.focus) {popwindow.focus()}
    return false;
}

function createElement(sType,oConfig){
	var o = document.createElement(sType);
	for(var p in oConfig){
		o[p] = oConfig[p];
	}
	return o;
}

function deleteNode(elementId){
  var label=document.getElementById(elementId);	
  while( label.hasChildNodes() ) { label.removeChild( label.lastChild ); }
}

var oMenuConfig = {
	items:[
		{id:1,key:"/koncernen",width:120,Height:24},
		{id:2,key:"/investorrelations",width:164,Height:24},
		{id:3,key:"/boliger",width:98,Height:24},
		{id:4,key:"/erhverv",width:103,Height:24},
		{id:5,key:"/content/dk/koncernen/ejendomsinvestering",width:195,Height:24}
	],
	//absUrl:"http://schaumannproperties.dk/",
	absUrl:"http://schaumann.customers.composite.net/",
	selectedId:1,
	relPath:""
};

window.onload = function (){

	deleteNode("pagemenu");

	var swap = function(){
		var img = this.getElementsByTagName("IMG")[0];
		img.src = (img.src == img.getAttribute("cSrc"))?img.getAttribute("cSrcOver"):img.getAttribute("cSrc");
	}
	var disableMenuItem = function (){
		this.onmouseover = null;
		this.onmouseout = null;
	}
	
	for(var i=0; i<oMenuConfig.items.length; i++){
		var oLi = createElement("LI",{});
		var oA = createElement("A",{id:"menu"+oMenuConfig.items[i].id,href:oMenuConfig.relPath + oMenuConfig.items[i].key,onmouseover:swap,onmouseout:swap,disable:disableMenuItem});
		var oImg1 = new Image();
		oImg1.style.width = oMenuConfig.items[i].width + "px";
		oImg1.style.Height = oMenuConfig.items[i].Height + "px";
		oImg1.src = oMenuConfig.absUrl + "Media/Dk/Menu/menu_0"+(i+1)+"_off.gif";
		oImg1.setAttribute("cSrc",oMenuConfig.absUrl + "Media/Dk/Menu/menu_0"+(i+1)+"_off.gif");
		oImg1.setAttribute("cSrcOver",oMenuConfig.absUrl + "Media/Dk/Menu/menu_0"+(i+1)+"_on.gif");
		var oImg2 = new Image();
		oImg2.src = oMenuConfig.absUrl + "Media/Dk/Menu/menu_0"+(i+1)+"_on.gif";
		oLi.appendChild(oA);
		oA.appendChild(oImg1);
		document.getElementById("pagemenu").appendChild(oLi);
	}
	
	/** 
		Swap and disable active menu link
	*/
	if(!oMenuConfig.selectedId == 0){
		document.getElementById("menu"+oMenuConfig.selectedId).onmouseover();
		document.getElementById("menu"+oMenuConfig.selectedId).disable();
	}
};
function popup(url,w,h,iEx, iEx){

	url = "../" + url;
	h = parseInt(h)+0;
	str="height="+h+",width="+w+"";
	if(parseInt(navigator.appVersion)>3) {
		str+=",left="+(screen.width-w)/2+",top="+parseInt((screen.height -h)/2);
		logWin=window.open(url,'Popup',str);
		logWin.focus();
	}
}
