
function getE(id) { return document.getElementById(id); }

function showhide_qm()
{
    if(getE('quickmenu').style.display == '')
    {
        getE('quickmenu').style.display = 'none';
        eraseCookie('quickmenu');
    }
    else
    {
        getE('quickmenu').style.display = '';
        createCookie('quickmenu','show','1500');

    }
}

function readCookie(name) {
    var nameEQ = name + "=";
    var ca = document.cookie.split(';');
    for(var i=0;i < ca.length;i++) {
        var c = ca[i];
        while (c.charAt(0)==' ') c = c.substring(1,c.length);
        if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
    }
    return null;
}

function createCookie(name,value,days) {
    if (days) {
        var date = new Date();
        date.setTime(date.getTime()+(days*24*60*60*1000));
        var expires = "; expires="+date.toGMTString();
    }
    else var expires = "";
    document.cookie = name+"="+value+expires+"; path=/";
}

function eraseCookie(name) {
    createCookie(name,"",-1);
}




function show_submenu(id)
{
	clear_sub_timeout();
	var oSub = document.getElementById(id);
	if(oSub) oSub.style.display = 'block';
}

function hide_submenu(id,oTime)
{
	if(typeof oTime == 'undefined') oTime = 1000;
	oSub = document.getElementById(id);
	if(oSub) oHideTimer = setTimeout("hide_it()",oTime);
}

function clear_sub_timeout() { 	if(typeof oHideTimer != 'undefined') clearTimeout(oHideTimer); }

function hide_it() { oSub.style.display = 'none';}

function hide_all_subs()
{
	for(i=0;i<oSubmenu_array.length;i++)
	{
		var oSub = document.getElementById(oSubmenu_array[i]);
		if(oSub) oSub.style.display = 'none';
	}
}


function showhide(id)
{
	t = document.getElementById(id);
	if(t.style.display == 'none') t.style.display = '';
	else t.style.display = 'none';
}

function show_parent_nodes(oSub,level)
{
	for(i=0;i<level;i++)
	{
		oSub = oSub.parentNode;
		oSub.style.display = '';
	}
}

function top_offset(oThis,oTarget_id,topOffset)
{
	if(!oThis.currentStyle)
	{
		oTopMargin = oThis.offsetHeight * topOffset;
		document.getElementById(oTarget_id).style.marginTop = oTopMargin;
	}
}

var flash_id = 1;
//document.write('<script src="../swfobject.js" type="text/javascript"></script>');
if(typeof oActive_insert == 'undefined') oActive_insert 	= new Object();
oActive_insert 	= function (src,type,width,height,params)
{
	this.oSrc 		= src;
	this.oType		= type;
	this.oWidth		= width;
	this.oHeight		= height;
	this.oParams		= params;

	if(this.oParams == '' || this.oParams == undefined) this.oParams = ' wmode="transparent" ';
	this.init		= function()
	{
		 this.oHTML 		= ''; // reset the html
		if(this.oParams == '' || typeof(this.oParams) == 'undefined') 	this.oParams = 'autoplay=\"0\" autostart=\"0\"';
		if(this.oType == 'swf') this.getswf();
		if(this.oType == 'mov') this.getmov();
		if(this.oType == 'avi') this.getmov();
		if(this.oType == 'dcr') this.getdcr();
		if(this.oType == 'mpeg' || this.oType == 'mpg') this.getmpeg();
		if(this.oType == 'wmv') this.getwmv();
		document.write(this.oHTML);
	}

	/*this.getswf = function()
	{
      this.id = 'f_' + flash_id;
  	  document.write('<div id="'+this.id+'" style="height:100%;width:100%;"></div>');

      flash_id++;
      var so = new SWFObject(this.oSrc, "id", this.oWidth, this.oHeight, "5", "", "high", "", "http://www.adobe.com/go/getflashplayer");
      so.addParam("wmode", "transparent");
      so.write(this.id);
	} */

    this.getswf = function()
    {
        this.oHTML         = '<embed src="'+this.oSrc+'" '+ this.oParams +' pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="'+this.oWidth+'" height="'+this.oHeight+'" />';
    }



	this.getmov = function()
	{
        this.oHTML 		= '  <embed src="'+this.oSrc+'" '+ this.oParams +' pluginspage="http://www.apple.com/quicktime/download/" type="video/quicktime" width="'+this.oWidth+'" height="'+this.oHeight+'" />';
	}

	this.getmpeg = function()
	{
        this.oHTML 		= '  <embed src="'+this.oSrc+'" '+ this.oParams +' pluginspage="http://www.microsoft.com/mac/otherproducts/otherproducts.aspx?pid=windowsmedia" type="video/quicktime" width="'+this.oWidth+'" height="'+this.oHeight+'" />';
	}

	this.getwmv = function()
	{
		this.oSrc = this.oSrc.replace("../../userfiles/",oAbspath+"userfiles/"); // op de een of andere manier werkt wmv alleen met absoluut pad
        this.oHTML 		= '  <embed src="'+this.oSrc+'" '+ this.oParams +' width="'+this.oWidth+'" height="'+this.oHeight+'" />';
	}

	this.getdcr = function()
	{
		this.oSrc = this.oSrc.replace("../../userfiles/",oAbspath+"userfiles/"); // op de een of andere manier werkt wmv alleen met absoluut pad
        this.oHTML 		= '  <embed '+ this.oParams +' src="'+this.oSrc+'" '+ this.oParams +' width="'+this.oWidth+'" height="'+this.oHeight+'" />';
        this.oHTML 		= '	<OBJECT CLASSID="clsid:166B1BCA-3F9C-11CF-8075-444553540000"  CODEBASE="http://active.macromedia.com/director/cabs/sw.cab" WIDTH="'+this.oWidth+'" HEIGHT="'+this.oHeight+'" > <PARAM NAME="SRC" VALUE="'+this.oSrc+'"><embed src="'+this.oSrc+'" width="'+this.oWidth+'"  height="'+this.oHeight+'" '+ this.oParams +'> </OBJECT>';
	}

	this.init();
}

