function chkFrm() {if(!parent.chgMonoFrm) loadFrmSet();}
function loadFrmSet() {window.location.href = 'http://' + window.location.hostname;}
function gId(Target){return document.getElementById(Target);}
function gfId(Frm,Obj){

	return getFrmDoc(Frm).getElementById(Obj);
	/*
	if (document.getElementById(Frm)) {
		if (document.getElementById(Frm).contentWindow)
			return document.getElementById(Frm).contentWindow.document.getElementById(Obj);
		else
			return document.getElementById(Frm).document.getElementById(Obj);
	}else{return null;};
	*/
}

function findPosX(obj) {
	    var curleft = 0;
	    if (obj.offsetParent)
			while (obj.offsetParent) {curleft += obj.offsetLeft;obj = obj.offsetParent;}
	    else if (obj.x)
		    curleft += obj.x;
	    return curleft;
    }

    function findPosY(obj) {
	    var curtop = 0;
	    if (obj.offsetParent)
	        while (obj.offsetParent) {curtop += obj.offsetTop;obj = obj.offsetParent;}
	    else if (obj.y)
		    curtop += obj.y;
	    return curtop;
    }

//Place un objet sous un autre et l'affiche si besoin
function vhm(display,oParent,oEnfant) {
	oEnfant.style.position		= oParent.style.position;
	oEnfant.style.left			= oParent.offsetLeft + 'px';
	oEnfant.style.top			= oParent.offsetTop + oParent.clientHeight + 'px';
	oEnfant.style.display		= display;
}

function xmlGetId(objParent,attr,value){
	var rtnValue = null;
	if (objParent.hasChildNodes) {
		var p=0;
		for (p=0;p< objParent.childNodes.length;p++) {
			if (rtnValue != null) break;
			var node = objParent.childNodes[p];
			if (node.nodeType == 1) {
				if (node.getAttribute(attr))
					rtnValue = (node.getAttribute(attr) == value) ? node: xmlGetId(node,attr,value);
				else
					rtnValue = xmlGetId(node,attr,value);
			}
		}
	}
	return rtnValue;
}

function xmlGetAttrib(node,attrib) {
	if (node.getAttribute(attrib))
		return node.getAttribute(attrib);//node.attributes[attrib].value;
	else
		return '';
}

/********************************/
/*			Commun				*/	
/********************************/
function callBackError(arg)		{alert(arg);}
/*****************************/

/****************************************
		CHAMPS de saisie explicite
****************************************/
function changeInputExplicit(object,classNoData,classData,valueNoData) {
		
	if (object.getAttribute('noData')) {
		valueNoData = object.getAttribute('noData');
		object.onblur = function () {
			if (this.value == '' || object.value == valueNoData) {
				this.className = classNoData;
				this.value = valueNoData;
			}
		}	
		object.onfocus = function () {
			this.className = classData;
			if (this.value == valueNoData)
				this.value = '';
		}
		if (object.value == '' || object.value == valueNoData) {
				object.value = valueNoData;
				object.className = classNoData;
			}
	}
}
/****************************
		HTML Loader
****************************/
function getHTMLLoader() {return '<div class=\"loader\"><span>Chargement en cours ...</span></div>';}

/****************************
		SELECT BOX
****************************/
//renvoi la valeur selectionnée d'un selectbox
function getSBValue(oSelect) { if(oSelect.options.length > 0 && oSelect.selectedIndex != -1) return oSelect.options[oSelect.selectedIndex].value; else return '';}
//preselection d'une valeur d'un selectbox
function defaultSelectBox(oSelect,value) {
	oSelect.selectedIndex = -1;
	if(oSelect.options.length >0)
		for(p=0;p< oSelect.options.length;p++)
			if (oSelect.options[p].value == value) oSelect.selectedIndex = p;
}
function loadSelectBoxFromXMLDoc(oSelect,Nodes,attText,attValue,preSelect,blankOption) {

	//Supprime les options en cours
	removeSBOptions(oSelect);
	//ajoute une ligne blanche si besoin
	if(blankOption) oSelect.options.add(document.createElement("OPTION"));
	//Ajoute les options à partir du XML
	for(p=0; p < Nodes.length;p++) {
//		ad(Nodes[i].getAttribute(attText));
		if (Nodes[p].getAttribute(attText)){
			var oOption = document.createElement("OPTION");
			oSelect.options.add(oOption);
			oOption.innerHTML = Nodes[p].attributes[attText].value;
			oOption.value = Nodes[p].attributes[attValue].value;
		}
	}
	//Sélectionne par défaut une valeur
	defaultSelectBox(oSelect,preSelect);
}
//Supprime les choix du selectbox
function removeSBOptions(oSelect) {
	while(oSelect.firstChild) {oSelect.removeChild(oSelect.firstChild);}
//	do {oSelect.options.remove(0);}while(oSelect.options.length > 0);
}
/****************************/

