 	BrowserDetector(navigator.userAgent);


	function jumpToMarker(selection)
	{
		if (selection > 0)
		{
			window.location.hash = selection;
		}
	}
	
	 	
 	function inspectStyle(elm)
 	{
		var str = "";
    		for (var i in elm)
    		{
	  		str += i + ": " + elm.getAttribute(i) + "\n";
		}
		
		document('mainContent').innerHTML = str;
	}
	
	var isDOM = (document.getElementById ? true : false); 
	var isIE = ((document.all && !isDOM) ? true : false);
	var isNS = (document.layers ? true : false);
	var isDyn = (isDOM || isIE4 || isNS4);

	function getRef(id)
	{
 		if (isDOM)
 		{
 			return document.getElementById(id);
 		}
 		if (isIE)
 		{
 			return document.all[id];
 		}
 		if (isNS)
 		{
 			//alert('isNS!');
 			return document.layers[id];
 		}
	}
	
	
	function visibleSubHeight()
	{
		var gapHeight = 5;
		lh = getRef('logo').offsetHeight + gapHeight;				// logo-height
		sh = getRef('subMenu').offsetHeight + gapHeight;			// subMenu-height
		lbh = getRef('languageBar').offsetHeight + gapHeight;			// languageBar-height
		uh = getRef('updates').offsetHeight + gapHeight;			// updates-height
		
		tmh = getRef('topMenu').offsetHeight + gapHeight;			// topMenu-height
		mch = getRef('mainContent').offsetHeight + gapHeight;			// mainContent-height
		vh = getRef('voetTekst').offsetHeight;					// voetTekst-height
		
		if (getRef('pollAndShopList'))
		{
			ph = getRef('pollAndShopList').offsetHeight;			// poll-height
		}
		else
		{	
			ph = 0;
		}
		
		if (getRef('uitslag'))
		{
			ush = getRef('uitslag').offsetHeight;				// uitslag-height
		}
		else
		{	
			ush = 0;
		}
		
		
		lkh = lh + sh + lbh + uh + ph + ush;		//LinkerKolomHoogte
		rkh = tmh + mch + vh;				//RechterKolomHoogte
		
		getRef('fillerColumn').style.height = rkh-lkh;
		//alert("totale hoogte van logo, submenu, languagebar, update en poll of uitslag: \n" + lkh + " pixels");
		//alert("totale hoogte van topmenu, maincontent en voettekst: \n" + rkh + " pixels");
		//alert(getRef('pollAndShopList').style.display);
	}


	function setPollHeight()
	{
		var poll = getRef('pollAndShopList');
		var mainContentHeight = getRef('mainContent').clientHeight + 35;
		var pollHeight = mainContentHeight - (visibleSubHeight() + subCorrection);
		var subCorrection = 0;
		
		if (isIE || isDOM)
		{
			subCorrection = 10;
		}	
	
		poll.clientHeight = pollHeight + 'px';
	}
	
	
	function inspect(elm)
	{
  		var str = "";
  		
  		for (var i in elm)
  		{
    			str += i + ": " + elm.getAttribute(i) + "\n";
  		}
  		
  		//document.('mainContent').innerHTML = str;
  		alert(str);
	}


 	function chooseStyleSheet(prefix)
	{
		// prefix kan leeg of '../' zijn
		if (navigator.userAgent.indexOf('MSIE') > 0)  //mogelijke browsers: IE en Opera
    		{
    			document.write('<link rel="stylesheet" href=' + prefix + '"styles/stylesIE.css" />');
      		}
    		else
    		{
    			document.write('<link rel="stylesheet" href=' + prefix + '"styles/stylesNS.css" />');
    		}
 	}
	
	var leftPos;
	var topPos;
	
	function positionWindow(windowWidth, windowHeight)
	{
		x = screen.width;
		y = screen.height;
		
		leftPos = (x - windowWidth) / 2
		topPos = (y - windowHeight) / 2
		//alert('Screen width: ' + x + ', screen.height: ' + y);
	}
	
	function openMedia(optredenId, whichHash)
	{
		//605, 550
		winWidth = 605;
		winHeight = 550;
		
		positionWindow(winWidth, winHeight);
		window.open('media.asp?id=' + optredenId + '#' + whichHash, 'Media', 'width=' + winWidth + ',height=' + winHeight + ',left='+leftPos+',top='+topPos+',status=no,toolbar=no,menubar=no,resizable=no,directories=no,scrollbars=yes');		
	}

	
	function openBestelling()
	{
		winWidth = 605;
		winHeight = screen.height - 75;
		
		positionWindow(winWidth, winHeight);
		window.open('bestelling.asp', 'Bestelling', 'width=' + winWidth + ',height=' + winHeight + ',left='+leftPos+',top='+topPos+',status=no,toolbar=no,menubar=no,resizable=no,directories=no,scrollbars=yes');		
	}


	function openDetails(artikelId)
	{
		winWidth = 500;
		winHeight = 500;
		
		positionWindow(winWidth, winHeight);
		window.open('Details.asp?id=' + artikelId, 'Details', 'width=' + winWidth + ',height=' + winHeight + ',left='+leftPos+',top='+topPos+'status=no,toolbar=no,menubar=no,resizable=no,directories=no,scrollbars=yes');		
	}


	function openDisclaimer(pathPrefix)
	{
		winWidth = 520;
		winHeight = 520;
		
		positionWindow(winWidth, winHeight);
		window.open(pathPrefix + 'Disclaimer.asp', 'Disclaimer', 'width=' + winWidth + ',height=' + winHeight + ',left='+leftPos+',top='+topPos+'status=no,toolbar=no,menubar=no,resizable=no,directories=no,scrollbars=yes');		
	}


	function openAudioStream(id)
	{
		winWidth = 300;
		winHeight = 125;

		positionWindow(winWidth, winHeight);
		window.open('AudioStream.asp?nummerId=' + id, 'Beluisteren', 'width=' + winWidth + ',height=' + winHeight + ',left='+leftPos+',top='+topPos+'status=no,toolbar=no,menubar=no,resizable=no,directories=no,scrollbars=no');		
	}


	function setStyle(obj,style,value)
	{
		alert(getRef(obj).style[style]);
		getRef(obj).style[style]= value;
	}
	
	
	function getRef(obj){
		return (typeof obj == "string") ? document.getElementById(obj) : obj;
	}
