// JavaScript Document



pause = 2;
vitesse = 5;
tabImg = new Array ("img1.jpg","img2.jpg","img3.jpg");
tabImgn = new Array ("http://www.smokeridge.com","http://www.smokeridge.com","http://www.smokeridge.com");

var type = "IE";	// Variable used to hold the browser name

BrowserSniffer();

//detects the capabilities of the browser
function BrowserSniffer() {
	if (navigator.userAgent.indexOf("Opera")!=-1 && document.getElementById) type="OP";		//Opera
	else if (document.all) type="IE";										                                        				//Internet Explorer e.g. IE4 upwards
	else if (document.layers) type="NN";													                                        //Netscape Communicator 4
	else if (!document.all && document.getElementById) type="MO";							                    //Mozila e.g. Netscape 6 upwards
	else type = "IE";		//I assume it will not get here
}

  function ShowLayer(id, action, id1,action1){
	if (type=="IE") eval("document.all." + id + ".style.visibility='" + action + "'");
	if (type=="NN") eval("document." + id + ".visibility='" + action + "'");
	if (type=="MO" || type=="OP") eval("document.getElementById('" + id + "').style.visibility='" + action + "'");
}


// script qui va animer les images  
function Initialise () {
if (type=="NN") { 
  imgW = document.images["img"].width;
  imgH = document.images["img"].height;
  obj = document.layer1;
  obj.top = document.images["img"].y;
  obj.left = document.images["img"].x;
  obj.clip.bottom = imgH;
  obj.clip.right = imgW;
  obj.clip.top = 0;
  obj.clip.left = 0;
  obj = document.layer1.document.layer2;
  objs = obj;
  } else {
 /*   imgW = document.all.img.width;
  imgH = document.all.img.height;
  obj = document.all.layer1;
  obj.style.top = document.all.img.offsetTop;
  obj.style.left = document.all.img.offsetLeft;
  obj.style.clip = "rect (0px," + imgW + "px," + imgH + "px,0px)";
  obj = document.all.layer2;
  objs = obj.style; */
  
  imgW = "0";
  imgH = "0";
  
  obj = document.getElementById('layer1');
  obj.style.top = "0";
  obj.style.left = "0";
  obj.style.clip = "rect(0px," + imgW + "px," + imgH + "px,0px)";
  obj = document.getElementById('layer2');
  objs = obj.style; 
  }
sens = 0;
cpt = 0;
ChangeImage ();
}

function ChangeImage () {
var x,y;

cpt++;
if (cpt >= tabImg.length) {
cpt=0;
}

  sens = 0

x = 0;
y = 0;
if (sens==0) {
  position = y = imgH;
}
else {
  position = x = imgW;
}
objs.top = y;
objs.left = x;
Ecrire ('<A HREF="'+tabImgn[cpt]+'" TARGET="img"><IMG SRC="'+tabImg[cpt]+'" NAME="tabImg2" BORDER="0" ALIGN="Top" onLoad="InitDiapo ()" onError="setTimeout(\'ChangeImage()\',500);"></A>');
}

function Ecrire (str) {
  if (type=="NN") { 
    with (obj.document) {
    write(str);
    close();
  }} else {
    obj.innerHTML = str;
}}

function InitDiapo () {
setTimeout ("slideSlide()",700*pause);
}

function slideSlide () {
position -= vitesse;
if (position < 0) position = 0;
if (sens==0) {
   objs.top = position;
  } else {
   objs.left = position;
  }

if (position == 0) {
  document.images['img'].src = tabImg[cpt];
  if (type=="NN") { 
      eval('document.links[0].href="'+tabImgn[cpt]+'";');
    } else if (type=="MO" || type=="OP") {
      eval('document.getElementById.href="'+tabImgn[cpt]+'";');
    } 
	else {
      eval('document.all.l.href="'+tabImgn[cpt]+'";');
    }
  ChangeImage ();
  } else {
    setTimeout ("slideSlide()",50);
  }
  


  }


