<!--   // Copyright© Acecom® Srl Italy - All rights reserved
       // Development by Acecom® Srl Italy
       // Mailing Module Manager Solutions 2008/APR/15 W3C XHTML
       // Note: Include Useragent.js


// Define global variables
var d = document
var vStartReset   = false;
var aMemDate      = new Array();
var aVerData      = new Array();
var iVerDataIdx   = 0;
var aMemoIniData  = new Array();
var iMemoIniIdx   = 0;


switch(jsLanguage) {
  case "DE":  var aPopWin  = new Array("Insert", "Korrigieren", " Um die anfrage zu senden, korrigieren, \n Sie bitte die Fehler und wiederholen Sie das. \n Einsendeverfahren.");
              var aPrivacy = new Array("Zustimmung des privacy wird nicht angenommen");
            break;

  case "EN":  var aPopWin  = new Array("Insert", "Verify", " Your request cannot be forwarded, \n as some information is missing or incorrect. \n Please correct the form and then repeat the \n forward procedure. Thank you.");
              var aPrivacy = new Array("Consent of the privacy is not accepted");
            break;

  case "FR":  var aPopWin  = new Array("Insert", "Verify", " Pour envoyer la demande, nous vous prions, \n de bien vouloir corriger les erreurs et de répéter \n l'opération d'envoi. Merci.");
              var aPrivacy = new Array("le consentement de la privacy n\'est pas accepté");
            break;

  default:    var aPopWin  = new Array("Inserire", "Verificare", " Per inviare la richiesta, si prega di, \n corregere gli errori e di ripetere l'operazione d'invio. \n Grazie.");
              var aPrivacy = new Array("Consenso privacy non accettato");
            break; }


// Functions Data Manager
function ResetData() {
   if (vStartReset == true)  RestoreIniData();
   if (vStartReset == false) MemorizeIniData();
 }

function RestoreIniData() {
   for (iDat = 0; iDat < aMemoIniData.length; iDat++) {
     with(d.FormPN.elements[aMemoIniData[iDat][0]]) {
       switch(aMemoIniData[iDat][1]) {
         case "text":       value = aMemoIniData[iDat][2];          break;
         case "textarea":   value = aMemoIniData[iDat][2];          break;
  } } }
}

function MemorizeIniData() {
   for (iDat = 0; iDat < d.FormPN.elements.length; iDat++) {
     with(d.FormPN.elements[iDat]) {
       switch(type) {
         case "text":       aMemoIniData[iMemoIniIdx] = new Array(name, type, value);         iMemoIniIdx++;  break;
         case "textarea":   aMemoIniData[iMemoIniIdx] = new Array(name, type, value);         iMemoIniIdx++;  break;
  } } }
   vStartReset = true;
}

// Functions
function FieldInput(inNameId, inDataSize, inTypeVer, inDescLan) {
  if (typeof inNameId != "undefined" && typeof inTypeVer != "undefined" && typeof inDescLan != "undefined") { 
     d.write('<img border="0" src="../../images/form.png" width="20" height="14" alt="" />');

     aVerData[iVerDataIdx] = new Array(inNameId, inTypeVer, inDescLan);
   iVerDataIdx++;
  }

  if (typeof inNameId != "undefined") { 
     d.write('<input class="FormInp01" size="' + BrowserResize(inDataSize) + '" type="text" maxlength="50" name="' + inNameId + '">');
   }
}

function FieldTextVisual(inNameId, inDataSize, inData) {
  if (typeof inNameId != "undefined") { 
     d.write('<input class="FormInp03" size="' + BrowserResize(inDataSize) + '" type="text" maxlength="50" name="' + inNameId + '" value="' + inData + '" readonly>');
   }
}

function FieldTextArea(inNameId, inDataSize) {
   if (typeof inNameId != "undefined") { 
     d.write('<textarea class="FormInp03" rows="8" name="' + inNameId + '" cols="' + BrowserResize(inDataSize) + '"></textarea>');
   }
}


