// (C) 2000 www.CodeLifter.com // http://www.codelifter.com // Free for all users, but leave in this  header
// NS4-6,IE4-6 // Fade effect only in IE; degrades gracefully

// =======================================
// set the following variables
// =======================================

// Set slideShowSpeed (milliseconds)
var slideShowSpeed = 4000

// Duration of crossfade (seconds)
var crossFadeDuration = 3

// Specify the image files
var Pic = new Array() // don't touch this
// to add more images, just continue
// the pattern, adding to the array below

Pic[0] = 'i/slide0.jpg'
Pic[1] = 'i/slide1.jpg'
Pic[2] = 'i/slide2.jpg'
Pic[3] = 'i/slide3.jpg'
Pic[4] = 'i/slide4.jpg'
Pic[5] = 'i/slide5.jpg'
Pic[6] = 'i/slide6.jpg'
Pic[7] = 'i/slide7.jpg'
Pic[8] = 'i/slide8.jpg'
Pic[9] = 'i/slide9.jpg'
Pic[10] = 'i/slide10.jpg'
Pic[11] = 'i/slide11.jpg'

// =======================================
// do not edit anything below this line
// =======================================

var t
var j = 0
var p = Pic.length

var preLoad = new Array()
for (i = 0; i < p; i++){
   preLoad[i] = new Image()
   preLoad[i].src = Pic[i]
}

function runSlideShow(){
   if (document.all){
      document.images.SlideShow.style.filter="blendTrans(duration=2)"
      document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuration)"
      document.images.SlideShow.filters.blendTrans.Apply()      
   }
   document.images.SlideShow.src = preLoad[j].src
   if (document.all){
      document.images.SlideShow.filters.blendTrans.Play()
   }
   j = j + 1
   if (j > (p-1)) j=0
   t = setTimeout('runSlideShow()', slideShowSpeed)
}

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.getElementsByTagName('li');
   nLI = LI.length;  
   for(i=0; i < nLI; i++){  
     LI[i].onmouseover = function(){ 
	      hover(this);   
		   }    
		   LI[i].onmouseout = function(){  
		       hover(this);    
			   }  
			   }
			   }

function reloadpage () {
	window.location.reload();
}
			   
			   
window.onresize= function(evt) {
	
	timer=setTimeout(reloadpage,100);
	
	
}

function findPos(obj) {
	// Kudos : http://www.quirksmode.org/js/findpos.html
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		//curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft,curtop];
}


function tribun(id, nom, ev) {
	
        obj = (document.all) ?  event.srcElement : ev.target ;
	    coords = findPos(obj);
	    x = coords[0];
	    y = coords[1] - 160;
        
        var tribdiv = document.createElement("div");
        var closetribdiv = document.createElement("div");

        var newstyle = "position: absolute; border: 0px solid; right:0; top:0; width: 20px; cursor: pointer" ;
       
        if (document.all) { closetribdiv.style.setAttribute("cssText", newstyle); } 
        	else closetribdiv.setAttribute("style", newstyle);

        closetribdiv.appendChild(document.createTextNode('[X]'));
        tribdiv.appendChild(closetribdiv);	
        
        var newstyle = "position: absolute; z-index:10 ;border: 1px solid;top:" + y + "px; left:" + x + "px; width: 120px;  padding: 15px; background-color: #FFFFFF" ;
       
        if (document.all) { tribdiv.style.setAttribute("cssText", newstyle); } 
        	else tribdiv.setAttribute("style", newstyle);
        var imgdoc = document.createElement("img");
        imgdoc.setAttribute('src', '/13/tribun/photos_100/' + id + '.gif');
        imgdoc.setAttribute('width', '100');
        imgdoc.setAttribute('height', '128');
        tribdiv.appendChild(imgdoc);
        tribdiv.onclick = function() {
       		var spanelem = document.getElementById('spanordre');
	        spanelem.innerHTML = "";
        }
        var txtdoc = document.createElement("p");
        txtdoc.appendChild(document.createTextNode(nom));
        tribdiv.appendChild(txtdoc);
        var spanelem = document.getElementById('spanordre');
        spanelem.innerHTML = "";
        spanelem.appendChild(tribdiv);
        //alert(spanelem.innerHTML)
                
}

