domtab={tabClass:'domtab',listClass:'tabs',activeClass:'active',contentElements:'div',backToLinks:/#top/,printID:'domtabprintview',showAllLinkText:'show all content',prevNextIndicator:'doprevnext',prevNextClass:'prevnext',prevLabel:'previous',nextLabel:'next',prevClass:'prev',nextClass:'next',init:function(){var temp;if(!document.getElementById||!document.createTextNode){return;}
var tempelm=document.getElementsByTagName('div');for(var i=0;i<tempelm.length;i++){if(!domtab.cssjs('check',tempelm[i],domtab.tabClass)){continue;}
domtab.initTabMenu(tempelm[i]);domtab.removeBackLinks(tempelm[i]);if(domtab.cssjs('check',tempelm[i],domtab.prevNextIndicator)){domtab.addPrevNext(tempelm[i]);}
domtab.checkURL();}
if(document.getElementById(domtab.printID)&&!document.getElementById(domtab.printID).getElementsByTagName('a')[0]){var newlink=document.createElement('a');domtab.addEvent(newlink,'mouseover',domtab.showAll,false);newlink.onmouseover=function(){return false;}
newlink.onclick=function(){return false;}
newlink.appendChild(document.createTextNode(domtab.showAllLinkText));document.getElementById(domtab.printID).appendChild(newlink);}},checkURL:function(){var id;var loc=window.location.toString();loc=/#/.test(loc)?loc.match(/#(\w.+)/)[1]:'';if(loc==''){return;}
var elm=document.getElementById(loc);if(!elm){return;}
var parentMenu=elm.parentNode.parentNode.parentNode;parentMenu.currentSection=loc;parentMenu.getElementsByTagName(domtab.contentElements)[0].style.display='none';domtab.cssjs('remove',parentMenu.getElementsByTagName('a')[0].parentNode,domtab.activeClass);var links=parentMenu.getElementsByTagName('a');for(i=0;i<links.length;i++){if(!links[i].getAttribute('href')){continue;}
if(!/#/.test(links[i].getAttribute('href').toString())){continue;}
id=links[i].className;if(id==loc){var cur=links[i].parentNode.parentNode;domtab.cssjs('add',links[i].parentNode,domtab.activeClass);break;}}
domtab.changeTab(elm,1);elm.focus();cur.currentLink=links[i];cur.currentSection=loc;},showAll:function(e){document.getElementById(domtab.printID).parentNode.removeChild(document.getElementById(domtab.printID));var tempelm=document.getElementsByTagName('div');for(var i=0;i<tempelm.length;i++){if(!domtab.cssjs('check',tempelm[i],domtab.tabClass)){continue;}
var sec=tempelm[i].getElementsByTagName(domtab.contentElements);for(var j=0;j<sec.length;j++){sec[j].style.display='block';}}
var tempelm=document.getElementsByTagName('ul');for(i=0;i<tempelm.length;i++){if(!domtab.cssjs('check',tempelm[i],domtab.prevNextClass)){continue;}
tempelm[i].parentNode.removeChild(tempelm[i]);i--;}
domtab.cancelClick(e);},addPrevNext:function(menu){var temp;var sections=menu.getElementsByTagName(domtab.contentElements);for(var i=0;i<sections.length;i++){temp=domtab.createPrevNext();if(i==0){temp.removeChild(temp.getElementsByTagName('li')[0]);}
if(i==sections.length-1){temp.removeChild(temp.getElementsByTagName('li')[1]);}
temp.i=i;temp.menu=menu;sections[i].appendChild(temp);}},removeBackLinks:function(menu){var links=menu.getElementsByTagName('a');for(var i=0;i<links.length;i++){if(!domtab.backToLinks.test(links[i].href)){continue;}
links[i].parentNode.removeChild(links[i]);i--;}},initTabMenu:function(menu){var id;var lists=menu.getElementsByTagName('ul');for(var i=0;i<lists.length;i++){if(domtab.cssjs('check',lists[i],domtab.listClass)){var thismenu=lists[i];break;}}
if(!thismenu){return;}
thismenu.currentSection='';thismenu.currentLink='';var tmp2
var links2=thismenu.getElementsByTagName('li');for(n=0;n<links2.length;n++){if(links2[n].className=='active'){tmp2=n;}}
var links=thismenu.getElementsByTagName('a');for(i=0;i<links.length;i++){id=links[i].className;if(document.getElementById(id)){domtab.addEvent(links[i],'mouseover',domtab.showTab,false);links[i].onmouseover=function(){return false;}
domtab.changeTab(document.getElementById(id),0);}}
links[0].className;var id2=links[tmp2].className;if(document.getElementById(id2)){domtab.changeTab(document.getElementById(id2),1);thismenu.currentSection=id2;thismenu.currentLink=links[tmp2];}},createPrevNext:function(){var temp=document.createElement('ul');temp.className=domtab.prevNextClass;temp.appendChild(document.createElement('li'));temp.getElementsByTagName('li')[0].appendChild(document.createElement('a'));temp.getElementsByTagName('a')[0].innerHTML=domtab.prevLabel;temp.getElementsByTagName('li')[0].className=domtab.prevClass;temp.appendChild(document.createElement('li'));temp.getElementsByTagName('li')[1].appendChild(document.createElement('a'));temp.getElementsByTagName('a')[1].setAttribute('href','#');temp.getElementsByTagName('a')[1].innerHTML=domtab.nextLabel;temp.getElementsByTagName('li')[1].className=domtab.nextClass;domtab.addEvent(temp.getElementsByTagName('a')[0],'mouseover',domtab.navTabs,false);domtab.addEvent(temp.getElementsByTagName('a')[1],'mouseover',domtab.navTabs,false);temp.getElementsByTagName('a')[0].onmouseover=function(){return false;}
temp.getElementsByTagName('a')[1].onmouseover=function(){return false;}
return temp;},navTabs:function(e){var li=domtab.getTarget(e);var menu=li.parentNode.parentNode.menu;var count=li.parentNode.parentNode.i;var section=menu.getElementsByTagName(domtab.contentElements);var links=menu.getElementsByTagName('a');var othercount=(li.parentNode.className==domtab.prevClass)?count-1:count+1;section[count].style.display='none';domtab.cssjs('remove',links[count].parentNode,domtab.activeClass);section[othercount].style.display='block';domtab.cssjs('add',links[othercount].parentNode,domtab.activeClass);var parent=links[count].parentNode.parentNode;parent.currentLink=links[othercount];parent.currentSection=links[othercount].href.match(/#(\w.+)/)[1];domtab.cancelClick(e);},changeTab:function(elm,state){do{elm=elm.parentNode;}while(elm.nodeName.toLowerCase()!=domtab.contentElements)
elm.style.display=state==0?'none':'block';},showTab:function(e){var o=domtab.getTarget(e);if(o.parentNode.parentNode.currentSection!=''){domtab.changeTab(document.getElementById(o.parentNode.parentNode.currentSection),0);domtab.cssjs('remove',o.parentNode.parentNode.currentLink.parentNode,domtab.activeClass);}
var id=o.className;o.parentNode.parentNode.currentSection=id;o.parentNode.parentNode.currentLink=o;domtab.cssjs('add',o.parentNode,domtab.activeClass);domtab.changeTab(document.getElementById(id),1);document.getElementById(id).focus();domtab.cancelClick(e);},getTarget:function(e){var target=window.event?window.event.srcElement:e?e.target:null;if(!target){return false;}
if(target.nodeName.toLowerCase()!='a'){target=target.parentNode;}
return target;},cancelClick:function(e){if(window.event){window.event.cancelBubble=true;window.event.returnValue=false;return;}
if(e){e.stopPropagation();e.preventDefault();}},addEvent:function(elm,evType,fn,useCapture){if(elm.addEventListener)
{elm.addEventListener(evType,fn,useCapture);return true;}else if(elm.attachEvent){var r=elm.attachEvent('on'+evType,fn);return r;}else{elm['on'+evType]=fn;}},cssjs:function(a,o,c1,c2){switch(a){case'swap':o.className=!domtab.cssjs('check',o,c1)?o.className.replace(c2,c1):o.className.replace(c1,c2);break;case'add':if(!domtab.cssjs('check',o,c1)){o.className+=o.className?' '+c1:c1;}
break;case'remove':var rep=o.className.match(' '+c1)?' '+c1:c1;o.className=o.className.replace(rep,'');break;case'check':var found=false;var temparray=o.className.split(' ');for(var i=0;i<temparray.length;i++){if(temparray[i]==c1){found=true;}}
return found;break;}}}
domtab.addEvent(window,'load',domtab.init,false);

var resizeTimer;  //buiten functie definieren zodat hij bij nieuwe aanroep beschikbaar blijft
window.onresize = function() {
    clearTimeout(resizeTimer);
    resizeTimer = setTimeout('setAankeilerSize()', 50);
}

/*window.onresize = function() {
        clearTimeout();
        setTimeout('window.location.reload( false )', 300);
}*/

function setAankeilerSize(param) {
	//aanpassen breedtes mainaankeilers
	var spotbox = document.getElementById("spotlightbox");
	var spotholder = document.getElementById("spotholder");
	var spotholderstatic = document.getElementById("spotholderstatic");
	if (spotholderstatic && spotholderstatic.offsetHeight > 0) spotholder = spotholderstatic;//voor noflash
	var main1 = document.getElementById("mainaankeilerbox1");
	var main2 = document.getElementById("mainaankeilerbox2");
	var aankeilerborder = 1;//breedte border aankeiler; niet via js op te vragen
	
	if (spotbox && spotholder && main1) {
		
		var boxX = findPosX(spotbox);
		var spotWidth = spotholder.offsetWidth;
		var spotX = findPosX(spotholder);
		var spotBottomY = findPosY(spotholder)+spotholder.offsetHeight;
		var boxPadding = spotX - boxX;
		var aankeilerWidth = main1.offsetWidth;
		var aankeilerX = findPosX(main1);
		var aankeilerY = findPosY(main1);
		var aankeilerMargin;
		
		if (aankeilerY > spotBottomY) {
			//dan aankeilers onder spotholder
			if (main2 == null) {
				newWidth = spotWidth;
			} else {
				aankeilerMargin = aankeilerY - spotBottomY;
				newWidth = Math.floor((spotWidth-aankeilerMargin)/2)-2*aankeilerborder;
			}
		} else {
			//dan aankeilers naast spotholder
			var boxWidth = spotbox.offsetWidth;
			var spotRightX = spotX + spotWidth;
			aankeilerMargin = aankeilerX - spotRightX;
			newWidth = boxWidth - 2*boxPadding - spotWidth - aankeilerMargin - 2*aankeilerborder;
		}
		
		newWidth = newWidth+"px";
		main1.style.width = newWidth;
		if (main2) main2.style.width = newWidth;
	}
}



function switchSpotlight() {
	//schakelt tussen flash- en tekstversie van spotlight
	var spotholder = document.getElementById("spotholder");
	var spotholderstatic = document.getElementById("spotholderstatic");
	spotholder.style.display = (spotholder.offsetHeight > 0) ? "none":"block";
	spotholderstatic.style.display = (spotholderstatic.offsetHeight > 0) ? "none":"block";

    //window.document.spotlight.GotoFrame(2);
    //if (document.getElementById("spotlight_flash").style.display == "block") window.document.spotlight.Play();
}

/**
 * FlashObject v1.3c: Flash detection and embed - http://blog.deconcept.com/flashobject/
 *
 * FlashObject is (c) 2006 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 */
 
/*
 *	:
 *	changed 20060329 jaron barends: added altElementId to function write
 */
if(typeof com == "undefined") var com = new Object();
if(typeof com.deconcept == "undefined") com.deconcept = new Object();
if(typeof com.deconcept.util == "undefined") com.deconcept.util = new Object();
if(typeof com.deconcept.FlashObjectUtil == "undefined") com.deconcept.FlashObjectUtil = new Object();
com.deconcept.FlashObject = function(swf, id, w, h, ver, c, useExpressInstall, quality, xiRedirectUrl, redirectUrl, detectKey){
  if (!document.createElement || !document.getElementById) return;
  this.DETECT_KEY = detectKey ? detectKey : 'detectflash';
  this.skipDetect = com.deconcept.util.getRequestParameter(this.DETECT_KEY);
  this.params = new Object();
  this.variables = new Object();
  this.attributes = new Array();
  this.useExpressInstall = useExpressInstall;

  if(swf) this.setAttribute('swf', swf);
  if(id) this.setAttribute('id', id);
  if(w) this.setAttribute('width', w);
  if(h) this.setAttribute('height', h);
  if(ver) this.setAttribute('version', new com.deconcept.PlayerVersion(ver.toString().split(".")));
  this.installedVer = com.deconcept.FlashObjectUtil.getPlayerVersion(this.getAttribute('version'), useExpressInstall);
  if(c) this.addParam('bgcolor', c);
  var q = quality ? quality : 'high';
  this.addParam('quality', q);
  var xir = (xiRedirectUrl) ? xiRedirectUrl : window.location;
  this.setAttribute('xiRedirectUrl', xir);
  this.setAttribute('redirectUrl', '');
  if(redirectUrl) this.setAttribute('redirectUrl', redirectUrl);
}
com.deconcept.FlashObject.prototype = {
  setAttribute: function(name, value){
    this.attributes[name] = value;
  },
  getAttribute: function(name){
    return this.attributes[name];
  },
  addParam: function(name, value){
    this.params[name] = value;
  },
  getParams: function(){
    return this.params;
  },
  addVariable: function(name, value){
    this.variables[name] = value;
  },
  getVariable: function(name){
    return this.variables[name];
  },
  getVariables: function(){
    return this.variables;
  },
  createParamTag: function(n, v){
    var p = document.createElement('param');
    p.setAttribute('name', n);
    p.setAttribute('value', v);
    return p;
  },
  getVariablePairs: function(){
    var variablePairs = new Array();
    var key;
    var variables = this.getVariables();
    for(key in variables){
      variablePairs.push(key +"="+ variables[key]);
    }
    return variablePairs;
  },
  getFlashHTML: function() {
    var flashNode = "";
    if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) { // netscape plugin architecture
      if (this.getAttribute("doExpressInstall")) this.addVariable("MMplayerType", "PlugIn");
      flashNode = '<embed type="application/x-shockwave-flash" src="'+ this.getAttribute('swf') +'" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'"';
      flashNode += ' id="'+ this.getAttribute('id') +'" name="'+ this.getAttribute('id') +'" ';
      var params = this.getParams();
       for(var key in params){ flashNode += [key] +'="'+ params[key] +'" '; }
      var pairs = this.getVariablePairs().join("&");
       if (pairs.length > 0){ flashNode += 'flashvars="'+ pairs +'"'; }
      flashNode += '/>';
    } else { // PC IE
      if (this.getAttribute("doExpressInstall")) this.addVariable("MMplayerType", "ActiveX");
      flashNode = '<object id="'+ this.getAttribute('id') +'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'">';
      flashNode += '<param name="movie" value="'+ this.getAttribute('swf') +'" />';
      var params = this.getParams();
      for(var key in params) {
       flashNode += '<param name="'+ key +'" value="'+ params[key] +'" />';
      }
      var pairs = this.getVariablePairs().join("&");
      if(pairs.length > 0) {flashNode += '<param name="flashvars" value="'+ pairs +'" />';}
      flashNode += "</object>";
    }
	//alert(flashNode);
	//document.getElementById("tempdiv").innerText = flashNode;
    return flashNode;
  },
  write: function(elementId, altElementId, extraHTML){
	//changed 20060329: added altElementId
	//kopieert de inhoud van elementId en plakt die in altElementId
	//voegt extraHTML nog toe aan flash-content van elementId
    if(this.useExpressInstall) {
      // check to see if we need to do an express install
      var expressInstallReqVer = new com.deconcept.PlayerVersion([6,0,65]);
      if (this.installedVer.versionIsValid(expressInstallReqVer) && !this.installedVer.versionIsValid(this.getAttribute('version'))) {
        this.setAttribute('doExpressInstall', true);
        this.addVariable("MMredirectURL", escape(this.getAttribute('xiRedirectUrl')));
        document.title = document.title.slice(0, 47) + " - Flash Player Installation";
        this.addVariable("MMdoctitle", document.title);
      }
    } else {
      this.setAttribute('doExpressInstall', false);
    }
    if(this.skipDetect || this.getAttribute('doExpressInstall') || this.installedVer.versionIsValid(this.getAttribute('version'))){
      var a = (typeof altElementId == 'string') ? document.getElementById(altElementId) : altElementId;
      var n = (typeof elementId == 'string') ? document.getElementById(elementId) : elementId;
	  a.innerHTML = n.innerHTML;
      n.innerHTML = this.getFlashHTML()+extraHTML;
	  //let op: wanneer je probeert extraHTML er in een aparte regel dmv n.innerHTML += extraHTML aan toe te voegen, worden de flashvars in IE niet goed aan flash doorgegeven!
    }else{
      if(this.getAttribute('redirectUrl') != "") {
        document.location.replace(this.getAttribute('redirectUrl'));
      }
    }
  }
  
}

