function initAciveItems(jsActiveMainTab){

		activeMainTab = jsActiveMainTab;

		//set mousedownevent van de verschillende a's
		if($('medium')) {  $('medium').addEvent('mousedown',setMedium); }
		if($('medium')) { $('large').addEvent('mousedown',setLarge); }
		if($('medium')) { $('xlarge').addEvent('mousedown',setXlarge); }

//console.log("jsActiveMainTab: " +jsActiveMainTab);

		//Afhandelen cookie informatie 51 52 98 398
		if ((jsCurrentPageID == 51) || (jsCurrentPageID == 52) || (jsCurrentPageID == 98) || (jsCurrentPageID == 398)){
			//Gebruiker komt direct op deze pagina, opslaan in cookie
			activeMainTab = jsCurrentPageID;

			if ((jsCurrentPageID == 51) || (jsCurrentPageID == 52)) jsCurrentPageID = 96;
			if (jsCurrentPageID == 98) jsCurrentPageID = 53;
			rootId = jsCurrentPageID;
		}
		else if (jsCurrentPageID == 329){ ///Henschotermeer
			activeMainTab = jsCurrentPageID;
			rootId = jsCurrentPageID;
		}
		else{
			//Gebruiker is niet op een homepage. Laden van cookie
			rootId = getCookie("rootid");

			//Als roodId leeg is dan the activeMainTab als rootId setten, activeMainTab wordt in config geset
			if((rootId == null)||(rootId == ""))rootId = activeMainTab;
			activeMainTab = rootId;

			//Diverse uitzonderingen maken voor PSA Amersfoort
				if ((rootId == 51) || (rootId == 52)) rootId = 96;
				if (rootId == 98)  rootId = 53;
		}

		//Level 2/3
		if($("submenu"+jsParentPageID)){
			if($("submenu"+jsParentPageID).className == "level2"){
				//alert("2-3 - 4 || " + jsParentPageID);
				createLevel4(jsParentPageID);
			}

			$("a"+jsParentPageID).className = 'active';
			$("a"+jsParentPageID).style.cursor = 'default';
		}

		//Level 4
		if($("submenu"+jsParentPageID)){
			if($("submenu"+jsParentPageID).className == "level3"){
				//alert("4 || " + jsParentPageID);
				//Id 157 is van 'soorten vergunningen'
				createLevel4(157);
				$("a174").className = 'active';
			}
		}
		if ($("a"+jsCurrentPageID)){
			$("a"+jsCurrentPageID).className = 'active';
			$("a"+jsCurrentPageID).style.cursor = 'default';
		}

//console.log("activeMainTab: " + activeMainTab);

		//Main tabs active maken en class setten == STYLEN
		if (activeMainTab == 98){
			//Specifiek voor PSA amersfoort
			if ($("a"+activeMainTab)) $("a"+activeMainTab).className = 'activebreed';
		}	else if (activeMainTab == 398){
			//Specifiek voor PSA amersfoort
			if ($("a"+activeMainTab)) $("a"+activeMainTab).className = 'activebreed_2';
		}
		else{
			//Specifiek voor PSA amersfoort
			if ($("a98")){$("a98").className = 'breed';}
			if ($("a398")){$("a398").className = 'breed_2';}

			//Algemeen
			if((activeMainTab != "")&&($("a"+activeMainTab))){$("a"+activeMainTab).className = 'active';}
		}

		//Footer menu verplaatsen
		if($("footer")){
			var written = true;

			//De eerste a een andere class geven
			var x = $("footer").getElementsByTagName('a');
			for (var i=0;i<x.length;i++)
			{
				if (written && x[i].parentNode.nodeName == 'LI'){
					x[i].className = 'first';
					written = false;
				}
			}
		}

	function createLevel4(id){
		//Fourth level menu
		$("vertMenuLeft").innerHTML = $("submenu"+id).innerHTML;
		$("leftmenu").style.display = "block";
		if ($("submenu"+id)!=null){
			removeChilds("submenu"+id);
		}
	};

	function copyAndRemove(idCopyAndRemove){
			$('nav').innerHTML = $("submenu"+idCopyAndRemove).innerHTML;
			removeChilds("submenu"+idCopyAndRemove);
	};

	function removeChilds(id){
		obj = document.getElementById(id);
		nodelist = obj.childNodes;
		c = nodelist.length;
		for(i = 0; i < c; i++){
			this_node = nodelist[0];
			removed_node = obj.removeChild(this_node);
		}
		while(obj.hasChildNodes() == true){
			obj.removeChild(obj.childNodes[0]);
		}
	};

};
/* ================================================= EINDE FUNCTIE ACTIVE == */


