<!--

//log
var ref=""+escape(document.referrer);
var colord = window.screen.colorDepth;
var res = window.screen.width + "x" + window.screen.height;
var eself = document.location;

// From http://phpbb.com
var clientPC = navigator.userAgent.toLowerCase();
var clientVer = parseInt(navigator.appVersion);
var is_ie = ((clientPC.indexOf("msie") != -1) && (clientPC.indexOf("opera") == -1));
var is_nav = ((clientPC.indexOf('mozilla')!=-1) && (clientPC.indexOf('spoofer')==-1) && (clientPC.indexOf('compatible') == -1) && (clientPC.indexOf('opera')==-1) && (clientPC.indexOf('webtv')==-1) && (clientPC.indexOf('hotjava')==-1));
var is_moz = 0;
var is_win = ((clientPC.indexOf("win")!=-1) || (clientPC.indexOf("16bit") != -1));
var is_mac = (clientPC.indexOf("mac")!=-1);


// From http://www.massless.org/mozedit/
function mozWrap(txtarea, open, close){
	var selLength = txtarea.textLength;
	var selStart = txtarea.selectionStart;
	var selEnd = txtarea.selectionEnd;
	if (selEnd == 1 || selEnd == 2) selEnd = selLength;
	var s1 = (txtarea.value).substring(0,selStart);
	var s2 = (txtarea.value).substring(selStart, selEnd)
	var s3 = (txtarea.value).substring(selEnd, selLength);
	txtarea.value = s1 + open + s2 + close + s3;
	return;
}

function mozSwap(txtarea, newtext){
	var selLength = txtarea.textLength;
	var selStart = txtarea.selectionStart;
	var selEnd = txtarea.selectionEnd;
	if (selEnd == 1 || selEnd == 2) selEnd = selLength;
	var s1 = (txtarea.value).substring(0,selStart);
	var s3 = (txtarea.value).substring(selEnd, selLength);
	txtarea.value = s1 + newtext + s3;
	return;
}

function storeCaret (textAr){
	so_selectedInputArea = textAr;
	if (textAr.createTextRange){
		so_selectedRange = document.selection.createRange().duplicate();
	}
}

function addtext(text, emote)
{
	if (window.so_selectedInputArea)
	{
		var ta = so_selectedInputArea;
		if (emote != true)
		{  // Split if its a paired bbcode
			val = text.split('][');
			if (val[0] == text) val[1] = '';
		}
		else 
		{ 
		val = text; 
		}

		if ((clientVer >= 4) && is_ie && is_win)
		{
			theSelection = document.selection.createRange().text; /* wrap selected text */
			alert(theSelection);
			if (theSelection) 
			{
				if (emote != true)
				{
				  if (val[1] == '')
				  {  // Single piece of text
					document.selection.createRange().text = val[0];
				  }
				  else
				  {  // bbcode
					document.selection.createRange().text = val[0] +']' +  theSelection + '[' + val[1];
				  }
				} 
				else 
				{
					document.selection.createRange().text = val + theSelection;
				}
				ta.focus();
				theSelection = '';
				return;
			}

		}
		else 
		  if (ta.selectionEnd && (ta.selectionEnd - ta.selectionStart > 0))
		  { // Selected text here
			if (emote != true)
			{
			  if  (val[1] != '')
			  {  // BBCode to wrap
				mozWrap(ta, val[0] +']', '[' + val[1]); /* wrap selected text */
			  }
			  else
			  {  // Single piece of text to insert, and delete any selected text
				mozSwap(ta, text); /* wrap selected text */
			  }
			} 
			else 
			{
				mozWrap(ta, val, ''); /* wrap selected text */
			}
			return;
		  }
		text = ' ' + text + ' ';
		if (ta.createTextRange && so_selectedRange) 
		{
			var caretPos = so_selectedRange; /* IE */
			caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? caretPos.text + text + ' ' : caretPos.text + text;
		} 
		else 
		  if (ta.selectionStart || ta.selectionStart == '0') 
		  { /* Moz */
		   	var startPos = ta.selectionStart;
			var endPos = ta.selectionEnd;
			var charb4 = ta.value.charAt(endPos-1);
			ta.value = ta.value.substring(0, endPos)+ text + ta.value.substring(endPos);
		  } 
		  else 
		  {
			ta.value  += text;
		  }
		ta.focus();
	}
}

function help(help,tagid){
	if(tagid){
		document.getElementById(tagid).value = help;
	} else if(document.getElementById('dataform')) {
		document.getElementById('dataform').helpb.value = help;
	}
}


//counter to limit max characters in text/textarea field
function limitText(textfield, counterfield, charactercount) {
	if (textfield.value.length > charactercount) {
		textfield.value = textfield.value.substring(0, charactercount);
	} else {
		counterfield.value = charactercount - textfield.value.length;
	}
}

