function pageInit() {
	if ((myBrowser[1] == "MSIE") && (myBrowser[2] < 7)) IE6FixFooter();
}

function IE6FixParagraphMarginTop(pElem) {
	var myPrevSibling = pElem.previousSibling;
	if (myPrevSibling != null) {
		if (myPrevSibling.tagName == "H3") {
			pElem.style.marginTop = 0;
		} else if ((myPrevSibling.tagName == "H1") || (myPrevSibling.tagName == "H2")) {
			pElem.style.fontWeight = "bold";
			if (myPrevSibling.className == "persbericht") pElem.style.fontWeight = "bold";
		}
	}
	pElem.behavior = null;
}

function IE6FixFooter() {
	myFooter = getElement("footer");
	if (myFooter != null)  {
		window.onscroll = function() {
			var dummy = document.createTextNode(' ');
			myFooter.parentNode.appendChild(dummy);
			dummy.parentNode.removeChild(dummy, true);
		}
	}
}

function setPressImageHover(pElem) {
	pElem.onmouseover = function () { pElem.style.borderColor = "#000000"; }
	pElem.onmouseout = function () { pElem.style.borderColor = "#DFDFDF"; }
	pElem.behavior = null;
}

function showPhoto(persid, bestandsnaam) {
	var myContainer = getElement('pressphoto');
	if (myContainer == null) {
		alert("Kan de foto niet tonen - de container voor de foto bestaat niet.\nNeem a.u.b. contact ons op om hiervan melding te maken.");
	} else {
		var myPhoto = myContainer.firstChild;
		myPhoto.onload = function()
		{
			if (myPhoto.src.toString().indexOf('spacer.gif') < 0) {
				myContainer.style.display = 'block';
				myPhoto.style.marginLeft = ((parseInt(getCurrentStyle(myContainer, "width"), 10) - myPhoto.width) / 2) + "px";
				myPhoto.style.marginTop = ((parseInt(getCurrentStyle(myContainer, "height"), 10) - myPhoto.height) / 2) + "px";
			} else {
				myPhoto.style.marginLeft = "0px";
				myPhoto.style.marginTop = "0px";
				myContainer.style.display = 'none';
			}
		};
		currentPhoto = '/images/pers/' + persid + '/' + bestandsnaam;
		var loadPhoto = new Image();
		loadPhoto.src = currentPhoto;
		if ((myBrowser[1] == "MSIE") && (myBrowser[2] < 7)) {
			myContainer.style.display = "none";
			if (loadPhoto.height < loadPhoto.width) {
				myPhoto.style.width = parseInt(getCurrentStyle(myContainer, "width"), 10) + "px";
				myPhoto.style.height = "auto";
			} else {
				myPhoto.style.height = parseInt(getCurrentStyle(myContainer, "height"), 10) + "px";
				myPhoto.style.width = "auto";
			}
		}
		myPhoto.src = loadPhoto.src;
	}
}

function hidePhoto() {
	var myContainer = getElement('pressphoto');
	if (myContainer != null) {
		var myPhoto = myContainer.firstChild;
		myPhoto.src = '/images/site/spacer.gif';
	}
}

function downloadPhoto() {
	window.location = "/download.php?type=image&image=" + currentPhoto;
}

var myFooter = null;
var currentPhoto = null;
