<!--
// @@@
// @@ Author: Bas van Dorst
// @@ Date: 2007-02-16
// @@ Last change: 2007-02-16
// @@ Version: 1
// @@ Revision: 0
// @@ Copyright: Ecommany B.V.
// @@ Description: Standaard Javascript functies
// @@$

function toggle(xxx,currSet) {
	var el = document.getElementById(currSet);
	var inputs = el.getElementsByTagName("INPUT");
	for (i=0; i<inputs.length; i++) {
		if (inputs[i].type.toLowerCase()=="checkbox") {
			 if(xxx.checked === false) {
			 	inputs[i].checked = false;
			} else {
				inputs[i].checked = true;
			}
		}
	}
}

function acceptVoorwaarden(element) {
	var el = document.getElementById('categorie');
	var inputs = el.getElementsByTagName("INPUT");
	for (i=0; i<inputs.length; i++) {
		if(element.checked === true) {
			inputs[i].disabled = false;
		} else {
			inputs[i].checked = false;
			inputs[i].disabled = true;
		}
	}
}

function Check(theForm) {
  //check NAW gegevens
  re = /'*\(*\w*/;

	if (re.exec(theForm.fNaam.value)=='') { alert('Vul uw naam in'); theForm.fNaam.focus(); return (false); }
	if (re.exec(theForm.fEmail.value)=='') { alert('Vul aub uw e-mail adres in'); theForm.fEmail.focus(); return (false); }
	
	if (re.exec(theForm.fEmail.value)!='') {
		checkOK = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXY@.-_0123456789';
		checkStr = theForm.fEmail.value;
		allValid = true;
		for (i=0; i<checkStr.length; i++) {
			ch = checkStr.charAt(i);
			for (j=0; j<checkOK.length; j++) if (ch==checkOK.charAt(j)) break;
			if (j==checkOK.length) {
				allValid = false;
				break;
			}
		}
		if (checkStr.indexOf('@')<3) allValid = false;
		if (checkStr.length-3<checkStr.lastIndexOf('.')) allValid = false;
		if (checkStr.lastIndexOf('.')<checkStr.indexOf('@')+3) allValid = false;
		if (!allValid && theForm.fEmail.value!='') {
		alert('Geen geldig e-mail adres opgegeven');
			theForm.fEmail.focus();
			return (false);
		}
	}
	selectedItems=0;
	var el = document.getElementById('categorie');
	var inputs = el.getElementsByTagName("INPUT");
	for (i=0; i<inputs.length; i++) {
		if(inputs[i].checked === true && (inputs[i].name == "fCategorie[]" || inputs[i].name == "fRichtlijn" || inputs[i].name == "fRichtlijnen[]" )) {
		 selectedItems++;
		}
	}
	if(selectedItems == 0) {alert('Selecteer minimaal 1 categorie'); return (false); }
}	



// code voor openen soort alt text

 d=document;
 l=d.layers;
 op=navigator.userAgent.indexOf('Opera')!=-1;
 px='px';

 var menuTimer = null;
 var timerRunning = false;
 var menuActive = '';

 function gE(e,f){if(l){f=(f)?f:self;var V=f.document.layers;if(V[e])return V[e];for(var W=0;W<V.length;)t=gE(e,V[W++]);return t;}if(d.all)return d.all[e];return d.getElementById(e);}
 function sE(e){l?e.visibility='show':e.style.visibility='visible';}
 function hE(e){l?e.visibility='hide':e.style.visibility='hidden';}
 function sX(e,x){l?e.left=x:op?e.style.pixelLeft=x:e.style.left=x+px;}
 function sY(e,y){l?e.top=y:op?e.style.pixelTop=y:e.style.top=y+px;}
 function gX(e){l?x=e.left:op?x=e.style.pixelLeft:x=e.style.left;if(isNaN(x))x=Number(x.substr(0,x.length-2));return x}
 function gY(e){l?y=e.top:op?y=e.style.pixelTop:y=e.style.top;if(isNaN(y))y=Number(y.substr(0,y.length-2));return y}
 function gIX(i){if(l)x=i.x;x=i.offsetLeft;tmp=i.offsetParent;while(tmp!=null){x+=tmp.offsetLeft;tmp=tmp.offsetParent}return x}
 function gIY(i){if(l)y=i.y;y=i.offsetTop;tmp=i.offsetParent;while(tmp!=null){y+=tmp.offsetTop;tmp=tmp.offsetParent}return y}

 function positionMenu(e,dx,dy) {
	x = gIX(d['pos_'+e]);
	y = gIY(d['pos_'+e]);
	el = gE(e);
	sX(el,x+dx);
	sY(el,y+dy);
 }

 function hideMenu(e,t) {
	if (t==0) {
		hE(gE(e));
		menuActive = '';
	} else {
		menuTimer = setTimeout('hE(gE(\''+e+'\'));menuActive=\'\'',t);
		timerRunning = true;
	} // if
 }

 function showMenu(e) {
	if(timerRunning) {
		clearTimeout(menuTimer);
		timerRunning = false;
	} // if
	if (menuActive!='' && e!=menuActive) hideMenu(menuActive,0);
	menuActive = e;
	delta_x=16; // 0
	delta_y=0; // 0
	if (e=='conc') delta_x=-160;
	if (e=='conc') delta_y=10;
	if (e=='overw') delta_x=-160;
	if (e=='overw') delta_y=10;
	positionMenu(e,delta_x,0);
	positionMenu(e,0,delta_y);
	sE(gE(e));
 }
 
 function contentVul(contentKnop){
  for (i=1; i<5; i++) {
   // inhoud van verstopte div in de content div laden van de tabel
   if (contentKnop==i){
    eval('  document.getElementById(\'div_content\').innerHTML = document.getElementById(\'content'+i+'\').innerHTML');
   }
   // alle tabjes lichte kleur maken
    document.getElementById('tab_knop_'+i).bgColor='#ffffff';

   // alle linkjes lichte kleur maken
   var exists = document.getElementById('knop_link_'+i);
   if (exists){
    document.getElementById('knop_link_'+i).style.color='#808080';
    document.getElementById('knop_link_'+i).style.fontWeight='bold';
   }
   // alle knoppen lichte kleur maken

  }
   // als tabje geselecteerd is een andere bgcolor geven
    document.getElementById('tab_knop_'+contentKnop).bgColor='#e6e6e6';
   // en de tekst zwart maken
    var exists = document.getElementById('knop_link_'+contentKnop);
    if (exists){
     document.getElementById('knop_link_'+contentKnop).style.color='#000000';
     document.getElementById('knop_link_'+contentKnop).style.fontWeight='bold';
    }

//if (window.scrollInit){ scrollInit() };

}