/* ---- detection functions ---- */
com.deconcept.FlashObjectUtil.getPlayerVersion = function(reqVer, xiInstall){
  var PlayerVersion = new com.deconcept.PlayerVersion(0,0,0);
  if(navigator.plugins && navigator.mimeTypes.length){
    var x = navigator.plugins["Shockwave Flash"];
    if(x && x.description) {
      PlayerVersion = new com.deconcept.PlayerVersion(x.description.replace(/([a-z]|[A-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".").split("."));
    }
  }else{
    try{
      var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
      for (var i=3; axo!=null; i++) {
        axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+i);
        PlayerVersion = new com.deconcept.PlayerVersion([i,0,0]);
      }
    }catch(e){}
    if (reqVer && PlayerVersion.major > reqVer.major) return PlayerVersion; // version is ok, skip minor detection
    // this only does the minor rev lookup if the user's major version 
    // is not 6 or we are checking for a specific minor or revision number
    // see http://blog.deconcept.com/2006/01/11/getvariable-setvariable-crash-internet-explorer-flash-6/
    if (!reqVer || ((reqVer.minor != 0 || reqVer.rev != 0) && PlayerVersion.major == reqVer.major) || PlayerVersion.major != 6 || xiInstall) {
      try{
        PlayerVersion = new com.deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));
      }catch(e){}
    }
  }
  return PlayerVersion;
}
com.deconcept.PlayerVersion = function(arrVersion){
  this.major = parseInt(arrVersion[0]) || 0;
  this.minor = parseInt(arrVersion[1]) || 0;
  this.rev = parseInt(arrVersion[2]) || 0;
}
com.deconcept.PlayerVersion.prototype.versionIsValid = function(fv){
  if(this.major < fv.major) return false;
  if(this.major > fv.major) return true;
  if(this.minor < fv.minor) return false;
  if(this.minor > fv.minor) return true;
  if(this.rev < fv.rev) return false;
  return true;
}
/* ---- get value of query string param ---- */
com.deconcept.util = {
  getRequestParameter: function(param){
    var q = document.location.search || document.location.hash;
    if(q){
      var startIndex = q.indexOf(param +"=");
      var endIndex = (q.indexOf("&", startIndex) > -1) ? q.indexOf("&", startIndex) : q.length;
      if (q.length > 1 && startIndex > -1) {
        return q.substring(q.indexOf("=", startIndex)+1, endIndex);
      }
    }
    return "";
  }
}

