/* Browser Detection Script begins here. */ 
/* The variable theDOM1 will be true for modern browsers. */
	var theDOM1 = (document.getElementById) ? true : false;

/* theApp will contain the browser name */
	var theApp = navigator.appName.toLowerCase();

/* UA (user agent) contains detailed browser info. For example,
	UA for Internet Explorer on Mac would be 'mozilla/4.0
	
(compatible; msie 5.0; mac_powerpc)' */
	var UA = navigator.userAgent.toLowerCase();

/* variables for the two major browsers in existence today. */
	var isIE = (UA.indexOf('msie') >= 0) ? true : false;
	var isNS = (UA.indexOf('mozilla') >= 0) ? true : false;

/* 'compatible' text string is only in non-Netscape browsers */
	if (UA.indexOf('compatible')>0)
	{
		isNS = false;
	}

/* platform */
	var thePlatform = navigator.platform.toLowerCase();
	var isMAC = (UA.indexOf('mac') >= 0) ? true : false;
	var isWIN = (UA.indexOf('win') >= 0) ? true : false;

/* Most UNIX users use X-Windows so this detects UNIX most of
the time.*/
	var isUNIX = (UA.indexOf('x11') >= 0) ? true : false;

/* browser version */
	var version = navigator.appVersion;
	var isMajor = parseInt( version );

/* Internet Explorer version 5 on the Mac reports itself as
	version 4. This code corrects the problem. */
	
	if(isIE && isMAC) 
	{
		if(UA.indexOf("msie 5")) 
		{
			isMajor = 5;
			var stringLoc = UA.indexOf("msie 5");
			version = UA.substring(stringLoc + 5, stringLoc + 8);
		}
	}
	
/* Internet Explorer version 6 on Windows reports itself as
	version 4. This code corrects the problem. */
	
	if(isIE && isWIN) 
	{
		if(UA.indexOf("msie 6")) 
		{
			isMajor = 6;
			var stringLoc = UA.indexOf("msie 6");
			version = UA.substring(stringLoc + 5, stringLoc + 8);
		}
		if(UA.indexOf("msie 5.5")) 
		{
			isMajor = 5;
			var stringLoc = UA.indexOf("msie 5.5");
			version = UA.substring(stringLoc + 5, stringLoc + 8);
		}
	}
	
/* Netscape 6 reports itself as version 5 on all platforms.
	This code corrects the problem. */
	
	if(isNS && isMajor>4) 
	{
		if(UA.indexOf("netscape6")) 
		{
			isMajor = 6;
			var stringLoc = UA.indexOf("netscape6");
			version = UA.substring(stringLoc + 10, stringLoc + 14);
		}
	}
	
var isMinor = parseFloat( version );

/* a function to report browser info */

function getBrowserInfo()
{
	var temp="<p>";
	temp += "User Agent: " + UA + "<br>";
	temp += "Platform: " + thePlatform + "<br>";
	temp += "Macintosh: " + isMAC + "<br>";
	temp += "Windows: " + isWIN + "<br>";
	temp += "Application: " + theApp + "<br>";
	temp += "Version: " + version + "<br>";
	temp += "Don't use this! || Netscape ||: " + isNS + "<br>";

	temp += "Internet Explorer: " + isIE + "<br>";
	temp += "Major Version: " + isMajor + "<br>";
	temp += "Full Version: " + isMinor + "<br>";
	temp += "<br>";
	if (theDOM1)
	{
		temp += "You appear to have a modern browser.<br>";
		temp += "Netscape 6, IE 6, or IE5Mac are recommended.";
	}
	else
	{
		temp += "Alert! Your browser is obsolete.<br>";
		temp += "You may enjoy the Web more if you upgrade.";
	}
	temp +="<\/p>";
	return temp;
}
/* End of browser detection code */

/* Convert object name string or object reference
	into a valid object reference */

function getObj(elementID){
	if (typeof elementID == "string") 
	{
		return document.getElementById(elementID);
	}
	else
	{
		return elementID;
	}
}


