function addDnPart(dn, type, value)
{
  if (value.length==0)
   return;   
  dn.push(type);
  dn.push("=");
  dn.push(value);
  dn.push(",");
}

function generateRequest()
{
//EMAILADDRESS=adrien06@gmail.com, CN=Vanderborght, OU=19346550006, O=083212093, ST=Ciney, C=BE
  var dn=[];
  dn.push("C=BE,");	
  addDnPart(dn, "ST", document.UIForm.location.value);
  addDnPart(dn, "O", document.UIForm.phoneNumber.value);
  addDnPart(dn, "OU", document.UIForm.inami.value);
  addDnPart(dn, "CN", document.UIForm.tbCommonName.value);
  addDnPart(dn, "E", document.UIForm.email.value);
  dn.pop();
  	
  document.getElementById("dn").value = dn.join('');
  document.getElementById("fn").value = document.UIForm.tbCommonName.value;
  document.forms["UIForm"].submit();  
}

function installTheCertificate()
{
		var sPKCS7=document.UIForm.taInstallCert.value;
		doInstall(sPKCS7);
}		


