function isListBoxValid(num)  // is list-box num valid?
  {
  if (num == 0)               //  blank (first) item selected
    return false;
  else                        // nonblank item selected
  return true;
  }


function isZipValid(str)        // is zip str valid?
  {

  for (i=0; i<=str.length-1; i++)
    {
    if (!isNum(str.charAt(i)))
      return false;
    }
  return true;                 
  }

function isEMailValid(str)                   // is email str valid?
  {
  if (isBlank(str) || str.indexOf("|") != -1)  
    {
       return false;
    }
  var atsignPos = str.indexOf("@", 0)       
  if (atsignPos == -1)	                    
    {
   
    return false;
    }
  if (str.indexOf(".", atsignPos) == -1)   
    {
    
    return false;
    }
  return true;                              
  }

function isPhoneValid(str)          // is phone str valid
  {
   
  for (i=0; i<=str.length-1; i++)
    {
      if (!isNum(str.charAt(i))) 
      {
      return false;
      }
	}
  return true;                     
  }
   
function isBlank(str)              // is str blank?
  {
  if (str.length == 0)           
    return true;
  for (i=0; i<=str.length-1; i++)  
    if (str.charAt(i) != " ")
      return false;
  return true;                     
  }

function isNum(chr)            // is character a number?
  {
  if (chr < "0" || chr > "9")  
    return false;
  else                         
    return true;
  }

function VerifExt(Path)
{
 
  if(Path != "")
  {
    var Chaine = new String(Path);
    MinChaine = Chaine.toLowerCase();
    var SubChaine = new String(MinChaine);
    Pos = SubChaine.lastIndexOf('.');
    Ext = SubChaine.substr(Pos+1);
    if((Ext != "doc")&&(Ext != "txt")&&(Ext != "pdf"))
    {
      alert("Veuillez insérer un fichier avec dont le format est :doc, txt ou pdf!");
      return false;
    }
  }
  
  return true;
}
