window.onload = function() {
	document.getElementById("Bookmark").onclick = function() {
		var title = "Camperverhuurcanada.nl - Voordelige camperverhuur in Canada";
		var url = "http://www.camperverhuurcanada.nl";
		if (document.all)
			window.external.AddFavorite(url, title);
		else if (window.sidebar)
			window.sidebar.addPanel(title, url, "");
	}

	document.getElementById("TellFriend").onclick = function() {
		NewWindow(this.href,'tellafriend','460','360','no','center');
		return false;
	}
	document.getElementById("TellFriend").onfocus = function() {
		this.blur();
	}

	if (window.event) { //IE only?
		var menuImages = document.getElementById("Menu").getElementsByTagName("IMG");
		for (i = (menuImages.length - 1); i > -1; i--) {
			if (menuImages[i].src.toUpperCase().substring(menuImages[i].src.length - 3, menuImages[i].src.length) == "PNG")
				menuImages[i].outerHTML = "<span style=\"width:" + menuImages[i].width + "px; height:" + menuImages[i].height + "px; display:inline-block; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'" + menuImages[i].src + "\', sizingMethod='scale');\"></span>" 
		}
	}

	if (!document.getElementsByTagName) return; 
	var anchors = document.getElementsByTagName("a"); 
	for (var i=0; i < anchors.length; i++) { 
		var anchor = anchors[i]; 
		if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external") 
			anchor.target = "_blank"; 
	} 

	document.onkeydown = function(e) {
		var e = (e) ? e : event;
		if (e.ctrlKey && e.shiftKey && e.keyCode == 86) {
			var url = "http://validator.w3.org/check?verbose=1&uri=";
			url += encodeURIComponent(window.location.href);
			window.location.href = url;
		}
	}
	if (document.getElementById("Menu").nextSibling.offsetHeight > 361) {
		document.getElementById("Menu").style.height = document.getElementById("Menu").nextSibling.offsetHeight + "px";
		document.getElementById("Menu").lastChild.style.top = (document.getElementById("Menu").nextSibling.offsetHeight - 378) + "px";
	}
	if (document.getElementsByTagName("iframe").length > 0)
		document.getElementsByTagName("iframe")[0].style.height = (document.body.clientHeight - 140) + "px";
}

function NewWindow(mypage, myname, w, h, scroll, pos) {
	if (pos == "random") {
		LeftPosition = (screen.width) ? Math.floor(Math.random() * (screen.width - w)) : 100;
		TopPosition = (screen.height) ? Math.floor(Math.random() * ((screen.height - h) - 75)) : 100;
	}
	if (pos == "center") {
		LeftPosition = (screen.width) ? (screen.width - w) / 2 : 100;
		TopPosition = (screen.height) ? (screen.height - h) / 2 : 100;
	}
	else
		if ((pos != "center" && pos != "random") || pos == null) { 
			LeftPosition = 0;
			TopPosition = 20
		}
	settings = 'width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
	win = window.open(mypage, myname, settings);
}

