function verify(Lang)
{
  if (document.form1.txtFirstname.value == "")
  {
    if (Lang == "en")
    {
      alert("The first name must be typed !!!");
    }
    else 
    {
      alert("Le prénom doit être renseigné!!!");
    }
    document.form1.txtFirstname.focus();
    return false; 
  }
  if (document.form1.txtMail.value == "")
  {
    if (Lang == "en")
    {
      alert("The e-mail address must be typed !!!");
    }
    else 
    {
      alert("L'adresse du courriel doit être renseignée!!!");
    }
    document.form1.txtMail.focus();
    return false; 
  }  
  if (document.form1.txtMailReceiver.value == "")
  {
    if (Lang == "en")
    {
      alert("The e-mail address of the receiver must be typed !!!");
    }
    else 
    {
      alert("L'adresse courriel du destinataire doit être renseignée!!!");
    }
    document.form1.txtMailReceiver.focus();
    return false; 
  }  
return true;
}

function verifyLogin(Lang)
{
 if (document.form1.txtUserName.value == "")
 {
   if (Lang == 'en')
   {
     alert("The user name must be type");
   }
   else 
   {
     alert("Le nom de l'utilisateur doit être rempli");
   }
   document.form1.txtUserName.focus();
   return false;
 }
 if (document.form1.txtPSW.value == "")
 {
   if (Lang == 'en')
   {
     alert("The password must be type");
   }
   else
   {
     alert("Le mot de passe de l'utilisateur doit être rempli");
   }
   document.form1.txtPSW.focus();
   return false;
 }
return true;
}

function verify_user(Lang)
{
 if (document.form1.txtName.value == "")
 {
   if (Lang == "en")
    {
      alert("The name must be typed");
    }
   else
    {
      alert("Le nom doit être renseigné ");
    }
   document.form1.txtName.focus();
   return false;
 }
if (document.form1.txtFirstName.value == "")
 {
   if (Lang == "en")
    {
      alert("The first name must be typed");
    }
   else
    {
      alert("Le prénom doit être renseigné ");
    }
   document.form1.txtFirstName.focus();
   return false;
 }
 if (document.form1.txtUserName.value == "")
   {
     if (Lang == 'en')
     {
       alert("The username must be typed");
     }
     else
     {
       alert("Le nom utilisateur est obligatoire!!!");
     }
     document.form1.txtUserName.focus();
     return false;
   }
 if (document.form1.txtPSW.value == "")
   {
     if (Lang == 'en')
     {
       alert("The password must be typed");
     }
     else
     {
       alert("Le mot de passe est obligatoire!!!");
     }
     document.form1.txtPSW.focus();
     return false;
   }
 
 if (document.form1.txtConfPSW.value == "")
   {
      if (Lang == 'en')
       {
         alert("The confirmation of the password must be typed");
       }
      else
       {
         alert("La confirmation du mot de passe est obligatoire!!!");
       }
     document.form1.txtConfPSW.focus();
     return false;
   }
 else
   {
     if (document.form1.txtPSW.value != document.form1.txtConfPSW.value)
     {
       if (Lang == 'en')
         {
            alert("The confirmation of the password is different from the password");
         }
       else
         {
            alert("La confirmation ne correspond pas au mot de passe entré !!!"); 
         }
         document.form1.txtConfPSW.focus();
         return false;
     }
   }
 if (document.form1.txtRights.value == "")
   {
     if (Lang == 'en')
     {
       alert("The rights must be typed");
     }
     else
     {
       alert("Les droits sont obligatoires!!!");
     }
     document.form1.txtRights.focus();
     return false;
   }
  else
   {
       if (isNaN(document.form1.txtRights.value))
       {
		   if (Lang == 'en')
		 {
		   alert("The rights must be numeric");
		 }
		 else
		 {
		   alert("Les droits doivent être numériques!!!");
		 }
         document.form1.txtRights.focus();
         return false;
       }
    }     
   
return true;
}

