
function addEvent(obj, event, fct){
    if(obj.attachEvent){
        obj.attachEvent("on" + event, fct); 
    } else {
	//alert(obj+" "+event+" "+fct);
        obj.addEventListener(event, fct, true);
    }
}

/*
 *=>Fil d'actualitŽ
 *****************************************************/

jQuery.fn.liScroll = function(settings) {
	settings = jQuery.extend({
	travelocity: 0.07
	}, settings);		
	return this.each(function(){
			    var $strip = jQuery(this);
			    $strip.addClass("newsticker")
			    var stripWidth = 50;
			    $strip.find("li").each(function(i){
			    stripWidth += jQuery(this, i).outerWidth(true); 
			});
			    
			var $mask = $strip.wrap("<div class='mask'></div>");
			var $tickercontainer = $strip.parent().wrap("<div class='tickercontainer'></div>");								
			var containerWidth = $strip.parent().parent().width();	//a.k.a. 'mask' width
			//document.getElementById('ticker01').style.width=4000+"px";
			$strip.width(stripWidth);			
			var totalTravel = stripWidth+containerWidth;//ici pour la vitesse
			var defTiming = totalTravel/settings.travelocity;		
			
			function scrollnews(spazio, tempo){
			    $strip.animate({left: '-='+ spazio}, tempo, "linear", function(){$strip.css("left", containerWidth); scrollnews(totalTravel, defTiming);});
			}
			scrollnews(totalTravel, defTiming);				
			$strip.hover(function(){
			jQuery(this).stop();
			},
			function(){
			var offset = jQuery(this).offset();
			var residualSpace = offset.left + stripWidth;
			var residualTime = residualSpace/settings.travelocity;
			scrollnews(residualSpace, residualTime);
			});
	});	
    };

/*
* => Menu de Recherche
*
*************************************************/
function MenuRech(){

    var DivLoupe=document.getElementById("ListeRecherche");

    function CreateDiv(event)
    {
        
      var TypeE=                    event.type;
      var InputRecherche=     document.getElementById('ChampsRecherche');
      var DivForm=                document.getElementById('DivForm');
        
        if(DivForm.style.display=="block")
        {
                        DivForm.style.display="none";
        } else {
                        DivForm.style.display="block";
                        InputRecherche.focus();
        }
        return false;
    }
    function DeleteDiv(){
          var Div=document.getElementById("ListeRecherche");
                Div.removeChild(document.getElementById('DivForm'));
    }
	    //alert("ici");
            addEvent(DivLoupe,"click",CreateDiv);
	    
}

addEvent(window, "load", MenuRech);



/*
*=> FONCTIONS IMG DU MENU
*
***********************************************************/
function AffImg(divId,X){
		var imgContent=window.document.getElementById(divId);
					imgContent.src="http://cmm-online.fr/Www/E/ELECTROGELOZ/design/menu/imgMenu/"+X+".jpg";
					imgContent.alt="Illustration : "+ X;
					imgContent.title=X;
					//alert("http://cmm-online.fr/Www/E/ELECTROGELOZ/design/menu/imgMenu/"+X+".jpg");
}
function AffMenu(X){
		var Div=document.getElementById(X);
					
							 Div.style.display="block";
					
}
function CachMenu(X){
		document.getElementById(X).style.display="none";
}