/* add Array.push if needed (ie5) */
if (Array.prototype.push == null) { Array.prototype.push = function(item) { this[this.length] = item; return this.length; }}

/* add some aliases for ease of use/backwards compatibility */
var getQueryParamValue = com.deconcept.util.getRequestParameter;
var FlashObject = com.deconcept.FlashObject;



// FormVal 2.3, (c) Back2Front 2002
// Contact: paul.vandam@back2front.nl


fValDefaultMessage="Het veld '%fieldname%' is niet correct ingevuld."

fVal=new Array;

FV_EMPTY	= /\S+/
FV_POSTCODE	= /^[0-9]{4}\s*[a-zA-Z]{2}$/
FV_EMAIL	= /^[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)*@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/
FV_NUMBER	= /^\d+([\s\.\,]?\d)*$/
FV_TELNUM	= /^\d{2}[-\s]?\d{8}$|^\d{3}[-\s]?\d{7}$|^\d{4}[-\s]?\d{4,6}$/
FV_USERNAME	= /^\w{4,}$/

function setTextVal(name,re,opt,msg){fVal[name]=[re,opt||0,msg||fValDefaultMessage];}
function setSelectVal(name,msg){fVal[name]=["sel",msg||fValDefaultMessage];}
function setCheckVal(nameArr,min,msg){fVal[nameArr[0]||nameArr]=["chk",nameArr,min,msg||fValDefaultMessage];}
function setRadioVal(name,msg){fVal[name]=["rad",msg||fValDefaultMessage];}

