// JavaScript Document
var AllowedCharList='0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-+()\'[]_.&,@=$!';
var ReplaceChar = {'œ':'oe','’':'\'','É':'E','é':'e','è':'e','à':'a','ù':'u','ú':'u','ê':'e','ë':'e','ï':'i','ç':'c','û':'u','â':'a','ô':'o','î':'i','ñ':'n'};
var isNS=(navigator.appName.indexOf("Netscape")!=-1?true:false);
var isDOM=(document.getElementById?true:false);
var isIE4=((document.all&&!isDOM)?true:false);
var isNS4=(document.layers?true:false);
var fakeIE = false;
try{fakeIE=document.createElement('<input>').outerHTML.substr(0,2)=='<<';}catch(e){fakeIE=false}
var isOP=(navigator.appName.indexOf("Opera")!=-1 || (parseInt(navigator.appVersion)==4 && navigator.appName.indexOf("Microsoft Internet Explorer")!=-1 && fakeIE)?true:false);
var isIE=navigator.appName.indexOf("Microsoft Internet Explorer")!=-1 && !fakeIE?true:false;
var isDyn=(isDOM||isIE4||isNS4);
var isFF = navigator.userAgent.indexOf('Firefox')!=-1? true: false;
var isSA = navigator.userAgent.indexOf('Safari/')!=-1? true: false;
var preload_img=new Array();
var url = ''+window.top.location;
url = url.substr(url.indexOf('://')+3);
if (typeof(GLOBALS)=='undefined')GLOBALS=[];
GLOBALS.HOST = url.substr(0, url.indexOf('/'));
var CURRENT = url.substr(url.indexOf('/'));
function	getRef(id){return(isDOM?document.getElementById(id):(isIE4?document.all[id]:(isNS4?document.layers[id]:false)));}
function	getNext(n,m){for(;n;n=n.nextSibling){if(n.nodeName.toLowerCase()==m)return(n);else if((f=getNext(n.firstChild,m)))return(f);}return false;}
function	dc(n){return(document.createElement(n))}
function	dt(t){return(document.createTextNode(t))}
function	basename(file){return(file.substr(file.lastIndexOf('/')+1));}
function	dirname(file){return(file.substr(0, file.lastIndexOf('/')+1));}
function	dump(xml){var t='';for(var i=xml.firstChild;i;i=i.nextSibling)t+=(i.nodeType==3?i.nodeValue:'<'+i.nodeName+'>'+dump(i)+'</'+i.nodeName+'>');return(t);}
function	GetKeyCode(e){if(!e)e=window.event;return(e.keyCode?e.keyCode:(e.which?e.which:0));}
function	_GET(n) {var reg=new RegExp('[\?&]'+n+'=([^&]+)','i');var v=reg.exec(window.top.location.search);return (v&&v.length>1?unescape(v[1]):'');}
function	getDrawableScreenSize() {if(typeof(window.innerWidth)=='number'){return ({width:window.innerWidth,height:window.innerHeight});}else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)){return({width:document.documentElement.clientWidth,height:document.documentElement.clientHeight});}else if(document.body&&(document.body.clientWidth||document.body.clientHeight)){return ({width:document.body.clientWidth,height:document.body.clientHeight});}}
function	GetCookie(name){var c={arg:name+"=",alen:name.length+1,clen:document.cookie.length};for(i=0;i<c.clen;){var j=i+c.alen;if(document.cookie.substring(i,j)==c.arg){var endstr=document.cookie.indexOf(";",j);endstr=unescape(document.cookie.substring(j,endstr==-1?document.cookie.length:endstr));return (endstr);}i=document.cookie.indexOf(" ",i)+1;if(i==0)break;}return null;}
function	DeleteCookie(name){var p=GLOBALS['HOST']+GLOBALS['ROOT'];var exp=new Date();exp.setTime(exp.getTime()-1000000000);var cval=GetCookie(name);var path=p?p.substr(p.indexOf('/')):null;var dmn=p?p.substr(0,p.indexOf('/')):null;document.cookie=name+"="+cval+"; expires="+exp.toGMTString()+(path?'; path='+path:'')+(dmn?'; domain='+dmn:'');}
function	SetCookie(name,val){var p=GLOBALS['HOST']+GLOBALS['ROOT'];var argv=SetCookie.arguments;var argc=SetCookie.arguments.length;var expi=(argc>2)?argv[2]:null;var path=(argc>3)?argv[3]:p?p.substr(p.indexOf('/')):null;var dmn=(argc>4)?argv[4]:p?p.substr(0,p.indexOf('/')):null;var sec=(argc>5)?argv[5]:false;document.cookie=name+"="+escape(val)+(expi?'; expires='+expi.toGMTString():'')+(path?'; path='+path:'')+(dmn?'; domain='+dmn:'')+(sec?'; secure': '');}
function	GetPageDescription(){try{if(document.getElementsByTagName)return(document.getElementsByTagName('meta')['description'].content);}catch(e){};return ('');}
function	GetPageKeywords(){try{if(document.getElementsByTagName)return(document.getElementsByTagName('meta')['keywords'].content);}catch(e){};return ('');}
function	ToggleAdmin() {
	if (GetCookie('Edit')) {
		DeleteCookie('Edit');
		SubmitForm({Action:'logout'})
	}
	else
		PopupAdmin();
	return false;
}
function		createCss(t) {
	var css = null;
	if (document.createStyleSheet) {
		css = document.createStyleSheet("");
		css.cssText=t;
	}
	else {
		css = document.createElement('style');
		css.type = 'text/css';
		css.appendChild(document.createTextNode(t));
		document.getElementsByTagName('head')[0].appendChild(css);
	}
	return (css);
};

var offsetTop = 100;
var ieexpr = "(document.documentElement.scrollTop || document.body.scrollTop)" + 
			"+Math.round((document.documentElement.offsetHeight || document.body.clientHeight) - 20) + 'px'";

createCss(
//'#nmodalOverlay					{background-color: white; height:100%; width:100%; position:fixed; left:0; top:0}' +
//'.popup							{display:none; position:fixed; top:'+offsetTop+'%; left:50%; margin-left:-300px; width:600px;}' +
//!	Fixed positioning emulation for IE6
(jQuery.browser.msie && jQuery.browser.version <= 6.0?
	'div#foot		 		{position:absolute; top:expression('+ieexpr+')}': '') +
'');

