// $Id: lib.js,v 1.19 2005/08/16 09:34:29 Sylvain Exp $

      stdBrowser = (document.getElementById) ? true : false

      function popUp(event,currElem) {
         popUpWin = (stdBrowser) ? document.getElementById(currElem).style : eval("document." +  currElem)
         
         if (document.all) {
            //popUpWin.pixelTop = event.OffsetY+2
            popUpWin.pixelTop = parseInt(event.screenY)+1
            popUpWin.pixelLeft = Math.max(2,parseInt(event.screenX)-150)
            //popUpWin.pixelLeft = event.OffsetX-150)
         }
         else {
            if (stdBrowser) {
               popUpWin.top = parseInt(e.pageY)+2 + "px"
               popUpWin.left = Math.max(2,parseInt(e.pageX)-150) + "px"
            }
            else {
               popUpWin.top = parseInt(e.pageY)+2
               popUpWin.left = Math.max(2,parseInt(e.pageX)-150)
            }
         }
         popUpWin.visibility = "visible"
      }

      function popDown(currElem) {
         popUpWin = (stdBrowser) ? document.getElementById(currElem).style : eval("document." +  currElem)
         popUpWin.visibility = "hidden"
      }
	  
	  
if (document.images) {
      groupeOn = new Image
	  groupeOff = new Image
      entrepriseOn = new Image
	  entrepriseOff = new Image
	  produitOn = new Image
	  produitOff = new Image
	  technologieOn = new Image
	  technologieOff = new Image
	  vendeurOn = new Image
	  vendeurOff = new Image
	  contactOn = new Image
	  contactOff = new Image
	  contactUsOn = new Image
	  contactUsOff = new Image
	  newsOn = new Image
	  newsOff = new Image
	  
	  groupeOnFR = new Image
	  groupeOffFR = new Image
      entrepriseOnFR = new Image
	  entrepriseOffFR = new Image
	  produitOnFR = new Image
	  produitOffFR = new Image
	  technologieOnFR = new Image
	  technologieOffFR = new Image
	  vendeurOnFR = new Image
	  vendeurOffFR = new Image
	  contactOnFR = new Image
	  contactOffFR = new Image
	  contactUsOnFR = new Image
	  contactUsOffFR = new Image
	  newsOnFR = new Image
	  newsOffFR = new Image
	  
	  groupeOnES = new Image
	  groupeOffES = new Image
      entrepriseOnES = new Image
	  entrepriseOffES = new Image
	  produitOnES = new Image
	  produitOffES = new Image
	  technologieOnES = new Image
	  technologieOffES = new Image
	  vendeurOnES = new Image
	  vendeurOffES = new Image
	  contactOnES = new Image
	  contactOffES = new Image
	  contactUsOnES = new Image
	  contactUsOffES = new Image
	  newsOnES = new Image
	  newsOffES = new Image
	  
	  groupeOn.src = "../images/btn_grup_on_en.png"
	  groupeOff.src = "../images/btn_grup_off_en.png"
      entrepriseOn.src = "../images/btn_company_on_en.png"
	  entrepriseOff.src = "../images/btn_company_off_en.png"
	  produitOn.src = "../images/btn_products_on_en.png"
	  produitOff.src = "../images/btn_products_off_en.png"
	  technologieOn.src = "../images/btn_technology_on_en.png"
	  technologieOff.src = "../images/btn_technology_off_en.png"
	  vendeurOn.src = "../images/btn_dealers_on_en.png"
	  vendeurOff.src = "../images/btn_dealers_off_en.png"
	  contactOn.src = "../images/btn_contacts_on_en.png"
	  contactOff.src = "../images/btn_contacts_off_en.png"
	  contactUsOn.src = "../images/btn_contactus_on_en.png"
	  contactUsOff.src = "../images/btn_contactus_off_en.png"
	  newsOn.src = "../images/btn_newsletter_on_en.png"
	  newsOff.src = "../images/btn_newsletter_off_en.png"

      groupeOnFR.src = "../images/btn_groupe_on_fr.png"
	  groupeOffFR.src = "../images/btn_groupe_off_fr.png"
      entrepriseOnFR.src = "../images/btn_entreprise_on_fr.png"
	  entrepriseOffFR.src = "../images/btn_entreprise_off_fr.png"
	  produitOnFR.src = "../images/btn_produits_on_fr.png"
	  produitOffFR.src = "../images/btn_produits_off_fr.png"
	  technologieOnFR.src = "../images/btn_technologie_on_fr.png"
	  technologieOffFR.src = "../images/btn_technologie_off_fr.png"
	  vendeurOnFR.src = "../images/btn_revendeurs_on_fr.png"
	  vendeurOffFR.src = "../images/btn_revendeurs_off_fr.png"
	  contactOnFR.src = "../images/btn_contacts_on_fr.png"
	  contactOffFR.src = "../images/btn_contacts_off_fr.png"
	  contactUsOnFR.src = "../images/btn_nous_contacter_on_fr.png"
	  contactUsOffFR.src = "../images/btn_nous_contacter_off_fr.png"
	  newsOnFR.src = "../images/btn_newsletter_on_fr.png"
	  newsOffFR.src = "../images/btn_newsletter_off_fr.png"
	  
	  groupeOnES.src = "../images/btn_grup_on_es.png"
	  groupeOffES.src = "../images/btn_grup_off_es.png"
      entrepriseOnES.src = "../images/btn_company_on_es.png"
	  entrepriseOffES.src = "../images/btn_company_off_es.png"
	  produitOnES.src = "../images/btn_products_on_es.png"
	  produitOffES.src = "../images/btn_products_off_es.png"
	  technologieOnES.src = "../images/btn_technology_on_es.png"
	  technologieOffES.src = "../images/btn_technology_off_es.png"
	  vendeurOnES.src = "../images/btn_dealers_on_es.png"
	  vendeurOffES.src = "../images/btn_dealers_off_es.png"
	  contactOnES.src = "../images/btn_contacts_on_es.png"
	  contactOffES.src = "../images/btn_contacts_off_es.png"
	  contactUsOnES.src = "../images/btn_contactus_on_es.png"
	  contactUsOffES.src = "../images/btn_contactus_off_es.png"
	  newsOnES.src = "../images/btn_newsletter_on_es.png"
	  newsOffES.src = "../images/btn_newsletter_off_es.png"
   }
   else {
	  groupeOn = ""
	  groupeOff = ""
      entrepriseOn = ""
	  entrepriseOff = ""
	  produitOn = ""
	  produitOff = ""
      technologieOn = ""
	  technologieOff = ""
	  vendeurOn = ""
	  vendeurOff = ""
	  contactOn = ""
	  contactOff = ""
	  contactUsOn = ""
	  contactUsOff = ""
	  newsOn = ""
	  newsOff = ""
	   
      groupeOnFR = ""
	  groupeOffFR = ""
      entrepriseOnFR = ""
	  entrepriseOffFR = ""
	  produitOnFR = ""
	  produitOffFR = ""
      technologieOnFR = ""
	  technologieOffFR = ""
	  vendeurOnFR = ""
	  vendeurOffFR = ""
	  contactOnFR = ""
	  contactOffFR = ""
	  contactUsOnFR = ""
	  contactUsOffFR = ""
	  newsOnFR = ""
	  newsOffFR = ""
	  
	  groupeOnES = ""
	  groupeOffES = ""
      entrepriseOnES = ""
	  entrepriseOffES = ""
	  produitOnES = ""
	  produitOffES = ""
      technologieOnES = ""
	  technologieOffES = ""
	  vendeurOnES = ""
	  vendeurOffES = ""
	  contactOnES = ""
	  contactOffES = ""
	  contactUsOnES = ""
	  contactUsOffES = ""
	  newsOnES = ""
	  newsOffES = ""
   }
   
 function joueOver() {
	eval("document.over.play();");
}

