<!--

// Scoutplaza

// Copyright Voorn Multimedia 2008
// Web Site: www.voornmultimedia.nl

// This script is free as long as the copyright notice remains intact.


	var tempstr ="";
	var kort ="";
	var tel=0;
	var error=0;
	var errorcolor="#ff0000";
	var normalcolor="#181818";
	var veldnaam="";
	var _alleenGetallen = new RegExp(/^\d+$/);
	var _alleenBedragen = new RegExp(/^[0-9]{1,6}[\.,]{0,1}[0-9]{0,2}$|^[0-9]{1,6}$/);   // mogelijk met een komma en twee decimaal
	var _alleenLetters = new RegExp(/[A-Z]{2}/);
	
	


	function submitswitch(theform,state){
		
		if (state=="1") {
				document.forms[theform].elements["submit"].disabled=false;
			} else {
				document.forms[theform].elements["submit"].disabled=true;
			}
		
	}
	

	function hID(tID) { 
		document.getElementById(tID).style.display="none"; 	
	} 
	function sID(tID) {  
		document.getElementById(tID).style.display="inline";  
	} 

		
	
	function replaceChars(naam, out, add) {
		var temp = "" + document.forms["algemeen"].elements[naam].value; // temporary holder

		while (temp.indexOf(out)>-1) {
			pos= temp.indexOf(out);
			temp = "" + (temp.substring(0, pos) + add + 
			temp.substring((pos + out.length), temp.length));
		}

		document.forms["algemeen"].elements[naam].value = temp;
	}
	
	
	
	
	function enable_save() {
	
		document.forms["algemeen"].elements["profiel_opslaan"].disabled=false;
	
	}
	
	function goHist(a) {
 		history.go(a);      // Go back one.
	}
	
	
	//charCounter() parameters are:  text field, count field, max length 
function charCounter() {
var maxkar=400;

     if (document.forms['algemeen'].keywords.value.length > maxkar) {
     	// if too long...trim it!
     	document.forms['algemeen'].keywords.value = document.forms['algemeen'].keywords.value.substring(0, maxkar);
      } else {
     	document.forms['algemeen'].countfield.value = maxkar - document.forms['algemeen'].keywords.value.length;
     }

     // otherwise, update 'characters left' counter
     
     
}
	
	
function trim(value) {
  value = value.replace(/^\s+/,''); 
  value = value.replace(/\s+$/,'');
  return value;
}

var errorcolor="#ff0000";
var normalcolor="#444444";
var backcolor="#999999";
var veldnaam="";
var _alleenGetallen = new RegExp(/^\d+$/);

function controlFieldGetal(formulier, naam, minimumlengte) {
	// is het wel een getal?
	// is de minimumlengte gehaald?
		if ((_alleenGetallen.test(document.forms[formulier].elements[naam].value)==false) || (document.forms[formulier].elements[naam].value.length<minimumlengte)) {
			document.getElementById(naam + '_titel').style.color=errorcolor; 
	
			return false;		
		} else {
			document.getElementById(naam + '_titel').style.color=normalcolor; 	
			
		}
		
}

function controlFieldNick(formulier, naam) {
	var error = "";
	
	strng=document.forms[formulier].elements[naam].value;
	
 	if (strng == "" || strng == "__" || strng == "___" || strng == "____" || strng == "_____" || strng == "______" || strng == "_______" || strng == "________" || strng == "_________" || strng == "__________" || strng == "___________") {
    	error = "You didn't enter a nickname.\n";
 	}
//    var illegalChars = /[\W_]/; // allow only letters and numbers
	var illegalChars = /\W/; // allow letters, numbers, and underscores 
    if ((strng.length < 3) || (strng.length > 10)) {
       error = "The password is the wrong length.\n";
    }
    else if (illegalChars.test(strng)) {
      error = "The nickname contains illegal characters.\n";
    }
	
	
	
	if (error!="") {
		document.getElementById(naam + '_titel').style.color=errorcolor; 
		
		return false;
		} else {
			document.getElementById(naam + '_titel').style.color=normalcolor; 
			
			}
}


function controlFieldWachtwoord(formulier, naam) {
	var error = "";
	
	strng=document.forms[formulier].elements[naam].value;
	
 	if (strng == "") {
    	error = "You didn't enter a password.\n";
 	}
    var illegalChars = /[\W_]/; // allow only letters and numbers
    if ((strng.length < 6) || (strng.length > 10)) {
       error = "The password is the wrong length.\n";
    }
    else if (illegalChars.test(strng)) {
      error = "The password contains illegal characters.\n";
    }
	
	if (error!="") {
		document.getElementById(naam + '_titel').style.color=errorcolor; 
		
		return false;
		} else {
			document.getElementById(naam + '_titel').style.color=normalcolor; 
			
			}
}

function controlFieldWachtwoordb() {
	
		if (document.forms["inschrijven"].elements["wachtwoord_b"].value!=document.forms["inschrijven"].elements["wachtwoord_a"].value) {
			document.getElementById('wachtwoord_b_titel').style.color=errorcolor; 
			return false;
			} else {
			document.getElementById('wachtwoord_b_titel').style.color=normalcolor; 
			}
	}
	
function controlFieldEmailb() {
	
		if (document.forms["inschrijven"].elements["email_b"].value!=document.forms["inschrijven"].elements["email_a"].value) {
			document.getElementById('email_b_titel').style.color=errorcolor; 
			return false;
			} else {
			document.getElementById('email_b_titel').style.color=normalcolor; 
			}
}

function controlFieldLengte(formulier, naam, minimumlengte) {
	if (document.forms[formulier].elements[naam].value.length<minimumlengte) {
		document.getElementById(naam + '_titel').style.color=errorcolor; 
		return false;
	} else {
		document.getElementById(naam + '_titel').style.color=normalcolor; 	
	}
}

function controlFieldEmail(formulier, naam) {
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.forms[formulier].elements[naam].value)){
	document.getElementById(naam + '_titel').style.color=normalcolor; 	
	return (true)
	}
	document.getElementById(naam + '_titel').style.color=errorcolor;
	return (false)
}


function travel(n) {
  window.location=n;
}

function alarm(melding, naam) {

	 if (naam == null){
   naam = "warning";
	 }


	document.getElementById(naam).innerHTML = melding;
}

function submitmsnform(formuliernaam)
{
  document.forms[formuliernaam].submit();
  return true;
}
function resetform(formuliernaam)
{
  document.forms[formuliernaam].reset();
  return false;
}

function g(hoofdmenuID,submenuID) {
	
	travel("index.php?t="+hoofdmenuID+"&s="+submenuID);
	
	}


function SetAllCheckBoxes(FormName, FieldName, CheckValue)
{
	if(!document.forms[FormName])
		return;
	var objCheckBoxes = document.forms[FormName].elements[FieldName];
	if(!objCheckBoxes)
		return;
	var countCheckBoxes = objCheckBoxes.length;
	if(!countCheckBoxes)
		objCheckBoxes.checked = CheckValue;
	else
		// set the check value for all check boxes
		for(var i = 0; i < countCheckBoxes; i++)
			objCheckBoxes[i].checked = CheckValue;
}

//-->