/*
	BrowserDetector()
	Parses User-Agent string into useful info.

	Source: Webmonkey Code Library
	(http://www.hotwired.com/webmonkey/javascript/code_library/)

	Author: Richard Blaylock
	Author Email: blaylock@wired.com

	Usage: var bd = new BrowserDetector(navigator.userAgent);
*/


	// Utility function to trim spaces from both ends of a string
	function Trim(inString)
	{
  		var retVal = "";
  		var start = 0;
  		
  		while ((start < inString.length) && (inString.charAt(start) == ' '))
  		{
    			++start;
  		}
  
  		var end = inString.length;
  		
  		while ((end > 0) && (inString.charAt(end - 1) == ' '))
  		{
    			--end;
  		}
  		
  		retVal = inString.substring(start, end);
  		return retVal;
	}



	function BrowserDetector(ua)
	{

		// Defaults
	  	this.browser = "Unknown";		//Netscape, Lynx, IE, Opera
  		this.platform = "Unknown";
  		this.version = "";
  		this.majorver = "";
  		this.minorver = "";

  		uaLen = ua.length;

		// ##### Split into stuff before parens and stuff in parens
  		var preparens = "";
  		var parenthesized = "";

  		i = ua.indexOf("(");
  		
  		if (i >= 0)
  		{
    			preparens = Trim(ua.substring(0,i));
        		parenthesized = ua.substring(i+1, uaLen);
        		j = parenthesized.indexOf(")");
        		
        		if (j >= 0)
        		{
          			parenthesized = parenthesized.substring(0, j);
        		}
  		}
  		else
  		{
    			preparens = ua;
  		}

		// ##### First assume browser and version are in preparens
		// ##### override later if we find them in the parenthesized stuff
  		var browVer = preparens;
  		var tokens = parenthesized.split(";");
  		var token = "";

		// # Now go through parenthesized tokens
  		for (var i=0; i < tokens.length; i++)
  		{
    			token = Trim(tokens[i]);
        		//## compatible - might want to reset from Netscape
        		
        		if (token == "compatible")
        		{
          			//## One might want to reset browVer to a null string
          			//## here, but instead, we'll assume that if we don't
          			//## find out otherwise, then it really is Mozilla
          			//## (or whatever showed up before the parens).
        			//## browser - try for Opera or IE
    			}
        		else if (token.indexOf("MSIE") >= 0)
        		{
      				browVer = token;
    			}
    			else if (token.indexOf("Opera") >= 0)
    			{
      				browVer = token;
    			}
        		//'## platform - try for X11, SunOS, Win, Mac, PPC
    			else if ((token.indexOf("X11") >= 0) || (token.indexOf("SunOS") >= 0) || (token.indexOf("Linux") >= 0))
    			{
      				this.platform = "Unix";
        		}
    			else if (token.indexOf("Win") >= 0)
    			{
      				this.platform = token;
        		}
    			else if ((token.indexOf("Mac") >= 0) || (token.indexOf("PPC") >= 0))
    			{
      				this.platform = token;
        		}
  		}

  		var msieIndex = browVer.indexOf("MSIE");
  		
  		if (msieIndex >= 0)
  		{
    			browVer = browVer.substring(msieIndex, browVer.length);
  		}

  		var leftover = "";
  		
  		if (browVer.substring(0, "Mozilla".length) == "Mozilla")
  		{
    			this.browser = "Netscape";
        		leftover = browVer.substring("Mozilla".length+1, browVer.length);
  		}
  		else if (browVer.substring(0, "Lynx".length) == "Lynx")
  		{
    			this.browser = "Lynx";
        		leftover = browVer.substring("Lynx".length+1, browVer.length);
  		}
  		else if (browVer.substring(0, "MSIE".length) == "MSIE")
  		{
    			this.browser = "IE";
    			leftover = browVer.substring("MSIE".length+1, browVer.length);
  		}
  		else if (browVer.substring(0, "Microsoft Internet Explorer".length) == "Microsoft Internet Explorer")
  		{
    			this.browser = "IE"
        		leftover = browVer.substring("Microsoft Internet Explorer".length+1, browVer.length);
  		}
  		else if (browVer.substring(0, "Opera".length) == "Opera")
  		{
    			this.browser = "Opera"
    			leftover = browVer.substring("Opera".length+1, browVer.length);
  		}

  		leftover = Trim(leftover);

  		// # Try to get version info out of leftover stuff
  		i = leftover.indexOf(" ");
  	
  		if (i >= 0)
  		{
    			this.version = leftover.substring(0, i);
  		}
  		else
  		{
    			this.version = leftover;
  		}
  		
  		j = this.version.indexOf(".");
  		
  		if (j >= 0)
  		{
    			this.majorver = this.version.substring(0,j);
    			this.minorver = this.version.substring(j+1, this.version.length);
  		}
  		else
  		{
    			this.majorver = this.version;
  		}
	}
	// function BrowserCap