jQuery(function() {
	var text = jQuery('body.current-language-FR').length?
		'Ce document est dans une autre langue': 'This document is in another language';
	jQuery('body.current-language-EN a.lang-FR,' +
			'body.current-language-FR a.lang-EN').each(function() {
		AddHelp(this, text);
	});
});
function	MakeInput(obj){
	var input=false;
	if(isIE){
		var t='';
		for(i in obj)
			if(typeof(obj[i])=='boolean')t+=' '+i+'="'+(obj[i]? 'true': 'false')+'"';
			else if(typeof(obj[i])!='object'&&typeof(obj[i])!='function'){
				try{
					t+=' '+i+'="'+obj[i].replace('\\', '\\\\').replace('"', '\\"')+'"';
				}catch(e){
					t+=' '+i+'="undefined"';
				}
			}
		try {
			input=dc('<input'+t+'>');
			//if (input.outerHTML.substr(0, 2) == '<<')
			//	throw ({message:'error'});
//			alert('Bouton OK: '+input.outerHTML);
			for(i in obj)
				if(typeof(obj[i])=='object'||typeof(obj[i])=='function')
					input[i]=obj[i];
		}
		catch(e) {input=false;}
	}
	if (!input) {
		var input=dc('input');
		for(i in obj)
			input[i]=obj[i];
	}
	with(input.style){borderWidth='1px';fontSize='11px';fontFamily='Verdana';};
	return(input);
}
function	TitleToFilename(title){
	for(i=0;i<title.length;i++)
		if(ReplaceChar[title.charAt(i)])
			title=title.substring(0, i)+ReplaceChar[title.charAt(i)]+title.substring(i+1);
	for(i=0;i<title.length;i++){
		var found=false;
		for(j=0;j<AllowedCharList.length;j++)
			if(title.charAt(i)==AllowedCharList.charAt(j))
				found=true;
			if(!found)
				title=title.substring(0,i)+'-'+title.substring(i+1);
	}
	while (title.indexOf('--') != -1)
		title=title.replace('--', '-');
	return(title);
}
function	Help(text){if(getRef('tabhelp'))getRef('tabhelp').innerHTML=text?text:'';}
function	AltToHelp(n){
	for(;n;n=n.nextSibling){
		AltToHelp(n.firstChild);
		if(n.alt)
			n._help = n.alt;
		else if (n.title)
			n._help = n.title;
		else
			continue ;		
		n.alt = '';
		n.title = '';
		n.onmouseover=function(){Help(this._help);}
		n.onmouseout=function(){Help();}
	}
	return false;
}
function	ValidateEmail(email) {var filter=/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;if(filter.test(email))return(true);else return(false);}
function	SubmitForm(fields,path){var form=dc('form');for(i in fields){var input=dc('input');input.type='hidden';input.name=i;input.value=fields[i];form.appendChild(input);}form.action=path?path:'';form.method='post';form.name='PageForm';document.body.appendChild(form);form.submit();}
function	GetParent(n,tagName){tagName=tagName.toLowerCase();while(n&&n.tagName&&n.tagName.toLowerCase()!=tagName)n=n.parentNode;return(n);}
function 	copy_title(v){if ((r=getRef('title')))r.value = v;};
function	TitleToFilename(title){for(i=0;i<title.length;i++)if(ReplaceChar[title.charAt(i)])title=title.substring(0,i)+ReplaceChar[title.charAt(i)]+title.substring(i+1);for(i=0;i<title.length;i++){var found=false;for(j=0;j<AllowedCharList.length;j++)if(title.charAt(i)==AllowedCharList.charAt(j))found=true;if(!found)title=title.substring(0,i)+'-'+title.substring(i+1);}while (title.indexOf('--')!=-1)title=title.replace('--', '-');return(title);}
function	GetNodeAttribute(n,p){if(!isFF&&typeof(n[p])!='undefined')return(n[p]);if(!n||!n.attributes)return;var a=n.attributes.getNamedItem(p);if(a)return(a.nodeValue);return(undefined);}
function	ValidateUrl(url){return true;}
function	getfileext(filename){if(!filename)return('');return(filename.lastIndexOf('.')>0? filename.substr(filename.lastIndexOf('.')+1): '');}
function	filenoext(filename){return(filename.lastIndexOf('.')>0? filename.substr(0, filename.lastIndexOf('.')): '');}
function	ChangeLang(lang){SetCookie('lang',lang);window.top.location=CURRENT;}
DeleteCookie('lang');
function	debug(t) {var n=getRef('debug');if(n)n.innerHTMLt+=t;else if (window.opener)window.opener.debug(t);}
var Calendars = [];
function	MakeInputRow(width, title, type, rows, width2, varname, value, modify) {
	var tr = dc('tr');
	tr.appendChild(dc('td')).appendChild(dt(title));
	AnalyzerInputs[varname] = tr.appendChild(dc('td')).appendChild(dc(type));
	AnalyzerInputs[varname].id = varname;
	if (type == 'input') AnalyzerInputs[varname].type = 'text'; else AnalyzerInputs[varname].rows = rows;
	AnalyzerInputs[varname].name = varname;
	if (!modify) AnalyzerInputs[varname].disabled = 'disabled';
	AnalyzerInputs[varname].value = value;
	AnalyzerInputs[varname].style.width = width2;
	with (AnalyzerInputs[varname].style){borderWidth='1px';fontSize='11px';fontFamily='Verdana';}
	return (tr);
}
function	MakeImageButton(obj, src, text, onclick, label) {
	var div=dc('div');div.style.cursor='pointer';//	AddHelp(div, text);
	var table=div.appendChild(dc('table'));table.style.borderCollapse='collapse';var tr=table.appendChild(dc('tbody')).appendChild(dc('tr'));
	var td=tr.appendChild(dc('td'));with (td.style){border='none';padding='0px';borderCollapse='collapse'}
	var img=td.appendChild(dc('img'));img.src=GLOBALS.ROOT+GLOBALS.PICT_FOLDER+src;img.alt=text;img.setAttribute('alt',text);img.className='clickable';img.onclick=onclick;
	if (label){var td=tr.appendChild(dc('td'));td.appendChild(dt(label));with (td.style){borderCollapse='collapse';border='none';padding='0px';}}
	td.obj = obj;
	td.callback = onclick;
	td.onclick=function() {this.callback(this.obj);}
	return (div);
}
function	ShowCalendar(input) {
	if (!input.Calendar) {
		var parent = input.parentNode;
		var d = dc('div');
		with (d.style) {position='relative'}
		d.style.top=(input.clientHeight+4)+'px'
		var div = dc('div');
		div.id = 'div_'+input.name;
		with (div.style) {position='absolute';width='190px';height='210px';zIndex=99;border='solid 0px #000000';visibility='hidden';}
		d.appendChild(div);
		parent.insertBefore(d, input);
		try {input.Calendar = new GnooCalendar(input, 6, 6);}catch(e){alert('le calendrier n\'est pas charge');}
		input.Calendar.init('div_'+input.name, input);
		input.Calendar.setFormat("us");
		Calendars[Calendars.length] = input.Calendar;
	}
	for (i in Calendars)
		Calendars[i].hide();
	try {
	input.Calendar.show();
	}catch(e) {alert(e.message);}
}