//OPENKLAPPEN VAN FAQ'S
function klap(wat, img, imgdicht, imgopen){
	d = document.getElementById(wat);
	if (d.style.display=='none'){
		d.style.display='block';
		if(img){
			document.getElementById(img).src = imgopen;
		}
	}else{
		d.style.display='none';
		if(img){
			document.getElementById(img).src = imgdicht;
		}
	}
}	

//swap items between two (multiple) select boxes

//theSource			: the source select box from which to move the selected element
//theDestination	: the destination select box from which to move the selected element
//theIdString		: the id string (comma seperated) of the active/enabled fields
//theIdSelect		: the select box from which to read the active/enabled elements after each action

function swapItems (theSource, theDestination, theIdString, theIdSelect)
{
	var source = document.getElementById(theSource);
	var destination = document.getElementById(theDestination);
	var str = '';

	// Add items to the destination
    for (var i = 0; i < source.length; i++)
	{
        if (source.options[i].selected == true)
		{
            //add to box
			destination.options[destination.length] = new Option(source.options[i].text,source.options[i].value);
			//new Option(text, value, defaultSelected, selected)
        }
    }

	// Remove items from the source
    for (var i = (source.length - 1); i >= 0; i--)
	{
        if (source.options[i].selected)
		{
            //remove from box
			source.options[i] = null;
        }
    }
	
	var idSelect = document.getElementById(theIdSelect);
	if(idSelect.length > 0){
		
		// validate the ids list from the destination elements
		for (var i = 0; i < idSelect.length; i++)
		{
			//add to id list
			str += idSelect.options[i].value + ',';
		}
	}
	
	//check id list
	if (str.length == 0) {
		document.getElementById(theIdString).value = '';
	} else {
		document.getElementById(theIdString).value = str;
	}
}

	
function externalLinks() {
	if (!document.getElementsByTagName) return;
	var anchors = document.getElementsByTagName("a");

	for (var i=0; i<anchors.length; i++) {
		var anchor = anchors[i];
		if (anchor.getAttribute("href") &&
			anchor.getAttribute("rel") == "external"){
			anchor.target = "_blank";
		}
		
		//make link active
		var url = anchor.getAttribute("href");
		if(url == document.location){
			anchor.className = "sideRightLink_active";
		}
	}
}

function jsconfirm(thetext){
	return confirm(thetext);
}

function insertext(str,tagid,display){
	document.getElementById(tagid).value = str;
	if(display){
		document.getElementById(display).style.display='none';
	}
}

function resizeWindow(theurl, windowname, features){
	window.open(theurl, windowname, features);
}

function closeWindow(){
	window.opener.location=window.opener.location;
	window.opener.focus();
	window.close()
}

if(document.getElementById&&!document.all){ns6=1;}else{ns6=0;}
var agtbrw=navigator.userAgent.toLowerCase();
var operaaa=(agtbrw.indexOf('opera')!=-1);
var head="display:''";
var folder='';

function expandit(curobj, hide) {

	var cur_objects = curobj.split(",");
	for(i=0; i<cur_objects.length; i++) {
		cur_objects[i]=cur_objects[i].replace(/^\s*(.*)/, "$1");
		cur_objects[i]=cur_objects[i].replace(/(.*?)\s*$/, "$1");
		if(document.getElementById(cur_objects[i])) {
			folder=document.getElementById(cur_objects[i]).style;
			if(folder.display=="none")
			{
				folder.display="";
			} else {
				folder.display="none";
			}
		}
	}
		

	if(hide) {
		var hide_objects = hide.split(",");
		for(i=0; i<hide_objects.length; i++) {
			hide_objects[i]=hide_objects[i].replace(/^\s*(.*)/, "$1");
			hide_objects[i]=hide_objects[i].replace(/(.*?)\s*$/, "$1");
			if(document.getElementById(hide_objects[i])) {
				hidden=document.getElementById(hide_objects[i]).style;
				if(hidden.display=="") {
					hidden.display="none";
				}
			}
		}
	}
}
function expandit_all(name,number) {
	for(i=1; i<100; i++) {
		if(i==number){}
		else{
			if(document.getElementById(name + i)) {
				folder=document.getElementById(name + i).style;
				folder.display='none';
				document.getElementById("div_" + i).className = 'regular';
				document.getElementById("faqlink_" + i).className = 'faq_question_regular';
			}
		}
	}
	folder=document.getElementById(name + number).style;
	if(folder.display=='none'){
		document.getElementById("div_" + number).className = 'selected';
		document.getElementById("faqlink_" + number).className = 'faq_question_selected';
		folder.display='block';
	}
	else {
		document.getElementById("div_" + number).className = 'regular';
		document.getElementById("faqlink_" + number).className = 'faq_question_regular';
		folder.display='none';
	}
}
/*
function openWin(FILE,windowWidth,windowHeight,windowname,toolbar,resizable,location,menubar,directories,scrollbars,status){

	if (!location) {location='no'}else{location='yes'}
	if (!menubar) {menubar='no'}else{menubar='yes'}
	if (!directories) {directories='no'}else{directories='yes'}
	if (!toolbar) {toolbar='no'}else{toolbar='yes'}
	if (!scrollbars) {scrollbars='no'}else{scrollbars='yes'}
	if (!resizable) {resizable='no'}else{resizable='yes'}
	if (!status) {status='no'}else{status='yes'}
	
	if (!windowname){windowname='Vergroot';}
	if ((screen.height-60)<windowHeight){windowHeight=screen.height-60;}
	if ((screen.width-10)<windowWidth){windowWidth=screen.width-10;}

	winprops="width="+windowWidth+",height="+windowHeight+",location="+location+",menubar="+menubar+",directories="+directories+",toolbar="+toolbar+",scrollbars="+scrollbars+",resizable="+resizable+",status="+status+"";

	win=window.open(FILE, windowname,winprops );

	if (parseInt(navigator.appVersion) >= 4){
		var yPos=(screen.height/2)-(windowHeight/2+20);
		if (yPos<10){
			yPos=10;
		}
		win.moveTo((screen.width/2)-(windowWidth/2+10),yPos);
	}

	win.focus();
}
*/