function trim(str){return str.replace(/^\s+|\s+$/g,'')}

function badInput(frmEle,msg,nameArr){
	alert(msg.replace(/%fieldname%/g,nameArr||frmEle.name));
	if(frmEle.focus) frmEle.focus();
	return false;
}

function formVal(frm){
	for(var i=0;i<frm.elements.length;i++){
		var frmEle=frm.elements[i];
		if(fVal[frmEle.name]){
			var eleVal=fVal[frmEle.name];
			if(eleVal[0]=="sel"){
				if(!frmEle[frmEle.selectedIndex].value) return badInput(frmEle,eleVal[1]);
			}else if(eleVal[0]=="chk"){
				var chkCnt=0;
				if(eleVal[1].indexOf){
					for(var j=0;j<frm.elements[eleVal[1]].length;j++){
						if(frm.elements[eleVal[1]][j].checked) chkCnt++;
					}	if(chkCnt<eleVal[2]) return badInput(frmEle,eleVal[3]);
				}else{
					for(var j=0;j<eleVal[1].length;j++){
						if(frm.elements[eleVal[1][j]].checked) chkCnt++;
					}	if(chkCnt<eleVal[2]) return badInput(frmEle,eleVal[3],eleVal[1]);
				}
			}else if(eleVal[0]=="rad"){
				var radCnt=0;
				for(var k=0;k<frm.elements[frmEle.name].length;k++){
					if(frm.elements[frmEle.name][k].checked) radCnt++;
				}	if(radCnt<1) return badInput(frmEle,eleVal[1]);
			}else{
				frmEle.value=trim(frmEle.value);
				var doChk=(eleVal[1]==0||(eleVal[1]==1&&frmEle.value.length>0));
				if(doChk&&!eleVal[0].test(frmEle.value)) return badInput(frmEle,eleVal[2]);
			}
		}
	}
	return fValCustomVal(frm);
}