var Calendar = false;
var expdate = new Date();
expdate.setTime(expdate.getTime() + (24 * 60 * 60 * 1000 * 365));
var AnalyzerDefault = -1;
var Menu;
var Expandable=[];
var AjaxRequest=[];
var AjaxObject=false;
var AjaxStates=['Uninitialized','Loading','Loaded','Processing','Finish'];
var IconList = {File: 'file_pdf.gif', Folder: 'folder16.gif', Evenement: 'file_activite.gif', Contact: 'icon_contact.gif'};
var IconFileList = {pdf: 'file_pdf.gif', ico: 'file_bmp.gif', bmp: 'file_bmp.gif', doc: 'file_doc.gif', gif: 'file_gif.gif', jpg: 'file_jpg.gif', mdb: 'file_mdb.gif', png: 'file_png.gif', ppt: 'file_ppt.gif', psd: 'file_psd.gif', qt: 'file_qt.gif', rar: 'file_rar.gif', tif: 'file_tif.gif', xls: 'file_xls.gif'};
var IconDefault = 'file16.gif';
var sBasePath = GLOBALS.ROOT+'scripts/FCKeditor/';


//////////////////////////////////////////////
//                                   	  	//
//            For the Animated list			//
//                                     		//
//////////////////////////////////////////////

var ExpandedDiv = [];
var AnimDiv = [];
var OldPageContent = false;
function	ListAll(a) {
	return ;
	
	var table = GetParent(a, 'table');
	
	var tdcontent = getRef('divcontent');
	var td = tdcontent.getElementsByTagName('td')[0];
	div = td.getElementsByTagName('div')[0];
	//alert(div.innerHTML);
	OldPageContent = div;
	
 	td.removeChild(div);
	td.appendChild(table);
	td.appendChild(OldPageContent);
}

function 	IsRightbar(div) {
	while (div && div.className != 'rightbar') {
		div = div.parentNode;	
	}
	return (div);
}



function	ExpandDiv(div) {
	var temp = jQuery('#temp');
	if (temp.is(':visible')){
		
		temp.fadeOut(function(){
			temp.css({display:'none'});
			temp.html('');
			jQuery('.rightbar').fadeIn(function(){
				jQuery('.more').html('Plus >>>');
				jQuery('.animdiv').css({overflow:'hidden', height : '0px'});
				jQuery('.box').fadeIn();
				return ;
			});
			return ;
		});
		return ;
	}
	//jQuery('.animdiv').css({overflow:'display', height : 'auto'}); // ok sur ff3. pas supporté par ie6 et 7 
	//jQuery('.animdiv').css('overflow:display, height:auto'); // tjrs ok sur ff3. tjrs pas supporté par ie.
	jQuery('.animdiv').css({height:'auto'}); // marche sur ie6 et 7. passe le overflow en display via le height:auto ...
	jQuery('.animdiv').fadeIn();
	var rightbar = jQuery('.rightbar');
	rightbar.fadeOut(function(){
		jQuery('.box').fadeOut(function(){
			var add = '<div style="height:35px;"/>'
			jQuery('#DBPage, #Contact, #Publication, #Evenement, #Session, #Theme').after(jQuery('<div id="temp">'+add+rightbar.html()+'</div>')); //.wrap(rightbar)
			jQuery('.more').html(' Revenir à la page <<< ');
			jQuery('.more').addClass('back');
			temp.fadeIn();
		});
	});
}

function	AdjustDivsSize() {
	for (i=0; i<AnimDiv.length; ) {
		var beg = AnimDiv[i].src_height;
		var end = AnimDiv[i].dst_height;
		if (AnimDiv[i].cur_i == 100) {
			if (end != AnimDiv[i].ClosedSize)
				ExpandedDiv[ExpandedDiv.length] = AnimDiv[i];
			AnimDiv[i].style.height = end+'px';
			AnimDiv.splice(i, 1);
		}
		else {
			AnimDiv[i].cur_i += 4;
			var newh = 1-((Math.cos(AnimDiv[i].cur_i*Math.PI/100)/2)+0.5);
			AnimDiv[i].style.height = (beg+(newh*(end-beg)))+'px';
			i++;
		}
	}
	if (AnimDiv.length)
		setTimeout('AdjustDivsSize()', 5);
}



/////////////////////////////////////////
//                                     //
//            For the Menu             //
//                                     //
/////////////////////////////////////////

var ExpandTo = '';
var IsOut = true;
function	TimeExpand(url){if(url!=ExpandTo)return;HighlightNow(ExpandTo);ExpandNow(ExpandTo);ExpandTo='';}
function	Expand(url){HighlightNow(url);ExpandTo=url;setTimeout('try{TimeExpand("'+url+'");}catch(e){};',250);}
function	TimeoutOut(){if(IsOut){ExpandTo=CURRENT;setTimeout('TimeExpand("'+CURRENT+'")',250);}}
function	HighlightNow(url){
	for(i in Expandable){
		try {
		var trs=Expandable[i].getElementsByTagName('tr');
		var j = 0;
		for(j=0;j<trs.length;j++) {
			var chg = url.indexOf(trs[j].id)!=-1? 'hover': '';
			var td = trs[j].getElementsByTagName('td')[0];
//			alert('ca: '+td.className );
			if (td.className != chg)
				td.className = chg;
		}
		}catch(e){}
	}
}
function	ExpandNow(url){
//	getRef('divcontent').innerHTML = ExpandTo;
	for(i in Expandable)
		if (url.indexOf(Expandable[i].id) === 0 && (!Expandable[i].parentNode || !Expandable[i].parentNode.parentNode))
			fullrow.appendChild(Expandable[i]);
		else if (url.indexOf(Expandable[i].id) !== 0 && Expandable[i].parentNode && Expandable[i].parentNode.parentNode)
			fullrow.removeChild(Expandable[i]);
	var width = 0;
	for (i in Expandable)
		if (Expandable[i].parentNode && Expandable[i].parentNode.parentNode)
			width += Expandable[i].clientWidth;
/*	var divs = menuTD.getElementsByTagName('div');
	if (divs.length)
		divs[0].style.width = (width+10)+'px';*/
}
var fullrow = false;
var menuTD = false;
function	RewriteMenu(td) {
	
	menuTD = td;
	if (!td) return ;
	td.onmouseout = function() {IsOut=true;setTimeout('try{TimeoutOut()}catch(e){}', 40);}
	td.onmouseover = function() {IsOut=false;}
	
	var menuTable = menuTD.getElementsByTagName('table')[0];
//	menuTable.className = 'loaded';
//	alert(menuTable.outerHTML);
	
	fullrow = td.getElementsByTagName('tr')[0];
	var as = fullrow.getElementsByTagName('a');
	for (i=0;i<as.length;i++) {
		
		var href = as[i].href;
		var tdtext = as[i].parentNode;
		var row = GetParent(as[i], 'tr');
		tdtext.insertBefore(dt('  '), tdtext.firstChild);
//		var img = tdtext.insertBefore(dc('img'), tdtext.firstChild);
		href = href.substr(href.indexOf('://')+3);
		href = href.substr(href.indexOf('/'));
//		img.src = GLOBALS.ROOT+GLOBALS.PICT_FOLDER+'arrowmenu.gif';
		row.onmouseover=function(){/*this.getElementsByTagName('img')[0].src=GLOBALS.ROOT+GLOBALS.PICT_FOLDER+'arrowmenu_selected.gif';*/Expand(this.id);}
		row.onmouseout=function(){/*if(CURRENT.indexOf(this.id)==-1)this.getElementsByTagName('img')[0].src=GLOBALS.ROOT+GLOBALS.PICT_FOLDER+'arrowmenu.gif';*/}
		row.id = href;row.onclick = function() {window.top.location = this.id;}
	}
	for (td = fullrow.firstChild; td; )
		if (td.tagName && td.tagName.toLowerCase() == 'td') {
			td.style.display = '';
		//n = tds[i];
		n = td;
		var id = '';
		//! recover td's id from sub a href
		var as = n.getElementsByTagName('a');
		for (j=0; j<as.length; j++) {
			var href = as[j].href;
			href = href.substr(href.indexOf('://')+3);
			href = href.substr(href.indexOf('/'));
			var tid = href;
			tid = tid.substr(0, (tid.charAt(tid.length-1)=='/'? tid.substr(0, tid.length-1): tid).lastIndexOf('/') + 1);
			id = (!id? tid: (id.length<tid.length? id: tid));
		}
		n.id = id;
		Expandable[Expandable.length] = n;
		if (CURRENT.indexOf(id) !== 0) {
			rem = td;
			td=td.nextSibling;
//			alert('removing: '+rem.outerHTML);
			fullrow.removeChild(rem);
		}
		else
			td=td.nextSibling;
	}
	else
		td=td.nextSibling;
	HighlightNow(CURRENT);
	var divs = menuTD.getElementsByTagName('div');
	if (divs.length)
		divs[0].style.display = '';
}