function open_window(url, width, height, windowName) {
	if('full' == width){
		pwindow = window.open(url)
	} else {
		
		//set width
		if (width) {
			windowWidth=width;
		} else {
			windowWidth=600;
		}

		//set height
		if (height) {
			windowHeight=height;
		} else {
			windowHeight=400;
		}
		
		//set window name
		if (!windowName){windowName='Name';}
		
		//adjust window dimensions
		if ((screen.height-60)<windowHeight){windowHeight=screen.height-60;}
		if ((screen.width-10)<windowWidth){windowWidth=screen.width-10;}

		//default window properties
		locat = 'no';
		menubar = 'no';
		directories = 'no';
		toolbar = 'no';
		scrollbars = 'yes';
		status = 'no';
		resizable = 'no';

		//window properties
		winprops = "top=100,left=100,width="+windowWidth+",height="+windowHeight+",location="+locat+",menubar="+menubar+",directories="+directories+",toolbar="+toolbar+",scrollbars="+scrollbars+",resizable="+resizable+",status="+status+"";
	
		pwindow = window.open(url, windowName, winprops);
		
		//center on screen
		if (parseInt(navigator.appVersion) >= 4){
			var yPos=(screen.height/2)-(windowHeight/2+20);
			if (yPos<10){
				yPos=10;
			}
			pwindow.moveTo((screen.width/2)-(windowWidth/2+10),yPos);
		}
	}
	pwindow.focus();
}


//check radio button
function setRadio(the_form, the_name, the_id) {
	
	//the form
	var form = document.forms[the_form];
	
	//the element group
	var group = form[the_name];

	//for(var i = 0; i < group.length; i++){
	//	alert(i+' - '+group[i].value);
	//}
	//alert(the_form+' - '+the_name+' - '+the_id);
	//the element
	var element = group[the_id];
//alert(group[the_id].value);
	//check the element
	element.checked = true;

	return true;
}



//check all / uncheck all
function setCheckboxes(the_form, do_check, the_cb){
	//var elts = (typeof(document.forms[the_form].elements[the_cb]) != 'undefined') ? document.forms[the_form].elements[the_cb] : document.forms[the_form].elements[the_cb];
	var elts = document.forms[the_form].elements[the_cb];

	var elts_cnt  = (typeof(elts.length) != 'undefined') ? elts.length : 0;
	if(elts_cnt){
		for(var i = 0; i < elts_cnt; i++){
			elts[i].checked = do_check;
		}
	}else{
		elts.checked = do_check;
	}
	return true;
}

//hideid is the default visible div element
//var hideid = 'stage1';
var hideid = '';
function showhideit(showid, defaulthideid){
	if(hideid==''){
		hideid=defaulthideid;
	}
	if (hideid!=showid){
		show=document.getElementById(showid);
		showel = show.style;
		
		hide=document.getElementById(hideid);
		hideel = hide.style;
		
		showel.display='';
		hideel.display='none';
		
		hideid = showid;
	}
}

//hideid is the default active element
function setstage(seq_name, seq_id){
	
	//total number of stages
	number = 8;
	
	//set these to active
	for(var i = 1; i <= seq_id; i++){
		element = seq_name+''+i;
		document.getElementById(element).className = 'stage_active';
	}
	
	//set these to inactive
	for(var i = seq_id+1; i <= number; i++){
		element = seq_name+''+i;
		document.getElementById(element).className = 'stage_inactive';
	}

}


//-->