function joueClic() {
	eval("document.clic.play();");
}

function PopupImage(img) {
	titre="Hose reels TR 30, 40, 50";
	w=open("",'image','width=640,height=480,toolbar=no,scrollbars=no,resizable=yes');	
	w.document.write("<HTML><HEAD><TITLE>"+titre+"</TITLE></HEAD>");
	w.document.write("<SCRIPT language=javascript>function checksize()  { if (document.images[0].complete) {  window.resizeTo(document.images[0].width+12,document.images[0].height+30); window.focus();} else { setTimeout('check()',250) } }</"+"SCRIPT>");
	w.document.write("<BODY onload='checksize()' leftMargin=0 topMargin=0 marginwidth=0 marginheight=0><IMG src='"+img+"' border=0>");
	w.document.write("");
	w.document.write("</BODY></HTML>");
	w.document.close();
}

function PopupImagefr(img,titre) {
	w=open("",'image','width=640,height=480,toolbar=no,scrollbars=no,resizable=yes');	
	w.document.write("<HTML><HEAD><TITLE>"+titre+"</TITLE></HEAD>");
	w.document.write("<SCRIPT language=javascript>function checksize()  { if (document.images[0].complete) {  window.resizeTo(document.images[0].width+12,document.images[0].height+30); window.focus();} else { setTimeout('check()',250) } }</"+"SCRIPT>");
	w.document.write("<BODY onload='checksize()' leftMargin=0 topMargin=0 marginwidth=0 marginheight=0><IMG src='"+img+"' border=0>");
	w.document.write("");
	w.document.write("</BODY></HTML>");
	w.document.close();
}