/////////////////////////////////////////
//                                     //
//            The Ajax Object          //
//                                     //
/////////////////////////////////////////

function	CreateMsConnection(){var connec;
	/*@cc_on @*/
	/*@if (@_jscript_version >= 5)
	var avers=["Microsoft.XmlHttp","MSXML2.XmlHttp","MSXML2.XmlHttp.3.0","MSXML2.XmlHttp.4.0","MSXML2.XmlHttp.5.0"];
	for(var i=avers.length-1;i>=0;i--){try{c=new ActiveXObject(avers[i]);return(c);}catch(e){}}
	@end @*/
	return false;
}
function	CreateConnection(){
	var c=CreateMsConnection();
	if(!c&&typeof(XMLHttpRequest)!='undefined'){
		try{c=new XMLHttpRequest();}catch(e){c=false;}
	}
	if(!c&&window.createRequest){
		try{c=window.createRequest();}catch(e){c=false;}
	}
	return(c);
}
function	AjaxSend(obj){
	if (AjaxObject)
		return;
	AjaxObject=CreateConnection();
	if (!AjaxObject){
		alert('Unable to get Ajax Object');
		return;
	}
	AjaxObject.onreadystatechange=AjaxCallback;
	try {
		AjaxObject.open(obj.method,obj.url,obj.flag);
		if (obj.method.toLowerCase()=='post')
			AjaxObject.setRequestHeader("Content-type","application/x-www-form-urlencoded");
		AjaxObject.send(obj.str);
	}
	catch(e) {
		alert(e.message+"\nfor : "+obj.method+" "+obj.url);
	}
}
function	XmlRequest(){
	this.onReceive=false;
	this.ACTION=[];
	this.POST='';
	this.debug='';
	this.query = function(method,url,flag,str){
		this.method=method;
		this.url=url;
		this.flag=flag;
		this.str=str;
		AjaxRequest[AjaxRequest.length] = this;
		AjaxSend(this);
	}
}
function	getXmlAttribute(x,a){
	try {
		return x.getAttribute(a);
	}
	catch(e){
		if (x.attributes&&x.attributes.item)
			for (i=0;i<x.attributes.length;i++)
				if (x.attributes.item(i).nodeName==a)
					return x.attributes.item(i).nodeValue;
	}
}
function	getTextContent(xml){
	if (xml.text)
		return xml.text;
	var t='';
	try {
		var seria=new XMLSerializer();
		for (var cdata=xml.firstChild;cdata;cdata=cdata.nextSibling) {
			if (cdata.nodeType==4) {
				var code=seria.serializeToString(cdata);
				if(code && code.indexOf('<![CDATA[')==0 && (e=code.lastIndexOf(']]>'))==code.length-3)
					code=code.substr(9,e-9);t+=code;
			}
			else if (cdata.nodeType==3)
				t+=seria.serializeToString(cdata);
		}
	}
	catch(e){
		
	}
	return t;
}

function	AjaxCallback(toto) {
	if (AjaxObject.readyState != 4)
		return ;
//	alert('AjaxCallback: '+AjaxRequest.length);
//	alert('AjaxCallback: '+AjaxRequest[0]);
	var obj = AjaxRequest[0];
//	alert('AjaxCallback: '+obj);
	AjaxRequest.splice(0, 1);
	var xml;
	if (AjaxObject.responseXML && AjaxObject.responseXML.documentElement && AjaxObject.responseXML.firstChild) {
		xml = AjaxObject.responseXML.documentElement;
		obj.debug = '';
		for (node = xml.firstChild; node; node = node.nextSibling) {
			if (node.tagName == 'debug')
				obj.debug += getTextContent(node);
			else if (node.tagName == 'action') {
				var properties = {};
				for (var prop = node.firstChild; prop; prop = prop.nextSibling) if (prop.tagName == 'property') {
					var value = getTextContent(prop);
					if (value == 'true') value = true;
					else if (value == 'false') value = false;
					properties[getXmlAttribute(prop, 'name')] = value;
				}
				obj.ACTION[getXmlAttribute(node, 'name')] = properties;
			}
			else if (node.tagName == 'POST')
				obj.POST += getTextContent(node);
		}
	}
	if(xml&&xml.tagName=='parsererror')xml=undefined;
	obj.debug = obj.debug.replace('<br />', "\n").replace('<br>', "\n").replace('<b>', "").replace('</b>', "");
	if (GLOBALS.dev && !xml) {
		var t = '';
		
//		if (obj.debug) t+= "--------------------- ERROR ---------------------\n"+obj.debug.replace('<br />', "\n")+"\n";
		if (!xml) t +=   "---------------- XML Parse Error ----------------\n"+AjaxObject.responseText+"\n";
		if (t && GLOBALS.dev)
			alert(obj.method.toUpperCase()+' '+obj.url+"\nPOST:\n==>\n"+obj.str+"\n<==\n\n"+t);
		else if (t) {
			alert("Une erreur est survenue lors du chargement des donnees de la page,\nvotre requete ne pourra aboutir, veuillez nous excuser pour la gene occasionnee");	
		}
	}
	
	if(typeof(obj.onReceive)=='function')obj.onReceive(AjaxObject.status,xml,AjaxObject.responseText);
	delete(AjaxObject);AjaxObject=false;
	if(AjaxRequest.length>0)AjaxSend(AjaxRequest[0]);
}







