
function popupViewer(theImage){day=new Date();id=day.getTime();eval("page"+id+" = window.open('viewer.php?image="+theImage+"' , '"+id+"', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=200,height=200,left=200,top=150');");}
function redirect(direction){window.location=direction;}
function getElement(id){return document.getElementById?document.getElementById(id):document.all?document.all(id):null;}
function hidediv(id){if(document.getElementById){document.getElementById(id).style.display='none';}
else{if(document.layers){document.id.display='none';}
else{document.all.id.style.display='none';}}}
function showdiv(id){if(document.getElementById){document.getElementById(id).style.display='block';}
else{if(document.layers){document.id.display='block';}
else{document.all.id.style.display='block';}}}
function addBookmark(title,url){if(window.sidebar){window.sidebar.addPanel(title,url,"");}else if(document.all){window.external.AddFavorite(url,title);}else if(window.opera&&window.print){return true;}}
function validateEmail(entered){apos=entered.indexOf("@");dotpos=entered.lastIndexOf(".");lastpos=entered.length-1;if(apos<1||dotpos-apos<2||lastpos-dotpos>3||lastpos-dotpos<2){return false;}else{return true;}}
function validateNumber(x){var anum=/(^\d+$)|(^\d+\.\d+$)/;if(anum.test(x)){return true;}else{return false;}}
var digits="0123456789";var phoneNumberDelimiters="()- ";var validWorldPhoneChars=phoneNumberDelimiters+"+";var minDigitsInIPhoneNumber=10;function isInteger(s){var i;for(i=0;i<s.length;i++){var c=s.charAt(i);if(((c<"0")||(c>"9")))return false;}
return true;}
function stripCharsInBag(s,bag){var i;var returnString="";for(i=0;i<s.length;i++){var c=s.charAt(i);if(bag.indexOf(c)==-1)returnString+=c;}
return returnString;}
function resizeOuterTo(w,h){if(parseInt(navigator.appVersion)>3){if(navigator.appName=="Netscape"){top.outerWidth=w;top.outerHeight=h;}else top.resizeTo(w,h);}
var x,y;if(self.innerHeight)
{x=self.innerWidth;y=self.innerHeight;}
else if(document.documentElement&&document.documentElement.clientHeight)
{x=document.documentElement.clientWidth;y=document.documentElement.clientHeight;}
else if(document.body)
{x=document.body.clientWidth;y=document.body.clientHeight;}
w=w+(w-x);h=h+(h-y);if(parseInt(navigator.appVersion)>3){if(navigator.appName=="Netscape"){top.outerWidth=w;top.outerHeight=h;}else top.resizeTo(w,h);}}
function addLoadEvent(func){var oldonload=window.onload;if(typeof window.onload!='function'){window.onload=func;}else{window.onload=function(){if(oldonload){oldonload();}
func();}}}
function getElementsByStyleClass(className){var all=document.all?document.all:document.getElementsByTagName('*');var elements=new Array();for(var e=0;e<all.length;e++)
if(all[e].className==className)
elements[elements.length]=all[e];return elements;}
function addBehavior(){elements=getElementsByStyleClass("targetBlank");for(var i=0;i<elements.length;i++){elements[i].target="_blank";}ieupdate();}
addLoadEvent(addBehavior);function displayImage(theImage,width,height){showImage(theImage,width,height);}
function showThumb(img,width,height){
	getElement("mainImage").src="displayPictureCropped.php?filename="+img+"&width=190&height=200";
	//getElement("mainImageLink").href="javascript:displayImage('"+img+"', "+width+", "+height+");";
}
function hideImage(){getElement("imageHolder").style.display="none";}
(function(){var m=document.uniqueID&&document.compatMode&&!window.XMLHttpRequest&&document.execCommand;try{if(!!m){m("BackgroundImageCache",false,true)}}catch(oh){};})();function effacerPhoto(product,photo){var conf=confirm("Do you really want to delete this photo?");if(conf){window.setTimeout("window.location='addProduct.php?id="+product+"&deletePhoto="+photo+"';history.go();",100);}}
function effacerEtiquette(product,francais){var conf=confirm("Do you really want to delete this label?");if(conf){if(francais)
window.location="addProduct.php?id="+product+"&deleteLabelFr";else window.location="addProduct.php?id="+product+"&deleteLabel";}}
function effacerEtiquetteItem(product,francais){var conf=confirm("Do you really want to delete this label?");if(conf){if(francais)
window.location="addItem.php?id="+product+"&deleteLabelFr";else window.location="addItem.php?id="+product+"&deleteLabel";}}
function effacerSecurite(product,francais){var conf=confirm("Do you really want to delete this health and security document?");if(conf){if(francais)
window.location="addProduct.php?id="+product+"&deleteSecurityFr";else window.location="addProduct.php?id="+product+"&deleteSecurity";}}
function effacerMSDS(product,francais){var conf=confirm("Do you really want to delete this MSDS document?");if(conf){if(francais)
window.location="addItem.php?id="+product+"&deleteMSDSFr";else window.location="addItem.php?id="+product+"&deleteMSDS";}}
function effacerDocument(product,francais){var conf=confirm("Do you really want to delete this descriptive document?");if(conf){if(francais)
window.location="addItem.php?id="+product+"&deleteDocumentFr";else window.location="addItem.php?id="+product+"&deleteDocument";}}

function effacerDocument2(product,francais){var conf=confirm("Do you really want to delete this descriptive document?");if(conf){if(francais)
window.location="addProduct.php?id="+product+"&deleteDocumentFr";else window.location="addProduct.php?id="+product+"&deleteDocument";}}

