var x, y, version;

initActivationClick = function() {
		// desactive tt les liens 
		if (document.getElementById("page").getElementsByTagName('a')[0]){
			var link = document.getElementById('page').getElementsByTagName('a');
			for (var i=0; i<link.length; i++) {
				link[i].style.visibility='hidden';
			}
			for (var i=0; i<link.length; i++) { 
				if (link[i].href.indexOf('.flv') > 0) {
					link[i].className += ' lienVideo';
					link[i].title = link[i].href;
					link[i].href = '#';
					link[i].onclick = function(){
						if( document.getElementById('playerFlash') ) {
							if (this.childNodes[0].className == 'bigVideo')
							{
								player = document.getElementById('player');
								player.innerHTML =  '<object id="playerFlash" type="application/x-shockwave-flash" data="themes/ica/playerflash/playericaflv1.swf" width ="720" height ="576">' +
								'<param name="movie" value="themes/ica/playerflash/playericaflv1.swf" />' +
								'<param name="wmode" value="transparent" />' +
								'<param name="Flashvars" value="url=' + this.title + '" />' +
								'</object>';
								document.getElementById('blocVideo').className = "grosBloc";
							}
							else
							{
								//alert('playerFlash trouvé');
								player = document.getElementById('player');
								player.innerHTML =  '<object id="playerFlash" type="application/x-shockwave-flash" data="themes/ica/playerflash/playericaflv1.swf" width ="354" height ="340">' +
								'<param name="movie" value="themes/ica/playerflash/playericaflv1.swf" />' +
								'<param name="wmode" value="transparent" />' +
								'<param name="Flashvars" value="url=' + this.title + '" />' +
								'</object>';
								document.getElementById('blocVideo').className = "video";
							}
						} else {
							//alert('playerFlash non trouvé video');
							var player = document.createElement('div');
							player.id='player';
							
							if (document.getElementById('blocVideo'))
							{
								//alert('blocVideo present');
								document.getElementById('blocVideo').appendChild(player);
								//alert('append Ok');
							}else { 
								//alert('que faire ?');
							}
							//alert (this.className);
							if (this.childNodes[0].className == 'bigVideo')
							{
								player = document.getElementById('player');
								player.innerHTML =  '<object id="playerFlash" type="application/x-shockwave-flash" data="themes/ica/playerflash/playericaflv1.swf" width ="720" height ="576">' +
								'<param name="movie" value="themes/ica/playerflash/playericaflv1.swf" />' +
								'<param name="wmode" value="transparent" />' +
								'<param name="Flashvars" value="url=' + this.title + '" />' +
								'</object>';
								document.getElementById('blocVideo').className = "grosBloc";
							}
							else
							{
								player = document.getElementById('player');
								player.innerHTML =  '<object id="playerFlash" type="application/x-shockwave-flash" data="themes/ica/playerflash/playericaflv1.swf" width ="354" height ="340">' +
								'<param name="movie" value="themes/ica/playerflash/playericaflv.swf" />' +
								'<param name="wmode" value="transparent" />' +
								'<param name="Flashvars" value="url=' + this.title + '" />' +
								'</object>';
								document.getElementById('blocVideo').className = "video";
							}
							//document.getElementById('blocVideo').appendChild(player);
						}
						findPos(this);
						/**/
						document.getElementById('blocVideo').style.display='';
						document.getElementById('blocVideo').style.top = (y) + 'px';
						//document.getElementById('blocVideo').style.left = (x + 150) + 'px';
						//document.getElementById('blocVideo').className = "video";
						//alert(document.getElementById('blocVideo').innerHTML);
						return false;
					};

				} else if (link[i].href.indexOf('.mp3') > 0) {
					link[i].className = 'lienSon ';
					link[i].title = link[i].href;
					link[i].href = '#';
					link[i].onclick = function(){
						if( document.getElementById('playerFlash') ) {
							//alert('playerFlash trouvé');
							player = document.getElementById('player');
							player.innerHTML =  '<object id="playerFlash" type="application/x-shockwave-flash" data="themes/ica/playerflash/playericamp3.swf" width ="310" height ="100">' +
							'<param name="movie" value="themes/ica/playerflash/playericamp3.swf" />' +
							'<param name="wmode" value="transparent" />' +
							'<param name="Flashvars" value="url=' + this.title + '" />' +
							'</object>';
						} else {
							//alert('playerFlash non trouvé');
							var player = document.createElement('div');
							player.id='player';
							player.innerHTML =  '<object id="playerFlash" type="application/x-shockwave-flash" data="themes/ica/playerflash/playericamp3.swf" width ="310" height ="100">' +
							'<param name="movie" value="themes/ica/playerflash/playericamp3.swf" />' +
							'<param name="wmode" value="transparent" />' +
							'<param name="Flashvars" value="url=' + this.title + '" />' +
							'</object>';
							document.getElementById('blocVideo').appendChild(player);
							//alert('playerFlash appended');
						}
						findPos(this);
						document.getElementById('blocVideo').style.display='';
						document.getElementById('blocVideo').style.top = (y) + 'px';
						//document.getElementById('blocVideo').style.left = (x + 150) + 'px';
						document.getElementById('blocVideo').className = "mp3";
						return false;
					};
				}
			}
			for (var i=0; i<link.length; i++) {
				link[i].style.visibility='visible';
			}
		}
		
		
		/*if (document.getElementById("menuSecondaire").getElementsByTagName('a')[0]){
			var toClick = document.getElementById("menuSecondaire").getElementsByTagName('a');
			for (var i=0; i<toClick.length; i++) {
				if (toClick[i].href.indexOf('art') < 1) {
					toClick[i].onclick=function() {
						return false;
					}
				}
			}
		}
		
		if (document.getElementById("menuSecondaire").getElementsByTagName('a')[0]){
			var toClick = document.getElementById("menuSecondaire").getElementsByTagName('a');
			for (var i=0; i<toClick.length; i++) {
				if (toClick[i].href.indexOf('art') < 1) {
					toClick[i].onclick=function() {
						return false;
					}
				}
			}
		}


		if (document.getElementById("menuSecondaire").getElementsByTagName('ul')[0]){
			var toClick = document.getElementById("menuSecondaire").getElementsByTagName('ul')[0].childNodes;
			for (var i=0; i<toClick.length; i++) {
				toClick[i].onclick=function() {
					var first = this.parentNode.firstChild;
					while (  first!=null ) 
					{
						if (first.tagName=='LI' ){
							first.className = first.className.replace(new RegExp("sfclick"), "");					
						}
						first = first.nextSibling;
						
					} 
					var toHover = this.getElementsByTagName("li");
					
					for (var j=0; j<toHover.length; j++) {
						
							toHover[j].onmouseover=function() {
								this.className=" sfhover";
							}
							toHover[j].onmouseout=function() {
								this.className = this.className.replace(new RegExp("sfhover"), "");
							}
					}
					this.className="sfclick";		
				}
			}
		}

		if (document.getElementById("menudteactif")){
			var toHover =  document.getElementById("menudteactif").getElementsByTagName("li");
			for (var j=0; j<toHover.length; j++) {
						toHover[j].onmouseover=function() {
							this.className=" sfhover";
						}
						toHover[j].onmouseout=function() {
							this.className = this.className.replace(new RegExp("sfhover"), "");
						}
			}
		}*/
//	}	
}


function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft;
		curtop = obj.offsetTop;
	}
	x = 20;
	y = curtop + 18;
}

/*		

function addEvent(obj, evType, fn){
 if (obj.addEventListener){
   obj.addEventListener(evType, fn, true);
   return true;
 } else if (obj.attachEvent){
   var r = obj.attachEvent("on"+evType, fn);
   return r;
 } else {
   return false;
 }
}
*/
// le addevant est present dans layout.js
/*addEvent(window, 'load', initActivationClick);*/

function waitForMenu(){ 
	if (document.getElementById('contenu') && document.getElementById('menuSecondaire') )
			initActivationClick();
	else window.setTimeout('waitForMenu()',1);
}
waitForMenu();