/////////////////////////////////////////////////
//                                             //
//            The Popup Window                 //
//                                             //
/////////////////////////////////////////////////

function	Popup(title, width, height, win) {
	this.win = win;
	this.title = title;this.width = width;this.height = height;var screendim = getDrawableScreenSize();
	//! Main div (layer)
	this.main = dc('div');
	this.main.className = 'Window';
	this.main.style.width = this.width+'px';this.main.style.height = this.height+'px';
	this.main.style.left = ((screendim.width - this.width) / 2)+'px';
	this.main.style.top = (((screendim.height - this.height - 200) / 2) + parseInt(document.documentElement.scrollTop))+'px';
	this.resize = function() {
//		alert('resize: '+parseInt(this.main.firstChild.clientWidth)+' , '+parseInt(this.main.firstChild.clientHeight));
		var screendim = getDrawableScreenSize();
		var left = (screendim.width - parseInt(this.main.firstChild.clientWidth)) / 2;
		left = left < 0? 0: left;
		var top = (screendim.height - parseInt(this.main.firstChild.clientHeight) - 100) / 2;
		top = top < 0? 0: top;
		this.main.style.left = left+'px';this.main.style.top = (top + parseInt(document.documentElement.scrollTop))+'px';
	}
	with (this.main.style) {visibility='hidden';position='absolute';zIndex=1000;align='center';borderCollapse='collapse';}
	//! Main table (3 x 3)
	var table = this.main.appendChild(dc('table'));
	table.style.width = this.width+'px';table.style.height = this.height+'px';
	with (table.style) {textAlign='center';borderCollapse='collapse';}
	//! Header row (title)
	var head = table.appendChild(dc('thead')).appendChild(dc('tr'));
	head.id = 'head';head.style.height = '18px';
	head.popup = this;
	//! Left rounded corner
	var ltd = head.appendChild(dc('td'));
	ltd.className = 'topleft';
	if (GLOBALS.PICT_FOLDER)
		ltd.style.background = 'url('+GLOBALS.ROOT+GLOBALS.PICT_FOLDER+'topleft.gif)';
	ltd.style.width = '18px';
	//! Middle title (left aligned title text)
	var mtd = head.appendChild(dc('td'));
	mtd.className = 'top';
	mtd.style.width = (this.width-2*18)+'px';
	if (GLOBALS.PICT_FOLDER)
		mtd.style.background = 'url('+GLOBALS.ROOT+GLOBALS.PICT_FOLDER+'back.gif) repeat-x';
//	mtd.appendChild(dt(this.title));
	mtd.innerHTML = this.title;
	with (mtd.style) {fontFamily='verdana,helvetica,arial,sans-serif';verticalAlign='middle';fontSize='11px';textAlign='left';}
	//! Right rounded corner (with close cross)
	var rtd = head.appendChild(dc('td'));
	rtd.className = 'topright';
	if (GLOBALS.PICT_FOLDER)
		rtd.style.background = 'url('+GLOBALS.ROOT+GLOBALS.PICT_FOLDER+'topright.gif) right';
//	rtd.style.background = 'url('+this.images.right.src+') right';
	rtd.style.backgroundPosition = 'right';
	rtd.style.width = '18px';
	rtd.style.verticalAlign = 'middle';
	img = rtd.appendChild(dc('img'));
	img.src = GLOBALS.ROOT+GLOBALS.PICT_FOLDER+'close.png';
	img.style.cursor = 'pointer';
	img.onclick = function() {this.parentNode.parentNode.popup.Close();};
	//! for all Title row
	for (var td = head.firstChild; td; td = td.nextSibling) {
		td.unselectable = 'on';	td.onmousedown = function() {this.parentNode.popup.StartDrag();}
		with (td.style) {height='18px';cursor='pointer';margin=padding=border='0px';borderCollapse='collapse';}
	}
	//! Content (3 columns)
	var tr = table.appendChild(dc('tbody')).appendChild(dc('tr'));
	tr.id = 'body';tr.style.height = (this.height-18+20)+'px';
	this.content = tr.appendChild(dc('td'));
	this.content.colSpan = 3;
	with(this.content.style){border='0px';borderLeft=borderRight='1px';borderStyle='solid';borderColor='#9b9a9a';padding='3px';textAlign='center';backgroundColor='#f2f2f2';}
	//! Footer row (Cancel, OK ...)
	var tr = table.appendChild(dc('tfoot')).appendChild(dc('tr'));
	tr.id = 'foot';this.foot = tr.appendChild(dc('td'));this.foot.colSpan = 3;
	with (this.foot.style) {borderLeft=borderRight=borderBottom='1px';borderTop='0px';borderStyle='solid';borderColor='#9b9a9a';padding='3px';textAlign='right';backgroundColor='#f2f2f2';}
	this.Close = function() {
		document.body.removeChild(this.main);
		if (!this.ContentObject) {
			alert('Content not defined in Window');
			return ;
		}
		if (typeof(this.ContentObject.onClose) == 'function')
			this.ContentObject.onClose();
	}
	this.offset_x=this.offset_y=0;
	this.Drag = function(x, y) {
		this.main.style.left=(x-this.offset_x<0?0: x-this.offset_x+this.main.clientWidth>xMousePosMax?xMousePosMax-this.main.clientWidth:x-this.offset_x)+'px';
		this.main.style.top=(y-this.offset_y<0?0:y-this.offset_y+this.main.clientHeight>yMousePosMax?yMousePosMax-this.main.clientHeight:y-this.offset_y)+'px';
	}
	this.ReleaseDrag = function() {for(i in mousemove)if(mousemove[i]==this)mousemove.splice(i,1);for(i in mouseup)if(mouseup[i]==this)mouseup.splice(i,1);}
	this.StartDrag=function(){captureMouseMove();this.offset_x=xMousePos-parseInt(this.main.style.left);this.offset_y=yMousePos-parseInt(this.main.style.top);mousemove.push(this);mouseup.push(this);}
	this.visibility = function(visible) {this.main.style.visibility = visible? '': 'hidden';}
	this.main.style.visibility = '';
	this.AddButton = function(label) {
		if (this.foot.firstChild) this.foot.appendChild(dt(' '));
		var button = this.foot.appendChild(MakeInput({type:'button', value:label, popup: this.win}));
		button.style.width = '100px';
		return (button);
	}
	document.body.appendChild(this.main);
}






