function alignFrontPage() {

	switch (navigator.appName) {
		case "Microsoft Internet Explorer":
			var testdiv = document.getElementById("content");
			window_width = parseInt(testdiv.offsetWidth);
			window_height = parseInt(testdiv.offsetHeight);
			
			//window_width = parseInt(document.body.offsetWidth);
			//window_height = parseInt(document.body.offsetHeight);
		break;
		case "Netscape": 
		default:
			var testdiv = document.getElementById("content");
			window_width = parseInt(testdiv.offsetWidth);
			window_height = parseInt(testdiv.offsetHeight);
			
			
			//window_width = parseInt(window.innerWidth);
			//window_height = parseInt(window.innerHeight);
		break;
	}

	document.getElementById("frontpage_link_nieuws").style.left = Math.round(window_width / 1024 * 220, 0);
	document.getElementById("frontpage_link_nieuws").style.top = Math.round(window_width / 1024 * 150, 0);
	document.getElementById("frontpage_link_description_nieuws").style.left = Math.round(window_width / 1024 * 220, 0);
	document.getElementById("frontpage_link_description_nieuws").style.top = Math.round(window_width / 1024 * 170, 0);
	
	document.getElementById("frontpage_link_wijkcentrum").style.left = Math.round(window_width / 1024 * 380, 0);
	document.getElementById("frontpage_link_wijkcentrum").style.top = Math.round(window_width / 1024 * 310, 0);
	document.getElementById("frontpage_link_description_wijkcentrum").style.left = Math.round(window_width / 1024 * 380, 0);
	document.getElementById("frontpage_link_description_wijkcentrum").style.top = Math.round(window_width / 1024 * 330, 0);
	
	document.getElementById("frontpage_link_wijkkranten").style.left = Math.round(window_width / 1024 * 590, 0);
	document.getElementById("frontpage_link_wijkkranten").style.top = Math.round(window_width / 1024 * 330, 0);
	document.getElementById("frontpage_link_description_wijkkranten").style.left = Math.round(window_width / 1024 * 590, 0);
	document.getElementById("frontpage_link_description_wijkkranten").style.top = Math.round(window_width / 1024 * 350, 0);
	
	document.getElementById("frontpage_link_wijk").style.left = Math.round(window_width / 1024 * 770, 0);
	document.getElementById("frontpage_link_wijk").style.top = Math.round(window_width / 1024 * 370, 0);
	document.getElementById("frontpage_link_description_wijk").style.left = Math.round(window_width / 1024 * 770, 0);
	document.getElementById("frontpage_link_description_wijk").style.top = Math.round(window_width / 1024 * 390, 0);
	
	document.getElementById("frontpage_link_eikwijt").style.left = Math.round(window_width / 1024 * 870, 0);
	document.getElementById("frontpage_link_eikwijt").style.top = Math.round(window_width / 1024 * 420, 0);
	document.getElementById("frontpage_link_description_eikwijt").style.left = Math.round(window_width / 1024 * 870, 0);
	document.getElementById("frontpage_link_description_eikwijt").style.top = Math.round(window_width / 1024 * 440, 0);
	
	document.getElementById("frontpage_link_fotogalerij").style.left = Math.round(window_width / 1024 * 840, 0);
	document.getElementById("frontpage_link_fotogalerij").style.top = Math.round(window_width / 1024 * 230, 0);
	document.getElementById("frontpage_link_description_fotogalerij").style.left = Math.round(window_width / 1024 * 840, 0);
	document.getElementById("frontpage_link_description_fotogalerij").style.top = Math.round(window_width / 1024 * 250, 0);
} 

function alignPageFrame() {

	switch (navigator.appName) {
		case "Microsoft Internet Explorer":
			window_width = parseInt(document.body.offsetWidth);
			window_height = parseInt(document.body.offsetHeight);
		break;
		case "Netscape": 
		default:
			window_width = parseInt(window.innerWidth);
			window_height = parseInt(window.innerHeight);
		break;
	}
	
	// page frame
	document.getElementById("page_frame").style.width = Math.round((window_width - 120) / 904 * 670, 0);
	document.getElementById("page_frame").style.height = Math.round((window_height - 123) / 645 * 635, 0);
	
	// sidebar
	document.getElementById("sidebar").style.left = Math.round((window_width - 120) / 904 * 680 + 120, 0);
	document.getElementById("sidebar").style.width = Math.round(1004 - (window_width - 120) / 904 * 800, 0);
	document.getElementById("sidebar").style.height = Math.round((window_height - 123) / 645 * 626, 0);
	
}

function alignPage() {

	switch (navigator.appName) {
		case "Microsoft Internet Explorer":
			window_width = parseInt(document.body.offsetWidth);
			window_height = parseInt(document.body.offsetHeight);
			
			parent_width = parseInt(parent.document.body.offsetWidth);
			parent_height = parseInt(parent.document.body.offsetHeight);
		break;
		case "Netscape": 
		default:
			window_width = parseInt(window.innerWidth);
			window_height = parseInt(window.innerHeight);
			
			parent_width = parseInt(parent.innerWidth);
			parent_height = parseInt(parent.innerHeight);
		break;
	}
	
	//background image
	document.getElementById("bgimage").style.width = Math.round(parent_width, 0);
	document.getElementById("bgimage").style.height = Math.round(parent_width / 1024 * 768, 0);
	
	// page subframe
	document.getElementById("page_subframe").style.width = Math.round(window_width, 0);
	document.getElementById("page_subframe").style.height = Math.round(window_height, 0);
	
}

