function getCookie(name)
{
	var dc = document.cookie;
    var prefix = name + "=";
    var begin = dc.indexOf("; " + prefix);
    if (begin == -1)
    {
        begin = dc.indexOf(prefix);
        if (begin != 0) return null;
    }
    else
    {
        begin += 2;
    }
    var end = document.cookie.indexOf(";", begin);
    if (end == -1)
    {
        end = dc.length;
    }
    return unescape(dc.substring(begin + prefix.length, end));
}

function getCookieKey(name,key) {
	var cookie;
	cookie = getCookie(name);
	if (cookie != null) {
		var prefix = key + "=";
	    var begin = cookie.indexOf("&" + prefix);
	    if (begin == -1)
	    {
	        begin = cookie.indexOf(prefix);
	        if (begin != 0) return null;
	    }
	    else
	    {
	        begin += 1;
	    }
	    var end = cookie.indexOf("&", begin);
	    if (end == -1)
	    {
	        end = cookie.length;
	    }
	    return unescape(cookie.substring(begin + prefix.length, end));
	}
	else {
		return null;
	}
}

function updateClientStats() {
	var url;
	var c;
	if (getCookieKey('NetOffice','UpdateClientStats') == '1') {
		url = 'updateclientstats.asp?';
		url += 'r=' + screen.width + 'x' + screen.height + '&';
		if (navigator.appName != 'Netscape') {c=screen.colorDepth;}
		else {c=screen.pixelDepth;}
		url += 'c=' + c;
		var plaatje1 = new Image()
		plaatje1.src = url;// url oproepen
		// cookie bijwerken
		document.cookie = document.cookie.replace('UpdateClientStats=1','UpdateClientStats=0');
	}	
}	
updateClientStats();

function whatbrowser() {
       if(!document.all && document.getElementById){
             myBrowser="NN6";
        }
       if(document.all){
             myBrowser="ie";
        }
        if(document.layers){
            myBrowser="NN4";
        }     
}
var myBrowser = whatbrowser;
var keepHilite = false;
var timer;

// browser and platform styles check
if ((navigator.userAgent.indexOf("Mac") != -1)){
	if (navigator.appName.indexOf('Netscape') != -1) {document.write("<link rel='stylesheet' href='styles/style_ie.css'>")}
	else {document.write("<link rel='stylesheet' href='styles/style_ie.css'>")};
};
if (navigator.userAgent.indexOf('Win') != -1){ 
	if (navigator.appName.indexOf('Netscape') != -1) {document.write("<link rel='stylesheet' href='styles/style_ns.css'>")}
	else {document.write("<link rel='stylesheet' href='styles/style_ie.css'>")};
}

function MM_openBrWindow(imageID,Beschrijving) { //v2.0
  //window.open(theURL,winName,features);
  test = window.open('','','menubar=yes,scrollbars=yes,resizable=yes,width=740,height=500');
  test.document.write('<html><head><title>Afbeelding</title></head><body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">');
  test.document.write('<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0"><tr><td align="center" valign="middle">');
  test.document.write('<img src="showpicture.asp?vid='+ imageID +'" border="0" alt="'+ Beschrijving +'">');
  test.document.write('</td></tr></table>');
  test.document.write('</body></html>');
} 

function openNewWindow(URL) {
	window.open(URL,'','');
}

function MM_hideSortering() {
	clearTimeout(timer);
	timer = null;
	timer = setTimeout("MM_showHideSortering('hide')",300);
}

function MM_showHideSortering(what) {
	clearTimeout(timer);
	timer = null;
	if (keepHilite) {return};
	if (myBrowser == "ie") {
		if (what == "show") {
			sorteermenu.style.visibility = "visible";
			sorteerknop.style.backgroundColor = "#FFFFFF";
		}
		else {
			sorteermenu.style.visibility = "hidden";
			sorteerknop.style.backgroundColor = "#E0E0E6";
		}
	}
	else {
		if (myBrowser == "NN4") {
			if (what == "show") {
				document.sorteermenu.visibility = "show";
				document.sorteerknop.backgroundColor = "#FFFFFF";
			}
			else {
				document.sorteermenu.visibility = "hide";
				document.sorteerknop.backgroundColor = "#E0E0E6";
			}
		}
		else {
			if (what == "show") {
				document.getElementById("sorteermenu").style.visibility = "visible";
				document.getElementById("sorteerknop").style.backgroundColor = "#FFFFFF";
			}
			else {
				document.getElementById("sorteermenu").style.visibility = "hidden";
				document.getElementById("sorteerknop").style.backgroundColor = "#E0E0E6";
			}
		}
	}
}

function settextScrollBox(hoogte, scrollboxhoogte) {
	if (document.body.clientHeight <= hoogte) {
		return 0;
	}
	
	if (myBrowser == "ie") {
		scrollBox.style.height = (document.body.clientHeight - hoogte) + "px";
		if (scrollBox.style.height <= scrollboxhoogte) {
			scrollBox.style.height = scrollboxhoogte + "px";	
		}
		scrollBox.style.width = document.body.clientWidth;
	}
	else {
		if (myBrowser == "NN4") {
			document.scrollBox.height = (document.body.clientHeight - hoogte) + "px";
			if (document.scrollBox.height <= scrollboxhoogte) {
				document.scrollBox.height = scrollboxhoogte + "px";	
			}
			document.scrollBox.width = document.body.clientWidth;
		}
		else {
			document.getElementById("scrollBox").style.height = (document.body.clientHeight - hoogte) + "px";
			if (document.getElementById("scrollBox").style.height <= scrollboxhoogte) {
				document.getElementById("scrollBox").style.height = scrollboxhoogte + "px";	
			}
			document.getElementById("scrollBox").style.width = document.body.clientWidth;
		}
	}
}