//-------------------------------------------------------------------------------------------
//
// Auteur:         Pierre Laplante
//                 SedNove Inc. 439 OAK St-Lambert, QC, Canada
//                 Copyright © 2000-2006
//                 All rights reserved.
//
// Description:    Fichier généré à partir de /includes/js/template.sn le 2009-05-07 13:43:02 par pparent
//
//-------------------------------------------------------------------------------------------

//-------------------------------------------------------------------------------------------
// Affiche un popup au centre de la page

function popup(url, name, popw, poph, parm) {  
  var w = screen.width;
  var h = screen.height;

  if (popw == undefined) {   
    popw=320; /*320*/
  }

  if (poph == undefined) {    
    poph=150; /*240*/
  }

  var l = (w-popw)/2, t = (h-poph)/2;

  if (name == undefined) {    
    name="";
  }

  if (parm == undefined) {    
    var w = window.open(url, name, "left="+l+",top="+t+",width="+popw+"+,height="+poph+",fullscreen=no,scrollbars=auto,resizable=yes,menubar=no,statusbar=no");
  } else {    
    var w = window.open(url, name, "left="+l+",top="+t+",width="+popw+"+,height="+poph+","+parm);
  }
}

function gotobasket() {
  location="/fr/commandes/panier.sn";
}

function reload_summary() {
  var ifr = document.getElementById('panier_resume');
  ifr.src = "/fr/commandes/panier_resume.sn";
}

// Fonction qui permet d'initialiser la valeur de s et de soumettre le formulaire
function sets(s) {
  document.fn.s.value = s ;
  document.fn.submit();
}







/* Script pour desactiver le RIGHT-CLICK - IE5, NS6, FF1 ---- START --- */

var message="Déactiver pour des raisons de droits d’auteurs - This is not allowed for copyright reasons";

function clickIE() 
	{if (document.all) {(message);return false;}}
