//   -			-			-			-			-			GENERAL VARIABLES

var strModulePath  = 'http://194.134.188.21/www.gezondebasis.nl/images/module_files/';
var strFillerImage = 'filler.gif';

var isOpera = ( navigator.appName.indexOf("Opera")>-1  || (!window.showHelp && navigator.appName=="Microsoft Internet Explorer"));
var isNS4   = (!isOpera && document.layers) ? true : false;
var isIE    = (!isOpera && document.all   ) ? true : false;
var isIE4   = (!isOpera && document.all && !document.getElementById ) ? true : false;
var isNS6   = (!isOpera && !isIE&&document.getElementById) ? true : false;
var isMac   = navigator.platform.indexOf("Mac")>-1;

var blnOpenCloseDocument = true;

var DOELGROEP_PROFESSIONALS   = 14;
var DOELGROEP_OUDERS		= 15;

//   -			-			-			-			-			GENERAL

function max(x,y) {return x>y?x:y;}
function min(x,y) {return x<y?x:y;}

//   -			-			-			-			-			Images

function image_swap(id,bron) {
	if (document.images) document.images[id].src = bron;
}

function image_preload() {
	document.preload = new Array();
	if (document.images) {
		for (var i = 0; i < image_preload.arguments.length; i++) {
			document.preload[i] = new Image();
			document.preload[i].src = image_preload.arguments[i];
		}
	}
}

//   -			-			-			-			-			LAYERS

function layer_style( bVisible, bAbsolute ) {
	var sRetval 
	
	if (isIE || isNS6)
	   sRetval = 'display:' + (bVisible ?  'block' : 'none' ) + ";";  
	else 
	   sRetval = 'visibility:' + (bVisible ?  'visible' : 'hidden' ) + ";";
 	sRetval += 'position:' + (bAbsolute ? 'absolute' : 'relative') + ";";
	sRetval +=  (bAbsolute ? 'position:absolute;' : '');
	if (isNS4&&!bAbsolute) sRetval += 'left:0px;top:0px;';
	return sRetval;
}

function layer_write_full( sName, bVisible, bAbsolute, sContent ){
	if (blnOpenCloseDocument) document.open();
	document.write ("<DIV ID=\"" + sName + "\" style=\""+layer_style(bVisible, bAbsolute)+"\">"+sContent+"</DIV>");
	if (blnOpenCloseDocument) document.close();
}

function layer_set_visible( sName, bVisible ) {
	var x = layer_get_style( sName );
	if (isIE || isNS6) {
		x.display = (bVisible ?  "block" : "none" );
	} else {
		x.visibility = (bVisible) ? 'visible' : 'hidden';
	}
}

function layer_get(sName) {
	if (document.getElementById) {
		return document.getElementById(sName);
	} else if (document.all) {
		return document.all[sName];
	} else if (document.layers) {
		return document.layers[sName];
	} else return false;
}

//
// Documented not to work under Opera (not supported)
//
function layer_set_content( sName, sContent ) {
	var x = layer_get( sName )
	
	if (document.layers) {
		with (x.document) {
			open();
			write("<P>"+sContent+"</P>");
			close();
		}
	} else 
		x.innerHTML = sContent;
}

//
// NS4 not supported
//
function layer_set_color( sName, sColor) {
	var x=layer_get_style( sName );
	x.color = sColor;
}

//
// NS4 not supported
//
function layer_set_backcolor( sName, sColor) {
	var x=layer_get_style( sName );
	x.backgroundColor = sColor;
}

function layer_get_style(sName) {
	if (document.getElementById) {
		return document.getElementById(sName).style;
	} else if (document.all) {
		return document.all[sName].style;
	} else if (document.layers) {
		return document.layers[sName];
	} else return false;
}


//   -			-			-			-			-			TIP
function tip( sTekst, iDoelgroep ) {
	if (sTekst!='') {
 	   document.write( '<table align=right width=146 cellpadding=0 cellspacing=0 border=0 style=\"margin-left:10px;margin-bottom:10px;border:1px solid '+doelgroep_kleur(iDoelgroep)+'\">' +
	   		   '<tr><td><img src='+strModulePath +'tip_'+iDoelgroep+'.gif height=19 width=146 border=0 alt=Tip></TD></TR>' + 
	   		   '<tr><td><CENTER><table border=0 cellpadding=5 bgcolor='+doelgroep_kleur_light(iDoelgroep)+'><tr><td>'+sTekst+'</td></tr></table></CENTER></td></tr></table>');
	}
}
//   -			-			-			-			-			WIST JE DAT  

var wjd_teller = 1;

function wjd_klik( nr ) {
	layer_set_visible('wjd'+nr, true);
	layer_set_visible('wjdklik'+nr, false);
}

function wistjedat( strTekst, iDoelgroep ) {
	var sKlik='Klik hier...';
	
	if (blnOpenCloseDocument) document.open();
	document.write ('<table align=right width=146 cellpadding=0 cellspacing=0 border=0 style=\"margin-left:10px;margin-bottom:10px;border:1px solid '+doelgroep_kleur(iDoelgroep)+'\">' +
					'<tr><td><a href=javascript:wjd_klik('+wjd_teller+')><img src='+strModulePath +'wist_'+iDoelgroep+'.gif height=19 width=146 border=0 alt=\"Klik voor meer informatie\"></a></td></tr>');
					
	document.write('<tr><td><table width=100% border=0 cellpadding=5 bgcolor='+doelgroep_kleur_light(iDoelgroep)+'><tr><td align=center>');
	layer_write_full('wjdklik'+wjd_teller, true , false, '<a href=javascript:wjd_klik('+wjd_teller+') align=center>' + sKlik + '</a>');
	layer_write_full('wjd'+wjd_teller    , false, false, '... ' + strTekst);
	document.write('</td></tr></table></td></tr></table>');
	if (blnOpenCloseDocument) document.close();
	wjd_teller=wjd_teller+1;
}

//   -			-			-			-			-			DOELGROEP_KLEUR

function doelgroep_kleur( dg ) {
	// older browsers don't accept Vars as Case statements 
	if (dg==DOELGROEP_PROFESSIONALS)	return "#088ece";
	if (dg==DOELGROEP_OUDERS)		return "#e77131";
	return "#000000"			
}


function doelgroep_kleur_light( dg ) {
	// older browsers don't accept Vars as Case statements 
	if (dg==DOELGROEP_PROFESSIONALS)	return "#d1f5fc";
	if (dg==DOELGROEP_OUDERS)		return "#fcede5";
	return "#ffffff"			
}


