/*******************************************************************************
 *    Author:		Remco Vermeer, neoCore (www.neocore.nl)
 *    Desciption:	Dit script bevat een reeks utils: venster openen, datum weergeven
 *    Edit Date:    21-06-2004
 *    Copyright:	Remco Vermeer, neoCore
 *    Version:		1.0
 *******************************************************************************/

function print_date() {
	var d, strDate;
	d = new Date();
	d = d.toLocaleString();
	strDate = "<SPAN Class=\"Date\">" + d + "</SPAN>";
	document.write(strDate);
}

function openwindow(sfile,iwidth,iheight) {
		newwin = 	window.open(sfile,'window','scrollbars=no,resizable=no,width=' + iwidth + ',height=' + iheight);
		newwin.opener=self;
		newwin.focus();
}

function openlink(sfile) {
		newwin = 	window.open(sfile,'window');
		newwin.opener=self;
		newwin.focus();
}

function preview(sfile) {
		previewfilename = "/includes/content/preview.php?picture=" + sfile;
		iwidth = 640;
		iheight = 505;
		posx = ((screen.width - iwidth) / 2);
		posy = ((screen.height - iheight) / 2) - 0.5 * ((screen.height - iheight) / 2);

		newwin = window.open(previewfilename,'window','scrollbars=no,resizable=no,width=' + iwidth + ',height=' + iheight + ',top=' + posy + 'left=' + posx);
		newwin.opener=self;
		newwin.focus();
}

function getWindowHeight() {
	var windowHeight=0;
	if (typeof(window.innerHeight)=='number') {
		windowHeight=window.innerHeight;
	}
	else {
		if (document.documentElement&&document.documentElement.clientHeight) {
			windowHeight=document.documentElement.clientHeight;
		}
		else {
			if (document.body&&document.body.clientHeight) {
				windowHeight=document.body.clientHeight;
			}
		}
	}
	return windowHeight;
}

function setFooter() {
	if (document.getElementById) {
		var windowHeight=getWindowHeight();
		if (windowHeight>0) {
			var contentHeight=document.getElementById('container').offsetHeight;
			var footerElement=document.getElementById('footer');
			var footerHeight=footerElement.offsetHeight;
			if (windowHeight-(contentHeight+footerHeight)>=0) {
				footerElement.style.position='relative';
				footerElement.style.top=(windowHeight-(contentHeight+footerHeight))+'px';
			}
			else {
				footerElement.style.position='static';
			}
		}
	}
}

// open externe links in nieuw browser window 
function externalLinks() { 
	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"; 
	} 
} 