function VerifyInfos(Lang)
{
if (document.form1.txtFirstName.value == "")
 {
   if (Lang == "en")
    {
      alert("The first name must be typed");
    }
   else
    {
      alert("Le prénom doit être renseigné ");
    }
   document.form1.txtFirstName.focus();
   return false;
 }
if (document.form1.txtLastName.value == "")
 {
   if (Lang == "en")
    {
      alert("The last name must be typed");
    }
   else
    {
      alert("Le nom doit être renseigné ");
    }
   document.form1.txtLastName.focus();
   return false;
 }
if (document.form1.txtStreet.value == "")
 {
   if (Lang == "en")
    {
      alert("The Street must be typed");
    }
   else
    {
      alert("La rue doit être renseignée ");
    }
   document.form1.txtStreet.focus();
   return false;
 }
if (document.form1.txtCity.value == "")
 {
   if (Lang == "en")
    {
      alert("The city name must be typed");
    }
   else
    {
      alert("Le nom de la ville doit être renseigné ");
    }
   document.form1.txtCity.focus();
   return false;
 }
if (document.form1.txtZIP.value == "")
 {
   if (Lang == "en")
    {
      alert("The ZIP code must be typed");
    }
   else
    {
      alert("Le code postal doit être renseigné ");
    }
   document.form1.txtZIP.focus();
   return false;
 }
return true;
}

function verifyBilling(Lang)
{
if (document.form1.txtCardNumber.value == "")
  {
    if (Lang == "en")
     {
       alert("The number of the credit card must be typed");
     }
    else
     {
       alert("Le numéro de la carte de crédit doit être renseigné");
     } 
    document.form1.txtCardNumber.focus();
    return false; 
  }
if (document.form1.txtExpDate.value == "")
  {
    if (Lang == "en")
     {
       alert("The Expiration date of the credit card must be typed");
     }
    else
     {
       alert("La date d'expiration de la carte de crédit doit être renseignée");
     } 
    document.form1.txtExpDate.focus();
    return false; 
  }
if (document.form1.txtCardName.value == "")
  {
    if (Lang == "en")
     {
       alert("The holder's name of the credit card must be typed");
     }
    else
     {
       alert("Le nom du détenteur de la carte de crédit doit être renseigné");
     } 
    document.form1.txtCardName.focus();
    return false; 
  }
if (document.form1.chkAddr.checked == false)
  {
    if (document.form1.txtStreet.value == "")
     {
      if (Lang == "en")
       {
         alert("The Street must be typed");
       }
      else
       {
         alert("La rue doit être renseignée ");
       }
      document.form1.txtStreet.focus();
      return false;
     }
   if (document.form1.txtCity.value == "")
     {
      if (Lang == "en")
       {
        alert("The city name must be typed");
       }
      else
       {
        alert("Le nom de la ville doit être renseigné ");
       }
      document.form1.txtCity.focus();
      return false;
     }
   if (document.form1.txtZIP.value == "")
     {
      if (Lang == "en")
       {
        alert("The ZIP code must be typed");
       }
      else
       {
        alert("Le code postal doit être renseigné ");
       }
      document.form1.txtZIP.focus();
      return false;
     }
  }
return true;
}
function NewWindow(u,n,w,h,f,p,x,y){var	ws=window.screen?1:0,m=Math,C='center',R='random',M='custom',sw=screen.availWidth,sh=screen.availHeight,T=(p==C&&ws)?(sh-h)/2:(p==R&&ws)?(m.floor(m.random()*(sh-h))):(p==M)?y:100,L=(p==C&&ws)?(sw-w)/2:(p==R&&ws)?(m.floor(m.random()*(sw-w))):(p==M)?x:100,s='width='+w+',height='+h+',top='+T+',left='+L;s+=(!f||f=='')?'':','+f;win=window.open(u,n,s);if(win.focus)win.focus();}