/////////////////////////////////////////////////
//                                             //
//            The Login Popup                  //
//                                             //
/////////////////////////////////////////////////

var PopupLoginAdmin=false;
function	PopupLoginAdminWindow() {
	this.popup = new Popup('Connexion utilisateur', 300, 120);
	this.popup.ContentObject = this;
	this.Ajax = new XmlRequest();
	this.Ajax.popup = this;
	this.popup.content.appendChild(dc('br'));
	this.popup.content.appendChild(dt('Veuillez entrez vos informations administrateur:'));
	this.popup.content.appendChild(dc('br'));
	this.popup.content.appendChild(dc('br'));
	var table = this.popup.content.appendChild(dc('table'));
	table.style.width = '280px';
	var tbody = table.appendChild(dc('tbody'));
	//! For User row
	var tr = tbody.appendChild(dc('tr'));
	var td = tr.appendChild(dc('td'));
	td.style.width = '100px';
	td.appendChild(dt('Utilisateur'));
	var td = tr.appendChild(dc('td'));
	this.user = td.appendChild(MakeInput({type:'text', value:GetCookie('login')? GetCookie('login'): ''}));
	this.user.popup = this;
	this.user.style.width = '180px';
	//! For Password row
	var tr = tbody.appendChild(dc('tr'))
	var td = tr.appendChild(dc('td'));
	td.style.width = '100px';
	td.appendChild(dt('Mot de passe'));
	var td = tr.appendChild(dc('td'));
	this.pass = td.appendChild(MakeInput({type:'password', value:'', popup: this}));
	this.pass.style.width = '180px';
	//! For Remember login row
/*	var tr = tbody.appendChild(dc('tr'))
	var td = tr.appendChild(dc('td'));
	td.colSpan = 2;
	var label = td.appendChild(dc('label'));
	td.appendChild(dt('  '));
	var text = 'Se souvenir de mon nom d\'utilisateur';
	var id = 'rememberlogin';
	var checked = (GetCookie('login')? true: false);
	this.rememberlogin = label.appendChild(MakeInput({type:'checkbox', id:id, label:text, checked:checked}));
	this.rememberlogin.popup = this;
	label.htmlFor = id;
	label.unselectable = true;
	label.setAttribute('for', id);
	label.appendChild(dt(text));*/
	//! For OK button
	this.okbutton = this.popup.foot.appendChild(MakeInput({type:'button', value:'OK', popup: this}));
	this.okbutton.style.width = '80px';

	this.okbutton.onclick = function() {
		this.popup.Ajax.onReceive = function(status, xml, text) {
			if (this.ACTION.login && this.ACTION.login.response == 'OK') {
				if (this.popup.rememberlogin && this.popup.rememberlogin.checked)SetCookie('login', this.popup.user.value);
				else DeleteCookie('login');
				this.popup.popup.Close();window.top.location = window.top.location;
				return ;
			}
			else if (this.ACTION.login) this.popup.response.innerHTML = this.ACTION.login.desc;else alert(text);
			DeleteCookie('login');
		}
//		alert('Action=login&user='+escape(this.popup.user.value)+'&pass='+escape(this.popup.pass.value));
		this.popup.Ajax.query('POST', '?xml', true, 'Action=login&user='+escape(this.popup.user.value)+'&pass='+escape(this.popup.pass.value));
	}
	//! little separation between buttons
	this.popup.foot.appendChild(dt('  '));
	//!	For Cancel Button
	this.cancelbutton = this.popup.foot.appendChild(MakeInput({type:'button', value:'Annuler', popup: this}));
	this.cancelbutton.style.width = '80px';
	this.cancelbutton.onclick = function() {this.popup.Close();}
	this.onClose = function() {PopupLoginAdmin = false;}
	this.popup.content.appendChild(dc('br'));
	this.response = this.popup.content.appendChild(dc('div'));
	this.response.style.color = 'red';
	/*this.rememberlogin.onkeypress = */this.user.onkeypress = this.pass.onkeypress = function(e) {if(GetKeyCode(e)==13) this.popup.okbutton.onclick();}
	this.focus = function() {this.user.value && !this.pass.value? this.pass.focus(): this.user.focus();}
	this.Close = function() {this.popup.Close();}
	this.focus();
}
function	PopupAdmin(){if (!PopupLoginAdmin)PopupLoginAdmin=new PopupLoginAdminWindow();else PopupLoginAdmin.focus();}





/////////////////////////////////////////////////
//                                             //
//       The Window Move functions             //
//                                             //
/////////////////////////////////////////////////

var mousemove=[];var mouseup=[];var xMousePos=0;var yMousePos=0;var xMousePosMax=0;var yMousePosMax=0;
function	captureMouseRelease(){for(i in mouseup)if(typeof(mouseup[i].ReleaseDrag)=='function')mouseup[i].ReleaseDrag();}
function	captureMousePosition(e) {if(document.layers){xMousePos=e.pageX;yMousePos=e.pageY;xMousePosMax=window.innerWidth+window.pageXOffset;yMousePosMax=window.innerHeight+window.pageYOffset;}else if(document.all){xMousePos=window.event.x+document.body.scrollLeft;yMousePos=window.event.y+document.body.scrollTop;xMousePosMax = document.body.clientWidth+document.body.scrollLeft;yMousePosMax=document.body.clientHeight+document.body.scrollTop;}else if(document.getElementById){xMousePos=e.pageX;yMousePos=e.pageY;xMousePosMax=window.innerWidth+window.pageXOffset;yMousePosMax=window.innerHeight+window.pageYOffset;}for(i in mousemove)if(typeof(mousemove[i].Drag)=='function')mousemove[i].Drag(xMousePos,yMousePos);}
function	captureMouseMove() {if(document.layers){document.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP);document.onmousemove=captureMousePosition;document.onmouseup=captureMouseRelease;}else if(document.all){document.onmousemove=captureMousePosition;document.onmouseup=captureMouseRelease;}else if(document.getElementById){document.onmousemove=captureMousePosition;document.onmouseup=captureMouseRelease;}try{var div=document.body.appendChild(dc('div'));div.id="divcalendar";with(div.style){position='absolute';visibility='hidden';backgroundColor='white';layerBackgroundColor='white';zIndex=3;}}catch(e){alert(e.message);}};
jQuery(captureMouseMove);





/////////////////////////////////////////////////
//                                             //
//               The Help Popup                //
//                                             //
/////////////////////////////////////////////////
var dom = false;
var msgtext = false;
var show = false;
var opened = false;