function PopupImagees(img,titre) {
	w=open("",'image','width=640,height=480,toolbar=no,scrollbars=no,resizable=yes');	
	w.document.write("<HTML><HEAD><TITLE>"+titre+"</TITLE></HEAD>");
	w.document.write("<SCRIPT language=javascript>function checksize()  { if (document.images[0].complete) {  window.resizeTo(document.images[0].width+12,document.images[0].height+30); window.focus();} else { setTimeout('check()',250) } }</"+"SCRIPT>");
	w.document.write("<BODY onload='checksize()' leftMargin=0 topMargin=0 marginwidth=0 marginheight=0><IMG src='"+img+"' border=0>");
	w.document.write("");
	w.document.write("</BODY></HTML>");
	w.document.close();
}

var IB=new Object;
var posX=0;posY=0;
var xOffset=10;yOffset=10;
function AffBulle(texte) {
  contenu="<TABLE border=0 cellspacing=0 cellpadding="+IB.NbPixel+"><TR bgcolor='"+IB.ColContour+"'><TD><TABLE border=0 cellpadding=2 cellspacing=0 bgcolor='"+IB.ColFond+"'><TR><TD><FONT size='-1' face='arial' color='"+IB.ColTexte+"'>"+texte+"</FONT></TD></TR></TABLE></TD></TR></TABLE>&nbsp;";
  var finalPosX=posX-xOffset;
  if (finalPosX<0) finalPosX=0;
  if (document.layers) {
    document.layers["bulle"].document.write(contenu);
    document.layers["bulle"].document.close();
    document.layers["bulle"].top=posY+yOffset;
    document.layers["bulle"].left=finalPosX;
    document.layers["bulle"].visibility="show";}
  if (document.all) {
    //var f=window.event;
    //doc=document.body.scrollTop;
    bulle.innerHTML=contenu;
    document.all["bulle"].style.top=posY+yOffset;
    document.all["bulle"].style.left=finalPosX;//f.x-xOffset;
    document.all["bulle"].style.visibility="visible";
  }
  //modif CL 09/2001 - NS6 : celui-ci ne supporte plus document.layers mais document.getElementById
  else if (document.getElementById) {
    document.getElementById("bulle").innerHTML=contenu;
    document.getElementById("bulle").style.top=posY+yOffset;
    document.getElementById("bulle").style.left=finalPosX;
    document.getElementById("bulle").style.visibility="visible";
  }
}
function getMousePos(e) {
  if (document.all) {
  posX=event.x+document.body.scrollLeft; //modifs CL 09/2001 - IE : regrouper l'évènement
  posY=event.y+document.body.scrollTop;
  }
  else {
  posX=e.pageX; //modifs CL 09/2001 - NS6 : celui-ci ne supporte pas e.x et e.y
  posY=e.pageY; 
  }
}
function HideBulle() {
	if (document.layers) {document.layers["bulle"].visibility="hide";}
	if (document.all) {document.all["bulle"].style.visibility="hidden";}
	else if (document.getElementById){document.getElementById("bulle").style.visibility="hidden";}
}