/*****************************
			POPUP
*****************************/

//Affiche un popup dans un objet
//Id:		obj à remplir
//waitTime: Temps d'attente avant affichage
//viewTime: Temps de visibilité
function popUpTimer(Id, waitTime, viewTime)	{window.setTimeout('waitToHide(\''+Id+'\',' + viewTime + ')',waitTime)}
//Cache un objet au bout d'un moment.
/*
function waitToHide(Id, waitTime)	{gId(Id).style.display = 'block';window.setTimeout('gId(\''+Id+'\').style.display = \'none\';',waitTime);}

//Affiche un popup dans un objet
//Id:		Obj à remplir
//Url:		Adresse du contenu
//waitTime: Temps d'attente avant affichage
//viewTime: Temps de visibilité
function getPopUp(Id,Url,waitTime,viewTime) {
	xhrRqt2(Url,gId(Id),gId(Id));
	popUpTimer(Id, waitTime, viewTime);
}
*/
/*****************************
			UPLOAD
*****************************/
function uploadFile(cmd)
{
	var oUpNewsImage = window.open(dirRRacine+'admin/tools/upload.aspx?cmd='+cmd,null,'directories=yes,fullscreen=no,width=400,'
		+ 'height=80,location=no,menubar=no,toolbar=no,scrollbars=no,status=no,titlebar=no,resizable=1')

	if (!oUpNewsImage)
		alert('Erreur lors de l\'ouverture de la création d\'une image de lettre d\'info.');
	else
		oUpNewsImage.focus();
}
/*****************************

/*****************************
			FICHE
*****************************/

function getFormFiche(idFiche, Url) {

	var oFiche		= document.createElement('div');
	var oElements	= document.createElement('div');
	var oVoile		= document.createElement('div');
	var oContIfr	= document.createElement('div');
	var oIframe		= document.createElement('iframe');
	var oBtnOut		= document.createElement('input');

	oBtnOut.setAttribute('type','button');
	oBtnOut.setAttribute('value','fermer');
	oBtnOut.onclick = function(){closeFormFiche(idFiche);};
	
	oVoile.setAttribute('class','voile');
	
	oElements.setAttribute('class','elements');
	oElements.appendChild(oBtnOut);
	oElements.appendChild(oIframe);

	oFiche.setAttribute('class','popFiche');
	oFiche.id = idFiche;
	oFiche.appendChild(oVoile);
	oFiche.appendChild(oElements);
	
	document.body.setAttribute('sovOverFlow',document.body.style.overflow);
	document.body.style.overflow = 'hidden';
	document.body.appendChild(oFiche);

	oIframe.src = Url + '&idFiche='+idFiche;
}

function closeFormFiche(idFiche) {
	alert(document.getElementById(idFiche));
	if (document.body.getAttribute('sovOverFlow'))
		document.body.style.overflow = document.body.getAttribute('sovOverFlow').value
	else
		document.body.style.overflow = '';
	if (document.getElementById(idFiche))
		document.body.removeChild(document.getElementById(idFiche));
}

/****************************/

var tVal = new Array('Rennes','Paris','Lille','Lyon','Bordeaux','Marseille','Redon','Bruz','Chartres de Bretagne', 'Toulouse');

