var cssmenuids=["cssmenu1"] //Enter id(s) of CSS Horizontal UL menus, separated by commas
var csssubmenuoffset=-1 //Offset of submenus from main menu. Default is 0 pixels.

function createcssmenu2(){
for (var i=0; i<cssmenuids.length; i++){
  var ultags=document.getElementById(cssmenuids[i]).getElementsByTagName("ul")
    for (var t=0; t<ultags.length; t++){
			ultags[t].style.top=ultags[t].parentNode.offsetHeight+csssubmenuoffset+"px"
    	var spanref=document.createElement("span")
			spanref.className="arrowdiv"
			spanref.innerHTML="&nbsp;&nbsp;&nbsp;&nbsp;"
			ultags[t].parentNode.getElementsByTagName("a")[0].appendChild(spanref)
    	ultags[t].parentNode.onmouseover=function(){
					this.style.zIndex=100
    	this.getElementsByTagName("ul")[0].style.visibility="visible"
					this.getElementsByTagName("ul")[0].style.zIndex=0
    	}
    	ultags[t].parentNode.onmouseout=function(){
					this.style.zIndex=0
					this.getElementsByTagName("ul")[0].style.visibility="hidden"
					this.getElementsByTagName("ul")[0].style.zIndex=100
    	}
    }
  }
}

if (window.addEventListener)
window.addEventListener("load", createcssmenu2, false)
else if (window.attachEvent)
window.attachEvent("onload", createcssmenu2)

function appsinfo(tekst){
	if (tekst != ""){
		document.getElementById('thistext').innerHTML = tekst;
	} else {
		document.getElementById('thistitle').innerHTML = 'Details applicatie';
		document.getElementById('thistext').innerHTML = 'Beweeg met de muis over een applicatie om de details te bekijken.';
	}
}

function siteinfo(title,tekst,image){
	if (tekst != "" && title != ""){
		document.getElementById('thistitle').innerHTML = title;
		document.getElementById('thistext').innerHTML = tekst;
		document.getElementById('webimage').src = image;
	} else {
		document.getElementById('thistitle').innerHTML = 'Details website';
		document.getElementById('thistext').innerHTML = 'Beweeg met de muis over een website om de details te bekijken.';
		document.getElementById('webimage').src = 'images/spacer.gif';
	}
}


function checkbox_checker(){
	var checkbox_choices = 0;
	if (document.getElementById('nl') && document.getElementById('nl').checked == true) { checkbox_choices++; }
	if (document.getElementById('be') && document.getElementById('be').checked == true) { checkbox_choices++; }
	if (document.getElementById('com') && document.getElementById('com').checked == true) { checkbox_choices++; }
	if (document.getElementById('net') && document.getElementById('net').checked == true) { checkbox_choices++; }
	if (document.getElementById('info') && document.getElementById('info').checked == true) { checkbox_choices++; }
	if (document.getElementById('org') && document.getElementById('org').checked == true) { checkbox_choices++; }
	if (document.getElementById('biz') && document.getElementById('biz').checked == true) { checkbox_choices++; }
	if (document.getElementById('eu') && document.getElementById('eu').checked == true) { checkbox_choices++; }

	if (checkbox_choices < 1 ){
		if (confirm("Weet u zeker dat u door wilt gaan zonder een domeinnaam te kiezen?")) {
			return (true);
		} else {
			return (false);
		}
	} else {
		return (true);
	}
}

var win= null;

function NewWindow(mypage,myname,w,h,scroll){
	var winl = (screen.width-w)/2;
	var wint = (screen.height-h)/2;
	var settings  ="height="+h+",";
	settings +="width="+w+",";
	settings +="top="+wint+",";
	settings +="left="+winl+",";
	settings +="scrollbars="+scroll+",";
	settings +="resizable=yes";
	win=window.open(mypage,myname,settings);
	if(parseInt(navigator.appVersion) >= 4){win.window.focus();}
}