function	BuildHelpbox() {var help=document.body.appendChild(dc('span'));help.id='helpbox';with(help.style){visibility='hidden';top='0px';left='0px';position='absolute';zIndex=100000};var table=help.appendChild(dc('table'));table.style.width='170px';table.style.border='none';var tbody=table.appendChild(dc('tbody'));var tr=tbody.appendChild(dc('tr'));var td=tr.appendChild(dc('td'));td.style.height='5px';td.style.width='170px';td.colSpan=5;td.style.background='url('+GLOBALS.ROOT+GLOBALS.PICT_FOLDER+'help_top.gif)';var tr=tbody.appendChild(dc('tr'));var td=tr.appendChild(dc('td'));td.style.width='1px';td.style.backgroundColor='#a44d00';var td=tr.appendChild(dc('td'));td.style.width='4px';td.style.backgroundColor='#f5ffe0';var td=tr.appendChild(dc('td'));td.style.width='160px';td.style.backgroundColor='#f5ffe0';td.id="msgtext"; msgtext=td;var td=tr.appendChild(dc('td'));td.style.width='4px';td.style.backgroundColor='#f5ffe0';var td=tr.appendChild(dc('td'));td.style.width='1px';td.style.backgroundColor='#a44d00';var tr=tbody.appendChild(dc('tr'));tr.style.height='5px';var td=tr.appendChild(dc('td'));td.style.height='5px';td.style.width='170px';td.colSpan=5;td.style.background = 'url('+GLOBALS.ROOT+GLOBALS.PICT_FOLDER+'help_bottom.gif)';dom=help;}
function startPop() {if(!show)return;popUp(show,15,15);opened=true;}
function helpBox(evt, msg) {if(!evt){show=false;opened=false;window.status='';HidePop();return;}if(!dom||!msgtext)BuildHelpbox();msgtext.innerHTML=msg;while(msg.search('<b>')!=-1)msg=msg.replace('<b>','');while(msg.search('<br />')!=-1)msg=msg.replace('<br />',' ');while(msg.search('</b>')!=-1)msg=msg.replace('</b>','');while(msg.search('<br>')!=-1)msg=msg.replace('<br>', '');window.status=msg? msg: '';if(show.type=='mousemove'&&opened){popUp(evt,15,15);return;}show={};for(i in evt)show[i]=evt[i];setTimeout('startPop()', 1000);}
function popUp(evt,offsetX,offsetY){ShowPop(evt,offsetX,offsetY,-1,-1,1);}
function popUpAbsolute(evt,Xabs,Yabs){ShowPop(evt,0,0,Xabs,Yabs,false);}
function HidePop(){try{(!isNS4? dom.style: dom).visibility = 'hidden';domStyle=(isNS4?dom:dom.style);domStyle.top='0px';domStyle.left='0px';}catch(e){}}
function ShowPop(evt,offsetX,offsetY,Xabs,Yabs,autom) {if(Xabs!=-1&&Yabs!=-1){topVal=Yabs;leftVal=Xabs;}livePageWidth=(window.innerWidth)?window.innerWidth:document.body.clientWidth;scrollLeft=(evt.x&&!isNS4)?document.body.scrollLeft:0;elemWidth=(dom.offsetWidth?dom.offsetWidth:(dom.clip?dom.clip.width:0));pageX=(evt.pageX?evt.pageX:evt.x);if(Xabs!=-1){leftVal=Xabs;}else{leftVal=pageX+offsetX+scrollLeft;if(autom&&(leftVal+elemWidth-scrollLeft)>livePageWidth){leftVal2=pageX+scrollLeft-elemWidth+10-offsetX;leftVal=(leftVal2>=2?leftVal2:livePageWidth-elemWidth-2);}if(leftVal<2)leftVal=2;}livePageHeight=(window.innerHeight)?window.innerHeight:document.body.clientHeight;scrollTop=(evt.y&&!isNS4)?document.body.scrollTop:0;elemHeight=(dom.offsetHeight)?dom.offsetHeight:((dom.clip)?dom.clip.height:0);pageY=(evt.pageY)?evt.pageY:evt.y;if(Yabs!=-1){topVal=Yabs;}else{topVal=pageY+offsetY+scrollTop;if(autom&&(topVal+elemHeight-scrollTop)>livePageHeight){topVal2=pageY-5+scrollTop-elemHeight-offsetY;topVal=(topVal2>=2?topVal2:livePageHeight-elemHeight-2);}if(topVal<2)topVal=2;};domStyle=(isNS4?dom:dom.style);domStyle.top=parseInt(topVal)+'px';domStyle.left=parseInt(leftVal)+'px';domStyle.visibility = 'visible';}



/////////////////////////////////////////////////
//                                             //
//        Once everything Loaded ...           //
//                                             //
/////////////////////////////////////////////////

function	AddHelp(n, text) {
	if (!n.help && text) {
		n.setAttribute('help',text);
		n.alt = '';
		n.title = '';
		n.help = text;
	}
	n.onmouseout=function(){try{helpBox();}catch(e){}}
	n.onmouseover=n.onmousemove=function(e){try{helpBox(isIE?window.event:e,GetNodeAttribute(this,'help'))}catch(e){};}
}

function	ParseDomAddHelp(node) {
	jQuery('[@title],[@help],[@alt]').each(function() {
		var j = jQuery(this);
		var t = j.attr('title') || j.attr('help') || j.attr('alt');
		AddHelp(this, t);
	});
}

function	AddLangSelector(tdlang) {
	if (!tdlang)
		return ;
	var choice = jQuery('<div class="barlang">' +
			'<span class="change-lang-FR" id="go-lang-FR">FRANÇAIS</span>'+
			'<span class="change-lang-EN" id="go-lang-EN">ENGLISH</span>' +
		'</div>').appendTo(tdlang);
	choice.find('span').click(function(){ChangeLang(this.id.substr(8))});
	jQuery('#NewsLetter #go2lang-EN, #NewsLetter #go2lang-FR').click(function(){ChangeLang(this.id.substr(8)); return false});;
}

