/*******
** vp ** 01.03.2005 v1.1
******/

	var counter = 1;

	function init_layerSwap (ID) {
		if (document.getElementById(ID)) {
			showFirstLayer();
			var entries = document.getElementById(ID).getElementsByTagName('a');
			for (var i=0; i < entries.length; i++) {
				entries[i].count = counter;
				entries[i].onclick = function () {
					rest = document.getElementsByTagName('div');
					links = document.getElementsByTagName('a');
					for (var x=0; x < links.length; x++) {
						if (links[x].className == 'active' ) {
							links[x].className = "";
						}
					}
					for (var a=0; a < rest.length; a++) {
						if (rest[a].className == 'v' ) {
							rest[a].style.display = 'none';
						}
					}
					var swap = 'layer_' + this.count;
					this.className = "active";
					document.getElementById(swap).style.display = "block"; 
				};
				counter++;
			}	
		}
	}

	function showFirstLayer() {
		var count2 = 1;
		var entries = document.getElementsByTagName('div');
		for (var i=0; i < entries.length; i++) {
			if (entries[i].className == 'v') {
				if (count2 == 1) {
					entries[i].style.display = 'block';
				}
				count2++;
			}
		}
	}
	
	
function initThumbs(){
	var entries = document.getElementsByTagName('a');
	for (var i=0; i < entries.length; i++) {
		if(entries[i].className == 'thumbnail') {
			entries[i].onclick = function() {
				popUpWindow('showimage.aspx?path=' + this.href, 100,100,'no');
				return false;
			};
			entries[i].focus = function() {
				this.blur();
				return false;
			};
		}
	}
}

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		btn_about_over = newImage("/img/btn_about-over.jpg");
		btn_portfolio_over = newImage("/img/btn_portfolio-over.jpg");
		btn_contact_over = newImage("/img/btn_contact-over.jpg");
		btn_guestbook_over = newImage("/img/btn_guestbook-over.jpg");
		btn_links_over = newImage("/img/btn_links-over.jpg");
		preloadFlag = true;
	}
}

var popUpWin=0;
function popUpWindow(URLStr, width, height, Bscroll){
	if(popUpWin){
		if(!popUpWin.closed) popUpWin.close();
	}
	popUpWin = window.open(URLStr, 'popUpWin', 'toolbar=no,location=no,scrollbars=' + Bscroll + ',directories=no,status=no,menubar=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',screenX=100,screenY=100,top=100,left=100');
}

function setwindow() {
	var containers = document.getElementById('imgBericht');
	top.resizeTo(containers.offsetWidth,containers.offsetHeight);
	
	var Cheight 		=	document.documentElement.offsetHeight;
	var Cwidth  		=	document.documentElement.offsetWidth;
	var Cheight_tot 	=	containers.offsetHeight;
	var Cwidtht_tot 	=	containers.offsetWidth;
	var Height_dif		=	Cheight_tot - Cheight;
	var Width_dif 		=	Cwidtht_tot - Cwidth;
	
	top.resizeTo(containers.offsetWidth + (Width_dif + 4),containers.offsetHeight + (Height_dif + 4)); 
	//het laatste cijfer is extra ruimte, Dit komt in het stmg geval door de onderbalk
}

window.onload = function(){
	preloadImages();
	init_layerSwap('subNav');
	initThumbs();
	hideFocusBorders();
}

function hideFocusBorders(){
	var theahrefs = document.getElementsByTagName("a");
	if (!theahrefs){return;}
	for(var x=0;x!=theahrefs.length;x++){
		theahrefs[x].onfocus = function stopLinkFocus(){this.hideFocus=true;};
	}
}