<!--

//POPUP
function popup(url, breedte, hoogte, scrolling) {
	day = new Date();
	id = day.getTime();
	
	eval("page" + id + " = window.open(url, '" + id + "', 'toolbar=0,scrollbars=" + scrolling + ",location=0,statusbar=1,menubar=0,resizable=0,top=0,left=0,width=" + breedte + ",height=" + hoogte + "');");
}

//SWITCH CLASS
function SwitchMe(obj,classNaam) {
	obj.className=classNaam;
}

//SELECT CHOICE
function MoveMe(url, val) {
	if (val != '') {	
		document.location = url + val;
	}
}

//CHANGE PIC
function changePic(objId, img) {
	document.getElementById(objId).src='../images/lists/' + img;
}

//CHECK FORMS

function checkWaarden(fouttext) {
	var form = document.forms["formulier"];
	var fouten = false;
	var color = "#e31c18";
	
	if (jsRequired != '') {
		
		requireds = jsRequired.split(";");
		for (x=0; x<requireds.length ;x++) {
			if(form[requireds[x]].value.length != ""){
				form[requireds[x]].style.backgroundColor = "";
			} else {
				fouten = true;
				//form[requireds[x]].style.backgroundColor = color;
			}
		}
	}
	if (jsNRequired != '') {
	
		requireds = jsNRequired.split(";");
		for (x=0; x<requireds.length ;x++) {
			if(form[requireds[x]].value.length != ""  && IsNumeric(form[requireds[x]].value)){
				form[requireds[x]].style.backgroundColor = "";
			} else {
				fouten = true;
				//form[requireds[x]].style.backgroundColor = color;
			}
		}
	}
	if (jsERequired != '') {
	
		requireds = jsERequired.split(";");
		for (x=0; x<requireds.length ;x++) {
			if(form[requireds[x]].value.length != ""  && echeck(form[requireds[x]].value)){
				form[requireds[x]].style.backgroundColor = "";
			} else {
				fouten = true;
				//form[requireds[x]].style.backgroundColor = color;
			}

		}
	}

	// is controle goed --> verdergaan, niet goed --> terug
	if(fouten){
		document.getElementById("error").innerHTML = "<FONT color='" + color + "'>" + fouttext + "</FONT><br><br>";
		//return false;
	}else{
		form.submit();
		//return true;
	}
}

//CHECK EMAIL

function checkEmail(fouttext) {
	var form = document.forms["news"];
	var fouten = false;
	var color = "#8DE3FF";
	
	if(form.mail.value.length != ""  && echeck(form.mail.value)) {
		form.mail.style.backgroundColor = "";
	} else {
		fouten = true;
		form.mail.style.backgroundColor = color;
	}
	
	// is controle goed --> verdergaan, niet goed --> terug
	if(fouten){
		document.getElementById("error").innerHTML = "<FONT color='" + color + "'>" + fouttext + "</FONT>";
	}else{
		form.submit();
	}
}

//CHECK LOGIN
function checkLogin(fouttext) {
	var form = document.forms["login"];
	var fouten = false;
	var color = "#dc7386";
	
	if(form.slogin.value.length != ""  && echeck(form.slogin.value)) {
		form.slogin.style.backgroundColor = "";
	} else {
		fouten = true;
		form.slogin.style.backgroundColor = color;
	}
	
	if(form.pasw.value.length != "") {
		form.pasw.style.backgroundColor = "";
	} else {
		fouten = true;
		form.pasw.style.backgroundColor = color;
	}
	
	if(fouten){
		//document.getElementById("error").innerHTML = "<FONT color='" + color + "'>" + fouttext + "</FONT>";
	}else{
		form.submit();
	}
}

//CHECK SEARCH
function checkSearch(fouttext) {
	var form = document.forms["search"];
	var fouten = false;
	var color = "#FF7F7C";
	
	if(form.searchw.value.length != "") {
		form.searchw.style.backgroundColor = "";
	} else {
		fouten = true;
		form.searchw.style.backgroundColor = color;
	}
	
	if(fouten) { }
	else { form.submit(); }
}

// OTHER

//KEYPRESS
function submitenter(myForm, e) {
	var keycode;
	
	if (window.event) keycode = window.event.keyCode;
	else if (e) keycode = e.which;
	else return true;
	
	if (keycode == 13) {
		//myForm.form.submit();
		checkLogin('');
		return false;
	} else return true;
}

function IsNumeric(string) {
    if (!string) return false; // als de string leeg is
    var Chars = "0123456789/-."; // mogelijke karakters in de string
    for (var i = 0; i < string.length; i++) { // alle karakters overlopen van de string
       if (Chars.indexOf(string.charAt(i)) == -1) // als het zoveelste karakter in de string NIET in char voorkomt
          return false;
    }
    return true;
}

function echeck(str) {
	var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)

	if (str.indexOf(at)==-1) {
		//alert("Invalid E-mail ID")
		
		return false
	}

	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr) {
		//alert("Invalid E-mail ID")

        return false
	}

	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr) {
		//alert("Invalid E-mail ID")

        return false
	}

	if (str.indexOf(at,(lat+1))!=-1) {
		//alert("Invalid E-mail ID")
		
		return false
	}

	if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot) {
		//alert("Invalid E-mail ID")

        return false
	}

	if (str.indexOf(dot,(lat+2))==-1) {
		//alert("Invalid E-mail ID")

        return false
	}

    if (str.indexOf(" ")!=-1) {
		//alert("Invalid E-mail ID")
		
		return false
	}

	return true                                                       
}

//-->