function fValCustomVal(frm){
	return true;
}

// inputbox functions
function inputClearText(thefield){
	if (thefield.defaultValue==thefield.value)
	thefield.value = ""
}

function inputNotEmpty(elem){
	if(elem.value.length == 0 || elem.value == 'Zoek'){
		elem.value = '';
		elem.focus(); // set the focus to this input
		return false;
	} 
	return true;
}

/* -- Start popup-functions --*/
	function popup(url, width, height, other_props) {
		//opent popup in midden van scherm; standaard geen toeters en bellen; deze kunnen desgewenst in other_props worden meegegeven
		var day = new Date();
		var id = day.getTime();
		if (other_props == null) {
			other_props = "";
		} else {
			other_props = ", "+other_props;
		}
		
		if (other_props.indexOf("toolbar")==-1) other_props += ", toolbar=0";
		if (other_props.indexOf("scrollbars")==-1) other_props += ", scrollbars=0";
		if (other_props.indexOf("location")==-1) other_props += ", location=0";
		if (other_props.indexOf("statusbar")==-1) other_props += ", statusbar=0";
		if (other_props.indexOf("menubar")==-1) other_props += ", menubar=0";
		if (other_props.indexOf("resizable")==-1) other_props += ", resizable=yes";
		if (other_props.indexOf("left") < 0) {
			//dan horizontaal centreren
			marginLeft=(screen.width) ? (screen.width-width)/2 : 100;
			other_props += ", left="+marginLeft;
		}
		if (other_props.indexOf("top") < 0) {
			//dan verticaal op 1/3 van scherm
			marginTop=(screen.height) ? (screen.height-height)/3 : 50;
			other_props += ", top="+marginTop;
		}
		
		eval("page" + id + " = window.open(url, '" + id + "', 'width="+width+", height="+ height+other_props+"');");
	}
