function init() {
}

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

function changePicture(name,image) {
	element = document.getElementById(name);
	element.src = 'images/'+ image;
}

function isEmail(string) {
	if (string.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1) {

		ext = new Array('.ac', '.ad', '.ae', '.af', '.ag', '.ai', '.al', '.am', '.an', '.ao', '.aq', '.ar', '.arpa', '.as', '.at', '.au', '.aw', '.az', '.ba', '.bb', '.bd', '.be', '.bf', '.bg', '.bh', '.bi', '.bj', '.bm', '.bn', '.bo', '.br', '.bs', '.bt', '.bv', '.bw', '.by', '.bz', '.ca', '.cc', '.cf', '.cg', '.ch', '.ci', '.ck', '.cl', '.cm', '.cn', '.co', '.com', '.cr', '.cs', '.cu', '.cv', '.cx', '.cy', '.cz', '.de', '.dj', '.dk', '.dm', '.do', '.dz', '.ec', '.edu', '.ee', '.eg', '.eh', '.er', '.es', '.et','.fi', '.firm', '.fj', '.fk', '.fm', '.fo', '.fr', '.fx', '.ga', '.gb', '.gd', '.ge', '.gf', '.gh', '.gi', '.gl', '.gm', '.gn', '.gov', '.gp', '.gq', '.gr', '.gs', '.gt', '.gu', '.gw', '.gy', '.hk', '.hm', '.hn', '.hr', '.ht', '.hu', '.id', '.ie', '.il', '.in', '.int', '.io', '.iq', '.ir', '.is', '.it', '.jm', '.jo', '.jp', '.ke', '.kg', '.kh', '.ki', '.km', '.kn', '.kp', '.kr', '.kw', '.ky', '.kz', '.la', '.lb', '.lc', '.li', '.lk', '.lr', '.ls', '.lt', '.lu', '.lv', '.ly', '.ma', '.mc', '.md', '.mg', '.mh', '.mil', '.mk', '.ml', '.mm', '.mn', '.mo', '.mp', '.mq', '.mr', '.ms', '.mt', '.mu', '.mv', '.mw', '.mx', '.my', '.mz', '.na', '.nato', '.nc', '.ne', '.net', '.nf', '.ng', '.ni', '.nl', '.no', '.nom', '.np', '.nr', '.nt', '.nu', '.nz', '.om', '.org', '.pa', '.pe', '.pf', '.pg', '.ph', '.pk', '.pl', '.pm', '.pn', '.pr', '.pt', '.pw', '.py', '.qa', '.re', '.ro', '.ru', '.rw', '.sa', '.sb', '.sc', '.sd', '.se', '.sg', '.sh', '.si', '.sj', '.sk', '.sl', '.sm', '.sn', '.so', '.sr', '.st', '.store', '.su', '.sv', '.sy', '.sz', '.tc', '.td', '.tf', '.tg', '.th', '.tj', '.tk', '.tm', '.tn', '.to', '.tp', '.tr', '.tt', '.tv', '.tw', '.tz', '.ua', '.ug', '.uk', '.um', '.us', '.uy','.uz', '.va', '.vc', '.ve', '.vg', '.vi', '.vn', '.vu', '.web', '.wf', '.ws', '.ye', '.yt', '.yu', '.za', '.zm', '.zr', '.zw');
		
		for (s = 0; s < ext.length; s++) {
			thisEntry = ext[s].toString();
			if (string.search(thisEntry) != -1) {
				return true;
			}
		}
	}
	return false;
}

function checkForm(formname, lng) {
	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;
				element.style.display = '';
			} else {
				if (elems[i].type == 'checkbox') {
					if (elems[i].checked == false) {
						tel = tel + 1;
						element.style.display = '';
						element.style.color = '#FF0000';
					} else {
						element.style.display = '';
						element.style.color = '#000000';
					}
				}
				if (elems[i].name.substr(0,5) == 'email') {
					if (!isEmail(elems[i].value)) {
						tel = tel + 1;
						if (lng == 0) {
							elems[i].value = 'geen geldige e-mail';
						} else {
							elems[i].value = 'no valid e-mail';
						}
						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) {
			if (lng == 0) {
				element.innerHTML = '<font color="#FF0000"><b>* Vul alle verplichte velden in [' + tel + ']</b></font>';
			} else {
				element.innerHTML = '<font color="#FF0000"><b>* Fill in all required fields [' + tel + ']</b></font>';
			}
		} else {
			element.innerHTML = '<font color="#FF0000"><b>* Herhaal uw wachtwoord correct</b></font>';
		}
	}
}