//Propose une liste de choix à partir d'une URL de fichier XML
//Formaté comme suit: <item id="" libelle="" />
function choiceBoxFromXml(Url,object, doOnSelect) {
    var oXml = xmlRqt(Url);
    var tVal = new Array();
    var tLib = new Array();
    if (oXml == null) {alert('Erreur');
    } else {
		nodes = oXml.getElementsByTagName('item');
		for (p = 0 ; p < nodes.length ;p++) {
			tVal[p] = xmlGetAttrib(nodes[p],'id');
			tLib[p] = xmlGetAttrib(nodes[p],'libelle');
		}
    }
    if (tVal.length >= 1)
		choiceBox(tLib,tVal,object, doOnSelect)
}

///
//valueTable: tableau de valeur
//txtBox: objet de base
//doOnSelect: fonction a executer après un choix
function choiceBox(libelleTable,valueTable,txtBox, doOnSelect) {

    function findPosX(obj) {
	    var curleft = 0;
	    if (obj.offsetParent)
		    while (obj.offsetParent) {curleft += obj.offsetLeft;obj = obj.offsetParent;}
	    else if (obj.x)
		    curleft += obj.x;
	    return curleft;
    }

    function findPosY(obj) {
	    var curtop = 0;
	    if (obj.offsetParent)
	        while (obj.offsetParent) {curtop += obj.offsetTop;obj = obj.offsetParent;}
	    else if (obj.y)
		    curtop += obj.y;
	    return curtop;
    }

	if(libelleTable.length != valueTable.length)
		alert('Erreur');

    //On controle si un objet de choix existe déjà
    if (document.getElementById('choiceBox_'+txtBox.id))
        document.body.removeChild(document.getElementById('choiceBox_'+txtBox.id));
    var choiceList = document.createElement('div');
    var theList = document.createElement('ul');
    if (txtBox.tagName == 'input')
		var filter = txtBox.value.toLowerCase();
	else
		var filter = '';
    for(p=0; p < valueTable.length ; p++) {
        if ((libelleTable[p].toLowerCase().indexOf(filter) != -1) || (filter == null)) {
            var line = document.createElement('li')
            var link = document.createElement('a')
            link.setAttribute('val',valueTable[p]);
            var cValue;
            if (filter != null)
                cValue = libelleTable[p].toLowerCase().replace(filter,'<b>'+filter+'</b>');
            else
                cValue = libelleTable[p];
            link.innerHTML = cValue;
            if (doOnSelect) {
				link.onclick = function() {
					doOnSelect(this.attributes['val'].value);
					/*
					if (this.parentNode.parentNode.parentNode)
						document.body.removeChild(this.parentNode.parentNode.parentNode);
					*/
				}
			} else {
				link.onclick = function() {
					txtBox.value = this.attributes['val'].value;
					/*
					if (this.parentNode.parentNode.parentNode)
						document.body.removeChild(this.parentNode.parentNode.parentNode);
					*/
				}
			}
            line.appendChild(link);
            theList.appendChild(line);
        }
    }
    choiceList.appendChild(theList);
    choiceList.id           = 'choiceBox_'+txtBox.id;
    choiceList.className    = 'choiceMenu';
    
    document.body.appendChild(choiceList);
   
    choiceList.style.top = (findPosY(txtBox) + txtBox.offsetHeight) + 'px';
    choiceList.style.left = findPosX(txtBox) + 'px';
    
    txtBox.onblur           = function() {window.setTimeout('if(document.getElementById(\''+choiceList.id+'\'))document.body.removeChild(document.getElementById(\''+choiceList.id+'\'))',300)}
    
   }