/* Object Motion and Position Scripts */
/*This function places a positionable object (obj) in
	three dimensions (x,y, and z).*/

function shiftTo(obj,x,y,z)
{
	var newObj = getObj(obj)
	newObj.style.left = x + "px";
	newObj.style.top = y + "px";
	newObj.style.zIndex = z;
}

/*This function gets the x coordinate of a positionable
	object.*/
	
function getObjX(obj)
{
	return parseInt(getObj(obj).style.left);
}

/*This function gets the y coordinate of a positionable
	object.*/

function getObjY(obj){
	return parseInt(getObj(obj).style.top);
}

/*This function gets the z-index of a positionable object.*/

function getObjZ(obj){
	return parseInt(getObj(obj).style.zIndex);
	}

/*The emptyNode() function loops through the array of child
	nodes and removes each one.*/
	
function emptyNode(elementID){
	var theNode = getObj(elementID);
	for (i=0;i<theNode.childNodes.length;i++){
		theNode.removeChild(theNode.childNodes[i]);
	}
}

/*This function gets the available width of the window.*/

function getAvailableWidth(){
	var theWidth=null;
	/*Netscape uses window.innerWidth */
	if (window.innerWidth) {
		theWidth = window.innerWidth;
	}
	/*IE uses document.body.clientWidth */
	if (document.body.clientWidth) {
		theWidth = document.body.clientWidth;
	}
return theWidth;
}

/*This function gets the available height of the window.
	IE6.0 on Windows has a bug and returns null.*/

function getAvailableHeight(){
	var theHeight = null;
	/*Netscape uses window.innerHeight */
	if (window.innerHeight) {
		theHeight = window.innerHeight;
	}
	/*IE uses document.body.clientHeight */
	if (document.body.clientHeight) {
		theHeight = document.body.clientHeight;
	}
	return theHeight;
}
/*This function sets the total height and width of the window.*/

function setWindowSize(w,h){
	window.resizeTo(w,h);
}

/*This function sets the size of the window to cover all of the
	screen.*/
	
function maximizeWindow(){
	window.moveTo(0,0);
	window.resizeTo(screen.availWidth,screen.availHeight);
}

/* Redirects visitors who are using outdated browsers.*/

function checkDOM(newlocation){
	if (!theDOM1){
		window.location.replace(newlocation);
	}
}

/* This function changes the cursor.
	The second argument is optional. */

function setCursor(cursortype,thisobj){
	if (UA.indexOf("msie 5")>=0){
		if (cursortype == 'pointer') { cursortype='hand'; }
	}
	if (thisobj==null){
		document.body.style.cursor = cursortype;
	}
	else{
		getObj(thisobj).style.cursor = cursortype;
	}
}

/*Set the background color of an object*/

function setBackground(thisobj, color){
	getObj(thisobj).style.background = color;
}

/*Set the text color of an object
	not set yet (???)*/

function setColor(thisobj, color){
	
}

/*Setting the visibility of an object*/

function setVisibility(obj,vis){
	var theObj = getObj(obj);
	if (vis == true || vis=='visible' || vis=='y'){
		theObj.style.visibility = "visible";
	}
	else{
		theObj.style.visibility = "hidden";
	}
}

/*Getting the visibility of an object*/

function isVisible(obj) {
	var theObj = getObj(obj);
	return theObj.style.visibility;
}

/*Setting the display of an object*/

function setDisplay(obj,dis){
	var theObj = getObj(obj);
	if (dis==true || dis=='block' || dis=='y'){
		theObj.style.display = "block";
	}
	else{
		if (dis==false || dis=='n'){
			theObj.style.display = "none";
		}
		else{
			theObj.style.display = dis;
		}
	}
}

/*Getting the display of an object*/

function isDisplayed(obj) {
	var theObj = getObj(obj);
	return theObj.style.display;
}

/*Set the clip region of an object*/

