var hoverCssClass = 'hover';
function addCssClass(source, cssClass)
{
var cn;
cn = source.className;
source.className = cn + ' ' + cssClass
}
function removeCssClass(source, cssClass)
{
var cn = source.className;
var lst = cn.split(' ');
var i = 0; cn = '';
for (i = 0; i< lst.length; i++)
{
if (lst[i] != cssClass) { cn += ' ' + lst[i]; }
}
source.className = cn;
}
function addCssOver(source, changeCursor, hoverclass)
{
if ((!hoverclass)||(hoverclass=='')) {hoverclass = hoverCssClass}
addCssClass(source, hoverclass);
if (changeCursor) { source.style.cursor='pointer'; }
}
function removeCssOver(source, changeCursor, hoverclass)
{
if ((!hoverclass)||(hoverclass=='')) {hoverclass = hoverCssClass}
removeCssClass(source, hoverclass);
if (changeCursor) { source.style.cursor='default'; }
}
function alternateCssOver(source, changeCursor, hoverclass){
var cn = source.className;
if ((!hoverclass)||(hoverclass=='')) {hoverclass = hoverCssClass}
if (cn.indexOf(hoverclass) > -1){
removeCssOver(source, changeCursor, hoverclass);
}
else {
addCssOver(source, changeCursor, hoverclass);
}
}
function getStyleProp(el,styleProp)
{
if (el.currentStyle)
var res = el.currentStyle[styleProp];
else if (window.getComputedStyle)
var res = document.defaultView.getComputedStyle(el,null).getPropertyValue(styleProp);
return res;
}
function getElementStyle(elem) {
if ((elem) && (elem != window.document)) {
if (elem.currentStyle) { 
return elem.currentStyle }
else if (window.getComputedStyle) {
return window.getComputedStyle(elem, ""); }
}
return null;
}
function setInnerHTMLById(id, html)
{
id = document.getElementById(id);
if(id) id.innerHTML = html;
}
function getPxAttrIntValue(pxValue) {
if (pxValue) {
var s = "";
var i = pxValue.indexOf("px");
if (i >= 0) {pxValue = pxValue.slice(0,i);}
if (!isNaN(pxValue)) {
i = parseInt(pxValue);
return i}
else {return(0);}
}
else {return(0);}
}
function getAttrIdxValue(attrValue, Idx) {
if (attrValue) {
var v = attrValue.split(" ");
if (v.length > idx) {
return(v[idx]);}
else if (v.length > 0) {
return (v[0]);}
}
return attrValue;
}
function getSpecIdxValue(attrValueSpec, attrValueGen, idx) {
if ((attrValueSpec) && (attrValueSpec != "") ){
return attrValueSpec;}
else {
return getAttrIdxValue( attrValueGen, idx);}
}
function getBkColor(elem) {
var color;
if (elem) {
var s = getElementStyle(elem);
if (s)  { color = s.backgroundColor ; }
}
return color;
}
function getParentBkColor(elem)  {
var color;
if (elem) {
elem = elem.parentNode;
if (elem) {
color = getBkColor(elem);
if ((!color) || (color == 'transparent')) {color = getParentBkColor(elem);}
}
}
if ((!color) || (color == 'transparent')) {color = getBkColor(document.window);}
if ((!color) || (color == 'transparent')) {color = 'white';}
return color;
}
function CreateEl(x){
if(isXHTML)
{return(document.createElementNS('http://www.w3.org/1999/xhtml',x));}
else
{return(document.createElement(x));}
}
function picturepopup(picture,title,width,height)
{
w = window.open('','pictpopup','width='+width+',height='+height+'');
w.document.write( "<html><head><title>"+title+"</title>\n" );
w.document.write( "<script language='JavaScript'>\n");
w.document.write( "	IE5=NN4=NN6=false;\n");
w.document.write( "	if(document.all)IE5=true;\n");
w.document.write( "	else if(document.getElementById)NN6=true;\n");
w.document.write( "	else if(document.layers)NN4=true;\n");
w.document.write( "	function autoSize() {\n");
w.document.write( "		if(IE5) self.resizeTo(document.images[0].width+10,document.images[0].height+31)\n");
w.document.write( "		else if(NN6) self.sizeToContent();\n");
w.document.write( "		else window.resizeTo(document.images[0].width,document.images[0].height+20)\n");
w.document.write( "		self.focus();\n");
w.document.write( "	}\n");
w.document.write( "</script>\n");
w.document.write( "</head>\n<body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 onLoad='javascript:autoSize();'>\n" );
var strWidth = "width="+width;
var strHeight = "height="+height;
if (!width) strWidth="";
if (!height) strHeight="";
w.document.write( "<a href=\'javascript:window.close();\'><img "+strHeight+" "+strWidth+" s"+"rc=\'"+picture+"\' border=0 alt=\'"+title+"\'></a>\n" );
w.document.write( "</body>\n</html>\n" );
w.document.close();
}
function DisplayHideDiv(ctrlDiv) {
if (!ctrlDiv.style.display) {
ctrlDiv.style.display = 'none';
}
if (ctrlDiv.style.display == 'none') {
ctrlDiv.style.display = 'block';
}
else {
ctrlDiv.style.display = 'none';
}
}
function setVisible(ctrl, bvisible) {
if (typeof ctrl == 'string') {
ctrl = getObjectById(ctrl)}
if (ctrl) {
if (bvisible == true) {
ctrl.style.display = 'block';
} else {
ctrl.style.display = 'none';
}
}
}
function stopjsevent(event) {
if (document.all) { IE=1; NN=0 }
else if (document.getElementById) { NN=1; IE=0; }
else { IE=0;NN=0}
if (IE){
window.event.cancelBubble=true;
}
if (NN){
event.stopPropagation();
}
}
var ns = (navigator.appName.indexOf("Netscape") != -1);
function CenterElement(eleId){
d = document;
var ele = getObjectById(eleId);
if (!ele) return;
ele.style.position="absolute";
var topPosition = (document.documentElement.clientHeight - ele.offsetHeight) / 2 + getVScrollPosition();
var leftPosition = (document.documentElement.clientWidth - ele.offsetWidth) / 2 + getHScrollPosition();
ele.style.top=topPosition + "px";
ele.style.left=leftPosition + "px";
}
function getObjectById(objId){
d = document;
var ele = d.getElementById?d.getElementById(objId):d.all?d.all[objId]:d.layers[objId];
return ele;
}
function getHScrollPosition(){
var sX = ns ? pageXOffset : document.documentElement.scrollLeft;
return sX;
}
function getVScrollPosition(){
var sY = ns ? pageYOffset : document.documentElement.scrollTop;
return sY;
}
function displayOneCtrl(ctrlId, CtrlArray, CtrlLinkId){
for (i=0; i<CtrlArray.length; i++){
var aEle = getObjectById(CtrlArray[i][0]);
var cell = getObjectById(CtrlArray[i][1]);
var rad = null;
if (CtrlArray[i][0] == ctrlId){
aEle.style.display="block";
addCssClass(cell, 'selected');
removeCssClass(cell, hoverCssClass);
cell.onmouseover='';
cell.onmouseout='';
rad = getObjectById(CtrlLinkId);
if (rad != null && rad.checked != 'undefined'){
rad.checked = true;
}
}
else{
aEle.style.display="none";
removeCssClass(cell, 'selected');
cell.onmouseover = function(){addCssOver(this, true, hoverCssClass);}
cell.onmouseout = function(){removeCssOver(this, true, hoverCssClass);}
}
}
}
function SetObjLstEnable(ObjLstId, Enable){
if (undefined != ObjLstId && ObjLstId != ''){
for (i=0;i<=ObjLstId.length-1;i++){
var obj = getObjectById(ObjLstId[i]);
if (undefined != obj){
obj.enabled = Enable;
}
}
}
}
function AddBookmark(url, title) {
if ( navigator.appName != 'Microsoft Internet Explorer' ) {
window.sidebar.addPanel( title, url, "");
}
else {
window.external.AddFavorite( url, title);
}
}
function trim(s) {
return ltrim(rtrim(s));
}
function ltrim(s) {
return s.replace(/^\s+/, '');
}
function rtrim(s) {
return s.replace(/\s+$/, '');
}
var iframeids=[];
var iframehide="yes";
var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1];
var FFextraHeight=parseFloat(getFFVersion)>=0.1? 30 : 0; 
function addIFrameIds(aId){
iframeids[iframeids.length] = aId;
}
function resizeCaller() {
var dyniframe=new Array()
for (i=0; i<iframeids.length; i++){
if (document.getElementById)
resizeIframe(iframeids[i])
if ((document.all || document.getElementById) && iframehide=="no"){
var tempobj=document.all? document.all[iframeids[i]] : document.getElementById(iframeids[i])
tempobj.style.display="block"
}
}
}
function resizeIframe(frameid){
var currentfr=document.getElementById(frameid)
if (currentfr && !window.opera){
currentfr.style.display="block"
if (currentfr.contentDocument && currentfr.contentDocument.body.offsetHeight){ 
currentfr.height = currentfr.contentDocument.body.offsetHeight+FFextraHeight;
}
else if (currentfr.Document && currentfr.Document.body.scrollHeight){ 
currentfr.height = currentfr.Document.body.scrollHeight + 20; 
}
if (currentfr.addEventListener)
currentfr.addEventListener("load", readjustIframe, false)
else if (currentfr.attachEvent){
currentfr.detachEvent("onload", readjustIframe) 
currentfr.attachEvent("onload", readjustIframe)
}
}
}
function readjustIframe(loadevt) {
var crossevt=(window.event)? event : loadevt
var iframeroot=(crossevt.currentTarget)? crossevt.currentTarget : crossevt.srcElement
if (iframeroot)
resizeIframe(iframeroot.id);
}
function loadintoIframe(iframeid, url){
if (document.getElementById)
document.getElementById(iframeid).src=url
}
function initIframeResizeCaller(){
if (window.addEventListener)
window.addEventListener("load", resizeCaller, false)
else if (window.attachEvent)
window.attachEvent("onload", resizeCaller)
else
window.onload=resizeCaller
}
var moved_window=0;
var moved_window_difx=0;
var moved_window_dify=0;
function addEvent(obj,event,fct){
if(obj.attachEvent)
obj.attachEvent('on' + event,fct);
else
obj.addEventListener(event,fct,true);
}
function start_move(ev,window) {
moved_window=window; 
old_mouseCoords=mouseCoords(ev); 
old_windowCoords=getPosition(window); 
moved_window_difx=old_mouseCoords.x-old_windowCoords.x;
moved_window_dify=old_mouseCoords.y-old_windowCoords.y;
}
function end_move() {
moved_window=0; 
}
function move_window(ev) {
if(moved_window!=0) {
var mouse=mouseCoords(ev);
moved_window.style.left=(mouse.x-moved_window_difx)+'px'; //On soustrait l'abscisse du curseur par rapport au coin gauche de la fenêtr
moved_window.style.top=(mouse.y-moved_window_dify)+'px'; //On fait de même avec l'ordonnée
}
}
function mouseCoords(ev){
if(ev.pageX || ev.pageY){
return {x:ev.pageX, y:ev.pageY}
}
return {
x:ev.clientX + document.body.scrollLeft - document.body.clientLeft,
y:ev.clientY + document.body.scrollTop  - document.body.clientTop
}
}
function getPosition(e){
var left = 0;
var top  = 0;
while (e.offsetParent){
left += e.offsetLeft;
top  += e.offsetTop;
e     = e.offsetParent;
}
left += e.offsetLeft;
top  += e.offsetTop;
return {x:left, y:top}
}