/* ================================================= SET FONT SIZE */
function setMedium(){
	$('container').style.fontSize='100%';
	$('medium').style.color='#4c1664';
	$('medium').style.textDecoration='underline';

	$('large').style.color='#929292';
	$('large').style.textDecoration='none';

	$('xlarge').style.color='#929292';
	$('xlarge').style.textDecoration='none';

	//uitzonderingen op de pagina
	$('nav').style.fontSize='100%';
	$('nav').style.fontWeight= 'normal';

	$('menu_a').style.fontSize='100%';
	$('menu_b').style.fontSize='100%';
	changeClass('');

	setCookie('initFontSize','100%',7,'/');
}
function setLarge(){

	$('container').style.fontSize='115%';
	$('medium').style.color='#929292';
	$('medium').style.textDecoration='none';

	$('large').style.color='#4c1664';
	$('large').style.textDecoration='underline';

	$('xlarge').style.color='#929292';
	$('xlarge').style.textDecoration='none';

	//uitzonderingen op de pagina
	$('nav').style.fontSize='90%';
	//$('nav').style.fontWeight= 'bold';

	$('menu_a').style.fontSize='90%';
	$('menu_b').style.fontSize='90%';

	changeClass('black');

	setCookie('initFontSize','115%',7,'/');
}
function setXlarge(){
	$('container').style.fontSize='130%';
	$('medium').style.color='#929292';
	$('medium').style.textDecoration='none';

	$('large').style.color='#929292';
	$('large').style.textDecoration='none';

	$('xlarge').style.color='#4c1664';
	$('xlarge').style.textDecoration='underline';

	$('nav').style.fontSize='80%';
	//$('nav').style.fontWeight= 'bold';

	$('menu_a').style.fontSize='85%';
	$('menu_b').style.fontSize='85%';
	changeClass('black');

	setCookie('initFontSize','130%',7,'/');
}

function changeClass(clsName){
	$("home").className = clsName;
	$("contact").className = clsName;
	$("flexpaslogin").className = clsName;
	$("eloketTop").className = clsName;
	$("stadskaart").className = clsName;
	$("print").className = clsName;
}

function setSize(){
	//zet fontgrootte op basis van cookie initFontSize
	$('container').style.fontSize=getCookie('initFontSize');

	//zet kleur van letter op basis van cookie
	if (getCookie('initFontSize')=='100%'){
		try {
			$('medium').style.color='#4c1664';
			$('medium').style.textDecoration='underline';
			setMedium();
		} catch(e) {
			// Ignore error
		}
	}
	else if(getCookie('initFontSize')=='115%'){
		try {
			$('large').style.color='#4c1664';
			$('large').style.textDecoration='underline';
			setLarge();
		} catch(e) {
			// Ignore error
		}
	}
	else if(getCookie('initFontSize')=='130%'){
		try {
			$('xlarge').style.color='#4c1664';
			$('xlarge').style.textDecoration='underline';
			setXlarge();
		} catch(e) {
			// Ignore error
		}
	}

}

/* == Set cookie == */
function getCookieVal (offset) {
  var endstr = document.cookie.indexOf (";", offset);
  if (endstr == -1)
    endstr = document.cookie.length;
  return unescape(document.cookie.substring(offset, endstr));
}
function FixCookieDate (date) {
  var base = new Date(0);
  var skew = base.getTime(); // dawn of (Unix) time - should be 0
  if (skew > 0)  // Except on the Mac - ahead of its time
    date.setTime (date.getTime() - skew);
}
function getCookie( name ) {
	var start = document.cookie.indexOf( name + "=" );
	var len = start + name.length + 1;
	if ( ( !start ) && ( name != document.cookie.substring( 0, name.length ) ) ) {
		return null;
	}
	if ( start == -1 ) return null;
	var end = document.cookie.indexOf( ";", len );
	if ( end == -1 ) end = document.cookie.length;
	return unescape( document.cookie.substring( len, end ) );
}

