// Onload des fonctions
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}

// Récupération d'éléments par nom de classe
document.getElementsByClassName = function(className) {
  var children = (document.all) ? document.all : document.getElementsByTagName('*');
  var elements = new Array();
  var counter = 0;
  
  for (var i = 0; i < children.length; i++) {
    var child = children[i];
    var classNames = child.className.split(' ');
    for (var j = 0; j < classNames.length; j++) {
      if (classNames[j] == className) {
        elements[counter] = child;
        counter++;
        break;
      }
    }
  }

  return elements;
}

// Actions sur les liens (basés sur la class
function initButtons() {
	
	//popup d'aide
	var aide = document.getElementsByClassName('aide');
	var defaultWidth = document.all ? 489 : 470;
	
	if(aide[0]) {
		var title = 'aide';
		var attrs = 'top=50,left=100,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=yes,status=no';
	
		for(var i = 0; i < aide.length; i++) {
			aide[i].idx = i;
			aide[i].onclick = function() {
				if (aide[i].getAttribute("popupx") && aide[i].getAttribute("popupy")) {
					attrs = "width="+aide[this.idx].getAttribute("popupx")+",height="+aide[this.idx].getAttribute("popupy")+"," + attrs;
				}
				else {
					attrs = "width=" + defaultWidth + ",height=300," + attrs;
				}
				
				var popup = window.open(this.href, title, attrs);
				popup.focus();
				return false;
			}
		}
	}
	
	//confirmation sur les boutons supprimer
	var suppr = document.getElementsByClassName('btn_suppr');
	for(var i = 0; i < suppr.length; i++) {
		if (suppr[i].tagName == "A") {
			suppr[i].onclick = function() {
				return confirm("Confirmer la suppression");
			}
		}
	}
		
	//liens sur les page d'agenda
	var agenda = document.getElementById('agenda');
	if(agenda) {


		icones = agenda.getElementsByTagName('img');
		if (icones.length > 0) {
			var rappels = document.getElementsByClassName('rappel');
			
			// correction pb IE lien non cliquable sur calendrier
			if(document.all && !window.XMLHttpRequest) { // detection d'IE versions inferieures à 7 
				for(var c = 0; c < rappels.length; c++) {
					var span = document.createElement('span');
					rappels[c].appendChild(span);
				}
			}
			// fin correction pb IE

			for(var i = 0; i < icones.length; i++) {
				icones[i].onclick = function() {
					this.className = (!this.className || this.className == '') ? 'actif' : '';
		
					var id = this.getAttribute('id').split('_')[1];
		
					for(var j = 0; j < rappels.length; j++) {
						if(rappels[j].getAttribute('id').split('_')[1] != id) {
							rappels[j].style.display = 'none';
						}
					}
		
					for(var k = 0; k < icones.length; k++) {
						if(icones[k].getAttribute('id').split('_')[1] != id) {
							icones[k].className = '';
						}
					}
		
					id = 'r_'+id;
		
					var target = document.getElementById(id);
					if(!target) return false;
					target.style.display = (target.style.display == 'none' || target.style.display == '') ? 'block' : 'none';
				}
			}
		}
	}
}

// Met en capitale la première lettre d'un champs de saisie.
// @param oInput L'objet input
function capitalizeInputValue(p_oInput)
{
	var sText = p_oInput.value;
	var a = new Array();
	
	for(var j = 0; j < sText.length ; j++)
	{
		if(j == 0)
		{
			a[j] = sText.substr(j,1).toUpperCase();
		}
		else 
		{
			a[j] = sText.substr(j,1).toLowerCase();
		}
	}
	p_oInput.value = a.join('');
}

//*****************************************************
//popups

//page centrée
function popupCentree(theA, width, height) {
	var title = 'offres';
	var attrs = 'width='+width+',height='+height+',top=' + ((screen.availHeight - height)/2) + ',left=' + ((screen.availWidth - width)/2) + ',toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes,status=no';
	if (popup = window.open(theA.href, title, attrs)) {
		popup.focus();
		popup.moveTo((screen.availWidth - width)/2, (screen.availHeight - height)/2);
		return false;
	}
	else {
			//ouverture en target _blank
		return true;
	}
}