function FieldTextAreaVisual(inNameId, inDataSize, inData) {
   if (typeof inNameId != "undefined") { 
     d.write('<textarea class="FormInp03" rows="8" name="' + inNameId + '" cols="' + BrowserResize(inDataSize) + '" readonly>' + inData +'</textarea>');
   }
}

// Functions Control-Data Manager
function VerWSpace(vInput) {
   return (VerSequence(vInput, " \t\n\r"));
}

function VerNumber(vInput) {
   return ((vInput >= "0") && (vInput <= "9"));
}

function VerSequence (vInput, vSeq) {
   for (iTes = 0; iTes < vSeq.length; iTes++) { 
     if (vSeq.charAt(iTes) == vInput) return (true); 
   }
   return  (false);
}

function IsEmpty(vDatVal) {
   return ((vDatVal == null) || (vDatVal == ""));
}

function IsNumber(vDatVal) {
   for (iChr = 0; iChr < vDatVal.length; iChr++) { 
     if (!VerNumber(vDatVal.charAt(iChr))) return (false);
   }
   if (vDatVal > 0) return (true); 
   else             return (false);
}

function IsMail(vDatVal) {
   iChr = 0;
   while ((iChr < vDatVal.length) && (vDatVal.charAt(iChr) != "@")) iChr++;
     if ((iChr >= vDatVal.length) || (vDatVal.charAt(iChr) != "@")) return (false); 
   
   iChr += 2;
   while ((iChr < vDatVal.length) && (vDatVal.charAt(iChr) != ".")) iChr++;
     if ((iChr >= vDatVal.length - 1) || (vDatVal.charAt(iChr) != ".")) return (false);   
   
   return (true);
}

function RemoveIniSpace(vDatVal) {
   iChr = 0;
   while ((iChr < vDatVal.length) && VerWSpace(vDatVal.charAt(iChr))) iChr++;
   
   return (vDatVal.substring(iChr, vDatVal.length));
}

function ConvertDefCase(vDatVal) {
   vDatOne = vDatTwo = "";

   if (vDatVal.length > 0) { 
     vDatOne = vDatVal.substring(0,1);
     vDatOne = vDatOne.toUpperCase(); }
   
   if (vDatVal.length > 1) { 
     vDatTwo = vDatVal.substring(1, vDatVal.length);
     vDatTwo = vDatTwo.toLowerCase(); }
   
   return (vDatOne + vDatTwo);
}

function VerifyForm(oForm) {
   vError =  "";
   vFlagOk = false;
   
   for (iDat = 0; iDat < aVerData.length; iDat ++) {
     oField = oForm.elements[aVerData[iDat][0]];

     if (oField.type == "text" || oField.type == "textarea") {
       oField.value = RemoveIniSpace(oField.value);

       if (Boolean(aVerData[iDat][1])) {
         if (IsEmpty(oField.value)) {
                                  vError += ("\n- " + aPopWin[0] + " " + aVerData[iDat][2]);
         } else {
             switch(aVerData[iDat][1]) {
               case "VerNumber":  vFlagOk = (!IsNumber(oField.value));  break;
               case "VerMail":    vFlagOk = (!IsMail(oField.value));    break;
               default:           vFlagOk = false;                      break;  } 
             if (vFlagOk == true) vError += ("\n- " + aPopWin[1] + " " + aVerData[iDat][2] + " \t [" + oField.value + "]");
         }
   } } }
                                 
   if (oForm.elements["DataOptPrivacy"][0].checked == false) {
                                  vError = (vError +"\n\n- " + aPrivacy[0] + "\n___________________________________________\n");
   }
                            
   if (vError != "") {
                                  vError = (aPopWin[2] + "\n___________________________________________\n" + vError);
     window.alert(vError);
     return (false);
   }
   return (true);
}

//-->