function kleurwissel_on(tab_knop){
 if (document.getElementById('tab_knop_'+tab_knop).bgColor == '#ffffff'){
  document.getElementById('tab_knop_'+tab_knop).bgColor='#f8f8f8';
 }
}

function kleurwissel_off(tab_knop){
 if (document.getElementById('tab_knop_'+tab_knop).bgColor != '#e6e6e6'){
  document.getElementById('tab_knop_'+tab_knop).bgColor='#ffffff';
 }
}




// code voor openen soort alt text

 d=document;
 l=d.layers;
 op=navigator.userAgent.indexOf('Opera')!=-1;
 px='px';

 var menuTimer = null;
 var timerRunning = false;
 var menuActive = '';

 function gE(e,f){if(l){f=(f)?f:self;var V=f.document.layers;if(V[e])return V[e];for(var W=0;W<V.length;)t=gE(e,V[W++]);return t;}if(d.all)return d.all[e];return d.getElementById(e);}
 function sE(e){l?e.visibility='show':e.style.visibility='visible';}
 function hE(e){l?e.visibility='hide':e.style.visibility='hidden';}
 function sX(e,x){l?e.left=x:op?e.style.pixelLeft=x:e.style.left=x+px;}
 function sY(e,y){l?e.top=y:op?e.style.pixelTop=y:e.style.top=y+px;}
 function gX(e){l?x=e.left:op?x=e.style.pixelLeft:x=e.style.left;if(isNaN(x))x=Number(x.substr(0,x.length-2));return x}
 function gY(e){l?y=e.top:op?y=e.style.pixelTop:y=e.style.top;if(isNaN(y))y=Number(y.substr(0,y.length-2));return y}
 function gIX(i){if(l)x=i.x;x=i.offsetLeft;tmp=i.offsetParent;while(tmp!=null){x+=tmp.offsetLeft;tmp=tmp.offsetParent}return x}
 function gIY(i){if(l)y=i.y;y=i.offsetTop;tmp=i.offsetParent;while(tmp!=null){y+=tmp.offsetTop;tmp=tmp.offsetParent}return y}

 function positionMenu(e,dx,dy) {
	x = gIX(d['pos_'+e]);
	y = gIY(d['pos_'+e]);
	el = gE(e);
	sX(el,x+dx);
	sY(el,y+dy);
 }

 function hideMenu(e,t) {
	if (t==0) {
		hE(gE(e));
		menuActive = '';
	} else {
		menuTimer = setTimeout('hE(gE(\''+e+'\'));menuActive=\'\'',t);
		timerRunning = true;
	} // if
 }

 function showMenu(e) {
	if(timerRunning) {
		clearTimeout(menuTimer);
		timerRunning = false;
	} // if
	if (menuActive!='' && e!=menuActive) hideMenu(menuActive,0);
	menuActive = e;
	delta_x=16; // 0
	delta_y=0; // 0
	if (e=='conc') delta_x=-160;
	if (e=='conc') delta_y=10;
	if (e=='overw') delta_x=-160;
	if (e=='overw') delta_y=10;
	positionMenu(e,delta_x,0);
	positionMenu(e,0,delta_y);
	sE(gE(e));
 }