function toggleMenu(obj,identifier) {

	menu_item = "";
	
	if (identifier.substr(identifier.length - 4) == ".php") {
	
		switch (identifier) {
			case "nieuws.php":
			case "fotogalerij.php":
			case "links.php":
			case "sitemap.php":
				menu_item = "none";
			break;
			case "wijkcentrum.php":
			case "wijkgids.php":
			case "agenda.php":
				menu_item = "wijkcentrum";
			break;
			case "wiezijnwij.php":
			case "bestuur.php":
			case "team.php.php":
			case "werkgebied.php":
				menu_item = "wiezijnwij";
			break;
			case "watdoenwij.php":
			case "groepen.php":
			case "infoadvies.php":
			case "faciliteiten.php":
			case "buurtpanels.php":
			case "werkgroepen.php":
				menu_item = "watdoenwij";
			break;
			case "wijkkranten.php":
			case "eilander.php":
			case "plweesperbuurt.php":
				menu_item = "wijkkranten";
			break;
			case "wijk.php":
			case "buurt1.php":
			case "buurt2.php":
			case "buurt3.php":
			case "buurt4.php":
			case "buurt5.php":
				menu_item = "wijk";
			break;
			case "eikwijt.php":
			case "meningen.php":
			case "vragen.php":
			case "discussie.php":
				menu_item = "eikwijt";
			break;
		}
		
	} else {
	
		menu_item = identifier;
		
	}
	
	if (obj.document.getElementById("menu_" + menu_item) != undefined) {
	
		if (obj.document.getElementById("menu_" + menu_item).style.display == 'block') {
		
			switch (menu_item) {
				case "wijkkranten":
					obj.document.getElementById("menu_watdoenwij").style.display = 'none';
					obj.document.getElementById("menu_wiezijnwij").style.display = 'none';
				break;
			}
			
		} else {
		
			obj.document.getElementById("menu_wijkkranten").style.display = 'none';
			obj.document.getElementById("menu_wijk").style.display = 'none';
			obj.document.getElementById("menu_eikwijt").style.display = 'none';
			
			obj.document.getElementById("menu_watdoenwij").style.display = 'none';
			obj.document.getElementById("menu_wiezijnwij").style.display = 'none';
			
			switch (menu_item) {
				case "wiezijnwij":
				case "watdoenwij":
					obj.document.getElementById("menu_wijkcentrum").style.display = 'block';
				break;
				case "wijkcentrum":
				case "wijkkranten":
				case "wijk":
				case "eikwijt":
					obj.document.getElementById("menu_wijkcentrum").style.display = 'none';
				break;
			}
			
			obj.document.getElementById("menu_" + menu_item).style.display = 'block';
			
		}
		
	} else if (menu_item == "none") {
	
		obj.document.getElementById("menu_wijkcentrum").style.display = 'none';
		obj.document.getElementById("menu_wijkkranten").style.display = 'none';
		obj.document.getElementById("menu_wijk").style.display = 'none';
		obj.document.getElementById("menu_eikwijt").style.display = 'none';
		
		obj.document.getElementById("menu_watdoenwij").style.display = 'none';
		obj.document.getElementById("menu_wiezijnwij").style.display = 'none';
		
	}
	
}

function showPage(page) {

	switch (page) {
		case "wijkgids.php":
		case "agenda.php":
			document.getElementById("menu_watdoenwij").style.display = 'none';
			document.getElementById("menu_wiezijnwij").style.display = 'none';
		break;
		case "nieuws.php":
		case "wijk.php":
		case "fotogalerij.php":
			document.getElementById("menu_wijkcentrum").style.display = 'none';
			document.getElementById("menu_wijkkranten").style.display = 'none';
			document.getElementById("menu_eikwijt").style.display = 'none';
		break;
	}
	
	window.frames["page"].document.location.href = "page_frame.php?p=" + page;
	
}


function scrollNews() {

	if (document.getElementById("hotnews_scroll").style.top == "" || -1 * parseInt(document.getElementById("hotnews_scroll").style.top) >= parseInt(document.getElementById("hotnews_scroll").style.height)) {
	
		document.getElementById("hotnews_scroll").style.top = 80;
		
	} else {
	
		document.getElementById("hotnews_scroll").style.top = parseInt(document.getElementById("hotnews_scroll").style.top) - 3;
		
	}
	
	setTimeout("scrollNews();",100);
	
}

function highlightListItem(obj) {
	obj.style.backgroundColor = "#0D2C89";
	obj.style.color = "#ffffcc";
}

function lowlightListItem(obj) {
	obj.style.backgroundColor = arguments[1] == undefined ? "transparent" : arguments[1];
	obj.style.color = "#0D2C89";
}

function pad(str, len, padstr) {
	while (str.length < len) {
		str = padstr + str;
	}
	
	str = str.substr(0, len);
	
	return str;
}

function validateDateTime(obj) {
	return pad(obj.value.replace(/[^0-9]+/g, ""), parseInt(obj.size), "0");
}
