var onmenu = 0;
var theTimer;

function init() {
}

function CMSPopUp(url, wi, he, winm) {
	if (winm == 0) {
		window.open(url, '', 'toolbar=0,location=0,directories=0,menubar=0,scrollbars=0,resizable=no,width=' + wi + ',height=' + he);
	} else {
		window.open(url, '', 'toolbar=1,location=1,directories=1,menubar=1,scrollbars=1,resizable=yes,width=' + (wi + 16) + ',height=' + he);
	}
}

function menuOpenClose(mid, show, xpos) {
	element = document.getElementById('menu_' + mid);
	if (element) {
		if (show == 1) {
			elems = document.all('showfields').elements;
			for (i = 0; i < elems.length; i++) {
				element_tmp = document.getElementById(elems[i].name.replace('show', ''));
				if (element_tmp) {
					element_tmp.style.display = 'none';
				}
			}
			element.style.display = '';
			theTimer = setTimeout("menuOpenClose(" + mid + ", 0, 0)", 1000);
			if (xpos > 0) {
					element.style.paddingLeft = xpos;
			}
		} else {
			if (onmenu == 0) {
				element.style.display = 'none';
				theTimer = null;
			} else {
				theTimer = setTimeout("menuOpenClose(" + mid + ", 0, 0)", 1000);
			}
		}
	}
}

function menuOpenClose2(mid, show, xpos) {
	element = document.getElementById('menu_' + mid);
	if (element) {
		if (show == 1) {
			elems = document.all('showfields2').elements;
			for (i = 0; i < elems.length; i++) {
				element_tmp = document.getElementById(elems[i].name.replace('show', ''));
				if (element_tmp) {
					element_tmp.style.display = 'none';
				}
			}
			element.style.display = '';
			theTimer = setTimeout("menuOpenClose2(" + mid + ", 0, 0)", 1000);
			if (xpos > 0) {
					element.style.paddingLeft = xpos;
			}
		} else {
			if (onmenu == 0) {
				element.style.display = 'none';
				theTimer = null;
			} else {
				theTimer = setTimeout("menuOpenClose2(" + mid + ", 0, 0)", 1000);
			}
		}
	}
}

function isEmail(string) {
	if (string.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)
		if (string.search(/.com/) != -1 | string.search(/.nl/) != -1 | string.search(/.net/) != -1 | string.search(/.org/) != -1 | string.search(/.nu/) != -1 | string.search(/.biz/) != -1 | string.search(/.info/) != -1 | string.search(/.be/) != -1) {
			return true;
		}
	else
		return false;
}

function checkForm(formname) {
	elems = document.all(formname).elements;
	tel= 0;
	document.all(formname).fields.value = '';
	for(i = 0; i < elems.length; i++) {
		element = null;
		element = document.getElementById(elems[i].name + '_');
		document.all(formname).fields.value = document.all(formname).fields.value + elems[i].name + ',';
		if (element) {
			element.style.display = 'none';
			if (elems[i].value == '') {
				tel = tel + 1;
				elems[i].className=elems[i].className.replace('_highlight', '')+'_highlight';
				element.style.display = '';
			} else {
				if (elems[i].type == 'checkbox') {
					if (elems[i].checked == false) {
						tel = tel + 1;
						elems[i].className=elems[i].className.replace('_highlight', '')+'_highlight';
						element.style.display = '';
						element.style.color = '#FF0000';
					} else {
						element.style.display = '';
						element.style.color = '#000000';
					}
				}
				// RESCUE OLD EMAILCHECK if (elems[i].name.substr(0,5) == 'email') {
				if (elems[i].name.indexOf('email') != -1) {
					if (!isEmail(elems[i].value)) {
						tel = tel + 1;
						elems[i].className=elems[i].className.replace('_highlight', '')+'_highlight';
						elems[i].value = document.all(formname).val_email.value;
						
						element.style.display = '';
					}
				}
			}
		}
	}
	passerror = 0;
	if (document.all(formname).password) {
		if (document.all(formname).password.value != document.all(formname).rep_password.value) {
			passerror = 1;
			tel = tel + 1;
			document.all('password_').style.display = '';
			document.all('rep_password_').style.display = '';
		}
	}
	element = document.getElementById('showcheck');
	if (tel == 0) {
		document.all(formname).submit();
	} else {
		if (passerror == 0) {
			
				element.innerHTML = '<font color="#bfe10e"><b>* ' + document.all(formname).val_velden.value + ' [' + tel + ']</b></font>';
			
		} else {
			element.innerHTML = '<font color="#FF0000"><b>* ' + document.all(formname).val_wachtwoord.value + '</b></font>';
		}
	}
}

// Select / Combo box
var onmenu = 0;

function showSelect(elm, show) {
	element = document.getElementById('menu_' + elm);
	if (element) {
		if (show == 1) {
			element.style.display = '';
			theTimer = setTimeout("showSelect('" + elm + "', 0, 0)", 1000);
		} else {
			if (onmenu == 0) {
				element.style.display = 'none';
				theTimer = null;
			} else {
				theTimer = setTimeout("showSelect('" + elm + "', 0, 0)", 1000);
			}
		}
	}
}


function selectItem(inputField, inputValue, showField, showValue, menuName) {
	
	if(elem = document.getElementById(inputField)) {
		elem.value=inputValue; 
	}
	
	if(elem2 = document.getElementById(showField)) {
		if (elem2.tagName == 'INPUT') {
			elem2.value=showValue; 
		}else{
			elem2.innerHTML=showValue; 
		}
		//elem2.value=showValue; 
	}
	onmenu=0; 
	showSelect(menuName, 0);
}

// -