//page offre
function popupOffre(theA) {
	width= (document.all) ? 469 : 450;
	height=440;
	var title = 'offres';
	var attrs = 'width='+width+',height='+height+',top=' + ((screen.availHeight - height)/2) + ',left=' + ((screen.availWidth - width)/2) + ',toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes,status=no';
	if (popup = window.open(theA.href, title, attrs)) {
		popup.focus();
		popup.moveTo((screen.availWidth - width)/2, (screen.availHeight - height)/2);
		return false;
	}
	else {
			//ouverture en target _blank
		return true;
	}
}

//page tarif
function popupTarif(theA) {
	width= (document.all) ? 469 : 450;
	height=380;
	var title = 'tarif';
	var attrs = 'width='+width+',height='+height+',top=' + ((screen.availHeight - height)/2) + ',left=' + ((screen.availWidth - width)/2) + ',toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes,status=no';
	if (popup = window.open(theA.href, title, attrs)) {
		popup.focus();
		popup.moveTo((screen.availWidth - width)/2, (screen.availHeight - height)/2);
		return false;
	}
	else {
			//ouverture en target _blank
		return true;
	}
}

//page affaire
function popupAffaire(theA) {
	width=330;
	height=325;
	var title = 'affaire';
	var attrs = 'width='+width+',height='+height+',top=' + ((screen.availHeight - height)/2) + ',left=' + ((screen.availWidth - width)/2) + ',toolbar=no,menubar=no,location=no,resizable=no,scrollbars=yes,status=no';
	if (popup = window.open(theA.href, title, attrs)) {
		popup.focus();
		popup.moveTo((screen.availWidth - width)/2, (screen.availHeight - height)/2);
		return false;
	}
	else {
			//ouverture en target _blank
		return true;
	}
}

//page conseil
function popupConseil(theA) {
	width= (document.all) ? 469 : 535;
	height=550;
	var title = 'conseil';
	var attrs = 'width='+width+',height='+height+',top=' + ((screen.availHeight - height)/2) + ',left=' + ((screen.availWidth - width)/2) + ',toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes,status=no';
	if (popup = window.open(theA.href, title, attrs)) {
		popup.focus();
		popup.moveTo((screen.availWidth - width)/2, (screen.availHeight - height)/2);
		return false;
	}
	else {
			//ouverture en target _blank
		return true;
	}
}

function popupAlerte(theA) {
	width= (document.all) ? 469 : 540;
	height=375;
	var title = 'alerte';
	var attrs = 'width='+width+',height='+height+',top=' + ((screen.availHeight - height)/2) + ',left=' + ((screen.availWidth - width)/2) + ',toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes,status=no';
	if (popup = window.open(theA.href, title, attrs)) {
		popup.focus();
		popup.moveTo((screen.availWidth - width)/2, (screen.availHeight - height)/2);
		return false;
	}
	else {
			//ouverture en target _blank
		return true;
	}
}

function popupPassword(theA) {
	width=400;
	height=320;
	var title = 'alerte';
	var attrs = 'width='+width+',height='+height+',top=' + ((screen.availHeight - height)/2) + ',left=' + ((screen.availWidth - width)/2) + ',toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes,status=no';
	if (popup = window.open(theA.href, title, attrs)) {
		popup.focus();
		popup.moveTo((screen.availWidth - width)/2, (screen.availHeight - height)/2);
		return false;
	}
	else {
			//ouverture en target _blank
		return true;
	}
}

function popupService(theA) {
	width=460;
	height=610;
	var title = 'service';
	var attrs = 'width='+width+',height='+height+',top=' + ((screen.availHeight - height)/2) + ',left=' + ((screen.availWidth - width)/2) + ',toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes,status=no';
	if (popup = window.open(theA.href, title, attrs)) {
		popup.focus();
		popup.moveTo((screen.availWidth - width)/2, (screen.availHeight - height)/2);
		return false;
	}
	else {
			//ouverture en target _blank
		return true;
	}
}

//*****************************************************
// gestion du nuancier

