function loadMenu(menuItem) {
	//..alert(menuItem);
	var menuIt = byId(menuItem);
	
	if(menuIt != null) {
		menuIt.style.display= "";
	}
}
function pageLoaded() {
	drawLeftMenu();
	drawBottom();
}
function loadSubMenu(menuName) {
	//..alert(menuItem);
	var submenuElem = byId("submenu");
//	submenuElem.innerHTML="gelukt";
//	var innerText = "";
//	if(menuName == "groen") {
//		innerText='<img src="groen_luik.jpg" id="bureau_menu" style="margin-left:57px"/>';
//	} else if(menuName == "blauw") {
//		innerText='<img src="blauw_luik.jpg" id="projecten_menu" style="margin-left:114px"/>';
//	} 
	submenuElem.innerHTML="";
	submenuElem.appendChild(drawSubmenu(menuName));
	
//	
//	<img src="blauw_luik.jpg" id="projecten_menu" style="display:none"/>
}

function drawSubmenu(menuName) {
	var innerText = "";
	
	var subDoc = document.createElement("div");
	

	if(menuName == "groen") {
		
		subDoc.innerHTML="<div style='float:left;width:57px;height:250px'></div>";

		//innerText='<img src="groen_luik.jpg" id="bureau_menu" style="margin-left:57px"/>';

		subDoc.appendChild(drawImgLink("./visie.html", "img/menu/groen_1.png", "visie"));
		subDoc.appendChild(document.createElement("br"));
		//subDoc.appendChild(drawImgLink("./visie.html", "groen_txt1.png", "visie"));
		subDoc.appendChild(drawImgLink("./visie.html", "img/menu/groen_txt1.png", "visie"));
		
		subDoc.appendChild(document.createElement("br"));
		subDoc.appendChild(drawImgLink("./service.html", "img/menu/groen_2.png", "service"));
		subDoc.appendChild(document.createElement("br"));
		subDoc.appendChild(drawImgLink("./service.html", "img/menu/groen_txt2.png", "service"));
		
		subDoc.appendChild(document.createElement("br"));
		subDoc.appendChild(drawImgLink("./architecten_bouwers.html", "img/menu/groen_3.png", "architecten bouwers"));
		subDoc.appendChild(document.createElement("br"));
		subDoc.appendChild(drawImgLink("./architecten_bouwers.html", "img/menu/groen_txt3.png", "architecten bouwers"));
	} else if(menuName == "blauw") {
		//innerText='<img src="blauw_luik.jpg" id="projecten_menu" style="margin-left:114px"/>';
		
		subDoc.innerHTML="<div style='float:left;width:114px;height:250px'></div>";
		
		
		subDoc.appendChild(drawImgLink("./laag_energie.php", "img/menu/puzzel.png", "laag energie"));
		subDoc.appendChild(document.createElement("br"));
		subDoc.appendChild(drawImgLink("./laag_energie.php", "img/menu/laag_energie_txt.png", "laag energie"));
	
		subDoc.appendChild(document.createElement("br"));
		subDoc.appendChild(drawImgLink("./nieuwbouw.php", "img/menu/puzzel.png", "nieuwbouw"));
		subDoc.appendChild(document.createElement("br"));
		subDoc.appendChild(drawImgLink("./nieuwbouw.php", "img/menu/nieuwbouw_txt.png", "nieuwbouw"));

		subDoc.appendChild(document.createElement("br"));
		subDoc.appendChild(drawImgLink("./renovatie.php", "img/menu/puzzel.png", "renovatie"));
		subDoc.appendChild(document.createElement("br"));
		subDoc.appendChild(drawImgLink("./renovatie.php", "img/menu/renovatie_txt.png", "renovatie"));
	} 
	
	
	return subDoc;
}
function goto() {
	
	window.location="nieuwbouw_detail.html";
}

function goTo(target) {
	window.location="index.html";
	if(target == "contact") {
		window.location="contact.html";
	}
	
	if(target == "projecten") {
		window.location="projecten.html";
	}
	
	if(target == "bureau") {
		window.location="bureau.html";
	}
	
	if(target == "nieuwbouw") {
		window.location="nieuwbouw.php";
	}
	
	if(target == "renovatie") {
		window.location="renovatie.php";
	}
	
	if(target == "laag_energie") {
		window.location="laag_energie.php";
	}
	
}
function drawLink(url, txt) {
	var link = document.createElement("a");
	link.href=url;
	link.appendChild(document.createTextNode(txt));
	return link;
}

function drawImgLink(url, imgUrl, title) {

	var link = document.createElement("a");
	link.href=url;
	var img = document.createElement("img");
	img.setAttribute("class", "imglink");
	img.setAttribute("border", "0");
	
	img.src= imgUrl;
	img.title= title;

	link.appendChild(img);
//	link.appendChild(document.createElement("br"));
//	link.appendChild(document.createTextNode(title));
	return link;
}

function loadPic(id, menuItem) {
	var menuIt = byId(id);
	
	
	if(menuIt != null) {

		menuIt.setAttribute("src", menuItem);
	}
	
}

function loadPic2(id, menuItem) {
	var menuIt = byId(id);
	
	
	if(menuIt != null) {

		menuIt.setAttribute("class", menuItem);
	}
	
}
function unloadMenu(menuItem) {
	var menuIt = byId(menuItem);
	
	if(menuIt != null) {
		menuIt.style.display= "none";
	}
}

function loadDiv(divName) {
	byId("meerwaarde").style.display = "none";
	byId("duurzaamheid").style.display = "none";
	byId("context").style.display = "none";
	byId("eenvoud").style.display = "none";
	byId("dialoog").style.display = "none";
	
	byId(divName).style.display="";
}
function byId(id){
	return document.getElementById(id);
}

function drawLeftMenu() {
	var leftElem = byId("left_menu_items");
	
	leftElem.innerHTML='<div onclick="goTo()" onmouseover="loadSubMenu(\'\')"></div><div onclick="goTo(\'bureau\')" onmouseover="loadSubMenu(\'groen\')"></div><div onclick="goTo(\'projecten\')" onmouseover="loadSubMenu(\'blauw\')"></div><div onclick="goTo(\'contact\')" onmouseover="loadSubMenu(\'\')"></div>'; 
	
	//leftElem.appendChild(drawImgLink("./laag_energie.html", "img/menu/blauw_1.png", "laag energie"));
	
	//leftText = "";
	//leftElem.innerHTML =leftText;
}

function drawBottom() {
	var footerElem = byId("footer");
	var footerTxt = "Architectenbureau K2A- architectuur bvba – burgerlijke vennootschap met handelsvorm<br/>Baalsebaan 168  3120 Tremelo -  RPR leuven BE 0887.915.234<br/><img src='img/energiebewust_architect.jpg' width='105px'>";
	footerElem.innerHTML =footerTxt;


}