function setCookie( name, value, expires, path, domain, secure ) {
	var today = new Date();
	today.setTime( today.getTime() );
	if ( expires ) {
		expires = expires * 1000 * 60 * 60 * 24;
	}
	var expires_date = new Date( today.getTime() + (expires) );
	document.cookie = name+"="+escape( value ) +
		( ( expires ) ? ";expires="+expires_date.toGMTString() : "" ) + //expires.toGMTString()
		( ( path ) ? ";path=" + path : "" ) +
		( ( domain ) ? ";domain=" + domain : "" ) +
		( ( secure ) ? ";secure" : "" );
}


/* ================================================= CREATE MENU DROPDOWN FOR IE6 */
sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("li");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);



/* ================================================= Show hide main content in tabs */
function displayContent(iTabNum, iNumItem) {
	resetContent(iNumItem)
	$('content_tab'+iTabNum).style.display = 'block';
	$('content_tab_nav'+iTabNum).className = 'active';
	//Voor IE6 de hoogte opnieuw bepalen en toekennen
	$('container').style.height = $('content_tab'+iTabNum).offsetHeight;
	$('content_tab_nav'+iTabNum).removeAttribute('href');
}
function resetContent(iItemNum) {
	for (var i = 1; i <= iItemNum; i++) {
		$('content_tab'+i).style.display = 'none';
		$('content_tab_nav'+i).className = 'activeLink';
	}
}

/* ================================================= ROWS INKLEUREN */
	function color2rows(){
		var countRow = 0;
		var x = document.getElementsByTagName('div');
		for (var i=0;i<x.length;i++)
		{
			if (x[i].className == 'row')
				if(countRow%2==0){x[i].className = 'row row1';
					countRow++;
				}else{x[i].className = 'row row2';
					countRow++;
				}
		}
	}

	function getWinWidth(){
		if (parseInt(navigator.appVersion)>3) {
		 if (navigator.appName=="Netscape") {
			winW = window.innerWidth;
		 }
		 if (navigator.appName.indexOf("Microsoft")!=-1) {
			winW = document.body.offsetWidth;
		 }
		}
		return winW;
	}


/** XHConn - Simple XMLHTTP Interface - bfults@gmail.com - 2005-04-08        **
 ** Code licensed under Creative Commons Attribution-ShareAlike License      **
 ** http://creativecommons.org/licenses/by-sa/2.0/                           **/
function XHConn()
{
  var xmlhttp, bComplete = false;
  try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); }
  catch (e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); }
  catch (e) { try { xmlhttp = new XMLHttpRequest(); }
  catch (e) { xmlhttp = false; }}}
  if (!xmlhttp) return null;
  this.connect = function(sURL, sMethod, sVars, fnDone)
  {
    if (!xmlhttp) return false;
    bComplete = false;
    sMethod = sMethod.toUpperCase();

    try {
      if (sMethod == "GET")
      {
        xmlhttp.open(sMethod, sURL+"?"+sVars, true);
        sVars = "";
      }
      else
      {
        xmlhttp.open(sMethod, sURL, true);
        xmlhttp.setRequestHeader("Method", "POST "+sURL+" HTTP/1.1");
        xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
      }
      xmlhttp.onreadystatechange = function(){
        if (xmlhttp.readyState == 4 && !bComplete)
        {
          bComplete = true;
          fnDone(xmlhttp);
        }};
      xmlhttp.send(sVars);
    }
    catch(z) { return false; }
    return true;
  };
  return this;
}

//twee functies voor registreren van clicks op de e-loket
function regClick(iELoketPageID, iBezoeker, sPaginaTitel)
{

	//zoek record
	var myConn = new XHConn();
	if (myConn)
	{
		myConn.connect("../media/component/eloket_reg_click.asp", "POST", "pid="+iELoketPageID+"&b="+iBezoeker+"&titel="+sPaginaTitel, fnDoneRegister);
		return false;
	}
}
function fnDoneRegister(oResponse) {
	go(oResponse.responseText);
}

function escapeChars(txt)
{
	txt = txt.replace(/\s+/g,"**_**");
	txt = txt.replace(/&/g,"**am**");
	txt = txt.replace(/=/g,"**eq**");
	txt = txt.replace(/\+/g,"**pl**");
	return txt;
}