//******************************************************
//					CALENDRIER
//******************************************************
function getCalendar(txtBox,startDate, dateSelectMin, dateSelectMax,fctControlOnSelect) {

	var _dateSelectMin = new Date('1/1/1');
	var _dateSelectMax = new Date('31/12/9999');
	if (dateSelectMin)
        if (dateSelectMin.toString().split('/').length == 3)
            _dateSelectMin = new Date(dateSelectMin.toString().split('/')[1] + '/' + dateSelectMin.toString().split('/')[0] + '/' + dateSelectMin.toString().split('/')[2]);

	if (dateSelectMax)
        if (dateSelectMax.toString().split('/').length == 3)
            _dateSelectMax = new Date(dateSelectMax.toString().split('/')[1] + '/' + dateSelectMax.toString().split('/')[0] + '/' + dateSelectMax.toString().split('/')[2]);

    //Positionnement en X
    function findPosX(obj) {
	    var curleft = 0;
	    if (obj.offsetParent)
		    while (obj.offsetParent) {curleft += obj.offsetLeft;obj = obj.offsetParent;}
	    else if (obj.x)
		    curleft += obj.x;
	    return curleft;
    }
    //Positionnement en Y
    function findPosY(obj) {
	    var curtop = 0;
	    if (obj.offsetParent)
	        while (obj.offsetParent) {curtop += obj.offsetTop;obj = obj.offsetParent;}
	    else if (obj.y)
		    curtop += obj.y;
	    return curtop;
    }
    
    //Renvoi le numéro de jour avec comme référence le lundi
    function myGetDay(theDate) {return (theDate.getDay() == 0) ? 6 : theDate.getDay()-1;}
    //Renvoi le numéro de semaine
    function getWeekNumber(_date) {return Math.ceil((Date.parse(_date) - Date.parse('1/1/'+_date.getFullYear())) / (1000*3600*24*7)+1)}

    //Date par défaut
    if (isNaN(Date.parse(startDate))) {
        if (!isNaN(Date.parse(txtBox.value))) {
            startDate = txtBox.value;
        } else {
            startDate = new Date().toString();
        }
    }
    
    //Conversion avec le systeme americain
    if (startDate)
        if (startDate.toString().split('/').length == 3)
            startDate = startDate.toString().split('/')[1] + '/' + startDate.toString().split('/')[0] + '/' + startDate.toString().split('/')[2]

    var dateCourante = new Date(startDate);

    //On controle si un objet de choix existe déjà
    /*
    if (document.getElementById('calendar_'+txtBox.id))
        document.body.removeChild(document.getElementById('calendar_'+txtBox.id));
       */
    var calendar = document.createElement('div');
    var table = document.createElement('table');
    table.className = 'entete';
    var header = document.createElement('thead');
    var lineMois = document.createElement('tr');
    //Mois précédent
    var celMoisPre = document.createElement('td');
    var btnMoisPre = document.createElement('a');
    celMoisPre.appendChild(btnMoisPre);
    btnMoisPre.innerHTML = (document.all) ? '<<' : '<' ;
    var dateMoisPre = new Date(dateCourante);
    dateMoisPre.setMonth(dateMoisPre.getMonth()-1);
    btnMoisPre.onclick=function() {
		document.body.removeChild(calendar);
		getCalendar(txtBox,dateMoisPre, dateSelectMin, dateSelectMax, fctControlOnSelect);
		txtBox.onfocus = function(){return false;};
		txtBox.focus();
	}
        
    lineMois.onmouseover = function() {txtBox.setAttribute('disableClose','1');}
    lineMois.onmouseout = function() {txtBox.setAttribute('disableClose','0');}
    lineMois.appendChild(celMoisPre);
    //Mois Courant
    var celMoisCourant = document.createElement('td');
    celMoisCourant.className = 'currentMonth';
    celMoisCourant.setAttribute('colspan','6');
    if(true) {
		var selectMois = document.createElement('select');
		var dateMonth = new Date(dateCourante);
		dateMonth.setMonth(dateMonth.getMonth()-12);
		for(p=0; p < 24; p++) {
			var cOption = document.createElement('option')
			cOption.value = dateMonth;//'01/'+(dateMonth.getMonth()+1)+'/'+dateMonth.getFullYear()
			cOption.innerHTML = (dateMonth.toLocaleDateString().split(' ')[2]) + ' ' + dateMonth.getFullYear()
			selectMois.appendChild(cOption);
			if (dateMonth.toLocaleDateString() == dateCourante.toLocaleDateString()) {
				selectMois.options[selectMois.options.length-1].className = 'current';
				selectMois.selectedIndex = p;
			}
			dateMonth.setMonth(dateMonth.getMonth()+1);
		}
		selectMois.onchange=function() {
		/*var dateChoisie = new Date(this.options[this.selectedIndex].value);
			document.body.removeChild(calendar);
			getCalendar(txtBox,dateChoisie);*/
		document.body.removeChild(calendar);
		getCalendar(txtBox,new Date(this.options[this.selectedIndex].value), dateSelectMin, dateSelectMax,fctControlOnSelect);
		txtBox.onfocus = function(){return false;};
		txtBox.focus();
    }
    celMoisCourant.appendChild(selectMois);
    }
    else{celMoisCourant.innerHTML = (dateCourante.toLocaleDateString().split(' ')[2]) + ' ' + dateCourante.getFullYear();}
    lineMois.appendChild(celMoisCourant);
    //Mois Suivant
    var celMoisSuiv = document.createElement('td');
    var btnMoisSuiv = document.createElement('a');
    btnMoisSuiv.innerHTML = '>';
    var dateMoisSuiv = new Date(dateCourante);
    dateMoisSuiv.setMonth(dateMoisSuiv.getMonth()+1);
    btnMoisSuiv.onclick=function() {
		document.body.removeChild(calendar);
		getCalendar(txtBox,dateMoisSuiv, dateSelectMin, dateSelectMax,fctControlOnSelect);
		txtBox.onfocus = function(){return false;};
		txtBox.focus();
	}
    celMoisSuiv.appendChild(btnMoisSuiv);
    lineMois.appendChild(celMoisSuiv);
    
    header.appendChild(lineMois);
    table.appendChild(header);
    
    //**********
    //Tableau Jour
    var table2 = document.createElement('table');
    //********** Entete des noms de jour
    var header2 = document.createElement('thead');
    var cRow, cCell, link;
    cRow = document.createElement('tr');
    cRow.appendChild(document.createElement('th')).innerHTML = 'sem.';
    cRow.appendChild(document.createElement('th')).innerHTML = 'lun';
    cRow.appendChild(document.createElement('th')).innerHTML = 'mar';
    cRow.appendChild(document.createElement('th')).innerHTML = 'mer';
    cRow.appendChild(document.createElement('th')).innerHTML = 'jeu';
    cRow.appendChild(document.createElement('th')).innerHTML = 'ven';
    cRow.appendChild(document.createElement('th')).innerHTML = 'sam';
    cRow.appendChild(document.createElement('th')).innerHTML = 'dim';
    cRow.className = 'nomJour';
	header2.appendChild(cRow);
	table2.appendChild(header2);
	//**********
	
    var tbody = document.createElement('tbody');
    
    var dateLoop;
    dateLoop = new Date(dateCourante);
    dateLoop.setDate(1);
    dateLoop.setDate(-dateLoop.getDay()+2);
    for(k=0;k<10;k++) {
        cRow = tbody.appendChild(document.createElement('tr'));
        cCell = cRow.appendChild(document.createElement('td'))
        cCell.className = 'cal-week';
        cCell.onmouseover = function() {document.title = this.className;}
        cCell.innerHTML = getWeekNumber(dateLoop);
        for(i=1;i<8;i++) {
            cCell = cRow.appendChild(document.createElement('td'))
            if (dateLoop.getMonth() != dateCourante.getMonth()) cCell.className = 'cal-day-out-month';
            link = document.createElement('a');
            link.innerHTML += dateLoop.getDate();
            link.setAttribute('val',dateLoop.getDate()+'/'+(dateLoop.getMonth()+1)+'/'+dateLoop.getFullYear());
            //test si la date en cours est séléctionnable
            var linkOK = true
            
			if (dateLoop.valueOf() < _dateSelectMin.valueOf()) {
				linkOK = false;
				link.className='no-selectable';
			}
			if (dateLoop.valueOf() > _dateSelectMax.valueOf()) {
				linkOK = false;
				link.className='no-selectable';
			}
			
			if (linkOK)
				link.onclick = function() {
					txtBox.value = this.attributes['val'].value;
					document.body.removeChild(document.getElementById(calendar.id));
					if(fctControlOnSelect)
						fctControlOnSelect();}
            cCell.appendChild(link);
            
            dateLoop.setDate(dateLoop.getDate()+1)
        }
        //document.appendChild //alert(dateLoop + ' ' + dateCourante);
        if (dateLoop.getMonth() > dateCourante.getMonth() || dateLoop.getFullYear() > dateCourante.getFullYear()) break;
    }
    table2.appendChild(tbody);

    calendar.style.position = 'absolute';
    calendar.id           = 'calendar_'+txtBox.id;
    calendar.className    = 'calendar';

    calendar.appendChild(table);
    calendar.appendChild(table2);
    
    calendar.style.top = (findPosY(txtBox) + txtBox.offsetHeight) + 'px';
    calendar.style.left = findPosX(txtBox) + 'px';
    
    document.body.appendChild(calendar);

    
    //Prépare la suppression du controle
    txtBox.onblur = function(){
		if (txtBox.getAttribute('disableClose') != '1')
			setTimeout(
			'if(document.getElementById(\'calendar_'+txtBox.id+ '\')) {'
			+ 'document.body.removeChild(document.getElementById(\'calendar_'+txtBox.id+'\'));'
			+ '}'
			+ 'document.getElementById(\''+txtBox.id+'\').onfocus = function() {getCalendar(this,this.value,'
			+ '\''+ dateSelectMin + '\',\''+dateSelectMax+'\','+fctControlOnSelect+');'
			 + '/*alert(document.getElementById(\''+txtBox.id+'\').onfocus);*/}'
			, 150);
	}
		
}
/********************************************************************/
//					Date Tools
/********************************************************************/