function nuancierShowHide() {
	theDiv = document.getElementById("id_div_nuancier");
	theBtn = document.getElementById("id_btn_nuancier");
	if (theDiv.style.display == "") {
		theDiv.style.display = "none";
		theBtn.style.display = "";
	}
	else {
		theDiv.style.display = "";
		theBtn.style.display = "none";
	}
}
function nuancierOver(i) {
	theInfo = document.getElementById("id_info_nuancier");
	theInfo.value = tCouleur[i];
}
function nuancierOut(i) {
	theInfo = document.getElementById("id_info_nuancier");
	theInfo.value = "";

}
function nuancierClick(i, c) {
	theCode = document.getElementById("id_code_couleur");
	theNom = document.getElementById("id_nom_couleur");
	theImg = document.getElementById("id_apercu");
	theNom.value = tCouleur[i];
	theCode.value = c;
	theImg.src = "upload/vehicule/nuancier/"+c+".gif";
	nuancierShowHide();
}

//*****************************************************
//gestion des doubles select

//supprim les éléments
function selEmpty(cbo) {
	cbo.length=0;
}

//recherche d'une valeur dans les tableaux (recherche linéaire...  :( )
function findKey(tab, val) {
	for (var i=0; i<tab.length; i++) {
		if (tab[i] == val) return i;
	}
	return 0;
}

//ajout d'un option
function selAddOpt(cbo, val, txt, selected) {
	var oOption; 
	oOption = document.createElement('OPTION'); 
	oOption.value = val; 
	oOption.text = txt; 
	oOption.selected = selected;
	cbo.options[cbo.length]=oOption;
}

//met à jour le contenu du select
function selUpdate(elSels, elSeld, tEl) {

	//strdebug = "";
	for (i=0; i<tIdx.length; i++) {

		//strdebug += i +" : " + tabsel[i] +"\n";
		if (tSel[i] == 0) {
			selAddOpt(elSels, tIdx[i], tLib[i], false);
		}
		else {
			selAddOpt(elSeld, tIdx[i], tLib[i], false);
		}
	}
}

//*****************************************************
//Permet de rendre updatable un champ (btn modifié)
function updateField(el, inputId) {
	theInput = document.getElementById(inputId);
	theInput.className = "";
	theInput.readOnly = false;
	el.style.display='none';
}

//*****************************************************
//affiche cache les conseils
function conseilShowHide(theId, t) {
	document.getElementById("div_"+theId+"_on").style.display = (t == "on") ? "" : "none";
	document.getElementById("div_"+theId+"_off").style.display = (t == "on") ? "none" : "";
	/*theA = document.getElementById("a_"+theId);
	if (theDiv.className == "itemOff") {
		theDiv.className = "item";
		theA.className = "hide";
		theA.innerHTML = "Réduire";
	}
	else {
		theDiv.className = "itemOff";
		theA.className = "show";
		theA.innerHTML = "Voir";
	}*/
}





/**
	Frédéric Saunier
	http://www.tekool.net/javascript/backtothehtml

	This program is part of a free software; you can redistribute it and/or
	modify it under the terms of the GNU General Public License
	as published by the Free Software Foundation; either version 2
	of the License, or (at your option) any later version.

	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with this program; if not, write to the Free Software
	Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

**/

/*****************************************************************************
* BackToTheHtml Command
*///**************************************************************************
function BackToTheHtml(node)
{
	if(node == null)
		this.node = document; 
	else
		this.node = node; 
};
BackToTheHtml.prototype.node = null;

BackToTheHtml.prototype.execute = function()
{
	this.activateObject();
}

BackToTheHtml.prototype.activateObject = function(domObject)
{
	var aDomObject = this.node.getElementsByTagName('object');
	var activationObject;
	for(var i=0; i<aDomObject.length; i++)
		if
		(
			aDomObject[i].getAttributeNode('BackToTheHtml') == null
			&&
			(activationObject = this.getActivationObject(aDomObject[i])) != null
		)
			activationObject.execute();
};

BackToTheHtml.prototype.getActivationObject = function(domObject)
{
	var classid = domObject.classid.toUpperCase().substr('clsid:'.length);
	var mimeType = domObject.type.toLowerCase();

	switch(true)
	{
		case 
			classid == 'D27CDB6E-AE6D-11CF-96B8-444553540000' 
			||
			mimeType == 'application/x-shockwave-flash'
		:
			return new ActivateObjectFlash(domObject);

		default :
			return null;
	}
};

BackToTheHtml.uniqueID = function(prefix)
{
	var sPrefix;
	if(prefix == null)
		sPrefix = 'uniqueId';
	else
		sPrefix = prefix;
		
	var i=0;
	while(document.getElementById(sPrefix + (i++)))
		;
	return sPrefix + (i-1);
};

