// ==================================================
// global vars
// ==================================================

var bbmx, bbmy; 				// global mousepos vars voor oa. Help Mouseover
var mmevent 	= 0;			// pas als mmevent op 1 staat zullen de mouse-coords worden uitgelezen

// browser shit

var is_mac		= navigator.platform.indexOf("Mac") != -1;
var is_win		= navigator.platform=="Win32";
var is_safari 	= navigator.userAgent.indexOf("Safari") != -1;
var is_opera 	= navigator.userAgent.indexOf("Opera") > -1;
var is_ie 		= navigator.userAgent.indexOf("MSIE") > 1 && !is_opera; //(navigator.userAgent.indexOf ("IE") != -1);
var is_mozilla	= navigator.userAgent.indexOf("Mozilla/5.") == 0 && !is_opera;
var is_gecko 	= /gecko/i.test(navigator.userAgent);

// ==================================================
// Function: Init Page na onload
// ==================================================

function getEl(el) {
	if (document.getElementById)	return document.getElementById(el);
	if (document.all)				return document.all[el];
	return false;
}

// ==================================================

function go(url) {
	location.href = check_url(url);
}

function ngo(url) {
	window.open(check_url(url));
}

function mail(adr) {
	location.href = "mailto:" + adr;
}

function openmedia(tiepe, pw, ph, file) {
	mx		= (screen.availWidth - pw) / 2;
	my		= (screen.availHeight - ph) / 2;
	popobj 	= window.open('', 'win', 'scrollbars=auto, resizable=1, fullscreen=0, menubar=0, status=0, statusbar=0, left='+mx+', top='+my+', width='+pw+', height='+ph);
	popobj.location.href = 'playmedia.php?w='+pw+'&h='+ph+'&type='+tiepe+'&file='+file;
	//popobj.resizeTo(pw + 0, ph + 0);
	popobj.focus();
	return true;
}

function check_url(url) {

	if (url.substr(0,7).toLowerCase() != "http://") {
		if (url.substr(0,3).toLowerCase() == "www") url = "http://" + url;
	}

	return url;
}

// ==================================================

function popwin(myurl) {
	pw	= 385;
	ph	= 530;
	mx	= window.top.imgx ? window.top.imgx : (screen.availWidth - pw) / 3;
	my	= window.top.imgy ? window.top.imgy : (screen.availHeight - ph) / 3;
	popobj = window.open(myurl, 'winimg', 'scrollbars=1, resizable=1, fullscreen=0, menubar=0, status=0, statusbar=0, left='+mx+', top='+my+', width='+pw+', height='+ph);
	popobj.focus();
	popobj.resizeTo(pw,ph);
}

function popgo(myurl) {
	window.top.opener.focus();
	window.top.opener.location.href = myurl;
	window.focus();
}

function popgoscroll(mywin, myurl, pw, ph, mayscroll) {
	if (is_ie) { pw += 32; ph += 64; }
	if (is_safari) { pw += 0; ph += 22; mywin += Math.random().toString() }
	mx = (screen.availWidth - pw) / 2;
	my = (screen.availHeight - ph) / 2;
	popobj 	= window.open('', mywin, 'scrollbars='+mayscroll+', resizable=1, fullscreen=0, menubar=0, status=0, statusbar=0, left='+mx+', top='+my+', width='+pw+', height='+ph);
	popobj.location.href = myurl;
	popobj.resizeTo(pw + 0, ph + 0);
	popobj.focus();
	return 1;
}

// ==================================================

function hover(obj, flg) {
	if (flg) {
		getEl(obj).style.textDecoration = 'none';
	} else {
		getEl(obj).style.textDecoration = 'underline';
	}
}

// ================================================
//	Help functies 8 mei 2002
// ================================================

function getmouseXY() {
	bbmx	= window.event.clientX + document.body.scrollLeft;
	bbmy	= window.event.clientY + document.body.scrollTop;
}

// ==================================================
// Window resizer: heeft begx, begy, endx, endy nodig
// ==================================================

function winresize() {
	iray = 1 - rray[rtel];
	curw = begw * iray + finw * rray[rtel];
	curh = begh * iray + finh * rray[rtel];
	window.resizeTo(Math.floor(curw), Math.floor(curh));
	rtel++;
	if (rtel >= rray.length) clearInterval(rzid);
}

function getyoff() {
	if (is_safari) 	return window.pageYOffset;
	if (is_ie) 		return document.body.scrollTop;
}

function setyoff(yoff) {
	if (is_safari) 	window.pageYOffset = yoff;
	if (is_ie) 		document.body.scrollTop = yoff;
}