function compareFrStringDate(date1,date2) {
	if (date1 && date2)
        if ((date1.toString().split('/').length == 3) && (date2.toString().split('/').length == 3))
        {
            date1 = new Date(date1.toString().split('/')[1] + '/' + date1.toString().split('/')[0] + '/' + date1.toString().split('/')[2]);
            date2 = new Date(date2.toString().split('/')[1] + '/' + date2.toString().split('/')[0] + '/' + date2.toString().split('/')[2]);
            return date2.valueOf() - date1.valueOf();
		}
}


/********************************************************************/
// This code was written by Tyler Akins and has been placed in the
// public domain.  It would be nice if you left this header intact.
// Base64 code from Tyler Akins -- http://rumkin.com
/********************************************************************/

var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";

function encode64(input) {
   var output = "";
   var chr1, chr2, chr3;
   var enc1, enc2, enc3, enc4;
   var i = 0;

   do {
      chr1 = input.charCodeAt(i++);
      chr2 = input.charCodeAt(i++);
      chr3 = input.charCodeAt(i++);

      enc1 = chr1 >> 2;
      enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
      enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
      enc4 = chr3 & 63;

      if (isNaN(chr2)) {
         enc3 = enc4 = 64;
      } else if (isNaN(chr3)) {
         enc4 = 64;
      }

      output = output + keyStr.charAt(enc1) + keyStr.charAt(enc2) + 
         keyStr.charAt(enc3) + keyStr.charAt(enc4);
   } while (i < input.length);
   
   return output;
}