function Delete_onClick(numero)
{
 var strHref;
 strHref = "GestionImg.asp?x=3&pk=" + numero;
 document.location.href = strHref;
}
//<SCRIPT LANGUAGE="JavaScript">
function ShowHelp(objet)
{
 var nouvelleFenetre;
 if(objet.value == "Aide")
 {
  nouvelleFenetre = window.open("AideGestionContenu.asp?Language=francais",null,"width=450,height=200,scrollbars=yes");
 } 
 else
 {
  nouvelleFenetre = window.open("AideGestionContenu.asp?Language=anglais",null,"width=450,height=200,scrollbars=yes");
 }  
}



 
function InsertPointForm( sTextComplet, sTextSelect )
{
 var cmpt = 0;
 var monExpReg = /(\r\n)/gi;
 var sTextFirst;
 var sTextLast; 
 
 sTextComplet = sTextComplet.replace(monExpReg, "");  
 sTextSelect = sTextSelect.replace(monExpReg, "");  
	  
 sTextFirst = sTextComplet.substring(0, sTextComplet.indexOf(sTextSelect) );
 sTextLast = sTextComplet.substring(  sTextComplet.indexOf(sTextSelect) + sTextSelect.length , sTextComplet.length );
 	 
 // uh oh probleme
 //quand le user ecrit et appuie sur enter, des balise de paragraphes apparaissent
 // 5 est le nombre de balise a verifier
 while( cmpt < 7 )
 {
  if (  sTextSelect.indexOf('P>') != -1  )
  {
   if (  sTextSelect.substring( (sTextSelect.length - 4) , sTextSelect.length ) == '</P>' )
   {   
    sTextSelect = sTextSelect.substring( 0, sTextSelect.length - 4 );
   } 
	
   if (  sTextSelect.substring( 0,  3 ) == '<P>' )
   {
    sTextSelect = sTextSelect.substring( sTextSelect.indexOf('>') + 1, sTextSelect.length );
   }
	
   if ( sTextComplet.indexOf(sTextSelect) != -1 )
   {  	
	sTextFirst = sTextComplet.substring( 0, sTextComplet.indexOf( sTextSelect ) );
    sTextLast = sTextComplet.substring( sTextComplet.indexOf(sTextSelect) , sTextComplet.length );
   }
  }
  
  
  //bold
  if (  sTextSelect.indexOf('STRONG>') != -1  )
  {
  
   if (  sTextSelect.substring( 0, sTextSelect.indexOf('<STRONG') + 8 ) == '<STRONG>' )
   {
	sTextSelect = sTextSelect.substring( sTextSelect.indexOf('<STRONG>') + 8, sTextSelect.length );
   }

   if ( sTextSelect.substring( sTextSelect.length - 9 ,sTextSelect.length) == '</STRONG>' )
   {
	sTextSelect = sTextSelect.substring( 0, sTextSelect.length - 9 );
   }

   if ( sTextComplet.indexOf(sTextSelect) != -1 )
   {	
	sTextFirst = sTextComplet.substring( 0, sTextComplet.indexOf( sTextSelect ) );
	sTextLast = sTextComplet.substring( sTextComplet.indexOf(sTextSelect) + sTextSelect.length , sTextComplet.length );
   }
  }
  //italic

  if (  sTextSelect.indexOf('EM>') != -1 )
  {

   if (  sTextSelect.substring( 0, sTextSelect.indexOf('<EM') + 4 ) == '<EM>' )
   {
	sTextSelect = sTextSelect.substring( sTextSelect.indexOf('<EM>') + 4, sTextSelect.length );
   }
 
   if ( sTextSelect.substring( sTextSelect.length - 5 ,sTextSelect.length) == '</EM>'  )
   {
	sTextSelect = sTextSelect.substring( 0, sTextSelect.length -5 );
   }

   if ( sTextComplet.indexOf(sTextSelect) != -1 )
   {
	sTextFirst = sTextComplet.substring( 0, sTextComplet.indexOf( sTextSelect ) );
	sTextLast = sTextComplet.substring( sTextComplet.indexOf(sTextSelect) + sTextSelect.length , sTextComplet.length );
   }
  }

  //souligné
  if ( sTextSelect.indexOf('U>') != -1 )
  {
   if (  sTextSelect.substring( 0, sTextSelect.indexOf('<U') + 3 ) == '<U>' )
   {
	sTextSelect = sTextSelect.substring( sTextSelect.indexOf('<U>') + 3, sTextSelect.length );
   }

   if ( sTextSelect.substring( sTextSelect.length - 4 ,sTextSelect.length) == '</U>'  )
   {
	sTextSelect = sTextSelect.substring( 0, sTextSelect.length - 4 );
   }

   if ( sTextComplet.indexOf(sTextSelect) != -1 )
   { 
	sTextFirst = sTextComplet.substring( 0, sTextComplet.indexOf( sTextSelect ) );
	sTextLast = sTextComplet.substring( sTextComplet.indexOf(sTextSelect) + sTextSelect.length , sTextComplet.length );
   }
  }

  //Point de forme  

  if ( sTextSelect.indexOf('LI>') != -1 )
  {
   if (  sTextSelect.substring( 0, sTextSelect.indexOf('<LI') + 4  ) == '<LI>' )
   {
	sTextSelect = sTextSelect.substring( sTextSelect.indexOf('<LI>') + 4, sTextSelect.length );
   }

   if ( sTextSelect.substring( sTextSelect.length - 5 ,sTextSelect.length) == '</LI>'  )
   {
	sTextSelect = sTextSelect.substring( 0, sTextSelect.length - 5 );
   }

   if (  sTextComplet.indexOf(sTextSelect) != -1 )
   {    
	sTextFirst = sTextComplet.substring( 0, sTextComplet.indexOf( sTextSelect ) );
	sTextLast = sTextComplet.substring( sTextComplet.indexOf(sTextSelect) + sTextSelect.length , sTextComplet.length );
   }
  }
 
  //Lien
  if ( sTextSelect.indexOf('<A href') != -1 || sTextSelect.indexOf('</A>' != -1) )
  {
   if (  sTextSelect.substring( 0, sTextSelect.indexOf('<A href') + 7  ) == '<A href' )
   {
	sTextSelect = sTextSelect.substring( sTextSelect.indexOf('>') + 1 , sTextSelect.length );
   }

   if ( sTextSelect.substring( sTextSelect.length - 4 ,sTextSelect.length) == '</A>'  )
   {
	sTextSelect = sTextSelect.substring( 0, sTextSelect.length - 4);
   }

   if ( sTextComplet.indexOf(sTextSelect) != -1 )
   {    
	sTextFirst = sTextComplet.substring( 0, sTextComplet.indexOf( sTextSelect ) );
	sTextLast = sTextComplet.substring( sTextComplet.indexOf(sTextSelect) + sTextSelect.length , sTextComplet.length );
   }
  }
  
  //Font
  if ( sTextSelect.indexOf('<FONT') != -1 || sTextSelect.indexOf('</FONT>' != -1) )
  {
   if (  sTextSelect.substring( 0, sTextSelect.indexOf('<FONT') + 5  ) == '<FONT' )
   {
	sTextSelect = sTextSelect.substring( sTextSelect.indexOf('>') + 1 , sTextSelect.length );
   }

   if ( sTextSelect.substring( sTextSelect.length - 7 ,sTextSelect.length) == '</FONT>'  )
   {
	sTextSelect = sTextSelect.substring( 0, sTextSelect.length - 7);
   }

   if ( sTextComplet.indexOf(sTextSelect) != -1 )
   {    
	sTextFirst = sTextComplet.substring( 0, sTextComplet.indexOf( sTextSelect ) );
	sTextLast = sTextComplet.substring( sTextComplet.indexOf(sTextSelect) + sTextSelect.length , sTextComplet.length );
   }
  } 

  cmpt++;
 } 
 
 if ( sTextFirst.substring( sTextFirst.length - 4, sTextFirst.length ) == "<LI>" ) 
 {	  
  sTextFirst = sTextFirst.substring( 0 , sTextFirst.length - 4 );
  
  if ( sTextSelect.indexOf('</LI>') != -1 )
  {
   sTextSelect = sTextSelect.substring( 0 , sTextSelect.indexOf('</LI>') ) + sTextSelect.substring(  sTextSelect.indexOf('</LI>') + 5, sTextSelect.length ) ;  
  }
  else
  {
   sTextLast = sTextLast.substring( 0 , sTextLast.indexOf('</LI>') ) + sTextLast.substring( sTextLast.indexOf('</LI>') + 5, sTextLast.length );
  }   
 }
 else if ( sTextSelect.substring(0, 4) == '<LI>' )
 {
  sTextSelect = sTextSelect.substring( 4, sTextSelect.length );  
  
  if ( sTextSelect.indexOf('</LI>') != -1 )
  {
   sTextSelect = sTextSelect.substring( 0 , sTextSelect.indexOf('</LI>') ) + sTextSelect.substring(  sTextSelect.indexOf('</LI>') + 5, sTextSelect.length ) ;  
  }
  else
  {
   sTextLast = sTextLast.substring( 0 , sTextLast.indexOf('</LI>') ) + sTextLast.substring( sTextLast.indexOf('</LI>') + 5, sTextLast.length );
  }  
 }
 else
 {	   
  sTextFirst = sTextFirst + '<LI>';
  
  if ( sTextSelect.indexOf('<LI>') == -1 )
  {
   sTextLast ='</LI>' + sTextLast;
  }
  else
  {
   sTextSelect = sTextSelect.substring(0,sTextSelect.indexOf('<LI>') ) + '</LI>' + sTextSelect.substring( sTextSelect.indexOf('<LI>'), sTextSelect.length );
  } 
 }
 

 return( sTextFirst + sTextSelect + sTextLast );

}  




