/* Event Right */
function right(e){
	if(navigator.appName=='Netscape'&& (e.which==3||e.which==2)) return false;
	else if(navigator.appName=='Microsoft Internet Explorer'&& (event.button==2||event.button==3)) {
		alert("© Copyright www.dszgejo.be");
		return false;
	}
	return true;
}
document.onmousedown=right;
document.onmouseup=right;
if(document.layers)window.captureEvents(Event.MOUSEDOWN);
if(document.layers)window.captureEvents(Event.MOUSEUP);
window.onmousedown=right;
window.onmouseup=right;

/* Selectbox link maker */
function checkMenu(param) {
	window.location = param;
}

/* Selectbox linker score insert */
function linkSelectbox() {
	score_insert_form.select_geslacht.selectedIndex = score_insert_form.select_naam.selectedIndex;
	var i = score_insert_form.select_geslacht.selectedIndex;
	score_insert_form.hidden_geslacht.value = score_insert_form.select_geslacht[i].value;
}

/* Opens a resizing window */
function PopupPic(sPicURL) { 
	window.open("site_image_popup.php?"+sPicURL, "", "resizable=1,HEIGHT=200,WIDTH=200");
}

/* Opens a popup window */
function popupimage(mylink, windowname)
{
	if (! window.focus)return true;
	var href;
	if (typeof(mylink) == 'string')
	href=mylink;
	else
	href=mylink.href;
	window.open(href, windowname, 'width=320,height=330,scrollbars=no,top=200, left=200');
	return false;
}

function popupaanzicht(mylink, windowname)
{
	if (! window.focus)return true;
	var href;
	if (typeof(mylink) == 'string')
	href=mylink;
	else
	href=mylink.href;
	window.open(href, windowname, 'width=420,height=286,scrollbars=no,top=200, left=200');
	return false;
}

function popupchart(mylink, windowname)
{
	if (! window.focus)return true;
	var href;
	if (typeof(mylink) == 'string')
	href=mylink;
	else
	href=mylink.href;
	window.open(href, windowname, 'width=450,height=350,scrollbars=no,top=200, left=200');
	return false;
}

/*
* this function parses comma separated name=value argument pairs from
* the querystring of the URL and stores them as properties of an object
* which it returns
*/
function getArgs(){
	var args = new Object();
	var query = location.search.substring(1);
	var pairs = query.split("&");
	for (var i=0; i < pairs.length; i++){
		var pos = pairs[i].indexOf('=');
		if (pos == -1) continue;
		var argname = pairs[i].substring(0,pos);
		var value = pairs[i].substring(pos+1);
		args[argname] = unescape(value);
	}
	return args;
}

/* Adds a name=value pair to a URL in string format and returns that string */
function AppendURL(strURL, strName, strValue)
{
	var I, I2;
	I = strURL.indexOf("?" + strName);
	if (I >= 0)
	{
		I2 = strURL.indexOf("&", I+1);
		if (I2 == -1)
			I2 = strURL.length;
		strURL = strURL.substring(0, I) + "?" + strName + "=" + escape(strValue) +
				 strURL.substring(I2, strURL.length);
	}
	else
	{
		I = strURL.indexOf("&" + strName, I+1);
		if (I >= 0)
		{
			I2 = strURL.indexOf("&", I+1);
			if (I2 == -1)
				I2 = strURL.length;
			strURL = strURL.substring(0, I) + "&" + strName + "=" + escape(strValue) +
					 strURL.substring(I2, strURL.length);
		}		
		else
			strURL += (strURL.indexOf("?") == -1 ? "?" : "&") + strName + "=" +
					  escape(strValue); //OK
	}
	return strURL;
}

// DEBUG TEMP CODE
DEBUGMODE = true;
function zalert(str){
	if (DEBUGMODE){
		alert(str);
	}
}

// SWAP Image function
function movepic(img_name, img_src){
	document[img_name].src=img_src;
}