function decode64(input) {
   var output = "";
   var chr1, chr2, chr3;
   var enc1, enc2, enc3, enc4;
   var i = 0;

   // remove all characters that are not A-Z, a-z, 0-9, +, /, or =
   input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");

   do {
      enc1 = keyStr.indexOf(input.charAt(i++));
      enc2 = keyStr.indexOf(input.charAt(i++));
      enc3 = keyStr.indexOf(input.charAt(i++));
      enc4 = keyStr.indexOf(input.charAt(i++));

      chr1 = (enc1 << 2) | (enc2 >> 4);
      chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
      chr3 = ((enc3 & 3) << 6) | enc4;

      output = output + String.fromCharCode(chr1);

      if (enc3 != 64) {
         output = output + String.fromCharCode(chr2);
      }
      if (enc4 != 64) {
         output = output + String.fromCharCode(chr3);
      }
   } while (i < input.length);

   return output;
}
/**********************************/

function moveOnX(objId, startLeft, stopLeft, step, waitTime, acceleration) {

	function findPosX(obj) {
	    var curleft = 0;
	    if (obj.offsetParent)
			while (obj.offsetParent) {curleft += obj.offsetLeft;obj = obj.offsetParent;}
	    else if (obj.x)
		    curleft += obj.x;
	    return curleft;
    }

    function findPosY(obj) {
	    var curtop = 0;
	    if (obj.offsetParent)
	        while (obj.offsetParent) {curtop += obj.offsetTop;obj = obj.offsetParent;}
	    else if (obj.y)
		    curtop += obj.y;
	    return curtop;
    }

	if (document.getElementById) {
		if (document.getElementById(objId)) {
			obj = document.getElementById(objId);
			
			if(findPosX(obj) < stopLeft) {
				obj.style.left = (findPosX(obj) + step) + 'px';
				
				if (findPosX(obj) < ((stopLeft-startLeft)/2) + startLeft)
					step = step + acceleration;
				else if(step>1)
						step = step - acceleration;
					else
						step = 1;

				if (findPosX(obj) < ((stopLeft-startLeft)/2) + startLeft)
					waitTime = waitTime - acceleration;
				else
					waitTime = waitTime + acceleration;
				window.setTimeout('MoveLeft(\''+objId+'\','+startLeft+','+stopLeft+','+step+','+waitTime+','+acceleration+')', waitTime);
			}
		}
	}
}