function setClip(obj,top,right,bottom,left){
	var theObj = getObj(obj);
	var r = 'rect('+top+'px,'+right+'px,'+bottom+'px,'+left+'px)';
	theObj.style.clip = r;
}

function showxy(evt){
if (window.event){ evt = window.event; }
	if (evt){
	var pos = evt.clientX + ", " + evt.clientY;
	window.status=pos;
	}
}

function checkModel(evt){
	if (window.event){
		alert("This browser uses the IE4+ event model.");
	}
	else{
		if (evt){
			alert("This browser uses the W3C/Netscape6 event model.");
		}
	}
}

/*Getting the width of an object*/

function getWidth(obj){
	var theObj = getObj(obj);
	if (theObj.clientWidth){
		return parseInt(theObj.clientWidth);
	}
	if (theObj.offsetWidth){
		return parseInt(theObj.offsetWidth);
	}
}

/*Getting the Height of an object*/

function getHeight(obj){
	var theObj = getObj(obj);
	if (theObj.clientHeight){
		return parseInt(theObj.clientHeight);
	}
	if (theObj.offsetHeight){
		return parseInt(theObj.offsetHeight);
	}
}

/*Drag and Drop Script for positioned divs and spans*/
/*Place this in your codelibrary.js file for future use.*/

var maxZdrag = document.getElementsByTagName("div").length;
maxZdrag += document.getElementsByTagName("span").length;
var dragElem=null;
var dragging=false;

function setDrag(evt,elementID){
	dragElem=getObj(elementID);
	startDrag();
}

function startDrag() {
	dragging=true;
	document.onmousemove=dragObj;
	document.onmouseup=dropObj;
}

function dragObj(evt) {
	if (window.event){ evt = window.event; }
		if (evt){
			var x = evt.clientX - parseInt(getWidth(dragElem)/2);
			var y = evt.clientY - parseInt(getHeight(dragElem)/2);
			var z = maxZdrag++;
			shiftTo(dragElem,x,y,z);
			var pos = "drag coordinates are: " + x + ", " + y + ", " + z;
			window.status=pos;
	}
	return false;
}

function dropObj() {
	dragging=false;
	document.onmousemove=null;
	document.onmouseup=null;
	window.status="";
}

/*End Drag and Drop Script*/
/*Utility function to convert decimal to hexadecimal*/

function getHex(base10){
	if (base10>255){base10=255;}
	var hexSet = "0123456789abcdef";
	var theMod = base10 % 16;
	var theRemainder = (base10 - theMod)/16;
	var hexNum = hexSet.charAt(theMod) + "";
	hexNum += hexSet.charAt(theRemainder);
	return hexNum;
}

/*Setting the width of an object*/

function setWidth(obj,w){
	var theObj = getObj(obj);
	theObj.style.width = w + "px";
}

/*Setting the height of an object*/

function setHeight(obj,h){
	var theObj = getObj(obj);
	theObj.style.height = h + "px";
}

/* Code to manipulate values from form objects */

function getRadioValue(formname,radioname){
	var theRadioButtons = document[formname][radioname];
	for (i=0;i<theRadioButtons.length;i++){
		if (theRadioButtons[i].checked){
			return theRadioButtons[i].value;
		}
	}
}

function showRadioValue(formname,radioname,thevalue){
	var theRadioButtons = document[formname][radioname];
	for (i=0;i<theRadioButtons.length;i++){
	var temp = theRadioButtons[i].value;
	if (temp == thevalue){
		theRadioButtons[i].checked = true;
		}
	}
}
function getSelectValue(formname,selectname){
	var theMenu = document[formname][selectname];
	var selecteditem = theMenu.selectedIndex;
	return theMenu.options[selecteditem].value;
}

function showSelectValue(formname,selectname,thevalue){
	var theMenu = document[formname][selectname];
		for (i=0;i<theMenu.options.length;i++){
			var temp = theMenu.options[i].value;
				if (temp == thevalue){
					theMenu.selectedIndex = i;
		}
	}
}

/* End of code to manipulate values from form objects */

