/// GERER LES WINDOWS.ONLOAD function addOnloadEvent(fnc){ if ( typeof window.addEventListener != "undefined" ) window.addEventListener( "load", fnc, false ); else if ( typeof window.attachEvent != "undefined" ) { window.attachEvent( "onload", fnc ); } else { if ( window.onload != null ) { var oldOnload = window.onload; window.onload = function ( e ) { oldOnload( e ); window[fnc](); }; } else window.onload = fnc; } }//////// function MM_jumpMenu(targ,selObj,restore){ eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'"); if (restore) selObj.selectedIndex=0; } ////// function ShowHide(id, visibility) { obj = document.getElementsByTagName("div"); obj[id].style.visibility = visibility; } /// DECOMPTE TEXTE TEXTAREA var ns6=document.getElementById&&!document.all function restrictinput(maxlength,e,placeholder){ if (window.event&&event.srcElement.value.length>=maxlength) return false else if (e.target&&e.target==eval(placeholder)&&e.target.value.length>=maxlength){ var pressedkey=/[a-zA-Z0-9\.\,\/]/ if (pressedkey.test(String.fromCharCode(e.which))) e.stopPropagation() } } function countlimit(maxlength,e,placeholder){ var theform=eval(placeholder) var lengthleft=maxlength-theform.value.length var placeholderobj=document.all? document.all[placeholder] : document.getElementById(placeholder) if (window.event||e.target&&e.target==eval(placeholder)){ if (lengthleft<0) theform.value=theform.value.substring(0,maxlength) placeholderobj.innerHTML=lengthleft } } function displaylimit(thename, theid, thelimit){ var theform=theid!=""? document.getElementById(theid) : thename var limit_text=''+thelimit+' caracteres Maximum.' if (document.all||ns6) document.write(limit_text) if (document.all){ eval(theform).onkeypress=function(){ return restrictinput(thelimit,event,theform)} eval(theform).onkeyup=function(){ countlimit(thelimit,event,theform)} } else if (ns6){ document.body.addEventListener('keypress', function(event) { restrictinput(thelimit,event,theform) }, true); document.body.addEventListener('keyup', function(event) { countlimit(thelimit,event,theform) }, true); } } //NEWS DEFILEMENT var DOM = (document.getElementById ? true : false); var DelayDefil = 15; // Delai pour defilement Msg var DelayPause = 3000; // Delai pour pause sur le Msg var IncY = 2; // Pas Incrementation du Msg var bFirst = false; var MsgTimer = null; // Timer du Msg var OfsY; // OfsY du Msg pour clipping var DeltaY; // Compteur pour pause Msg var PosX; // Positon d'affichage X du Msg var PosY; // Positon d'affichage Y du Msg var MsgClip; // Hauteur visible du Msg var MsgEnCours; // Numero du Msg en cours d'affichage var MsgNbr; // Nbr Ligne à afficher var MsgZone; // Div ou l'on affichage var MsgLarg; // Largeur Msg var MsgHaut; // Hauteur Msg var MsgOK = false; // Flag pour Init correct var Clip = new RECT(); // Zone de clipping du Msg var Message = new Array(); //---------------------------- function RECT( l_, t_, r_, b_){ var Arg = arguments; this.Left = ( Arg[0] ? l_: 0); this.Top = ( Arg[1] ? t_: 0); this.Right = ( Arg[2] ? r_: 0); this.Bottom = ( Arg[3] ? b_: 0); } //--------------------- function GetObjet(div_){ if( DOM) return document.getElementById(div_); } //--------------------- function GetStyle(div_){ var Obj = GetObjet(div_); if( Obj) return( Obj.style); return( null); } //--------------------------- function ObjGetLargeur( div_){ var Larg = 0; var Obj = GetObjet( div_); if( Obj) Larg = Obj.scrollWidth; return( Larg); } //--------------------------- function ObjGetHauteur( div_){ var Haut = 0; var Obj = GetObjet( div_); if( Obj) Haut = Obj.scrollHeight; return( Haut); } //----------------------------- function ObjWrite( div_, html_){ var Obj = GetObjet( div_); if( Obj) Obj.innerHTML = html_; } //------------------------- function ObjShow( div_, z_){ var Obj = GetStyle( div_); if( Obj){ Obj.visibility = "visible"; if( arguments[1] != null) Obj.zIndex = z_; } return(true); } //------------------------------- function ObjMoveTo( div_, x_, y_){ var Arg = arguments; var Obj = GetStyle( div_); if( Obj){ if( Arg[1] != null) Obj.left = x_ +"px"; if( Arg[2] != null) Obj.top = y_ +"px"; } } //-------------------------------------------- // ATTENTION à l'ordre des paramètres // Top Right Bottom et Left // Nota: ne convient pas pour NS4 //-------------------------------------------- function ObjSetClipping( div_, t_, r_, b_, l_){ var Obj = null; var Clipping = "rect("; var Arg = arguments; if( div_){ Obj = GetStyle( div_); if( Obj){ for( i=1; i< Arg.length; i++){ if( Arg[i] != null) Clipping += " "+Arg[i] + "px"; else Clipping += " auto"; } Clipping += ")"; Obj.clip = Clipping; } } } //------------------------------------------------- // Creation d'un div lorsque le document est charge //------------------------------------------------- function Add_Div( div_){ var Html =""; var NewDiv; var Obj = GetObjet( MsgZone); with( Obj){ //-- pour eviter le mouseover sous Opera notamment style.overflow = 'hidden'; //-- Pb d'héritage if( style.textAlign == "") style.textAlign="left"; } Html = '
 