function Modifier_onclick(parametre)
{
 var parametreName = parametre.name;
 var effet = parametreName.charAt(0);
 var numero = parametreName.charAt(1);
   
 var range =  document.selection.createRange(); 
 var notreSelection = range.htmlText; 
 var sTextSelect = notreSelection;
 
 
 maDivisionNom = "Division" + numero;
 maDivision = document.getElementById(maDivisionNom);
 
 var sTextComplet = maDivision.innerHTML;

 var sFindTextSelect;
 var sFindTextSelect2;
 
 var cmptSelect;
 var cmptSelect2;
 
 var bFind = false;
 	
 if(notreSelection)
 {
  switch (effet)
  {
   case "B":
      maDivision.document.execCommand('bold', false, null);
	  break;
   case "I":
      maDivision.document.execCommand('italic', false, null);
	  break;
   case "U":
      maDivision.document.execCommand('underline', false, null);
	  break;
   case "P":      	   
	  maDivision.innerHTML = InsertPointForm( sTextComplet, sTextSelect );
	  maDivision.document.execCommand('unselect', false, null);    	
	 break;
   case "N":    
      maDivision.document.execCommand('ForeColor', false, '#000000');
	 break;
   case "R": 
      maDivision.document.execCommand('ForeColor', false, '#A85E41');
     break;	   
   case "V": 
      maDivision.document.execCommand('ForeColor', false, '#021D3B');
     break;	   
   case "L":
      maDivision.document.execCommand("CreateLink");
	  break;
  }
 }
 else
 {
  alert("Vous devez souligner une partie du texte.");
 }
}