function NewPDF(mypage,myname,w){
	var winl = (screen.width-w)/2;
	var settings  ="height="+screen.height+",";
	settings +="width="+w+",";
	settings +="top=0,";
	settings +="left="+winl+",";
	settings +="scrollbars=yes,";
	settings +="resizable=yes";
	win=window.open(mypage,myname,settings);
	if(parseInt(navigator.appVersion) >= 4){win.window.focus();}
}
function passwordStrength(passwd) {
	var intScore = 0;

	if ((passwd.length > 0) && (passwd.length <= 4)){
		intScore = 2;
	} else if ((passwd.length>=5) && (passwd.length<=7)){
		intScore = passwd.length / 0.6;
	} else if ((passwd.length>=8) && (passwd.length<=10)){
		intScore = (passwd.length * 1.5) / 0.6;
	} else if (passwd.length >= 11){
		intScore = 25;
	} 

	if (passwd.match(/[a-z]/)){ intScore = (intScore + 2); }
	if (passwd.match(/[A-Z]/)){ intScore = (intScore + 5); }
	if (passwd.match(/\d+/)){ intScore = (intScore + 5); }
	if (passwd.match(/(.*[0-9].*[0-9].*[0-9])/)){ intScore = (intScore + 13); }
	if (passwd.match(/.[!,@,#,$,%,^,&,*,?,_,~]/)){ intScore = (intScore + 8); }
	if (passwd.match(/(.*[!,@,#,$,%,^,&,*,?,_,~].*[!,@,#,$,%,^,&,*,?,_,~])/)) { intScore = (intScore + 11); }
	if (passwd.match(/([a-z].*[A-Z])|([A-Z].*[a-z])/)){ intScore = (intScore + 8); }
	if (passwd.match(/([a-zA-Z])/) && passwd.match(/([0-9])/)){ intScore = (intScore + 10); }
	if (passwd.match(/([a-zA-Z0-9].*[!,@,#,$,%,^,&,*,?,_,~])|([!,@,#,$,%,^,&,*,?,_,~].*[a-zA-Z0-9])/)){ intScore = (intScore + 13); }
	return intScore;
}

function showStrength(strength) {
	var strengthText = "";
	if (strength == 0) {
		strengthText = "Wachtwoord sterkte";
	} else if (strength < 20) {
		strengthText = "Wachtwoord is zeer zwak";
	} else if (strength < 30) {
		strengthText = "Wachtwoord is zwak";
	} else if (strength < 60) {
		strengthText = "Wachtwoord is gemiddeld";
	} else if (strength < 85) {
		strengthText = "Wachtwoord is sterk";
	} else {
		strengthText = "Wachtwoord is zeer sterk";
	}
	updateBar(strength, 'barMask', 'barBG', 'barText', strengthText);
}

function updateBar(val, maskId, bgId, textId, newHTML) {
	barWidth = parseInt(document.getElementById(bgId).style.width);
	maskWidth = barWidth - (barWidth * (val/100));
	document.getElementById("passstrength").value = val;
	document.getElementById(maskId).style.width = maskWidth + "px";
	if (!newHTML) {
		document.getElementById(textId).innerHTML = Math.floor((curLeft / parseInt(document.getElementById(bgId).offsetWidth))*100) + "%";
	} else {
		document.getElementById(textId).innerHTML = newHTML;
	}
}

function checkpass(){
	if (document.getElementById("passstrength").value >= 30){
		return true;
	} else {
		alert("Wachtwoord-sterkte dient minimaal gemiddelde te zijn!!!\nTip: Gebruik hoofdletters, kleine letters en leestekens.");
	}
	return false;
}

function checkpass_eml(){
	if (document.getElementById("passstrength").value >= 30){
		return true;
	} else {
		alert("Wachtwoord-sterkte dient minimaal gemiddeld te zijn!!!\nTip: Gebruik hoofdletters, kleine letters en leestekens.");
	}
	return false;
}
