// JavaScript Document
function keurMailformGoed(oForm)
{
//alert("hoi"+document.forms.length);
  var err = "";
  for(i=0;i<oForm.elements.length;i++){

  	//if(oForm.elements[i].alt!="" || oForm.elements[i].alt!=undefined){
		//alert("hoi"+oForm.elements[i].value+" "+oForm.elements[i].selectedIndex+" "+oForm.elements[i].alt);
		//alert("hoi2"+oForm.elements[i].checked+" "+oForm.elements[i].name+" "+oForm.elements[i].alt);
		//if((oForm.elements[i].value=="" && oForm.elements[i].selectedIndex==undefined && oForm.elements[i].checked==undefined)||oForm.elements[i].checked==false){
		if((oForm.elements[i].value=="" && oForm.elements[i].selectedIndex==undefined )||oForm.elements[i].checked==false&&oForm.elements[i].value=="on"){
			//alert(typeof(oForm.elements[i].rel));
			temp=typeof(oForm.elements[i].rel);
			if(oForm.elements[i].rel!=undefined){
				if(oForm.elements[i].rel!=""){
					//alert("deze"+oForm.elements[i].value+" "+oForm.elements[i].name);
					err += oForm.elements[i].name + "\n";
				}
			}
		}
  }
  if (err != "") {

    window.alert("Verplichte gegevens ontbreken:\n \n" + err);
    return false;
  } else {
  	return true;
  }
}

function dis2alt()
{
  var err = "";
	//alert("hoi"+document.forms[0].elements.length);
	var inputs=document.getElementsByTagName("input");
	var inputsC=inputs.length;
	for(i=0; i<inputsC; i++){
		var input = inputs[i];
		if (!input) { continue; }


		//alert("hoi"+input.name);
			//if(document.forms[0].elements[i].alt!="" || document.forms[0].elements[i].alt!=undefined){
			//alert("hoi"+document.forms[0].elements[i].selectedIndex+" "+document.forms[0].elements[i].name+" "+document.forms[0].elements[i].alt);
			if(input.disabled){
				//alert("altert"+input.name);
				input.rel=input.name;
				input.disabled="";
			}
			if(input.type=="radio" && input.className){
				//alert("altert"+input.name);
				//alert("altert"+input.className);
				//input.onclick=function(){onclickFunction(j,i);};
				//input.onclick=function(){alert(this.value);};
				//this.forms.action=this.className;
				input.onclick=function(){setAction(this.form.name,this.className)};
				if(input.checked){
					var form = input.parentNode;
					while(form.nodeName.toLowerCase() != "form") {
						form = form.parentNode;
					}
					form.action=input.className;
					//alert(j);
				}
			}

			var   subSection = input.name.substring(6,0);
			var naam;
			if(subSection == "datum_")
			{
				naam=input.name;
				//alert(naam);
				datum(input,naam);
				input.parentNode.removeChild(input);
				//alert("hoi");
			}
		}
}


var firstSelect,secondSelect,thirdSelect;
var teller,optie;
function datum(hetObject,naam){

	thirdSelect=document.createElement("select");
	thirdSelect.setAttribute("name",naam+"3");
	for (teller=1900; teller<2008; teller++ )
	{
		optie=document.createElement("option");
		optie.setAttribute("value",teller);
		optie.appendChild(document.createTextNode(teller));
		thirdSelect.appendChild(optie);
	}
	if(hetObject.nextSibling!=null){
		hetObject.form.insertBefore(thirdSelect,hetObject.nextSibling);
	}

	secondSelect=document.createElement("select");
	secondSelect.setAttribute("name",naam+"2");
	for (teller=1; teller<13; teller++ )
	{
		optie=document.createElement("option");
		optie.setAttribute("value",teller);
		optie.appendChild(document.createTextNode(teller));
		secondSelect.appendChild(optie);
	}
	if(hetObject.nextSibling!=null){
		hetObject.form.insertBefore(secondSelect,hetObject.nextSibling);
	}

	firstSelect=document.createElement("select");
	firstSelect.setAttribute("name",naam+"1");
	for (teller=1; teller<32; teller++ )
	{
		optie=document.createElement("option");
		optie.setAttribute("value",teller);
		optie.appendChild(document.createTextNode(teller));
		firstSelect.appendChild(optie);
	}

	if(hetObject.nextSibling!=null){
		hetObject.form.insertBefore(firstSelect,hetObject.nextSibling);
	}
}


function setAction(formName,strWaarde)
{
	document.forms[formName].action=strWaarde;
	//alert(strWaarde);
}

/*********************************
*********************************/
function showOpmerkingArtikel(strId,intX,intY)
{
	oOpm = document.getElementById(strId);

	if(oOpm!=undefined)
	{
		oOpm.style.visibility = "visible";
		//oOpm.style.left = 30+intX+"px;"//intX+"px";
		//oOpm.style.top = -30+intY+"px;"//intX+"px";
	}
}

/*********************************
*********************************/
function hideOpmerkingArtikel(strId)
{
	oOpm = document.getElementById(strId);
	if(oOpm!=undefined)
	{
		oOpm.style.visibility = "hidden";
	}
}

window.onload=function(){dis2alt();};