/* -- Start popup-functions --*/


function randomFreeCap(tmp, noImageMessage) {
	if (document.getElementById) {
		var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";
		var string_length = 6;
		var randomstring = '';
		for (var i=0; i<string_length; i++) {
			var rnum = Math.floor(Math.random() * chars.length);
			randomstring += chars.substring(rnum,rnum+1);
		}
		var id = randomstring;
		//alert(id);
		var theImage = document.getElementById("tx_srfreecap_pi2_captcha_image_"+id);
		var parts = theImage.src.split("&amp");
		theImage.src = parts[0] + "&amp;" + parts[1] + "&amp;set=" + Math.round(Math.random()*100000);
	} else {
		alert(noImageMessage ? noImageMessage : "Sorry, we cannot autoreload a new image. Submit the form and a new image will be loaded.");
	}
}


function initLogin() {
 jQuery(document).ready(function($) {
  if (typeof(loginInfoUrl) != "undefined") {
   var loginHtml;    
   var ajx = $.ajax({
    type: "POST",
    url: loginInfoUrl,//returns html
    //success: showLoginInfo,
    success: function(loginHtml) {
     if (loginHtml.toLowerCase().indexOf("welkom") > -1) {
      //dan moeten we default waarde wijzigen
      jQuery('#loginholder').fadeOut("fast", function(){
       $(this).html(loginHtml).fadeIn("fast");
      });
     }
    }
   });
  }
 });
}