function effacerProduit(id){var conf=confirm("Do you really want to delete this product?");if(conf){window.location="listProducts.php?remove="+id;}}
function effacerItem(id){var conf=confirm("Do you really want to delete this item?");if(conf){window.location="listItems.php?remove="+id;}}
function effacerEvenement(id){var conf=confirm("Do you really want to delete this event?");if(conf){window.location="listEvents.php?remove="+id;}}
function checkCategory(cat,section,isChecked){}
function checkCategory(cat,section,isChecked,checkRow){}
function checkRow(cat,isChecked){$('category-'+cat+"-section").checked=isChecked;if($('category-'+cat+"-canadaenglish")){$('category-'+cat+"-canadaenglish").checked=isChecked;checkCategory(cat,"canadaenglish",isChecked,true);}
if($('category-'+cat+"-canadafrancais")){$('category-'+cat+"-canadafrancais").checked=isChecked;checkCategory(cat,"canadafrancais",isChecked,true);}
if($('category-'+cat+"-international")){$('category-'+cat+"-international").checked=isChecked;checkCategory(cat,"international",isChecked,true);}
if($('category-'+cat+"-unitedstates")){$('category-'+cat+"-unitedstates").checked=isChecked;checkCategory(cat,"unitedstates",isChecked,true);}}
function selectAllCategories(isChecked){checkAll("",isChecked);}
function checkPanier(){if($('envoyer').value=="1"){$('envoyer').value="0";if($('nom').value.length==0){alert("Veuillez entrer votre nom complet.");$('nom').focus();return false;}
if(!validateEmail($('courriel').value)){alert("Veuillez entrer un courriel valide.");$('courriel').focus();return false;}
if($('telephone').value.length==0){alert("Veuillez entrer un numéro de téléphone afin de nous permettre de vous rejoindre.");$('telephone').focus();return false;}
$('envoyer').value="1";return true;}
return true;}
function checkAll(name,isChecked){elements=getElementsByStyleClass("checkbox");for(var i=0;i<elements.length;i++){if(elements[i].id.substring(0,name.length)==name)
elements[i].checked=isChecked;}}
function showImage(image,w,h){
     getElement("overlay").style.display="block";
     if(w>900){
          var neww=900;
          var newh=parseInt((parseFloat(w)/parseFloat(neww))*parseFloat(h));
          getElement("imagePrincipale").src="displayPictureCropped.php?filename="+image+"&width="+neww+"&height="+newh;
          w=neww;
          h=newh
     }else{
          getElement("imagePrincipale").src=image;
     }
     getElement("imagePrincipale").width=w;
     getElement("imagePrincipale").style.width=w;
     getElement("imagePrincipale").style.height=h;
     center('box',w,h);
     return false;
}
function hideBox(){getElement("box").style.display="none";getElement("overlay").style.display="none";return false;}
function center(element,w,h){try{element=getElement(element);}catch(e){return;}
var my_width=0;var my_height=0;if(typeof(window.innerWidth)=='number'){my_width=window.innerWidth;my_height=window.innerHeight;}else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)){my_width=document.documentElement.clientWidth;my_height=document.documentElement.clientHeight;}
else if(document.body&&(document.body.clientWidth||document.body.clientHeight)){my_width=document.body.clientWidth;my_height=document.body.clientHeight;}
element.style.position='absolute';element.style.zIndex=99;var scrollY=0;if(document.documentElement&&document.documentElement.scrollTop){scrollY=document.documentElement.scrollTop;}else if(document.body&&document.body.scrollTop){scrollY=document.body.scrollTop;}else if(window.pageYOffset){scrollY=window.pageYOffset;}else if(window.scrollY){scrollY=window.scrollY;}
var setX=(my_width-w)/2;var setY=(my_height-h)/2+scrollY;getElement("overlay").style.top=scrollY+"px";setX=(setX<0)?0:setX;setY=(setY<0)?0:setY;element.style.left=setX+"px";element.style.top=setY+"px";element.style.display='block';}
function displayMenu(id){for(var i=0;i<=15;i++){if( getElement("submenu"+i) ){hidediv("submenu"+i);} else {break;}}if( getElement("submenu"+id) ){showdiv("submenu"+id);}}

function ieupdate(){
 var strBrowser = navigator.userAgent.toLowerCase();
 if(strBrowser.indexOf("msie") > -1 && strBrowser.indexOf("mac") < 0){
  var theObjects = document.getElementsByTagName('object');
  var theObjectsLen = theObjects.length;
  for (var i = 0; i < theObjectsLen; i++) {
   if(theObjects[i].outerHTML){
    if(theObjects[i].data){
     theObjects[i].removeAttribute('data');
    }
    var theParams = theObjects[i].getElementsByTagName("param");
    var theParamsLength = theParams.length;
    for (var j = 0; j < theParamsLength; j++) {
      if(theParams[j].name.toLowerCase() == 'flashvars'){
        var theFlashVars = theParams[j].value;
      }
    }
    var theOuterHTML = theObjects[i].outerHTML;
    var re = /<param name="FlashVars" value="">/ig;
    theOuterHTML = theOuterHTML.replace(re,"<param name='FlashVars' value='" + theFlashVars + "'>");
    theObjects[i].outerHTML = theOuterHTML;
   }
  }
 }
}
window.onunload = function() {
 if (document.getElementsByTagName) {
  var objs = document.getElementsByTagName("object");
  for (i=0; i<objs.length; i++) {
   objs[i].outerHTML = "";
  }
 }
};