var Today = new Date;
var annee = Today.getFullYear();

/*SLIDESHOW TOP*/

function Slideshow(slideshow, timeout) {
  this.slides = [];
  var nl = $(slideshow).getElementsByTagName('div');
  for (var i = 0; i < nl.length; i++) {
    if (Element.hasClassName(nl[i], 'slide')) {
      this.slides.push(nl[i]);
    }
  }
  this.timeout = timeout;
  this.current = 0;

  for (var i = 0; i < this.slides.length; i++) {
    this.slides[i].style.zIndex = this.slides.length - i;
  }

  Element.show(slideshow);
  setTimeout((function(){this.next();}).bind(this), this.timeout + 850);
}
Slideshow.prototype = {
  next: function() {
    for (var i = 0; i < this.slides.length; i++) {
      var slide = this.slides[(this.current + i) % this.slides.length];
      slide.style.zIndex = this.slides.length - i;
    }

    Effect.Fade(this.slides[this.current], {
      afterFinish: function(effect) {
        effect.element.style.zIndex = 0;
        Element.show(effect.element);
        Element.setOpacity(effect.element, 1);
      }
    });
    
    this.current = (this.current + 1) % this.slides.length;
    setTimeout((function(){this.next();}).bind(this), this.timeout + 850);
  }
}




//functon suivant projet
function prevP(pageone, pagetwo){
	new Effect.toggle(''+pageone+'','appear',{asynchronous:true, onComplete:nextP(pagetwo)});
}

function nextP(pagetwo){
	Effect.toggle(''+pagetwo+'','appear',{asynchronous:true, delay:1});
}



// popup window
function MM_openBrWindow(theURL,winName,features) { 
 	newwin= window.open(theURL,winName,features);
}


function open_popup(nom_html,w,h)
{
	var popup_url = nom_html+".html";
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	MM_openBrWindow(popup_url,'','width='+w+', height='+h+', top='+wint+',left='+winl+'');
	
}

//popup image 
function cedpopup(img,wi,he,titre,imgtoolbar) {
	var winl = (screen.width - wi) / 2;
	var wint = (screen.height - he) / 2;
	w=open("",'image','toolbar=no,scrollbars=no,resizable=no, width='+wi+', height='+he+', top='+wint+',left='+winl+'');	
	w.document.write("<HTML><HEAD>");
	if (imgtoolbar==0) { w.document.write('<meta http-equiv="imagetoolbar" content="false" />'); }
	w.document.write("<TITLE>"+titre+"</TITLE></HEAD>");
	w.document.write("<SCRIPT language=javascript>function checksize() { if (document.images[0].complete) { window.resizeTo(document.images[0].width+50,document.images[0].height+80); window.focus();} else { setTimeout('checksize()',250) } }</"+"SCRIPT>"); 
	w.document.write("<BODY bgcolor='#ffffff' onload='checksize()' onblur='window.close()' onclick='window.close()' >");
	w.document.write("<TABLE width='100%' border='0' cellspacing='0' cellpadding='0' height='100%'><TR>");
	w.document.write("<TD valign='middle' align='center'><IMG src='"+img+"' border='0'>"); 
	w.document.write("</TD></TR></TABLE>");
	w.document.write("</BODY></HTML>");
	w.document.close();
}

//popup swf
function swfpopup(img,wi,he,titre) {
	var winl = (screen.width - wi) / 2;
	var wint = (screen.height - he) / 2;
	w=open("",'','toolbar=no,scrollbars=no,resizable=no, width='+wi+', height='+he+', top='+wint+',left='+winl+'');	
	w.document.write("<HTML><HEAD>");
	w.document.write("<TITLE>"+titre+"</TITLE></HEAD>"); 
	w.document.write("<BODY bgcolor='#000000' onblur='window.close()' onclick='window.close()' topmargin='0' leftmargin='0'>");
	w.document.write("<TABLE width='100%' border='0' cellspacing='0' cellpadding='0' height='100%'><TR>");
	w.document.write("<TD valign='middle' align='center'>");
	w.document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width='+wi+' height='+he+'>');
	w.document.write('<param name="movie" value='+img+' /><param name="quality" value="high" />');
	w.document.write('<embed src='+img+' quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width='+wi+' height='+he+'></embed></object>'); 
	w.document.write("</TD></TR></TABLE>");
	w.document.write("</BODY></HTML>");
	w.document.close();
}