function backlink()
{
	oBl = document.getElementById('backlink');
	if(oBl)
	{
		if(window.history.length > 1)
		{
			oBl.style.display = '';
		}
	}

}

window.setTimeout('backlink()',400);

function getWindowWidth() {
	var windowWidth = 0;
	if (typeof(window.innerWidth) == 'number') {
		windowWidth = window.innerWidth;
	}
	else {
		if (document.documentElement && document.documentElement.clientWidth) {
			windowWidth = document.documentElement.clientWidth;
		}
		else {
			if (document.body && document.body.clientWidth) {
				windowWidth = document.body.clientWidth;
			}
		}
	}
	return windowWidth;
}


function getWindowHeight() {
	var windowHeight = 0;
	if (typeof(window.innerHeight) == 'number') {
		windowHeight = window.innerHeight;
	}
	else {
		if (document.documentElement && document.documentElement.clientHeight) {
			windowHeight = document.documentElement.clientHeight;
		}
		else {
			if (document.body && document.body.clientHeight) {
				windowHeight = document.body.clientHeight;
			}
		}
	}
	return windowHeight;
}




/**
* Function : dump()
* Arguments: The data - array,hash(associative array),object
*    The level - OPTIONAL
* Returns  : The textual representation of the array.
* This function was inspired by the print_r function of PHP.
* This will accept some data as the argument and return a
* text that will be a more readable version of the
* array/hash/object that is given.
*/
function dump(arr,level) {
var dumped_text = "";
if(!level) level = 0;

//The padding given at the beginning of the line.
var level_padding = "";
for(var j=0;j<level+1;j++) level_padding += "    ";

if(typeof(arr) == 'object') { //Array/Hashes/Objects
 for(var item in arr) {
  var value = arr[item];

  if(typeof(value) == 'object') { //If it is an array,
   dumped_text += level_padding + "'" + item + "' ...\n";
   dumped_text += dump(value,level+1);
  } else {
   dumped_text += level_padding + "'" + item + "' => \"" + value + "\"\n";
  }
 }
} else { //Stings/Chars/Numbers etc.
 dumped_text = "===>"+arr+"<===("+typeof(arr)+")";
}
return dumped_text;
}









/*
    Developed by Robert Nyman, http://www.robertnyman.com
    Code/licensing: http://code.google.com/p/getelementsbyclassname/
*/
var getElementsByClassName = function (className, tag, elm){
    if (document.getElementsByClassName) {
        getElementsByClassName = function (className, tag, elm) {
            elm = elm || document;
            var elements = elm.getElementsByClassName(className),
                nodeName = (tag)? new RegExp("\\b" + tag + "\\b", "i") : null,
                returnElements = [],
                current;
            for(var i=0, il=elements.length; i<il; i+=1){
                current = elements[i];
                if(!nodeName || nodeName.test(current.nodeName)) {
                    returnElements.push(current);
                }
            }
            return returnElements;
        };
    }
    else if (document.evaluate) {
        getElementsByClassName = function (className, tag, elm) {
            tag = tag || "*";
            elm = elm || document;
            var classes = className.split(" "),
                classesToCheck = "",
                xhtmlNamespace = "http://www.w3.org/1999/xhtml",
                namespaceResolver = (document.documentElement.namespaceURI === xhtmlNamespace)? xhtmlNamespace : null,
                returnElements = [],
                elements,
                node;
            for(var j=0, jl=classes.length; j<jl; j+=1){
                classesToCheck += "[contains(concat(' ', @class, ' '), ' " + classes[j] + " ')]";
            }
            try    {
                elements = document.evaluate(".//" + tag + classesToCheck, elm, namespaceResolver, 0, null);
            }
            catch (e) {
                elements = document.evaluate(".//" + tag + classesToCheck, elm, null, 0, null);
            }
            while ((node = elements.iterateNext())) {
                returnElements.push(node);
            }
            return returnElements;
        };
    }
    else {
        getElementsByClassName = function (className, tag, elm) {
            tag = tag || "*";
            elm = elm || document;
            var classes = className.split(" "),
                classesToCheck = [],
                elements = (tag === "*" && elm.all)? elm.all : elm.getElementsByTagName(tag),
                current,
                returnElements = [],
                match;
            for(var k=0, kl=classes.length; k<kl; k+=1){
                classesToCheck.push(new RegExp("(^|\\s)" + classes[k] + "(\\s|$)"));
            }
            for(var l=0, ll=elements.length; l<ll; l+=1){
                current = elements[l];
                match = false;
                for(var m=0, ml=classesToCheck.length; m<ml; m+=1){
                    match = classesToCheck[m].test(current.className);
                    if (!match) {
                        break;
                    }
                }
                if (match) {
                    returnElements.push(current);
                }
            }
            return returnElements;
        };
    }
    return getElementsByClassName(className, tag, elm);
};