BackToTheHtml.isParentOf = function(parent,child)
{
	var found = false;
	for(var i=0; i<parent.childNodes.length; i++)
		if(parent.childNodes[i] == child)
			return true;
		else
			found = arguments.callee(parent.childNodes[i],child);

	return found;
}

/*****************************************************************************
* ActivateObject Command
*///**************************************************************************
function ActivateObject(domObject)
{
	this.domObject = domObject;
}

ActivateObject.prototype.domObject = null;
ActivateObject.prototype.classid = null;
ActivateObject.prototype.aHtmlAttribute = ['accessKey','align','alt','archive','border','code','codeBase','codeType','declare','dir','height','hideFocus','hspace','lang','language','name','standby','tabIndex','title','useMap','vspace','width'];
ActivateObject.prototype.aObjectProperty = null;

ActivateObject.prototype.execute = function()
{
	this.xndObjectId = BackToTheHtml.uniqueID();
	this.setTextHtml();
	this.writeObject();

	this.xndObject = document.getElementById(this.xndObjectId);
	this.setSpecialProperties();
	this.removeOriginalObject();
}

ActivateObject.prototype.setTextHtml = function()
{
	var str = '';
	str += '<object BackToTheHtml ' + '\n';
	str += ' classid="clsid:' + this.classid + '" ' + '\n';

	//Add HTML attributes to the <object> tag
	for(var i=0; i<this.aHtmlAttribute.length; i++)
	{
		var name = this.aHtmlAttribute[i];
		if(typeof this.domObject[name] != 'undefined' && this.domObject[name].toString() != '')
			str += '\t' + name + '="' + this.domObject[name].toString() + '" ' + '\n';
	}

	str += 'id="' + this.xndObjectId + '" ' + '\n';
	str += '>';

	for(var i=0; i<this.aObjectProperty.length; i++)
	{
		var name = this.aObjectProperty[i];
		if(typeof this.domObject[name] != 'undefined' && this.domObject[name].toString() != '' )
			str += '\t<param name="' + name + '" value="' + this.domObject[name].toString() + '"></param>' + '\n';
	}
	str += '</object>';

	this.textHtml = str;
};

ActivateObject.prototype.writeObject = function()
{
	this.domObject.insertAdjacentHTML("afterEnd",this.textHtml);
};

ActivateObject.prototype.setSpecialProperties = function()
{
	if(typeof this.domObject.className != 'undefined' && this.domObject.className.toString() != '')
		this.xndObject.className = this.domObject.className

	if(typeof this.domObject.style.cssText != 'undefined' && this.domObject.style.cssText.toString() != '')
		this.xndObject.style.cssText = this.domObject.style.cssText;

	if(typeof this.domObject.SWRemote != 'undefined' && this.domObject.SWRemote.toString() != '')
		this.xndObject.FlashVars = this.domObject.SWRemote;

	if(typeof this.domObject.codebase == 'undefined' || this.domObject.codebase.toString() == '')
		this.xndObject.codebase = 'http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,24,0';

	if(typeof this.domObject.id != 'undefined' && this.domObject.id.toString() != '')
		this.xndObject.id = this.domObject.id;

};

ActivateObject.prototype.removeOriginalObject = function()
{
	this.domObject.parentNode.removeChild(this.domObject);
};

/*****************************************************************************
* ActivateObjectFlash Command
*///**************************************************************************
function ActivateObjectFlash(domObject)
{
	ActivateObject.call(this,domObject);
}
ActivateObjectFlash.prototype = new ActivateObject;
ActivateObjectFlash.prototype.aObjectProperty = ['FrameNum','Playing','Quality','Quality2','Scalemode','Scale','AlignMode','SAlign','BackgroundColor','BGColor','Loop','Movie','WMode','Base','DeviceFont','EmbedMovie','SWRemote','FlashVars','AllowScriptAccess'];
ActivateObjectFlash.prototype.classid = 'D27CDB6E-AE6D-11CF-96B8-444553540000';