function initReactie() {
	jQuery(document).ready(function($) {
		if (typeof(reactieInfoUrl) != "undefined") {
			var reactieHtml;				
			var ajx = jQuery.ajax({
				type: "POST",
				url: reactieInfoUrl,//returns html				
				success: function(reactieHtml) {
					if (reactieHtml.toLowerCase().indexOf("reageer op") > -1) {
						//dan moeten we default waarde wijzigen
						jQuery('#reactieholder').fadeOut("fast", function(){
							jQuery(this).html(reactieHtml).fadeIn("fast", function(){initForm();});
						});
						
					}
				}
			});
		}
	});
}

function initForm(){
	jQuery('#varaveguestbookform').submit( function (evt) {
		evt.preventDefault();
		//var firstname = jQuery('#tx_veguestbook_pi1_firstname').val();
		var entry = jQuery('#tx_veguestbook_pi1_entry').val();
		//var captcha_response = jQuery('#tx_veguestbook_pi1_captcha_response').val();
		var storage = jQuery('#tx_veguestbook_pi1_storage').val();
		var page_uid = jQuery('#page_uid').val();
		//var captcha_type = jQuery('#tx_veguestbook_pi1_captcha_type').val();
		//var freecap_uid = jQuery('.tx-srfreecap-pi2-image').attr('id');
		var tt_news = jQuery('#tx_veguestbook_pi1_tt_news').val();
		var template = jQuery('#tx_veguestbook_pi1_template').val();
		
		jQuery.ajax({
		   type: 'POST',
		   url: 'index.php',
		   data: {eID: 'tx_varaveguestbookform_eid', storage: storage, page_uid: page_uid, entry: entry,  tt_news: tt_news, template: template},
		   dataType: 'script'
		});
	});
}

function showMessage(msg, isError) {

	if (! document.getElementById('msgpanel'))
		jQuery('#varaveguestbookform').before('<div id="msgpanel"></div>');

	if(isError)
		var cssObj = {'border':'1px dotted red','background-color':'pink', 'padding':'2px 4px'};
	else
		var cssObj = {'border':'1px dotted #7bff8e','background-color':'#d6ffdc', 'padding':'2px 4px'};

	jQuery('.tx-veguestbook-pi1 #msgpanel').html(msg).css(cssObj);
}

jQuery(document).ready(initLogin);
jQuery(document).ready(initReactie);