/* Beginning of Cookie Code Based on code by Bill Dortch
of hidaho designs who has generously placed it in the public
domain.*/

function SetCookie(name,value,expires,path,domain,secure){
	var temp = name + "=" + escape(value);
	if (expires){
		temp += "; expires=" + expires.toGMTString();
	}
	if (path){
		temp += "; path=" + path;
	}
	if (domain){
		temp += "; domain=" + domain;
	}
	if (secure){
		temp += "; secure";
	}
	document.cookie = temp;
}

function GetCookie(name){
	var arg = name + "=";
	var alen = arg.length;
	var clen = document.cookie.length;
	var i = 0;
	while (i < clen) {
	var j = i + alen;
	if (document.cookie.substring(i,j) == arg){
		return getCookieVal(j);
	}
	i = document.cookie.indexOf(" ", i) + 1;
	if (i == 0) break;
	}
return null;
}

function getCookieVal(offset){
	var endstr = document.cookie.indexOf(";", offset);
	if (endstr == -1){
	endstr = document.cookie.length;
}
return unescape(document.cookie.substring(offset,endstr));
}

function DeleteCookie (name,path,domain) {
	if (GetCookie(name)) {
		var temp = name + "=";
		temp += ((path) ? "; path=" + path : "");
		temp += ((domain) ? "; domain=" + domain : "");
		temp += "; expires=Thu, 01-Jan-70 00:00:01 GMT";
		document.cookie = temp;
	}
}
/* End of Cookie Code */

/* converts days to milliseconds */
function daysToMS(days){
return days * 24 * 60 * 60 * 1000;
}

/* converts weeks to milliseconds */
function weeksToMS(weeks){
return weeks * 7 * 24 * 60 * 60 * 1000;
}

/* converts years to milliseconds */
function yearsToMS(years){
return years * 365.25 * 24 * 60 * 60 * 1000;
}

/* code to open a new window with various features */
var myWindow = null;
function openWin(url,targetname,W,H,L,T,thefeatures) {
	var params = "";
	var nofeatures = "toolbar=0,location=0,directories=0,status=0,";
	nofeatures += "menubar=0,scrollbars=0,resizable=0,copyhistory=0";
	var basicfeatures = "scrollbars=1,resizable=1,menubar=1 ";
	var morefeatures = "toolbar=1,location=1,directories=1,";
	morefeatures += "status=1,copyhistory=1";
	var dimensions = "width=" + W + ",height=" + H;
/* The placement variable contains values for left/top and
screenX/screenY. Use both to ensure compatibility with all
browsers. */
	var placement = "left=" + L + ",top=" + T;
	placement += ",screenX=" + L + ",screenY=" + T;
/* The switch control structure makes decisions that
depend on the value of a variable. In this case the value of the
parameter variable thefeatures determines the value of the
variable params. */
	switch (thefeatures){
	case "none":
	params += nofeatures;
	break;
	case "basic":
	params += basicfeatures;
	break;
	case "full":
	params += basicfeatures + "," + morefeatures;
	break;
	default:
	params += thefeatures;
}
/* Adds the dimensions and placement info to the params
variable. */
	params += "," + dimensions + "," + placement;
/* The window.open() method creates myWindow. */
	myWindow = window.open(url,targetname,params);
}

function closeWin(){
	if (myWindow != null){
		myWindow.close();
		myWindow = null;
	}
}

/**
 * QLIB 1.0 Base Abstract Control
 * Copyright (C) 2002 2003, Quazzle.com Serge Dolgov
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 * http://qlib.quazzle.com
 
 * amen? Riesart
 
 */

function QControl_init(parent, name) {
    this.parent = parent || self;
    this.window = (parent && parent.window) || self;
    this.document = (parent && parent.document) || self.document;
    this.name = (parent && parent.name) ? (parent.name + "." + name) : ("self." + name);
    this.id = "Q";
    var h = this.hash(this.name);
    for (var j=0; j<8; j++) {
        this.id += QControl.HEXTABLE.charAt(h & 15);
        h >>>= 4;
    }
}