function	ReplacePuce() {
	var divs = jQuery('div.puce1, span.puce1, div.puce2, span.puce2');
	
	for (var i=0; i<divs.length; i++) {
		if (jQuery(divs[i]).is('.puce1')) {
			jQuery(divs[i]).prepend('<img src="'+GLOBALS.ROOT+GLOBALS.PICT_FOLDER+'puceBleue2.gif"/>');
//			var img = divs[i].insertBefore(dc('img'), divs[i].firstChild);
//			img.src = ''+GLOBALS.ROOT+GLOBALS.PICT_FOLDER+'puceBleue2.gif'/*'pucef.gif'*/;
		}
		if (jQuery(divs[i]).is('.puce2')) {
			jQuery(divs[i]).prepend('<img src="'+GLOBALS.ROOT+GLOBALS.PICT_FOLDER+'arrowmenu_selected.gif"/> ');
//			divs[i].insertBefore(dt(' '), divs[i].firstChild);
//			var img = divs[i].insertBefore(dc('img'), divs[i].firstChild);
//			img.src = ''+GLOBALS.ROOT+GLOBALS.PICT_FOLDER+'arrowmenu_selected.gif';
		}
	}
}
function		get_host(url) {
	url = url;
	var pos = url.indexOf('://');
	if (pos==-1)
		return get_host(''+window.top.location);
	var host = url.substr(pos+3);	
	if (host.indexOf('/')==-1)
		return host;
	return host.substr(0, host.indexOf('/'));
}
function		ExternalLink() {
	jQuery('a').each(function(){
		var href = jQuery(this).attr('href');
		if (href && get_host(href) != GLOBALS.HOST || getfileext(href) == 'pdf')
			this.target = '_blank';
	});
}

function	fileext(name) {
	var p = name.lastIndexOf('.');
	return p > 0? name.substr(p+1): '';
};
jQuery(function() {
	/** Redimensionne le contenu pour que le footer soit a la bonne hauteur */
	var jwindow = jQuery(window),
		band = jQuery('#band'),
		menu = jQuery('#menu'),
		foot = jQuery('#foot'),
		content = jQuery('#MainTable');
	jQuery(document).resize(function() {
		function resizeNow() {
			var height = jwindow.height()-band.height()-menu.height()-foot.height();
			content.height(height);
		}
		if (jQuery.browser.msie)
			setTimeout(resizeNow, 10);
		else
			resizeNow();
	}).resize();
	
	RewriteMenu(getRef('menu'));
	ReplacePuce();
	ExternalLink();
	setTimeout('ParseDomAddHelp(document.body);', 1000);
	AddLangSelector(getRef('lang'));
	
	try {	
		if (GLOBALS.FckEditors) {
			AnalyzerDefault='Mise en forme';
			AnalyzerPages[AnalyzerDefault]=function(td){td.appendChild(dc('div')).id='xToolbar';}
			try{document.getElementById('divcontent').style.paddingBottom='60px'}catch(e){}
		}
		AddMySQLQueriesPage();
	}catch(e){};
	try {	new SiteAnalyzer(AnalyzerPages, 800);	}catch(e){/*alert(e.message)*/};
	try {	ReplaceFckEditorTextarea();				}catch(e){/*alert(e.message)*/};
	
	var current_host = ''+window.location;
	current_host = current_host.substr(0, current_host.indexOf('/', 7)+1);
//	console.info('current: '+current_host);
	var mapped = [];
	if (false) {
		jQuery('a').each(function() {
			var href = this.href;
			
			if (href.indexOf(current_host) !== 0)
				return ;
			if (jQuery.inArray(fileext(href), ['pdf', 'mov', 'mp3', 'doc', 'xls', 'avi', 'mpg']) != -1) {
				jQuery(this).mouseover(displayDownloadCheckbox);
				mapped.push(this);
			}
		});
	}
	var uidlink = 0;
	function	displayDownloadCheckbox() {
		var a = jQuery(this);
		a.addClass('over');
		if (a.prev().is('.multiselect'))
			return ;
		update_multiselect_downloader();
		uidlink++;
		var m = jQuery('<div class="multiselect" title="Cochez la case pour télécharger ce fichier ainsi que d\'autres en même temps">' +
				'<input type="checkbox" id="select-box-'+uidlink+'" /><label for="select-box-'+uidlink+'">télécharger</label><br />' +
			'</div>');
		var t = null;
		jQuery([this, m[0]]).mouseout(function() {
			a.removeClass('over');
			if (t)clearTimeout(t);
			t = setTimeout(remove_timed, 2000);
		});
		m.mouseover(function() {
			a.addClass('over');
		});
		m.find(':checkbox').change(function() {
			a[0].download = !!this.checked;
			update_multiselect_downloader();
		});
		function remove_timed() {
			if (a.is('.over') || m.find(':checkbox').is(':checked'))
				return ;
			try {
				update_multiselect_downloader();
				m.fadeOut(function() {
					try {m.remove();}catch(e){}
				});
			}catch(e){}
		}
		a.before(m);
		var pos = a.offset();
		m.css({top: pos.top+a.height(), left: pos.left+a.width()});
		a.fadeIn();
	};
//	console.info();
	var place = null;
	var tpl = '<div class="downloader"><div class="box"><a href="">Télécharger (<span class="value"></span>)</a></div></div>';
	function	update_multiselect_downloader() {
		if (!place)
			place = jQuery('.clickable.advsearchbt');
		var count = 0;
		var href = '';
		for (var i=0; i<mapped.length; i++)
			if (mapped[i].download) {
				count++;
				href += (href? '&':'?')+'zip[]='+encodeURIComponent(mapped[i].href.substr(current_host.length-1));
			}
		
		if (place.next().is('.downloader')) {
			if (!count)
				place.next().find('.box').slideUp();
			else
				place.next().find('.box').slideDown();
		}
		else {
			if (count) {
				place.after(jQuery(tpl));
				place.find('.box').slideUp(2);
				place.find('.box').slideDown();
			}
		}
		place.next().find('.box .value').html(count);
		place.next().find('.box a').attr({href:href});
	}
		
});

var globInput = false;	
function	MakeAutoText(input, text) {
	input.bak = {fontWeight: input.style.fontWeight, color: input.style.color, text: text};
	if (input.value == "" || input.value == text) {
		input.style.fontWeight = '100';
		input.style.color = '#CCCCCC';
		input.value = text;
	}
	input.onfocus = function() {
		if (this.value == this.bak.text) {
			try {
				this.value = '';
			}catch(e) {}
		}
		this.style.fontWeight = this.bak.fontWeight;
		this.style.color = this.bak.color;
	}
	input.onblur = function() {
		if (this.value != '' && this.value != this.bak.text)
			return ;
		this.value = this.bak.text;
		this.style.fontWeight = '100';
		this.style.color = '#CCCCCC';
	}
}

/////////////////////////////////////////////////
//                                             //
//        phpMyVisites			 ...           //
//                                             //
/////////////////////////////////////////////////




function getWindowHeight() {
    var windowHeight=0;
    if (typeof(window.innerHeight)=='number') {
        windowHeight=window.innerHeight;
    }
    else { 
		if (document.documentElement&& document.documentElement.clientHeight) {
			windowHeight = document.documentElement.clientHeight;}
    	else { 
			if (document.body&&document.body.clientHeight) {
				windowHeight=document.body.clientHeight;}
		}
	}
    return windowHeight;
}


function getScrollXY() {
  var scrOfX = 0, scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
    scrOfX = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
    scrOfX = document.documentElement.scrollLeft;
  }
  return [ scrOfX, scrOfY ];
}