function InitBulle(ColTexte,ColFond,ColContour,NbPixel) {
	IB.ColTexte=ColTexte;IB.ColFond=ColFond;IB.ColContour=ColContour;IB.NbPixel=NbPixel;
	if (document.layers) {
		window.captureEvents(Event.MOUSEMOVE);window.onMouseMove=getMousePos;
		document.write("<LAYER name='bulle' top=0 left=0 visibility='hide'></LAYER>");
	}
	if (document.all) {
		document.write("<DIV id='bulle' style='position:absolute;top:0;left:0;visibility:hidden'></DIV>");
		document.onmousemove=getMousePos;
	}
	//modif CL 09/2001 - NS6 : celui-ci ne supporte plus document.layers mais document.getElementById
	else if (document.getElementById) {
	        document.onmousemove=getMousePos;
	        document.write("<DIV id='bulle' style='position:absolute;top:0;left:0;visibility:hidden'></DIV>");
	}

}

function toggleMenu(currMenu) {
         if (document.getElementById) {
            thisMenu = document.getElementById(currMenu).style
            if (thisMenu.display == "block") {
               thisMenu.display = "none"
            }
            else {
               thisMenu.display = "block"
            }
            return false
         }
         else {
            return true
         }
      }
	  
function disp(txt) {document.write(txt);}
var banniere=new CreerBan('Lindsay');

banniere.Add("../images/logo_perrot.gif","produits_lindsay.php","_self",7);
banniere.Add("../images/logo_greenfield.gif","http://www.lindsaymanufacturing.com/","_blank",7);
banniere.Add("../images/logo_GROWSMARTT.gif","http://www.growsmart.com/","_blank",7);
banniere.Add("../images/logo_ZIMMATIC.gif","http://www.zimmatic.com/","_blank",7);

function CreerBan(alt) {
	this.nb=0;
	this.no=0;
	this.alt=alt;

	this.Add=AddBan;
	this.Init=InitBan;
}
function AddBan(img,href,target,delai) {
	var ban=new Object;
		ban.img=img;
		ban.href=href;
		ban.target=target;
		ban.delai=delai;
	this[this.nb]=ban;
	this.nb++;
}
function InitBan() {
	var aff="";
	if (document.images) { for(var i=0;i<this.nb;i++){var gif=new preload(this[i].img)}}
	disp(aff+"<BR><A href='javascript:clicban()'><IMG name='tjsimg' src='"+this[0].img+"' alt='"+this.alt+"'></A>");
	setTimeout("rotation()",this[0].delai*1000);
}
function rotation() {
	banniere.no++; var no=banniere.no; if (no>=banniere.nb) {banniere.no=0; no=0}
	document.images["tjsimg"].src=banniere[no].img;
	setTimeout("rotation()",banniere[no].delai*1000);
}
function clicban() {
	with(banniere[banniere.no]) {
		if(target=="_blank"){window.open(href,"")} else {
			if(target=="_top"){parent.window.location=href} else {
				if(target=="_self"){window.location=href} else {
				parent.frames[target].window.location=href}
				
			}
		}
	}
}
function preload() {
	this.length = preload.arguments.length;
	for (var i = 0; i < this.length; i++) {
		this[i+1] = new Image();
		this[i+1].src = preload.arguments[i];
	}
}