function QControl_hash(str) {
    var h = 0;
    if (str) {
        for (var j=str.length-1; j>=0; j--) {
            h ^= QControl.ANTABLE.indexOf(str.charAt(j)) + 1;
            for (var i=0; i<3; i++) {
                var m = (h = h<<7 | h>>>25) & 150994944;
                h ^= m ? (m == 150994944 ? 1 : 0) : 1;
            }
        }
    }
    return h;
}

function QControl_nop() {
}

function QControl() {
    this.init = QControl_init;
    this.hash = QControl_hash;
    this.window = self;
    this.document = self.document;
    this.tag = null;
}
QControl.ANTABLE  = "w5Q2KkFts3deLIPg8Nynu_JAUBZ9YxmH1XW47oDpa6lcjMRfi0CrhbGSOTvqzEV";
QControl.HEXTABLE = "0123456789ABCDEF";
QControl.nop = QControl_nop;
QControl.event = QControl_nop;

/**
 * QLIB 1.0 Preloaded Sound
 * Copyright (C) 2002 2003, Quazzle.com Serge Dolgov
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 * http://qlib.quazzle.com
 
 * Amen! RiesArt
 
**/

function QSound_play(loop) {
    this._out.loop = loop || 0;
    this._out.src = this._buf.src;
}

function QSound_stop() {
    this._out.loop = 0;
    this._out.src = "";
}

function QSound_setVolume(volume) {
    this._out.volume = this.volume = volume;
}
 
function QSound(parent, name, src, volume) {
    this.init(parent, name);
    this.volume = volume || 0;
    this.play = this.stop = this.setVolume = QControl.nop;
    with (this) {
        document.write('<bgsound id="' + id + '" src="" volume="' + volume + '">');
        if (document.all && document.all.item) {
            this._out = document.all.item(id);
            if (_out && (typeof _out.src != "undefined") && (_out.volume === volume)) {
                document.write('<bgsound id="b' + id + '" src="' + src + '" volume="-10000">');
                this._buf = document.all.item("b" + id);
                if (_buf) {
                    this.play = QSound_play;
                    this.stop = QSound_stop;
                    this.setVolume = QSound_setVolume;

                    _out.onreadystatechange = new Function("alert(0)");
                }
            }
        }
    }
}
QSound.prototype = new QControl();