function doCopDiv(cmpt,objet)
{
 var num;
 for (num = 1; num <= cmpt; num++)
 {     
	 maDivisionNom = "Division" + num;
	 maDivision = document.getElementById(maDivisionNom);
     maCopDivNom = "CopDiv" + num;
	 maCopDiv = document.getElementById(maCopDivNom);
	 strText = maDivision.innerHTML;
	 strText = FormaterText(strText);
	 maCopDiv.value = strText;
 }
 if (objet.value == "Soumettre")
 {
  if (confirm("Voulez-vous vraiment enregistrer les changements?"))
  {
   return true;
  }
 }
 else
 {
  if (confirm("Are you sure you want to save changes?"))
  {
   return true;
  }
 } 
 return false;
}

function FormaterText(strText)
{
 var maChaine = strText
 var monExpReg = /(<[/]P>\r\n<P>)/gi;
 maChaine = maChaine.replace(monExpReg, "<BR><BR>");
 monExpReg = /(<P>)/gi;
 maChaine = maChaine.replace(monExpReg, "");
 monExpReg = /(<[/]P>)/gi;
 maChaine = maChaine.replace(monExpReg, "");
 monExpReg = /(<STRONG>)/gi;
 maChaine = maChaine.replace(monExpReg, "<B>");
 monExpReg = /(<[/]STRONG>)/gi;
 maChaine = maChaine.replace(monExpReg, "</B>");
 monExpReg = /(<EM>)/gi;
 maChaine = maChaine.replace(monExpReg, "<I>");
 monExpReg = /(<[/]EM>)/gi;
 maChaine = maChaine.replace(monExpReg, "</I>");
 monExpReg = /([&]nbsp[;]|nbsp[;])/gi;
 maChaine = maChaine.replace(monExpReg, "");
 monExpReg = /(\r\n)/gi;
 maChaine = maChaine.replace(monExpReg, "");
 monExpReg = /(<A href)/gi;
 maChaine = maChaine.replace(monExpReg, "<A style='margin-left: 0px; margin-right: 0px; font-weight: bold' href");
 var OK = true;
 while (OK == true)
 {
  var longueur = maChaine.length;
  if (maChaine.substring(longueur - 4,longueur)=="<BR>")
  {
   maChaine = maChaine.substring(0,longueur - 4);
  }
  else
  {
   OK = false;  
  } 
 } 
 return maChaine; 
}