'; //-- Creation Element NewDiv = document.createElement('DIV'); //-- Ajout du New Element Obj.appendChild(NewDiv); //-- Ajout du Texte NewDiv.innerHTML = Html; } //----------------------- function Add_Message( m_){ var i = Message.length; Message[i] = m_; } //----------------------- // Formatage du Message //----------------------- function Msg_Creer( div_){ var Html = ""; var szTR = ""; var Largeur = ObjGetLargeur( MsgZone); var Hauteur = ObjGetHauteur( MsgZone); //-- Calcul valeur coherente au pas Y Hauteur = parseInt(Hauteur /IncY) * IncY; MsgNbr = Message.length +1; szTR = ' '; Html = ''; for( i in Message) Html += szTR +Message[i] +''; //-- On rajoute la 1st Ligne pour rotation Html += szTR +Message[0] +''; Html += '
'; ObjWrite( div_, Html); } //----------------- function Msg_Stop(){ if( MsgTimer) clearTimeout( MsgTimer); } //----------------------- function Msg_Replay(div_){ if( MsgOK){ Msg_Stop(); MsgTimer = setTimeout("DefilHAUT('" +div_ +"')", DelayDefil); } } //----------------------- function Msg_Begin( div_){ //-- Reinitialisation OfsY = 0; DeltaY = 0; MsgEnCours = 1; //-- Init des Clipping Clip.Top = 0; Clip.Bottom = Clip.Top + MsgClip; //-- On applique le clipping ObjSetClipping( div_, Clip.Top, MsgLarg, Clip.Bottom, 0); //-- On place le div ObjMoveTo( div_, 0, 0); ObjShow( div_, 100); //-- Pause sur message MsgTimer = setTimeout("DefilHAUT('" +div_ +"')", DelayPause); } //----------------------- function Msg_Start( div_){ //----------------------- var Obj = null; var Html= ""; Msg_Stop(); Obj = GetObjet( div_); if( Obj){ //-- On Récup l'Objet bFirst = true; //-- Creation d'un Message unique Msg_Creer( div_); //-- Recup. des dimensions MsgLarg = ObjGetLargeur( div_); MsgHaut = ObjGetHauteur( div_); //-- Calcul Hauteur de chaque Message MsgClip = MsgHaut / MsgNbr; //-- C'est parti Msg_Begin( div_); //-- Return Init OK return( true); } return( false); } //----------------------- function DefilHAUT( div_){ //----------------------- //-- Incrementation OfsY += IncY; DeltaY += IncY; //-- Init des Clipping Clip.Top = OfsY; Clip.Bottom = Clip.Top + MsgClip; //-- On applique le clipping ObjSetClipping( div_, Clip.Top, MsgLarg, Clip.Bottom, 0); //-- On deplace ou replace ObjMoveTo( div_, 0, -Clip.Top); //-- On montre si first if( bFirst){ ObjShow( div_, 100); bFirst = false; } //-- Gestion du deplacement if( DeltaY < MsgClip){ //-- On y Retourne MsgTimer = setTimeout("DefilHAUT('" +div_ +"')", DelayDefil); } else{ DeltaY = 0; MsgEnCours ++; if( MsgEnCours == MsgNbr){ Msg_Begin( div_); } else{ MsgTimer = setTimeout("DefilHAUT('" +div_ +"')", DelayPause); } } } //--------------------------------------- // Fonction à mettre sur onload du //--------------------------------------- function Msg_Init( where_){ if( DOM){ MsgZone = where_; Add_Div ('defilnewsmsg'); MsgOK = Msg_Start('defilnewsmsg'); } else alert("Cette Animation n'est pas supportée par votre navigateur..\nI'm SORRY"); } //---------------------------------------------------------------- //== INITIALISATION du Message =================================== //---------------------------------------------------------------- // Add_Message( 'Texte du Message 1...'); // Add_Message( 'Texte du Message 2...'); //-- EOF -----------------------------