/*
	' Klok ' 
	(c) Richard Knol, 2002 | www.fishjewel.com
*/

	function Datum() 
	{
	
	/*	object Datum met volgende attributen 
		maak een div met id: 'tijdspan'
		maak een javascript-block met daarin 'Datum()' */

		this.datum = new Date();
		
		this.weekDagNr = datum.getDay();
		this.weekDagNaam = setWeekDagNrNaarNaam(weekDagNr);
	
		this.kalenderDagNr = datum.getDate();
		this.timeZone = datum.getTimezoneOffset();
	
		this.maandNr = datum.getMonth();
		this.maandNaam = setMaandNrNaarNaam(maandNr);
	
		this.jaar = datum.getYear();
	
		this.uren = geefTijdWeer(datum.getHours());
		this.minuten =  geefTijdWeer(datum.getMinutes());
		this.secondes =  geefTijdWeer(datum.getSeconds());
		this.millis = datum.getMilliseconds();

		tijd = uren + ":" + minuten + ":" + secondes;

		this.setTimeout("Datum()", wisselVertraging());
		this.display();
	}

	function wisselVertraging()
	{
	/*	functie voor wisselende en willekeurige vertraging */
	
		var delayArray = new Array (50, 80, 130, 210, 340, 560, 900, 1460, 2360, 2820);
		var willeDelay = Math.floor(Math.random(10) * 10);
		var arrayItem = delayArray[willeDelay];
		return arrayItem;		
	}
	
	function setWeekDagNrNaarNaam(weekDagNr) 
	{
	/* functie zorgt voor Nederlandse dag-namen */
	
		var weekDagNamen = new Array(7);
	
		weekDagNamen[0] = "zondag ";
		weekDagNamen[1] = "maandag ";
		weekDagNamen[2] = "dinsdag ";
		weekDagNamen[3] = "woensdag ";
		weekDagNamen[4] = "donderdag ";
		weekDagNamen[5] = "vrijdag ";
		weekDagNamen[6] = "zaterdag ";
		
		for (weekDag = 0; weekDag < 7; weekDag++) {

			weekDagNaam = weekDagNamen[weekDagNr];
		}	
		return weekDagNaam;
	}

	function setMaandNrNaarNaam(maandNr) 
	{
	/*	functie zorgt Nederlandse maand-namen */
	
		var maandNamen = new Array(12);

		maandNamen [0] = "januari ";
		maandNamen [1] = "februari ";
		maandNamen [2] = "maart ";
		maandNamen [3] = "april ";
		maandNamen [4] = "mei ";
		maandNamen [5] = "juni ";
		maandNamen [6] = "juli ";
		maandNamen [7] = "augustus ";
		maandNamen [8] = "september ";
		maandNamen [9] = "oktober ";	
		maandNamen [10] = "november ";
		maandNamen [11] = "december ";
	
		for (maandDag = 0; maandDag < 12; maandDag++) {

			maandNaam = maandNamen [maandNr];
		}
		return maandNaam;	
	}


	function geefTijdWeer (tijdsEenheid) 
	{
	/* funtie zorgt voor voorloop nullen */
	
		if (tijdsEenheid < 10) {
			tijdsEenheid = "0" + tijdsEenheid;
		}
		return tijdsEenheid;
	}
	
	function getInternetTijd () 
	{
	
	/* 
		internetTijd: 
		1/1000 van een dag is 1 "beat"
		1/100 van een "beat" is 1 "tip"
	*/
		var internetTijd = uren* 3600000 + minuten * 60000 + secondes * 1000 + millis;
 		internetTijd = internetTijd + timeZone * 60000 + 3600000;
		
			if (internetTijd < 0) internetTijd += 86400000;
			if (internetTijd >= 86400000) internetTijd -= 86400000;
		
		internetTijd= Math.floor(internetTijd/864);
  
		var voorloopNul="";
		var voorloopNullen="";
		
			if (internetTijd % 100 < 10) 
				voorloopNul = "0";		
			if (internetTijd < 10000) 
				voorloopNullen = "0";
			if (internetTijd < 1000) 
				voorloopNullen = "00";
  
			internetTijd = "@ " + 
			voorloopNullen + 
			Math.floor(internetTijd/100) + " beats : " + 
			voorloopNul + internetTijd%100 +  " tips" ;
			
			return internetTijd;

	//	setTimeout("getInternetTijd()",100);
	}
	
	function wissel()
	{
	/*	functie die in willekeurige vorm een 
		tijds-item laat zien.	
	*/
		
		var intTijd = getInternetTijd();
		var maandWeergave = kalenderDagNr + " " + maandNaam;
		var eenArray = new Array(intTijd, weekDagNaam, maandWeergave, jaar, tijd);
		var willeItem = Math.floor(Math.random(5) * 5);
		var laatDitZien = eenArray[willeItem];
		
		return laatDitZien;
	}
	
	function display() 
	{
	/*	functie die naar het scherm schrijft
		maak in het HTML document een element 
		met als id 'tijdSpan'.
	*/
		
		tijdSpan.innerHTML = wissel();
		
	//	vertraging;
	}

/*	vertraag functie, kunnen gebruikt worden wanneer
	er geen andere vertraaging in he document is.
	
	function timeOut (time) {

		var vertraag = time;
		this.setTimeout("Datum()", vertraag );
	}

	function stopTimeOut (timer)  {

		var stopTimer = timer;
		this.clearTimeout(stopTimer);
	}
*/

/* End of openWin() and closeWin() functions */
/* End of codelibrary.js */