/*****************************************************************************
* Script initialisation
*///**************************************************************************
if(typeof ActiveXObject != 'undefined' && typeof Function.call != 'undefined')
{
	var styleId = BackToTheHtml.uniqueID();
	document.write('<style id="' + styleId + '" ></style>');
	var domStyle = document.getElementById(styleId);

	var isHead = false;
	var aHead = document.getElementsByTagName('head');
	for(var i=0; i<aHead.length; i++)
		if(BackToTheHtml.isParentOf(aHead[i],domStyle))
			isHead = true;

	if(isHead)
	{
		document.write('<style type="text/css">OBJECT{visibility:hidden;}</style>');
		document.onreadystatechange = function()
		{
			if(document.readyState == 'complete')
			{
				new BackToTheHtml().execute();
				document.styleSheets[document.styleSheets.length-1].addRule("OBJECT","visibility:visible;");
				//alert('head');
				//alert(document.body.innerHTML);
			}
		}
	}
	else
	{
		new BackToTheHtml().execute();
		//alert('body');
		//alert(document.body.innerHTML);
	}
	
	domStyle.parentNode.removeChild(domStyle);
}


/***********************************************
* Cool DHTML tooltip script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

var offsetxpoint = -60; //Customize x offset of tooltip
var offsetypoint = 20; //Customize y offset of tooltip
var ie=document.all;
var ns6=document.getElementById && !document.all;
var enabletip = false;

var tipobj = "";

function ietruebody(){
	return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body;
}

function ddrivetip(thetext){
	if (ns6||ie){
		tipobj.innerHTML=thetext;
		enabletip=true;
		return false;
	}
}

function positiontip(e){
	if (enabletip) {
		var curX=(ns6)?e.pageX : event.clientX+ietruebody().scrollLeft;
		var curY=(ns6)?e.pageY : event.clientY+ietruebody().scrollTop;
		//Find out how close the mouse is to the corner of the window
		var rightedge=ie&&!window.opera? ietruebody().clientWidth-event.clientX-offsetxpoint : window.innerWidth-e.clientX-offsetxpoint-20;
		var bottomedge=ie&&!window.opera? ietruebody().clientHeight-event.clientY-offsetypoint : window.innerHeight-e.clientY-offsetypoint-20;
		
		var leftedge=(offsetxpoint<0)? offsetxpoint*(-1) : -1000;
		
		//if the horizontal distance isn't enough to accomodate the width of the context menu
		if (rightedge<tipobj.offsetWidth)
			//move the horizontal position of the menu to the left by it's width
			tipobj.style.left=ie? ietruebody().scrollLeft+event.clientX-tipobj.offsetWidth+"px" : window.pageXOffset+e.clientX-tipobj.offsetWidth+"px";
		else if (curX<leftedge)
			tipobj.style.left="5px";
		else
			//position the horizontal position of the menu where the mouse is positioned
			tipobj.style.left=curX+offsetxpoint+"px";
		
		//same concept with the vertical position
		if (bottomedge<tipobj.offsetHeight) {
			tipobj.style.top=ie? ietruebody().scrollTop+event.clientY-tipobj.offsetHeight-offsetypoint+"px" : window.pageYOffset+e.clientY-tipobj.offsetHeight-offsetypoint+"px";
		} else {
			tipobj.style.top=curY+offsetypoint+"px";
			tipobj.style.visibility="visible";
		}
	}
}

function hideddrivetip(){
	if (ns6||ie){
		enabletip=false;
		tipobj.style.visibility="hidden";
		tipobj.style.left="-1000px";
		tipobj.style.width='';
	}
}

document.onmousemove=positiontip;


/***********************************************
* Pausing up-down scroller- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/

function pausescroller(content, divId, divClass, delay){
	this.content=content //message array content
	this.tickerid=divId //ID of ticker div to display information
	this.delay=delay //Delay between msg change, in miliseconds.
	this.mouseoverBol=0 //Boolean to indicate whether mouse is currently over scroller (and pause it if it is)
	this.hiddendivpointer=1 //index of message array for hidden div
	document.write('<div id="'+divId+'" class="'+divClass+'" style="position: relative; overflow: hidden"><div class="innerDiv" style="position: absolute; width: 100%" id="'+divId+'1">'+content[0]+'</div><div class="innerDiv" style="position: absolute; width: 100%; visibility: hidden" id="'+divId+'2">'+content[1]+'</div></div>')
	var scrollerinstance=this
	if (window.addEventListener) //run onload in DOM2 browsers
	window.addEventListener("load", function(){scrollerinstance.initialize()}, false)
	else if (window.attachEvent) //run onload in IE5.5+
	window.attachEvent("onload", function(){scrollerinstance.initialize()})
	else if (document.getElementById) //if legacy DOM browsers, just start scroller after 0.5 sec
	setTimeout(function(){scrollerinstance.initialize()}, 500)

}

// -------------------------------------------------------------------
// initialize()- Initialize scroller method.
// -Get div objects, set initial positions, start up down animation
// -------------------------------------------------------------------

pausescroller.prototype.initialize=function(){
	this.tickerdiv=document.getElementById(this.tickerid)
	this.visiblediv=document.getElementById(this.tickerid+"1")
	this.hiddendiv=document.getElementById(this.tickerid+"2")
	this.visibledivtop=parseInt(pausescroller.getCSSpadding(this.tickerdiv))
	//set width of inner DIVs to outer DIV's width minus padding (padding assumed to be top padding x 2)
	this.visiblediv.style.width=this.hiddendiv.style.width=this.tickerdiv.offsetWidth-(this.visibledivtop*2)+"px"
	this.getinline(this.visiblediv, this.hiddendiv)
	this.hiddendiv.style.visibility="visible"
	var scrollerinstance=this
	document.getElementById(this.tickerid).onmouseover=function(){scrollerinstance.mouseoverBol=1}
	document.getElementById(this.tickerid).onmouseout=function(){scrollerinstance.mouseoverBol=0}
	if (window.attachEvent) //Clean up loose references in IE
	window.attachEvent("onunload", function(){scrollerinstance.tickerdiv.onmouseover=scrollerinstance.tickerdiv.onmouseout=null})
	setTimeout(function(){scrollerinstance.animateup()}, this.delay)
}


// -------------------------------------------------------------------
// animateup()- Move the two inner divs of the scroller up and in sync
// -------------------------------------------------------------------

pausescroller.prototype.animateup=function(){
var scrollerinstance=this
if (parseInt(this.hiddendiv.style.top)>(this.visibledivtop+5)){
this.visiblediv.style.top=parseInt(this.visiblediv.style.top)-5+"px"
this.hiddendiv.style.top=parseInt(this.hiddendiv.style.top)-5+"px"
setTimeout(function(){scrollerinstance.animateup()}, 50)
}
else{
this.getinline(this.hiddendiv, this.visiblediv)
this.swapdivs()
setTimeout(function(){scrollerinstance.setmessage()}, this.delay)
}
}

// -------------------------------------------------------------------
// swapdivs()- Swap between which is the visible and which is the hidden div
// -------------------------------------------------------------------

pausescroller.prototype.swapdivs=function(){
var tempcontainer=this.visiblediv
this.visiblediv=this.hiddendiv
this.hiddendiv=tempcontainer
}

pausescroller.prototype.getinline=function(div1, div2){
div1.style.top=this.visibledivtop+"px"
div2.style.top=Math.max(div1.parentNode.offsetHeight, div1.offsetHeight)+"px"
}

// -------------------------------------------------------------------
// setmessage()- Populate the hidden div with the next message before it's visible
// -------------------------------------------------------------------

pausescroller.prototype.setmessage=function(){
var scrollerinstance=this
if (this.mouseoverBol==1) //if mouse is currently over scoller, do nothing (pause it)
setTimeout(function(){scrollerinstance.setmessage()}, 100)
else{
var i=this.hiddendivpointer
var ceiling=this.content.length
this.hiddendivpointer=(i+1>ceiling-1)? 0 : i+1
this.hiddendiv.innerHTML=this.content[this.hiddendivpointer]
this.animateup()
}
}

pausescroller.getCSSpadding=function(tickerobj){ //get CSS padding value, if any
if (tickerobj.currentStyle)
return tickerobj.currentStyle["paddingTop"]
else if (window.getComputedStyle) //if DOM2
return window.getComputedStyle(tickerobj, "").getPropertyValue("padding-top")
else
return 0
}



//*****************************************************
// Chargement des fonctions en onload
function init()
{
	tipobj = document.all? document.all["dhtmltooltip"] : document.getElementById? document.getElementById("dhtmltooltip") : "";
	initButtons();
}

addLoadEvent(init);