<!-- ticker => https://developer.mozilla.org/En/DHTML_Demonstrations_Using_DOM/Style:Stock_Ticker -->
function Ticker(name, id, shiftBy, interval) {
  this.name     = name;
  this.id       = id;
  this.shiftBy  = shiftBy ? shiftBy : 1;
  this.interval = interval ? interval : 100;
  this.runId	= null;
  this.div = document.getElementById(id);
  // remove extra textnodes that may separate the child nodes
  // of the ticker div
  var node = this.div.firstChild;
  var next;
  while (node) {
    next = node.nextSibling;
    if (node.nodeType == 3)
      this.div.removeChild(node);
    node = next;
  }
  //end of extra textnodes removal
  this.left = 0;
  this.shiftLeftAt = this.div.firstChild.offsetWidth;
  this.div.style.height	= this.div.firstChild.offsetHeight;
  this.div.style.width = 2 * screen.availWidth;
  this.div.style.visibility = 'visible';
}
function startTicker() {
  this.stop();
  this.left -= this.shiftBy;
  if (this.left <= -this.shiftLeftAt){
    this.left = 0;
    this.div.appendChild(this.div.firstChild);
    this.shiftLeftAt = this.div.firstChild.offsetWidth;
  }
  this.div.style.left = (this.left + 'px');
  this.runId = setTimeout(this.name + '.start()', this.interval);
}
function stopTicker(){
  if (this.runId)
    clearTimeout(this.runId);
  this.runId = null;
}
/* Prototypes for Ticker */
Ticker.prototype.start = startTicker;
Ticker.prototype.stop = stopTicker;
//Ticker.prototype.changeInterval = changeTickerInterval;
var ticker = null; /* ticker object */
function startticker() {
	ticker = new Ticker('ticker', 'tickerID', 1, 15);
	ticker.start();
}

// main
$(document).ready(function(){
	for(var i=1;i<7;i++) {
		$("#menu"+i).height(38).css("top",200).show();
		$("#pmenu"+i).hide();
	}
	var menuouvert="";
	$(".menus").click(function () {
		$(".menus").each(function(){
        	if(document.getElementById($(this).attr("name")).style.top!="200px") {
				menuouvert=$(this).attr("name");
				$(this).animate({height: "38px",top: "200px"}, { duration: 800 });
	  			$("#p"+$(this).attr("name")).fadeOut(800);
			}
      	});
		if($(this).attr("name")!=menuouvert) {
			switch ($(this).attr("name")) {
				case "menu1":var h1="238";var t1="0";open_menu1=1;break;  
				case "menu2":var h1="190";var t1="48";open_menu1=2;break;  
				case "menu3":var h1="130";var t1="108";open_menu1=3;break;  
				case "menu4":var h1="180";var t1="58";open_menu1=4;break;  
				case "menu5":var h1="150";var t1="88";open_menu1=5;break;  
				case "menu6":var h1="238";var t1="0";open_menu1=6;break;  
			}
			$(this).animate({height: "+"+h1+"px",top: ""+t1+"px"}, { duration: 800 });
			$("#p"+$(this).attr("name")).fadeIn(800);
		} else {
			menuouvert="";
		}
		
	});
	$(".menus").hover(
		function () {
			$(this).css("cursor","pointer");
		},
		function () {
			$(this).css("cursor","default");
		}
	);
	// Le texte defilant
	startticker();
});

function aller(url) {if(url!="/"){location.href=url;}}