function moveScrollInto(objId, startLeft, stopLeft, step, waitTime, acceleration) {

	function findPosX(obj) {
	    var curleft = 0;
	    if (obj.offsetParent)
			while (obj.offsetParent) {curleft += obj.offsetLeft;obj = obj.offsetParent;}
	    else if (obj.x)
		    curleft += obj.x;
	    return curleft;
    }

    function findPosY(obj) {
	    var curtop = 0;
	    if (obj.offsetParent)
	        while (obj.offsetParent) {curtop += obj.offsetTop;obj = obj.offsetParent;}
	    else if (obj.y)
		    curtop += obj.y;
	    return curtop;
    }

	if (document.getElementById) {
		if (document.getElementById(objId)) {
			obj = document.getElementById(objId);
			/*
			if(findPosX(obj) < stopLeft) {
				obj.style.left = (findPosX(obj) + step) + 'px';
				
				if (findPosX(obj) < ((stopLeft-startLeft)/2) + startLeft)
					step = step + acceleration;
				else if(step>1)
						step = step - acceleration;
					else
						step = 1;

				if (findPosX(obj) < ((stopLeft-startLeft)/2) + startLeft)
					waitTime = waitTime - acceleration;
				else
					waitTime = waitTime + acceleration;
				window.setTimeout('MoveLeft(\''+objId+'\','+startLeft+','+stopLeft+','+step+','+waitTime+','+acceleration+')', waitTime);
			}
			*/
		}
	}
}

function setOpacity(obj, opacity) {
  opacity = (opacity == 100)?99.999:opacity;
  // IE/Win
  obj.style.filter = "alpha(opacity:"+opacity+")";
  // Safari<1.2, Konqueror
  obj.style.KHTMLOpacity = opacity/100;
  // Older Mozilla and Firefox
  obj.style.MozOpacity = opacity/100;
  // Safari 1.2, newer Firefox and Mozilla, CSS3
  obj.style.opacity = opacity/100;
}

/*
The fadeIn function uses a Timeout to call itself every 100ms with an object Id and an opacity.
The opacity is specified as a percentage and increased 10% at a time. The loop stops once the opacity reaches 100%:
*/

function fadeIn(objId,opacity) {
	if (document.getElementById) {
		if (document.getElementById(objId)) {
			obj = document.getElementById(objId);
			if (opacity <= 100) {
				setOpacity(obj, opacity);
				obj.style.display = 'block';
				opacity += 10;
				window.setTimeout("fadeIn('"+objId+"',"+opacity+")", 20);
			}
		}
	}
}

function fadeOut(objId,opacity,nextObjId) {
  if (document.getElementById) {
	if (document.getElementById(objId)) {
		obj = document.getElementById(objId);
		//alert(opacity);
		if (opacity >= 0) {
		  setOpacity(obj, opacity);
		  opacity -= 10;
		  window.setTimeout("fadeOut('"+objId+"',"+opacity+",\'"+nextObjId+"\')", 20);
		}
		else
			obj.style.display = 'none';

	  }
	}
	if (document.getElementById(nextObjId)) fadeIn(nextObjId,0)

}