function ClearAll(parametre)
{
 var parametreName = parametre.name;
 var numero = parametreName.charAt(1);
 maDivisionNom = "Division" + numero
 maDivision = document.getElementById(maDivisionNom)
 maDivision.innerHTML = "";
}

function addbookmark()
{
var bookmarkurl="http://www.nicfortin.qc.ca"
var bookmarktitle="Hommage à Nicolas Fortin @ www.nicfortin.qc.ca"
if (document.all)
window.external.AddFavorite(bookmarkurl,bookmarktitle)
}

function verifylist()
{
 if (document.form1.txtName.value == "")
 {
   alert("Le nom doit être rempli !!!");
   document.form1.txtName.focus();
   return false;
 }
 if (document.form1.txtMail.value == "")
 {
   alert("Le courriel doit être rempli !!!");
   document.form1.txtMail.focus();
   return false;
 } 
  var trouveAt = document.form1.txtMail.value.indexOf("@");
  var trouvePoint = document.form1.txtMail.value.indexOf(".");
  if(trouveAt == -1 ||trouvePoint == -1 )
  {
    alert("L'adresse courriel n'est pas conforme !!!");
    document.form1.txtMail.focus();
    return false;
  }
  if (document.form1.areaMsg.value == "")
 {
   alert("Le message doit être rempli !!!");
   document.form1.areaMsg.focus();
   return false;
 }
return true;
}

//Specify speed of scroll. Larger=faster (ie: 5)
var scrollspeed=cache=1

function initialize(){
marqueeheight=document.all? parent.document.all.datamain.height : parent.document.getElementById("datamain").getAttribute("height")
dataobj=document.all? document.all.datacontainer : document.getElementById("datacontainer")
dataobj.style.top=5
thelength=dataobj.offsetHeight
scrolltest()
}

function scrolltest(){
dataobj.style.top=parseInt(dataobj.style.top)-scrollspeed
if (parseInt(dataobj.style.top)<thelength*(-1))
dataobj.style.top=5
setTimeout("scrolltest()",50)
}
//</SCRIPT>
