var error;
colorbad="#FFF8C0";
colorgood="#FFFFFF";
function colorize(obj,bool) {
	obj.style.backgroundColor=bool?colorbad:colorgood;
	if (bool) {
		error=true;
		if (fc=="") fc=obj;
	}
}
function checkform(frm) {
	fc=""; error="";
	for (i=0;i<frm.elements.length;i++) {
		el=frm.elements[i];
		if (!el.disabled) {
			for (j=0;j<el.attributes.length;j++) {
				if (el.attributes[j].name.toUpperCase()=="MUST") {
					if (el.value=="No state selected") {
						if (document.getElementById('country').value=="us" || document.getElementById('country').value=="ca") {
							if (el.type=="select-one") colorize(el,(el.options[el.selectedIndex].value=="No state selected" && el.options[el.selectedIndex].text=="No state selected")?true:false);
						}
					} else {
						if (el.type=="text") colorize(el,el.value==""?true:false);
						if (el.type=="file") colorize(el,el.value==""?true:false);
						if (el.type=="textarea") colorize(el,el.value==""?true:false);
						if (el.type=="password") colorize(el,el.value==""?true:false);
						if (el.type=="select-one") colorize(el,(el.options[el.selectedIndex].value=="" && el.options[el.selectedIndex].text=="")?true:false);
					}
				}
			}
		}
	}
	if (error) {
		
		e = document.location.href.split('/');
		f = e[2].split('.');
		taal = f[0];		
		if (taal == 'www') taal = 'en';
		
		switch(taal) {
			case 'en':
			alert("Please enter all mandatory fields");
			break
			case 'jp':
			alert("Please enter all mandatory fields");
			break
			case 'nl':
			alert("Gelieve alle verplichte velden in te vullen");
			break
			case 'de':
			alert("Please enter all mandatory fields");
			break
			case 'fr':
			alert("Please enter all mandatory fields");
			break
		}
		
		fc.focus();
	} else frm.submit();
}