function clickNS(e) 
	{if (document.layers||(document.getElementById&&!document.all)) {
	if (e.which==2 || e.which==3) {(message);return false;}}}
	if (document.layers) 
	{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else
	{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}

document.oncontextmenu=new Function("return false")

/* Script pour desactiver le RIGHT-CLICK - IE5, NS6, FF1 ---- END --- */






/* Script pour desactiver les POP-UPs ---- START --- */

function pop_up(){
  var openWin=window.open('popup/pop_up.html','PopWin','toolbar=0,status=0,resize=0,scrollbars=0,location=0,menubar=0,directories=0,width=250,height=225')
  var winHeight=screen.height
  var winWidth=screen.width
 //to set the focus to the window
  if(openWin.focus)
  {
    openWin.focus();
  }

 //to move the window
  if(openWin.moveTo)
  {
  openWin.moveTo(195,225);
  }
  
}

/* Script pour desactiver les POP-UPs ---- END --- */







/* Script pour les ROLL-OVERs ---- START --- */

function changeImage(witchone,newimage) {
 document[witchone].src=newimage;
}

var endding='.gif';
var preloadedImages=' '.split(' ');
var images=new Array();
var pathAndBegenning='/fr/images/n-'
for (var i=0; i<preloadedImages.length; i++){
  images[i]=new Image();
  images[i].src=pathAndBegenning+preloadedImages[i]+endding;
}

/* Script pour les ROLL-OVERs ---- END --- */






/* Script pour naviguer a partir des MENUS DEROULANTS ---- START --- */

function surfto(form) {
var myindex=form.dest.selectedIndex
location=form.dest.options[myindex].value;
}

/* Script pour naviguer a partir des MENUS DEROULANTS ---- END --- */




/* Script pour imprimer les pages ---- START --- */

function printpage() {
window.print();  
}

/* Script pour imprimer les pages ---- END --- */






/* Script pour transparence dans les images PNG pour IE ---- START --- 

// Correctly handle PNG transparency in Win IE 5.5 or higher.
// http://homepage.ntlworld.com/bobosola. Updated 02-March-2004

function correctPNG()
{
for(var i=0; i<document.images.length; i++)
{
var img = document.images[i]
var imgName = img.src.toUpperCase()
if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
{
var imgID = (img.id) ? "id='" + img.id + "' " : ""
var imgClass = (img.className) ? "class='" + img.className + "' " : ""
var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
var imgStyle = "display:inline-block;" + img.style.cssText
if (img.align == "left") imgStyle = "float:left;" + imgStyle
if (img.align == "right") imgStyle = "float:right;" + imgStyle
if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
var strNewHTML = "<span " + imgID + imgClass + imgTitle
+ " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
+ "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
+ "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>"
img.outerHTML = strNewHTML
i = i-1
}
}
}
window.attachEvent("onload", correctPNG);

 Script pour transparence dans les images PNG pour IE  ---- END --- */











/* Script pour NAVIGATION et SOUS-MENUS ---- START --- */

/* Non - ypSlideOutMenusC.js - 21-06-2006 */

function hover(obj){
  if(document.all){
    UL = obj.getElementsByTagName('ul');
    if(UL.length > 0){
      sousMenu = UL[0].style;
      if(sousMenu.display == 'none' || sousMenu.display == ''){
        sousMenu.display = 'block';
      }else{
        sousMenu.display = 'none';
      }
    }
  }
}

function setHover(){
  LI = document.getElementById('menu').getElementsByTagName('li');
  nLI = LI.length;
  for(i=0; i < nLI; i++){
	  /** AJOUT POUR RESETER LES HOVERs A OFF - IE **/
	  LI[i].display = 'none'; 
	  /**/
    LI[i].onmouseover = function(){
      hover(this);
	  
	  if (navigator.userAgent.indexOf("MSIE") != -1) { /* Ajout pour IE */
	  this.className+="over"; /* Ajout pour IE */
	  }
	  
    }
    LI[i].onmouseout = function(){
      hover(this);
	  
	  if (navigator.userAgent.indexOf("MSIE") != -1) {  /* Ajout pour IE */
	  this.className=this.className.replace("over", ""); /* Ajout pour IE */
	  }
	  
    }
  }
}

/* Script pour NAVIGATION et SOUS-MENUS ---- END --- */




/*-------- SCRIPT POUR HOVER TABLE (HEADER, TR et TD) - START ----- */

function mover(elem) {
  var oldclass = elem.className;
  elem.className=oldclass+"-over";
}

function mout(elem) {
  var oldclass = elem.className;
  var cl = oldclass.split("-");
  elem.className=cl[0];
}

/*-------- SCRIPT POUR HOVER TABLE (HEADER, TR et TD) - END ----- */




//-------------------------------------------------------------------------------------------
// Validation JS pour courriel - new

function validForm(){

/* document.getElementById('menu') */

/*	if (document.f.courriel.value == "" || document.f.email.value == ""){ 
*/
	if (document.f.courriel.value == ""){
	alert("Veuillez inscrire votre adresse courriel");
	document.f.courriel.focus();
	//* return (false) ; *//
	return false ;
}
	
	else if (document.f.courriel.value.indexOf ('@',0) == -1 || document.f.courriel.value.indexOf ('.',0) == -1) {			
	alert ("L’adresse courriel est incorrecte")
			document.f.courriel.focus();
	//* return (false) ; *//
	return false ;
	}

	else {
	document.f.submit();
	//* return (true) ; *//
	}

}

//-------------------------------------------------------------------------------------------






/* ///////// SCRIPT VALIDATE FORM OLD////////// 2007-05-17 / */


function checkFormRequired(obj) {   
for ( var i = 0 ; i < obj.elements.length ; i++ )  {   
if(obj.elements[i].title.length > 0 && ( obj.elements[i].type == 'text' || obj.elements[i].type == 'textarea' || obj.elements[i].type == 'checkbox')) {
	
if(obj.elements[i].type == 'checkbox' && obj.elements[i].checked == false) {    
alert("Vous n avez pas coché :" + obj.elements[i].title);    
return false; 
}             

if(obj.elements[i].value.length <= 0) {    
alert("Veuillez remplire le champ :" + obj.elements[i].title);    
obj.elements[i].focus();   
return false;   
}

if(obj.elements[i].title == 'email' || obj.elements[i].title == 'courriel') {  

if(!isEmail(obj.elements[i].value)) {  
                   alert("Le courriel que vous avez saisie est invalide");   
         obj.elements[i].focus();   
return false;   
}   
} 
 

else {
	document.f.submit()
return true;
}

}
}
}  


 
 function isEmail(strSaisie)  {   
  var verif = /^[^@]+@(([\w\-]+\.){,4}[a-zA-Z]{,4}|(([01]?\d?\d|2[0-4]\d|25[0-5])\.){}([01]?\d?\d|2[0-4]\d|25[0-5]))$/   
 return ( verif.test(strSaisie) );   
 }  



 
/* ///////// SCRIPT VALIDATE FORM OLD /////////// */




/* ///////// SCRIPT VALIDATE FORM / EMAIL /////////// */

function checkEmail(f)
{
  // see http://www.thesitewizard.com/archive/validation.shtml

  // ** START **
  if (f.courriel.value == "" ) {
    alert( "Veuillez inscrire votre adresse courriel" );
    f.courriel.focus();
    return false ;
  }
  // ** END **
document.f.submit()
  return true ;
}

/* ///////// SCRIPT VALIDATE FORM / EMAIL /////////// */


/* ///////// SCRIPT VALIDATE FORM / EMAIL + NO MEMBRE /////////// */

function checkRenewall(f)
{

  // ** START **
  if (f.courriel.value == "") {
    alert( "Veuillez inscrire votre adresse courriel" );
    f.courriel.focus();
    return false ;
  }
  // ** END **

  // ** START **
  if (f.no_membre.value == "") {
    alert( "Veuillez remplir le champ suivant : " ) + f.no_membre.title;
    f.no_membre.focus();
    return false ;
  }
  // ** END **

document.f.submit()
  return true ;
}

/* ///////// SCRIPT VALIDATE FORM / EMAIL + NO MEMBRE /////////// */




/* ///////// SCRIPT SWAP CLASS FOR DIVs /////////// */

function SwapVisibility(d) {
if(d.length < 1) { return; }
if(document.getElementById(d).className == "divOff") { document.getElementById(d).className = "divOn"; }
else { document.getElementById(d).className = "divOff"; }
}

/* ///////// SCRIPT SWAP CLASS FOR DIVs /////////// */



/* ///////// SCRIPT POPUP HOMEDAMDE /////////// */
/*
$(function(){

	$('#dialog').dialog({
		autoOpen: false,
		width: "auto",
		resizable: false,
		modal: true,
		bgiframe: true,
		show: 200,
		overlay: {
		    opacity: 0.75
		  }
	});
	
	$('.imgvisuels').hover(function(){(this).css("border-color","black")},function(){(this).css("border-color","white")});
});


function show_popup(id, idg){
	var str=$('#'+idg).html();
	$('#'+id).html(str);
	$('#'+id).dialog('open');
	setTimeout ("$('#dialog').dialog('option','width',31+$('#dialog .bigimg').width())", 400 );
	
}

function hide_popup(id){
	$('#'+id).dialog('close');
}
function change(i){
	if (i==1) {('#dialog .closeimg').get(0).src="/images/close_image2.jpg";}
	else {('#dialog .closeimg').get(0).src="/images/close_image.jpg";}
}

*/


/* ///////// SCRIPT POPUP HOMEDAMDE /////////// */