/* $Id: global.js,v 1.47 2008/01/16 11:24:11 meyer Exp $ */
/* $VtId: global.js,v 1.13 2004/06/02 15:31:58 nicolas Exp $ */
/* $VtId: global.js,v 1.11 2004/04/19 17:43:14 nicolas Exp $ */
/* $VtId: global.js,v 1.2 2003/11/28 08:52:37 reno Exp $ */
//*******************************************************************************
// detect.js
// dhtmllib.js
// winutils.js
// date.js
// utils.js
// gfs.js
// img.js
// form.js
// tooltip.js
// bi_iframe.js (pour la fonction filterHtml
//*******************************************************************************
//*******************************************************************************
//-------------------------------------------------------------------------------
// DETECT.JS
//-------------------------------------------------------------------------------
//*******************************************************************************
/*************** Script functions in this file **************
Filename: detect.js; as of 09/24/2001
  FUNCTION:                                               LINE:
  Fl_DetectFlash()                                         72   
  Fl_DetectFlashVb()                                       61   
************ (end Script functions in this file) ***********/

var bDHTMLDebug = false;	// show debug (object not found)

// Determine Versions
var agent=navigator.userAgent.toLowerCase();
var browser=navigator.appName.toLowerCase();
var versMajor = parseInt(navigator.appVersion);
var versMinor = parseFloat(navigator.appVersion);

// Determine browser.
var isNS = (browser.indexOf("netscape") >= 0);
var isIE = (browser.indexOf("internet explorer") >= 0); // (agent.indexOf("msie") != -1);
var isOpera = (agent.indexOf('opera') != -1);
var isAOL = (agent.indexOf("aol") != -1);
var isWebTV = (agent.indexOf("webtv") != -1);

// NS
var isNS2 = (isNS && (versMajor == 2));
var isNS3 = (isNS && (versMajor == 3));
var isNS4 = (isNS && (versMajor == 4));
var isNS5 = (isNS && (versMajor == 5));
var isNS6 = (isNS && document.getElementById != null);
var isMinNS6 = isNS6;
var isMinNS4 = (isNS && (versMajor >= 4)) && ! isMinNS6;
var isMinNS5 = (isNS && (versMajor >= 5));

// IE
var isIE3 = (isIE && (versMajor < 4));
var isIE4  = (isIE && (versMajor == 4) && (agent.indexOf("msie 5.")==-1) && (agent.indexOf("msie 6.")==-1));
var isIE5  = (isIE && (versMajor == 4) && (agent.indexOf("msie 6.")==-1) && (agent.indexOf("msie 5.")!=-1));
var isIE55 = (isIE5 && (navigator.appVersion.indexOf("5.5") >= 0));
var isIE6 = (navigator.appVersion.indexOf("6.") >= 0);
var isMinIE4 = (isIE && versMajor >= 4);
var isMinIE6 = isIE6;
var isMinIE5 = (isMinIE4 && (navigator.appVersion.indexOf("5.") >= 0) || isMinIE6);
var isMinIE55 = (isMinIE4 && (navigator.appVersion.indexOf("5.5") >= 0));

var isIENS6 = isIE || isMinNS6 ;

// AOL
var isAOL3  = (isAOL && isIE3);
var isAOL4  = (isAOL && isIE4);

// Determine OS
var isMac = (navigator.appVersion.indexOf("Mac") >= 0);
var isWin = (navigator.appVersion.indexOf("Win") >= 0);
var isLinux = (navigator.appVersion.indexOf("Linux") >= 0);

// Versions
if (isNS2)
	browserVersion = "2";
if (isIE3 || isNS3)
	browserVersion = "3";
if (isIE4 || isNS4)
	browserVersion = "4";
if (isIE5)
	browserVersion = "5";
if (isMinIE55)
	browserVersion = "5.5";
if (isNS6)
	browserVersion = "6";
  
function isDefined(sVar) {
  if (typeof sVar == 'undefined') return false;
  else return true;
}

// Determine Flash
// ********************************** FALSH DETECT
var Fl_requiredVersion = 4;			// version the user needs to view site (max is 5, min is 2)
var Fl_flash2Installed = false;		// boolean. true if flash 2 is installed
var Fl_flash3Installed = false;		// boolean. true if flash 3 is installed
var Fl_flash4Installed = false;		// boolean. true if flash 4 is installed
var Fl_flash5Installed = false;		// boolean. true if flash 5 is installed
var Fl_maxVersion = 5;					// highest version we can actually detect
var Fl_actualVersion = 0;				// version the user really has
var Fl_hasRightVersion = false;		// boolean. true if it's safe to embed the flash movie in the page
var Fl_isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;		// true if we're on ie
var Fl_isWin = (navigator.appVersion.indexOf("Windows") != -1) ? true : false; // true if we're on windows
function Fl_DetectFlashVb() {
  if(Fl_isIE && Fl_isWin){ // don't write vbscript tags on anything but ie win
  	document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
  	document.write('on error resume next \n');
  	document.write('Fl_flash2Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.2"))) \n');
  	document.write('Fl_flash3Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.3"))) \n');
  	document.write('Fl_flash4Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.4"))) \n');
  	document.write('Fl_flash5Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.5"))) \n');	
  	document.write('</SCR' + 'IPT\> \n'); // break up end tag so it doesn't end our script
  }
}
function Fl_DetectFlash() {
  if (navigator.plugins){								// does navigator.plugins exist?
    if (navigator.plugins["Shockwave Flash 2.0"] 	// yes>> then is Flash 2 
    || navigator.plugins["Shockwave Flash"]){		// or flash 3+ installed?
    	var isVersion2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
    	var flashDescription = navigator.plugins["Shockwave Flash" + isVersion2].description;
    	var flashVersion = parseInt(flashDescription.charAt(flashDescription.indexOf(".") - 1));
    	Fl_flash2Installed = flashVersion == 2;		
    	Fl_flash3Installed = flashVersion == 3;
    	Fl_flash4Installed = flashVersion == 4;
    	Fl_flash5Installed = flashVersion == 5;
    }
  }
  for (var i = 2; i <= Fl_maxVersion; i++) {	
  	if (eval("Fl_flash" + i + "Installed") == true) Fl_actualVersion = i;
  }
  if(navigator.userAgent.indexOf("WebTV") != -1) Fl_actualVersion = 2;	
  if (Fl_actualVersion >= Fl_requiredVersion) { 		// user has a new enough version
  	Fl_hasRightVersion = true;						// flag: it's okay to write out the object/embed tags later
    return true;
  }
  return false;
}  

// --------------------------------
// Plugin Detection
// --------------------------------

/*
Plugin Detector()

Source: Webmonkey Code Library
(http://www.hotwired.com/webmonkey/javascript/code_library/)

Author: Nadav Savio
Author Email: webmonkey@giantant.com
*/

// this is where we write out the VBScript for MSIE Windows
var WM_startTagFix = '</';
var msie_windows = 0;
if ((navigator.userAgent.indexOf('MSIE') != -1) && (navigator.userAgent.indexOf('Win') != -1)){
  msie_windows = 1;
  document.writeln('<script language="VBscript">');
  document.writeln('\'This will scan for plugins for all versions of Internet Explorer that have a VBscript engine version 2 or greater.');
  document.writeln('\'This includes all versions of IE4 and beyond and some versions of IE 3.');
  document.writeln('Dim WM_detect_through_vb');
  document.writeln('WM_detect_through_vb = 0');
  document.writeln('If ScriptEngineMajorVersion >= 2 then');
  document.writeln('  WM_detect_through_vb = 1');
  document.writeln('End If');
  document.writeln('Function WM_activeXDetect(activeXname)');
  document.writeln('  on error resume next');
  document.writeln('  If ScriptEngineMajorVersion >= 2 then');
  document.writeln('     WM_activeXDetect = False');
  document.writeln('     WM_activeXDetect = IsObject(CreateObject(activeXname))');
  document.writeln('     If (err) then');
  document.writeln('        WM_activeXDetect = False');
  document.writeln('     End If');
  document.writeln('   Else');
  document.writeln('     WM_activeXDetect = False');
  document.writeln('   End If');
  document.writeln('End Function');
  document.writeln(WM_startTagFix+'script>');
}

function WM_pluginDetect(plugindescription, pluginxtension, pluginmime, activeXname){
  //This script block will test all user agents that have a real plug-in array
  //(i.e. Netscape) and set the variables, otherwise it directs the routine
  // to WM_activeXDetect to detect the activeX control.

  // First define some variables
  var i,plugin_undetectable=0,detected=0, daPlugin=new Object();
  plugin_undetectable = (msie_windows && WM_detect_through_vb)?0:1;

  // If it has a real plugins or mimetypes array, we look there for the plugin first
  if (navigator.plugins) {
    numPlugins = navigator.plugins.length;
    if (numPlugins > 1) {
	    if (navigator.mimeTypes && navigator.mimeTypes[pluginmime] && navigator.mimeTypes[pluginmime].enabledPlugin && (navigator.mimeTypes[pluginmime].suffixes.indexOf(pluginxtension) != -1)) { // seems like we have it, let's just make sure and check the version (if specified)
	      if ((navigator.appName == 'Netscape') && (navigator.appVersion.indexOf('4.0') != -1)) { // stupid, stupid Netscape can't handle the references to navigator.plugins by number, sooo...
    		  for(i in navigator.plugins) {
		        if ((navigator.plugins[i].description.indexOf(plugindescription) != -1) || (i.indexOf(plugindescription) != -1)) { // some versions of quicktime have no description. feh!
    			   detected=1;
		         break;
		        }
		      }
	      } else {
		      for (i = 0; i < numPlugins; i++) {
		        daPlugin = navigator.plugins[i];
		        if ((daPlugin.description.indexOf(plugindescription) != -1) || (daPlugin.name.indexOf(plugindescription) != -1)) {
			        detected=1;
			        break;
		        }
		      }
	      }

  	    // Mac weirdness
        if (navigator.mimeTypes[pluginmime] == null) {
    		  detected = 0;
  	    }
	    }
	    return detected;
      } else if((msie_windows == 1) && !plugin_undetectable){
	      return WM_activeXDetect(activeXname);
      } else { 		
	      return 0;
      }
    } else {
      return 0;
  }
}

// this next function just makes it easy to detect the common plugins
function WM_easyDetect(whichPlugin) {
  // this function just makes it easy to do basic plug-in detection without
  // knowing all the mimetypes and activeX names and such
  var isItThere = 0;
  if( (whichPlugin == 'flash') || (whichPlugin == 'Flash') ) {
    isItThere = WM_pluginDetect('Flash', 'swf', 'application/x-shockwave-flash', 'ShockwaveFlash.ShockwaveFlash');
  } else if( (whichPlugin == 'director') || (whichPlugin == 'Director') ) {
    isItThere = WM_pluginDetect('Shockwave', 'dcr', 'application/x-director', 'SWCtl.SWCtl.1');
  } else if( (whichPlugin == 'quicktime') || (whichPlugin == 'Quicktime') || (whichPlugin == 'QuickTime') ) {
    isItThere = WM_pluginDetect('QuickTime', 'mov', 'video/quicktime', 'QuickTimeCheckObject.QuickTimeCheck.1');
  } else if( (whichPlugin == 'realaudio') || (whichPlugin == 'Realaudio') || (whichPlugin == 'RealAudio') ) {
    isItThere = (WM_pluginDetect('RealPlayer', 'rpm', 'audio/x-pn-realaudio-plugin', 'RealPlayer.RealPlayer(tm) ActiveX Control (32-bit)')) || (WM_pluginDetect('RealPlayer', 'rpm', 'audio/x-pn-realaudio-plugin','rmocx.RealPlayer G2 Control')) || (WM_pluginDetect('RealPlayer', 'rpm', 'audio/x-pn-realaudio-plugin','RealPlayer.RealPlayer(tm) ActiveX Control (32-bit)')) || (WM_pluginDetect('RealPlayer', 'rpm', 'audio/x-pn-realaudio-plugin','RealVideo.RealVideo(tm) ActiveX Control (32-bit)'))
  } else {
    alert('You need to tell me which plug-in to look for, like so:\n\n' + '          WM_easyDetect(\'flash\')\n\n' + '          WM_easyDetect(\'director\')\n\n' + '          WM_easyDetect(\'quicktime\')\n\n' + '          WM_easyDetect(\'realaudio\')');
  }
  return isItThere;
}
//*******************************************************************************
//-------------------------------------------------------------------------------
// DHTMLLIB.JS
//-------------------------------------------------------------------------------
//*******************************************************************************
/******************************************************************************
* dhtmllib.js                                                                 *
*                                                                             *
* Copyright 1999 by Mike Hall.                                                *
* Web address: http://www.brainjar.com                                        *
* Last update: February 26, 2000.                                             *
*                                                                             *
* Provides basic functions for DHTML positioned elements which will work on   *
* both Netscape Communicator and Internet Explorer browsers (version 4.0 and  *
* up).                                                                        *
******************************************************************************/

// requiert detect.js
// Compatible NS6 - Nicolas - last modified : 10/12/01 
//-----------------------------------------------------------------------------
// Global var
//-----------------------------------------------------------------------------
var bDHTMLDebug = false;	// show debug (object not found)

//-----------------------------------------------------------------------------
// Common function
//-----------------------------------------------------------------------------
function isNullLayer(layer,strFunc)
{
	if (strFunc == null) strFunc = "";

	if (layer == null)
	{
  	if (bDHTMLDebug) alert(strFunc+" : layer is null");
		return true;
	}
	return false;
}


//-----------------------------------------------------------------------------
// Layer visibility.
//-----------------------------------------------------------------------------
function hideLayer(layer) {
  if (typeof(layer) == "string") layer = getLayer(layer);
	if (isNullLayer(layer,"hide")) return;
	if (layer.visibility != null) layer.visibility = "hide";
  if (layer.style && layer.style.visibility != null) layer.style.visibility = "hidden";
	return;
} // function hideLayer

function showLayer(layer) {
  if (typeof(layer) == "string") layer = getLayer(layer);
	if (isNullLayer(layer,"show")) return;
  if (layer.visibility != null) layer.visibility = "show";
  if (layer.style && layer.style.visibility != null) layer.style.visibility = "visible";
	return;
} // function showLayer

function inheritLayer(layer) {
  if (typeof(layer) == "string") layer = getLayer(layer);
	if (isNullLayer(layer,"inherit")) return;
  if (layer.visibility != null) layer.visibility = "inherit";
  if (layer.style && layer.style.visibility != null) layer.style.visibility = "inherit";
  return;
} // function inheritLayer

function getVisibility(layer) {
  if (typeof(layer) == "string") layer = getLayer(layer);
	if (isNullLayer(layer,"visibility")) return;

  if (layer.visibility != null) {
    if (layer.visibility == "show") return "visible";
    if (layer.visibility == "hide")  return "hidden";
    return layer.visibility;
  }
  if (layer.style && layer.style.visibility != null) return layer.style.visibility;
  return;
} // function getVisibility

function openLayer(layer) {
  if (typeof(layer) == "string") layer = getLayer(layer);
	if (isNullLayer(layer,"display")) return;
  if (layer.style) layer.style.display="block";
  return;
}

function closeLayer(layer) {
  if (typeof(layer) == "string") layer = getLayer(layer);
	if (isNullLayer(layer,"display")) return;
  if (layer.style) layer.style.display="none";
  return;
}

//-----------------------------------------------------------------------------
// Layer content modification.
//-----------------------------------------------------------------------------
function writeLayer(layer,txt) 
{
  if (typeof(layer) == "string") layer = getLayer(layer);
	if (isNullLayer(layer,"write")) return;

  if (isMinNS4) 
	{
		layer.document.close();
	  layer.document.write(txt);
		layer.document.close();
		return;
	}
  if (layer.innerHTML != null) layer.innerHTML = txt;
  else if (layer.document) layer.document.body.innerHTML = txt;
	return;
} // function writeLayer

// keep for compatibility
function writeILayer(layer,txt){  
  if (typeof(layer) == "string") layer = getLayer(layer);
  writeLayer(layer,txt);
  return;
}

function writeILayerOuter(layer,txt)
{
  if (typeof(layer) == "string") layer = getLayer(layer);
	if (isNullLayer(layer,"writeILayer")) return;
  if (isMinNS4)	writeLayer(layer,txt); // pas supporté par NS4
  if (isIENS6) layer.document.body.outerHTML = txt;
  return;
}

//-----------------------------------------------------------------------------
// visibility + positionning.
//-----------------------------------------------------------------------------
function SetOff() {
  var a=SetOff.arguments;
  for (i = 0; i < a.length; i++) {
    hideLayer(a[i]);
  }
}
function SetLayer(IdOn, IdOff, cx, cy) {
  if (IdOn) {
    if (isMinNS4) { cx-=0; cy-=0; }
//    if (isIENS6) {
      cx += getPageScrollX(); 
      cy += getPageScrollY(); 
//    }
  	moveLayerTo(IdOn, cx, cy);
    showLayer(IdOn);
  }
  if (IdOff){
    hideLayer(IdOff);
  }
}

var SL_pull_Int = false;
var SL_pull_To = 30;
var SL_pull_Pad = 15;
var SL_pull_IdOn = false;
var SL_pull_Cy = 0;
var SL_pull_Cx = 0;
function SetLayer_pullengine(IdOn, cy){
  pObj = IdOn;
  if (getClipHeight(pObj) < cy) {
    clipLayer(pObj, 0, 0, getClipRight(pObj), getClipBottom(pObj)+SL_pull_Pad);
  } else {
    clearInterval(SL_pull_Int);
    SL_pull_Int = false;
    SL_pull_IdOn = false;
  }
}

function SetLayer_pull(IdOn, IdOff, cx, cy, bNotPull) {
  if (SL_pull_IdOn) {
    if (SL_pull_Int) clearInterval(SL_pull_Int);
    objOn = getLayer(SL_pull_IdOn);
    clipLayer(objOn, 0, 0, getWidth(objOn)+10, SL_pull_Cy);
  }
  if (bNotPull) return SetLayer(IdOn, IdOff, cx, cy);
  if (IdOff){
    objOff = getLayer(IdOff);
    hideLayer(objOff);
  }
  if (IdOn) {
    SL_pull_IdOn = IdOn;
    objOn = getLayer(IdOn);
    if (isMinNS4) { cx-=0; cy-=0; }
  	moveLayerTo(objOn, cx, cy);
    SL_pull_Cy = getHeight(objOn);
    clipLayer(objOn, 0, 0, getWidth(objOn)+10, 15);
    showLayer(objOn);
    SL_pull_Int = setInterval("SetLayer_pullengine('"+IdOn+"', "+SL_pull_Cy+")", SL_pull_To);
  }
}

function SetLayer_pullengineW(IdOn, cx){
  pObj = IdOn;
  if (getClipWidth(pObj) < cx) {
    clipLayer(pObj, 0, 0, getClipRight(pObj)+SL_pull_Pad, getClipBottom(pObj));
  } else {
    clearInterval(SL_pull_Int);
    SL_pull_Int = false;
    SL_pull_IdOn = false;
  }
}
function SetLayer_pullW(IdOn, IdOff, cx, cy, bNotPull) {
  if (bNotPull) return SetLayer(IdOn, IdOff, cx, cy);
  if (IdOff){
    objOff = getLayer(IdOff);
    hideLayer(objOff);
  }
  if (IdOn) {
    SL_pull_IdOn = IdOn;
    objOn = getLayer(IdOn);
    if (isMinNS4) { cx-=0; cy-=0; }
  	moveLayerTo(objOn, cx, cy);
    SL_pull_Cx = getWidth(objOn);
    clipLayer(objOn, 0, 0, 10, getHeight(objOn)+10);
    showLayer(objOn);
    SL_pull_Int = setInterval("SetLayer_pullengineW('"+IdOn+"', "+SL_pull_Cx+")", SL_pull_To);
  }
}

//-----------------------------------------------------------------------------
// Layer properties.
//-----------------------------------------------------------------------------
function getLeft(layer) {
  if (typeof(layer) == "string") layer = getLayer(layer);
	if (isNullLayer(layer,"left")) return;
  if (layer.left) return layer.left;
  if (layer.style.pixelLeft) return layer.style.pixelLeft;
  if (layer.style.left) return layer.style.left;
  return;
}

function getTop(layer) {
  if (typeof(layer) == "string") layer = getLayer(layer);
	if (isNullLayer(layer,"top")) return;
  if (layer.top) return layer.top;
  if (layer.style.pixelTop) return layer.style.pixelTop;
  if (layer.style.top) return layer.style.top;
  return;
}

function getRight(layer) {
  if (typeof(layer) == "string") layer = getLayer(layer);
	if (isNullLayer(layer,"right")) return;
  return getLeft(layer) + getWidth(layer);
} // function getRight

function getBottom(layer) {
  if (typeof(layer) == "string") layer = getLayer(layer);
	if (isNullLayer(layer,"bottom")) return;
  return getTop(layer) + getHeight(layer);
} // function getBottom

function getPageLeft(layer) {
  if (typeof(layer) == "string") layer = getLayer(layer);
	if (isNullLayer(layer,"left")) return 0;
  if (layer.pageX) return layer.pageX;
  if (isIENS6) {
    x = 0;
    while (layer.offsetParent != null) {
      x += layer.offsetLeft;
      layer = layer.offsetParent;
    }
    x += layer.offsetLeft;
    return x;
  }
  return 0;
}

function getPageRight(layer) {
  if (typeof(layer) == "string") layer = getLayer(layer);
	if (isNullLayer(layer,"right")) return;
	return getPageLeft(layer)+getWidth(layer);
}

function getPageTop(layer) {
  if (typeof(layer) == "string") layer = getLayer(layer);
	if (isNullLayer(layer,"top")) return 0;
  if (layer.pageY) return layer.pageY;
  if (isIENS6) 	{
    y = 0;
    while (layer.offsetParent != null) 		{
      y += layer.offsetTop;
      layer = layer.offsetParent;
    }
    y += layer.offsetTop;
    return y;
  }
  return 0;
}

function getPageBottom(layer) 
{
  if (typeof(layer) == "string") layer = getLayer(layer);
	if (isNullLayer(layer,"bottom")) return;
	return getPageTop(layer)+getHeight(layer);
}

function getHeight(layer) {
  if (typeof(layer) == "string") layer = getLayer(layer);
	if (isNullLayer(layer,"height")) return;
  if (isMinNS4) 
	{
    if (layer.document.height) return layer.document.height;
    else return layer.clip.bottom - layer.clip.top;
  }
  if (parseInt(layer.offsetHeight)) return parseInt(layer.offsetHeight);
  if (layer.style && layer.style.pixelHeight) return layer.style.pixelHeight;
  if (layer.style && layer.style.offsetHeight) return layer.style.offsetHeight;
  if (layer.clientHeight) return layer.clientHeight;
  return 0;
} // function getHeight

function getWidth(layer) {
  if (typeof(layer) == "string") layer = getLayer(layer);
	if (isNullLayer(layer,"width")) return;

  if (isMinNS4) 
	{
    if (layer.document.width) return layer.document.width;
    else return layer.clip.right - layer.clip.left;
  }
  if (parseInt(layer.offsetWidth)) return parseInt(layer.offsetWidth);
  if (layer.style && layer.style.pixelWidth) return layer.style.pixelWidth;
  if (layer.style && layer.style.offsetWidth) return layer.style.offsetWidth;
  if (layer.clientWidth) return layer.clientWidth;
  return 0;
} // function getWidth


function setWidth(layer,iWidth) {
  if (typeof(layer) == "string") layer = getLayer(layer);
	if (isNullLayer(layer,"width")) return;
  if (isMinNS4) 	{
    if (layer.document.width) layer.document.width = iWidth;
    return iWidth;
  }
  if (isMinNS6) {
    layer.offsetWidth = iWidth;
    return iWidth;
  }
  if (isMinIE4) 	{
    if (layer.style) layer.style.pixelWidth = iWidth;
    else layer.clientWidth = iWidth;
    return iWidth;
  }
  return iWidth;
}

function setHeight(layer,iHeight) {
  if (typeof(layer) == "string") layer = getLayer(layer);
	if (isNullLayer(layer,"height")) return;
  if (isMinNS4)
	{
    if (layer.document.height) layer.document.height = iHeight;
  }
  if (isMinNS6) {
    layer.offsetHeight = iHeight;
  }
  if (isMinIE4) 
	{
    if (layer.style.pixelHeight) layer.style.pixelHeight = iHeight;
    else layer.clientHeight = iHeight;
  }
  return iHeight;
}

function getContentHeight(layer) { 
  if (typeof(layer) == "string") layer = getLayer(layer);
	if (isNullLayer(layer,"height")) return;
  if (parseInt(layer.scrollHeight)) return parseInt(layer.scrollHeight);
  if (layer.document.height) return layer.document.height;
  if (layer.clip) return layer.clip.bottom - layer.clip.top;
  return 0;
}

function getContentWidth(layer) { 
  if (typeof(layer) == "string") layer = getLayer(layer);
	if (isNullLayer(layer,"width")) return;
  if (parseInt(layer.scrollWidth)) return parseInt(layer.scrollWidth);
  if (layer.document.width) return layer.document.width;
  if (layer.clip) return layer.clip.right - layer.clip.left;
  return 0;
}

function resizeLayerTo(layer, pWidth, pHeight)
{
  if (typeof(layer) == "string") layer = getLayer(layer);
	if (isMinNS4)
	{
		layer.height = pHeight;
		layer.width = pWidth;
	}
  if (isIENS6)
  {
  	layer.style.width = pWidth;
  	layer.style.height = pHeight;
  }
  return;
}

//-----------------------------------------------------------------------------
// Move Layer
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// Move Layer
//-----------------------------------------------------------------------------
function moveLayerTo(layer, x, y, bInScreen, strPosX, strPosY) {
  var dx = 0;
  var dy = 0;
  switch(strPosX) {
    case "left": dx = -getWidth(layer); break;
    case "right": dx = +getWidth(layer); break;
  }
  switch(strPosY) {
    case "bottom": dy = +getHeight(layer); break;
    case "top": dy = -getHeight(layer); break;
  }
  if (bInScreen) return moveLayerToInScreen(layer, x, y, dx, dy);
  if (typeof(layer) == "string") layer = getLayer(layer);
	if (isNullLayer(layer,"moveto ")) return;
  if (layer.moveTo) layer.moveTo(parseInt(x), parseInt(y));

  if (isIENS6) {
    var obj = layer.offsetParent;
    while (obj != null) {
      x -= parseInt(obj.offsetLeft, 10);
      y -= parseInt(obj.offsetTop, 10);
      obj = obj.offsetParent;
    }
  }

  if (layer.style && layer.style.pixelLeft != null) {
    layer.style.pixelLeft = x;
    layer.style.pixelTop  = y;
  }
  else
  if (layer.style && layer.style.left != null) {
    layer.style.left = x+"px";
    layer.style.top = y+"px";
	}
  return;
} // function moveLayerTo
function moveLayerToInScreen(layer, x, y, dx, dy, strPosX, strPosY) {
  if (typeof(layer) == "string") layer = getLayer(layer);

  if (x == null) x = getPageLeft(layer);
  if (y == null) y = getPageTop(layer);
  if (dx == null) dx = 0;
  if (dy == null) dy = 0;

  switch(strPosX) {
    case "left": dx -= getWidth(layer); break;
    case "right": dx += getWidth(layer); break;
  }
  switch(strPosY) {
    case "bottom": dy += getHeight(layer); break;
    case "top": dy -= getHeight(layer); break;
  }
  
  iLeft = x+dx ;
  iRight = iLeft + getWidth(layer);
  iTop = y+dy;
  iBottom = iTop + getHeight(layer);
  
  iLeftwin = getPageScrollX();
  iRightwin = iLeftwin+getWindowWidth();
  iTopwin = getPageScrollY();
  iBottomwin = iTopwin+getWindowHeight();
  
	ix = (iRight > iRightwin) ? iRightwin - getWidth(layer) : iLeft;
	iy = (iBottom > iBottomwin) ? iBottomwin - getHeight(layer) : iTop;
	
	if (ix < iLeftwin) ix = iLeftwin;
	if (iy < iTopwin) iy = iTopwin;
	
  return moveLayerTo(layer, ix, iy, 0);
}

function setLayerTop(layer,y)
{
  if (typeof(layer) == "string") layer = getLayer(layer);
	if (isNullLayer(layer,"moveto")) return;
  if (layer.moveTo) {layer.moveTo(getLeft(layer), parseInt(y));return}
  if (layer.style && layer.style.pixelTop != null) {layer.style.pixelTop  = y;return}
  if (layer.style && layer.style.top != null) {layer.style.top = y+"px";return}
  return;
}

function setLayerLeft(layer,x)
{
  if (typeof(layer) == "string") layer = getLayer(layer);
	if (isNullLayer(layer,"moveto")) return;
  if (layer.moveTo) {layer.moveTo(parseInt(x), getTop(layer));return}
  if (layer.style && layer.style.pixelLeft != null) {layer.style.pixelLeft = x;return}
  if (layer.style && layer.style.left != null) {layer.style.left = x+"px";return}
  return;
}


function moveLayerBy(layer, dx, dy) {
  if (typeof(layer) == "string") layer = getLayer(layer);
	if (isNullLayer(layer,"moveby")) return;
  if (layer.moveBy) {layer.moveBy(dx, dy);return}
  if (layer.style && layer.style.pixelLeft != null) {
    layer.style.pixelLeft += dx;
    layer.style.pixelTop  += dy;
    return;
  }
  if (layer.style && layer.style.left != null) {
    layer.style.left = parseInt(layer.style.left) + dx+"px";
    layer.style.top  = parseInt(layer.style.top) + dy+"px";
  }
  return;
}

function moveLayerToLayer(layer, ilayer, dx , dy, bInScreen, strPosX, strPosY)
{
  if (typeof(layer) == "string") layer = getLayer(layer);
  if (typeof(ilayer) == "string") ilayer = getLayer(ilayer);
  if (dx == null) dx = 0;
  if (dy == null) dy = 0;
	if (isNullLayer(layer, "movelayertolayer : layer") || isNullLayer(ilayer,"movelayertolayer :ilayer")) return;
  moveLayerTo(layer, getPageLeft(ilayer)+dx, getPageTop(ilayer)+dy, bInScreen, strPosX, strPosY);
  return;
} // function moveLayerToLayer

function moveLayerToEvent(layer, e, dx , dy, bInScreen, strPosX, strPosY)
{
  if (typeof(layer) == "string") layer = getLayer(layer);
	if (isNullLayer(layer, "movelayertoevent : "+layer)) return;
  if (dx == null) dx = 0;
  if (dy == null) dy = 0;
  moveLayerTo(layer, getPageX(e)+dx, getPageY(e)+dy, bInScreen, strPosX, strPosY);
  return;
} // function moveLayerToEvent

function moveLayerToLayerMv(player,pilayer,distx,disty)
{
  if (typeof(player) == "string") player = getLayer(player);
  if (typeof(pilayer) == "string") pilayer = getLayer(pilayer);

	if (isNullLayer(layer,"movelayertolayer : layer") || isNullLayer(ilayer,"movelayertolayer :ilayer")) return;

	if (!distx && !disty)
	{
		distx = getPageLeft(ilayer) - getPageLeft(layer);
		disty = getPageTop(ilayer) - getPageTop(layer);
	}
	if (distx == 0)	signex = 1;
	else signex = parseInt(Math.abs(distx)/distx);
	if (disty == 0)	signey = 1;
	else signey = parseInt(Math.abs(disty)/disty);
	jx=parseInt(signex*Math.abs(distx)/50);
	jy=parseInt(signey*Math.abs(disty)/50);
	
	while (Math.abs(getPageLeft(layer) - getPageLeft(ilayer)) > Math.abs(jx) ||  Math.abs(getPageTop(layer)- getPageTop(ilayer)) > Math.abs(jy))
	{
		if (Math.abs(getPageLeft(layer) - getPageLeft(ilayer)) <  Math.abs(jx)) jx = 0;
		if (Math.abs(getPageTop(layer) - getPageTop(ilayer)) <  Math.abs(jy)) jy = 0;
		moveLayerBy(layer, jx, jy);
		setTimeout("moveLayerToLayerMv(\""+player+"\",\""+pilayer+"\","+distx+","+disty+")",1);
		return;
	}	
	moveLayerToLayer(player,pilayer);
	return;
}

function centerLayerW(layer) {
  if (typeof(layer) == "string") layer = getLayer(layer);
	if (isNullLayer(layer,"centerw")) return;
	var x = (getPageWidth()-getWidth(layer)) / 2;
	moveLayerTo(layer,x,0);
  return;
}

function centerLayerH(layer) {
  if (typeof(layer) == "string") layer = getLayer(layer);
	if (isNullLayer(layer,"centerh")) return;
	var y = (getPageHeight()-getHeight(layer)) / 2;
	moveLayerTo(layer,0,y);
  return;
}

function centerLayer(layer) {
  if (typeof(layer) == "string") layer = getLayer(layer);
	if (isNullLayer(layer,"center")) return;
	var x = (getPageWidth()-getWidth(layer)) / 2;
	var y = (getPageHeight()-getHeight(layer)) / 2;
	moveLayerTo(layer,x,y);
  return;
}

//-----------------------------------------------------------------------------
// Z-Index
//-----------------------------------------------------------------------------
function getzIndex(layer) {
  if (typeof(layer) == "string") layer = getLayer(layer);
	if (isNullLayer(layer,"z-index")) return;
	if (layer.zIndex) return layer.zIndex;
  if (layer.style) return layer.style.zIndex;
  return 0;
} // function getzIndex

function setzIndex(layer, z) {
  if (typeof(layer) == "string") layer = getLayer(layer);
	if (isNullLayer(layer,"z-index")) return;
  if (layer.zIndex != null) layer.zIndex = z;
  if (layer.style) layer.style.zIndex = z;
  return;
} // function setzIndex

function moveAbove(layer,win)
{
  if (typeof(layer) == "string") layer = getLayer(layer);
	var max=0;
	if (!win) win =window;
  if (isIE) tab = win.document.all.tags("DIV");
  else tab = document.layers;
  
  if (tab)
  {
  	for (i=0;i<tab.length;i++)
  		if (getzIndex(tab[i]) > max) max = getzIndex(tab[i]);
  }
  	
  if (isNS6) layer.moveAbove();  
	else setzIndex(layer, max+1)
  return;
}

function moveBelow(layer,win)
{
  if (typeof(layer) == "string") layer = getLayer(layer);
	var min=0;
	if (!win) win =window;
	if (isIE) tab = win.document.all.tags("DIV");
  else tab = document.layers;
	for (i=0;i<tab.length;i++)
		if (getzIndex(tab[i]) < min) min = getzIndex(tab[i]);
	
	if (isNS6) layer.moveAbove();  
  else setzIndex(layer, min-1)
  return;
}


//-----------------------------------------------------------------------------
// Layer clipping.
//-----------------------------------------------------------------------------
function clipLayer(layer, clipleft, cliptop, clipright, clipbottom) {
  if (typeof(layer) == "string") layer = getLayer(layer);
	if (isNullLayer(layer,"clip")) return;

  if (isMinNS4) {
    layer.clip.left   = clipleft;
    layer.clip.top    = cliptop;
    layer.clip.right  = clipright;
    layer.clip.bottom = clipbottom;
  }
  if (isIENS6)
    layer.style.clip = 'rect(' + cliptop + ' ' +  clipright + ' ' + clipbottom + ' ' + clipleft +')';
  return;
}

function getClipLeft(layer) {
  if (typeof(layer) == "string") layer = getLayer(layer);
	if (isNullLayer(layer,"clipleft")) return;

  if (isMinNS4)
    return layer.clip.left;
  if (isIENS6) {
    var str =  layer.style.clip;
    if (!str)
      return 0;
    var clip = getIEClipValues(layer.style.clip);
    return(clip[3]);
  }
  return;
}

function getClipTop(layer) {
  if (typeof(layer) == "string") layer = getLayer(layer);
	if (isNullLayer(layer,"cliptop")) return;

  if (isMinNS4)
    return layer.clip.top;
  if (isIENS6) {
    var str =  layer.style.clip;
    if (!str)
      return 0;
    var clip = getIEClipValues(layer.style.clip);
    return clip[0];
  }
  return;
}

function getClipRight(layer) {
  if (typeof(layer) == "string") layer = getLayer(layer);
	if (isNullLayer(layer,"clipright")) return;

  if (isMinNS4)
    return layer.clip.right;
  if (isIENS6) {
    var str =  layer.style.clip;
    if (!str)
      return layer.style.pixelWidth;
    var clip = getIEClipValues(layer.style.clip);
    return clip[1];
  }
  return;
}

function getClipBottom(layer) {
  if (typeof(layer) == "string") layer = getLayer(layer);
	if (isNullLayer(layer,"clipbottom")) return;

  if (isMinNS4)
    return layer.clip.bottom;
  if (isIENS6) {
    var str =  layer.style.clip;
    if (!str)
      return layer.style.pixelHeight;
    var clip = getIEClipValues(layer.style.clip);
    return clip[2];
  }
  return;
}

function getClipWidth(layer) {
  if (typeof(layer) == "string") layer = getLayer(layer);
	if (isNullLayer(layer,"clipwidth")) return;

  if (isMinNS4)
    return layer.clip.width;
  if (isIENS6) {
    var str = layer.style.clip;
    if (!str)
      return layer.style.pixelWidth;
    var clip = getIEClipValues(layer.style.clip);
    return clip[1] - clip[3];
  }
  return;
}

function getClipHeight(layer) {
  if (typeof(layer) == "string") layer = getLayer(layer);
	if (isNullLayer(layer,"clipheight")) return;

  if (isMinNS4) return layer.clip.height;
  if (isIENS6) {
    var str =  layer.style.clip;
    if (!str)
      return layer.style.pixelHeight;
    var clip = getIEClipValues(layer.style.clip);
    return clip[2] - clip[0];
  }
  return;
}

function getIEClipValues(str) {
  var clip = new Array();
  var i;

  // Parse out the clipping values for IE layers.

  i = str.indexOf("(");
  clip[0] = parseInt(str.substring(i + 1, str.length), 10);
  i = str.indexOf(" ", i + 1);
  clip[1] = parseInt(str.substring(i + 1, str.length), 10);
  i = str.indexOf(" ", i + 1);
  clip[2] = parseInt(str.substring(i + 1, str.length), 10);
  i = str.indexOf(" ", i + 1);
  clip[3] = parseInt(str.substring(i + 1, str.length), 10);
  return clip;
}

//-----------------------------------------------------------------------------
// Layer scrolling.
//-----------------------------------------------------------------------------
function scrollLayerTo(layer, x, y, bound) {
  if (typeof(layer) == "string") layer = getLayer(layer);
	if (isNullLayer(layer,"scroll")) return;

  var dx = getClipLeft(layer) - x;
  var dy = getClipTop(layer) - y;

  scrollLayerBy(layer, -dx, -dy, bound);
  return;
}

function scrollLayerBy(layer, dx, dy, bound) {
  if (typeof(layer) == "string") layer = getLayer(layer);
	if (isNullLayer(layer,"scrollby")) return;

  var cl = getClipLeft(layer);
  var ct = getClipTop(layer);
  var cr = getClipRight(layer);
  var cb = getClipBottom(layer);

  if (bound) {
    if (cl + dx < 0)
      dx = -cl;
    else if (cr + dx > getWidth(layer))
      dx = getWidth(layer) - cr;
    if (ct + dy < 0)
      dy = -ct;
    else if (cb + dy > getHeight(layer))
      dy = getHeight(layer) - cb;
  }
	
	if (getClipHeight(layer) >= layer.document.height)
		dy = 0;
	if (getClipWidth(layer) >= layer.document.width)
		dx = 0;

  clipLayer(layer, cl + dx, ct + dy, cr + dx, cb + dy);
  moveLayerBy(layer, -dx, -dy);
  return;
}

//-----------------------------------------------------------------------------
// Layer background.
//-----------------------------------------------------------------------------
function getBgColor(layer) {
  if (typeof(layer) == "string") layer = getLayer(layer);
	if (isNullLayer(layer,"bgcolor")) return;
  if (isMinNS4)  return layer.bgColor;
  if (isIENS6) return layer.style.backgroundColor;
}

function getForeColor(layer) {
  if (typeof(layer) == "string") layer = getLayer(layer);
	if (isNullLayer(layer,"color")) return;
  if (isMinNS4) return layer.color;
  if (isIENS6)	return layer.style.color;
}

function getBorderColor(layer) {
  if (typeof(layer) == "string") layer = getLayer(layer);
	if (isNullLayer(layer,"bordercolor")) return;
  if (isMinNS4) return layer.bordercolor;
 	if (isIENS6) return layer.style.borderColor;
}

function setBgColor(layer, color) {
  if (!color.match(/^(\d|[a-fA-F]){6}$/)) return; 
  if (typeof(layer) == "string") layer = getLayer(layer);
	if (isNullLayer(layer,"bgcolor")) return;
  if (isMinNS4) layer.bgColor = color;
  if (isIENS6) layer.style.backgroundColor = color;
  return;
}

function setForeColor(layer, color) {
  if (typeof(layer) == "string") layer = getLayer(layer);
	if (isNullLayer(layer,"color")) return;
  if (isMinNS4) layer.color = color;
	if (isIENS6) layer.style.color = color;
  return;
}

function setBorderColor(layer,color)
{
  if (typeof(layer) == "string") layer = getLayer(layer);
	if (isNullLayer(layer,"bordercolor")) return;
  if (isMinNS4) layer.bordercolor = color;
	if (isIENS6) layer.style.borderColor = color;
  return;
}

function setBgImage(layer, src) {
  if (typeof(layer) == "string") layer = getLayer(layer);
	if (isNullLayer(layer,"bgimage")) return;
  if (isMinNS4) layer.background.src = src;
  if (isIENS6) layer.style.backgroundImage = "url(" + src + ")";
}

//-----------------------------------------------------------------------------
// Layer creation.
//-----------------------------------------------------------------------------
// Compatible IE & NS
function createLayer(p_name,p_style,p_action,p_src)
{
	if (!p_style) p_style="";
	if (!p_action) p_action="";
	if (!p_src)	p_src="#";
	
	if (isMinNS4 || isMinNS6)
	{
		if (p_style) p_style = styleToNS(p_style);
		document.write("<layer "+p_style+" name=\""+p_name+"\" id=\""+p_name+"\" "+p_action+">"+p_src+"</layer>");
	}
	
  if (isMinIE4)	document.write("<div name=\""+p_name+"\" id=\""+p_name+"\" style='"+p_style+"' "+p_action+" >"+p_src+"</div>");

	l_lay = getLayer(p_name);
	if (isMinNS4)	l_lay.innerHTML = p_src;

	return l_lay;
}

function styleToNS(p_style)
{
	aTab=p_style.split(";");
	for (i=0;i<aTab.length;i++)
		aTab[i]=aTab[i].replace(/:/g,"='")+"'";

	p_style = aTab.toString();
	p_style = p_style.replace(/,/g," ");
	p_style = p_style.replace(/background-color/g,"bgcolor");
	p_style = p_style.replace(/border='[^']*'/,"border=1");
	return p_style;
}

function createILayer(p_name,p_style,p_action,p_src)
{
	if (!p_style) p_style="";
	if (!p_src) p_src="#";
	if (!p_action) p_action="";	

	if (isMinNS4 || isMinNS6) 
	{
		if (p_style) p_style = styleToNS(p_style);		
		document.write("<ilayer src=\""+p_src+"\" "+p_style+" name=\""+p_name+"\" id=\""+p_name+"\" "+p_action+"></ilayer>");
	}
  if (isMinIE4){
		document.write("<iframe style='"+p_style+"' name=\""+p_name+"\" id=\""+p_name+"\" "+p_action+" src=\""+p_src+"\"></iframe>");
	}
	return;
}


//-----------------------------------------------------------------------------
// Find Layer
//-----------------------------------------------------------------------------
function getFrame(p_name, win) {

	if (win == null) win = window;
	if (isMinNS4) return findLayer(p_name, win.document);
  if (isMinIE4) return win.document.frames(p_name);
  return;
}

function getLayer(p_name, win) {
	if (win == null) win = window;
  if (typeof(p_name) == "object") return p_name ;
  if (isMinIE5 || isMinNS6)	return (win.document.getElementById(p_name));
	if (isMinNS4)  return findLayer(p_name, win.document);
	if (isMinIE4) return win.document.all(p_name);
  return (win.document.getElementById(p_name));
}

function findLayer(p_name, doc) {
  var i, layer;
  for (i = 0; i < doc.layers.length; i++) {
    layer = doc.layers[i];
    if (layer.name == p_name || layer.id == p_name) return layer;
    if (layer.document.layers.length > 0)
      if ((layer = findLayer(p_name, layer.document)) != null) return layer;
  }
  return null;
}

//-----------------------------------------------------------------------------
// Page & Window properties.
//-----------------------------------------------------------------------------
function getWindowWidth(win) {
	if (!win) win=window;
  if (win.innerWidth) return win.innerWidth;
  if (win.document.documentElement && document.documentElement.clientWidth) return win.document.documentElement.clientWidth;
  if (win.document.body) return win.document.body.clientWidth;
  return -1;
} // function getWindowWidth

function getWindowHeight(win) {
	if (!win) win=window;
  if (win.innerHeight) return win.innerHeight;
  if (win.document.documentElement && document.documentElement.clientHeight) return win.document.documentElement.clientHeight;
  if (win.document.body) return win.document.body.clientHeight;
  return -1;
} // function getWindowHeight

function getPageWidth(win) {
  if (!win) win=window;
  var h = 0 ;
  if ((win.document.width)&&(h<win.document.width)) h=win.document.width ;
  if (win.document.body)
  {
    if ((win.document.body.offsetWidth)&&(h<win.document.body.offsetWidth)) h=win.document.body.offsetWidth ;
    if ((win.document.body.scrollWidth)&&(h<win.document.body.scrollWidth)) h=win.document.body.scrollWidth ; 
  }
  return h;
}

function getPageHeight(win) {
  if (!win) win=window;
  var h = 0 ;
  if ((win.document.height)&&(h<win.document.height)) h=win.document.height ;
  if (win.document.body)
  {
    if ((win.document.body.offsetHeight)&&(h<win.document.body.offsetHeight)) h=win.document.body.offsetHeight ;
    if ((win.document.body.scrollHeight)&&(h<win.document.body.scrollHeight)) h=win.document.body.scrollHeight ;
  }
  return h;
}

function getPageScrollX(win) {
	if (!win) win=window;
  if (win.pageXOffset) return win.pageXOffset;
  doc = (win.document.documentElement && win.document.documentElement.scrollLeft) ? win.document.documentElement : win.document.body;
  if (doc && doc.scrollLeft) return doc.scrollLeft;
  return 0;
} // function getPageScrollX(win) {

function getPageScrollY(win) {
	if (!win) win=window;
  if (win.pageYOffset) return win.pageYOffset;
  doc = (win.document.documentElement && win.document.documentElement.scrollTop) ? win.document.documentElement : win.document.body;
  if (doc && doc.scrollTop) return doc.scrollTop;
  return 0;
} // function getPageScrollY

//-----------------------------------------------------------------------------
// Event properties.
//-----------------------------------------------------------------------------
function getPageX(e,win) 
{
  if (e.pageX) return e.pageX;
  if (e.clientX) return e.clientX + getPageScrollX(win);
  return;
} // function getPageX

function getPageY(e,win) 
{
  if (e.pageY) return e.pageY;
  if (e.clientY) return e.clientY + getPageScrollY(win);
  return;
} // function getPageY


function getElement(sObj)
{
  if (document.all) return document.all(sObj);
  if (document.getElementById) return document.getElementById(sObj);
  return eval("document."+sObj);
}

function getPageVisibleHeight() {
  if (window.innerHeight) return window.innerHeight;
  if (document.body.clientHeight) return document.body.clientHeight;
  return -1;
} // function getPageVisibleHeight

function getPageVisibleWidth() {
  if (window.innerWidth) return window.innerWidth;
  if (document.body.clientWidth) return document.body.clientWidth;
  return -1;
} // function getPageVisibleWidth

function isDef() {
  for(var i=0; i<arguments.length; ++i){if(typeof(arguments[i])=='undefined') return false;}
  return true;
}

//*******************************************************************************
//-------------------------------------------------------------------------------
// WINUTILS.JS
//-------------------------------------------------------------------------------
//*******************************************************************************
// Window Properties
function getWindowWidth(win) 
{
	if (! win) win = window;
  if (isMinNS4)  return win.innerWidth;
  if (isMinIE4) return win.document.body.clientWidth;
  return -1;
}
	
function getWindowHeight(win) 
{
	if (!win) win = window;
  if (isMinNS4) return win.innerHeight;
  if (isMinIE4) return win.document.body.clientHeight;
  return -1;
}

// centre la fenetre sur l'ecran
function center(win){
	if (!win) win = window;
		
	win.moveTo((screen.availWidth-getWindowWidth(win))/2,(screen.availHeight-getWindowHeight(win))/2);
  win.focus();
	return win;
}

// Test l'existence d'une fenetre
function ExistsWin(pWin)
{
	if (pWin && pWin.open && !pWin.closed)
		return pWin;
	else
		return false;
}

function Pop2Print(strUrl, strName, isizeX, isizeY) {
  var iPop2Print = null;
  iPop2Print = window.open(strUrl, strName, 'width='+isizeX+',height='+isizeY+',toolbar=no,scrollbars=yes,statusbar=no,menubar=yes,left=15,top=15,resizable=yes,personalbar=no,locationbar=no');
  if (iPop2Print) iPop2Print.focus();
  if (! isMinIE4) iPop2Print.print();
}

function PopWindow(strUrl, strName) {
  var iPopWindow = null;
  iPopWindow = window.open(strUrl, strName);
  if (iPopWindow) iPopWindow.focus();
}

function Pop2Show(strUrl, strName, isizeX, isizeY) {
  var iPop2Show = null;
  iPop2Show = window.open(strUrl, strName, 'width='+isizeX+',height='+isizeY+',toolbar=no,scrollbars=no,statusbar=no,menubar=no,left=15,top=15,resizable=yes,personalbar=no,locationbar=no');
//  if (iPop2Show) iPop2Show.focus();
}

function Pop2ShowSta(strUrl, strName, isizeX, isizeY) { // avec status
  var P2S = null;
  P2S = window.open(strUrl, strName, 'width='+isizeX+',height='+isizeY+',toolbar=no,scrollbars=no,statusbar=yes,menubar=no,left=15,top=15,resizable=yes,personalbar=no,locationbar=no');
  if (P2S) P2S.focus();
}

function Pop2ShowR(strUrl, strName, isizeX, isizeY) { // non resizable
  var P2S = null;
  P2S = window.open(strUrl, strName, 'width='+isizeX+',height='+isizeY+',toolbar=no,scrollbars=no,statusbar=no,menubar=no,left=15,top=15,resizable=no,personalbar=no,locationbar=no');
  if (P2S) P2S.focus();
}

function Pop2ShowS(strUrl, strName, isizeX, isizeY) { // avec scroll
  var P2S = null;
  P2S = window.open(strUrl, strName, 'width='+isizeX+',height='+isizeY+',toolbar=no,scrollbars=yes,statusbar=no,menubar=no,left=15,top=15,resizable=no,personalbar=no,locationbar=no');
  if (P2S) P2S.focus();
}

function Pop2ShowSR(strUrl, strName, isizeX, isizeY) { // avec scroll + resizable
  var P2S = null;
  P2S = window.open(strUrl, strName, 'width='+isizeX+',height='+isizeY+',toolbar=no,scrollbars=yes,statusbar=no,menubar=no,left=15,top=15,resizable=yes,personalbar=no,locationbar=no');
  if (P2S) P2S.focus();
}

function Pop2ShowC(strUrl, strName, isizeX, isizeY, bScroll) {
  cxx = (screen.width / 2) - (isizeX / 2);
  cyy = (screen.height / 2) - (isizeY / 2);
  var Pop2Show = null;
  if (bScroll)
    Pop2Show = window.open(strUrl, strName, 'width='+isizeX+',height='+isizeY+',toolbar=no,scrollbars=yes,statusbar=no,menubar=yes,left='+cxx+',top='+cyy+',resizable=no,personalbar=no,locationbar=no');
  else 
    Pop2Show = window.open(strUrl, strName, 'width='+isizeX+',height='+isizeY+',toolbar=no,scrollbars=no,statusbar=no,menubar=yes,left='+cxx+',top='+cyy+',resizable=no,personalbar=no,locationbar=no');
  if (Pop2Show) Pop2Show.focus();
}

function Pop2ShowCNM(strUrl, strName, isizeX, isizeY, bScroll, bFocus) {
  cxx = (screen.width / 2) - (isizeX / 2);
  cyy = (screen.height / 2) - (isizeY / 2);
  var Pop2S = null;
  if (bScroll)
    Pop2S = window.open(strUrl, strName, 'width='+isizeX+',height='+isizeY+',toolbar=no,scrollbars=yes,statusbar=no,menubar=no,left='+cxx+',top='+cyy+',resizable=no,personalbar=no,locationbar=no');
  else 
    Pop2S = window.open(strUrl, strName, 'width='+isizeX+',height='+isizeY+',toolbar=no,scrollbars=no,statusbar=no,menubar=no,left='+cxx+',top='+cyy+',resizable=no,personalbar=no,locationbar=no');
  if (bFocus && Pop2S) Pop2S.focus();
}

function PopImg(fic, x, y, sTitle, bScroll, bInTable, sClose) {
  var oPopImg = null;
  var sPopImg = '';

  var cxx = (screen.width / 2) - (x / 2);
  var cyy = (screen.height / 2) - (y / 2);
  var sScr = (bScroll) ? "yes" : "no";
  var sClose = (sClose) ? sClose : "Cliquez pour fermer la fen&ecirc;tre";
  oPopImg=window.open('','pop','width='+x+',height='+y+',toolbar=no,scrollbars='+sScr+',statusbar=no,titlebar=no,menubar=no,left='+cxx+',top='+cyy+',resizable=no,personalbar=no,locationbar=no');
  var sStartJS = '<scr'+''+'ipt language="JavaScript" > \
    function setClientSize(win, W, H)  {\
      win.resizeTo(W, H); \
      var cp = document.createElement("div"); \
      cp.style.position = "absolute"; \
      cp.style.width = "0px"; \
      cp.style.height = "0px"; \
      cp.style.right = "0px"; \
      cp.style.bottom = "0px"; \
      document.body.appendChild(cp); \
      var current_width = cp.offsetLeft; \
      var current_height = cp.offsetTop; \
      var dw = W - current_width; \
      var dh = H - current_height; \
      win.resizeBy(dw, dh); \
      document.body.removeChild(cp); \
      return { missed_width: dw, missed_height: dh }; \
    } \
    function PopImgShow(fic, isIENS6, x, y) { \
      var im = document.getElementById("im"); \
      im.src = fic; \
      while (isIENS6 && !im.complete) { \
        setTimeout("PopImgShow(\'"+fic+"\', "+parseInt(isIENS6)+", "+x+", "+y+");", 1500); \
        return; \
      } \
      var popimgonload = document.getElementById("popimgonload"); \
      popimgonload.style.display="none"; \
      var aim = document.getElementById("aim"); \
      aim.style.display="block"; \
      setClientSize(window, x, y); \
    } ';
  sStartJS += 'var im = new Image();im.src="'+fic+'";</scr'+''+'ipt>';
  sStart = '<div id="popimgonload" name="popimgonload" class="popimg" style="position:absolute;top:0px;left:0px;z-index:10;background-color:#FFF;color:#000;width:'+x+'px;height:'+y+'px;padding-top:'+Math.floor(y/2)+'px;text-align:center;"><h2>En cours de chargement...</h2></div>';
  sPopImg = '<html><head><title>'+sTitle+'</title>';
  sEnd = '<scr'+''+'ipt language="JavaScript" >';
  isOK = (isIENS6) ? 1 : 0;
  sEnd += "PopImgShow('"+fic+"',"+parseInt(isOK)+", "+x+", "+y+");";
  sEnd += "</script>";

  sPopImg += sStartJS+'</head><body style="margin:0;padding:0">'+sStart+'<a href="javascript:self.close();" id="aim" style="display:none;position:absolute;top:0px;left:0px;z-index:0;" title="'+sClose+'"><img src="/images/im_shim.gif" id="im" style="position:relative;margin:0;padding:0;border:0" alt="'+sClose+'"></a>';
  sPopImg += sEnd+'</body></html>';
  oPopImg.document.clear();
  oPopImg.document.open();
  oPopImg.document.write(sPopImg);
  oPopImg.document.close();
  oPopImg.focus();
}

function FullEcran(strUrl) {
  var Fen_imprim = null;
  Fenl=screen.width-50;
  FenL=screen.height-100;
  Fen_imprim = window.open(strUrl,'Pleinecran','width='+Fenl+',height='+FenL+',top=0,left=0,resizable=yes,toolbar=yes,scrollbars=yes,menubar=yes,statusbar=no');
  Fen_imprim.focus();
}

// Fenetre sans barre du haut ! IE seulement
var splashWin, autoCloseTimeoutHandle, ontopIntervalHandle;
function Pop2ShowNoBar(sUrl, sName, width, height, left, top, autoCloseTime) {

	var w = window.screen.width;
	var h = window.screen.height;
	var l = (left != null) ? left : (w-width)/2;
	var t = (top != null) ? top : (h-height)/2;
	
	splashWin = window.open(sUrl, sName, 'fullscreen=1,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0');

	splashWin.blur();	// Hide while updating
	window.focus();
	
	splashWin.resizeTo(width,height);
	splashWin.moveTo(l, t);

	splashWin.focus();
	
	ontopIntervalHandle = splashWin.setInterval("window.opener.splashWin.focus();", 50);
	splashWin.document.body.onbeforeunload = function() {
		// Splash is being closed. no need to close it again
		window.clearInterval(autoCloseTimeoutHandle);
		window.onbeforeunload = null;
	};
	
	splashWin.document.body.onload = function() {splashWin.setInterval("window.opener.splashWin.focus();", 50);};
	
	window.clearTimeout(autoCloseTimeoutHandle);	// in case some one calls this twice	
	if (autoCloseTime != null && autoCloseTime > 0) {
		autoCloseTimeoutHandle = window.setTimeout("splashWin.close()", autoCloseTime);
	}
	
	window.onbeforeunload = function() {splashWin.close();};	// Close splash when this page is unloaded
}
//*******************************************************************************
//-------------------------------------------------------------------------------
// DATE.JS
//-------------------------------------------------------------------------------
//*******************************************************************************
function tableau() {
  this.length = tableau.arguments.length
  for (var i = 0; i < this.length; i++)
  this[i+1] = tableau.arguments[i]
}

var tablJour = new tableau("Dimanche","Lundi","Mardi","Mercredi","Jeudi","Vendredi","Samedi");
var tablMois = new tableau("Janvier","F&eacute;vrier","Mars","Avril","Mai","Juin","Juillet","Ao&ucirc;t","Septembre","Octobre","Novembre","D&eacute;cembre");
var DateJour = new Date();

function date() {
  document.write(tablJour[(DateJour.getDay()+1)]," ",DateJour.getDate()," ");
  document.write(tablMois[(DateJour.getMonth()+1)]," ");
  if (!document.all) {
    document.write((DateJour.getFullYear()));
  } else {
    document.write(DateJour.getFullYear());
  }
}

function dateShort() {
  document.write(tablJour[(DateJour.getDay()+1)]," ",DateJour.getDate()," ");
  document.write(tablMois[(DateJour.getMonth()+1)]);
}

function time() {
  document.write(DateJour.getHours(),":",DateJour.getMinutes());
}

function TestTime(strTime)
{
// format testé 00:00:00
  re = /^(\d{1,2}):(\d{1,2}):?(\d{1,2})?$/;
  MyArray = re.exec(strTime);
  if (!MyArray) return false;
  iHou = MyArray[1];
  iMin = MyArray[2];
  if (MyArray.length > 3) {
    iSec = MyArray[3];
    if (iSec < 0 && iSec > 59) return false;
  }
  if (iHou < 0 || iHou > 23) return false;
  if (iMin < 0 && iMin > 59) return false;
  return true;
}

function checkDate(iDay, iMonth, iYear) {
  if (iMonth < 1 || iMonth > 12) return false;
  if (iMonth == 2 && iDay > 28) {
    if (iYear%4 != 0) return false;
    if (iDay > 29) return false;
  } else
  if ((iMonth == 4 || iMonth == 6 || iMonth == 9 || iMonth == 11) && iDay > 30) {
    return false;
  } else 
  if (iDay > 31) return false;
  return true;
}

function TestDate(strDate)
{
 // format testé AAAA-MM-JJ HH:MM:SS
  re = /^(\d{4})-(\d{2})-(\d{2})\s?(\d{1,2}:\d{1,2}:\d{1,2})?$/;
  MyArray = re.exec(strDate);
  if (MyArray) {
    iDay = Number(MyArray[3]);
    iMonth = Number(MyArray[2]);
    iYear = Number(MyArray[1]);
    if (!checkDate(iDay, iMonth, iYear)) return false;
    if (MyArray[4]) if (!TestTime(MyArray[4])) return false;
    return true;
  }
// format testé JJ/MM/AAAA
  re1 = /^(\d{1,2})[- \/](\d{1,2})[- \/](\d{2}|\d{4})$/;
  MyArray = re1.exec(strDate);
  if (MyArray) {
    iDay = Number(MyArray[1]);
    iMonth = Number(MyArray[2]);
    iYear = Number(MyArray[3]);
    if (!checkDate(iDay, iMonth, iYear)) return false;
    return true;
  }
  return false;
}

function SetDateToSql(strDate) {
  if (!TestDate(strDate)) return false;
  sDate = strDate;
  re1 = /^(\d{1,2})[- \/](\d{1,2})[- \/](\d{2}|\d{4})$/;
  MyArray = re1.exec(strDate);
  if (MyArray) {
    iYear = Number(MyArray[3]);
    if (iYear < 100) iYear+=2000;
    iMonth = Number(MyArray[2]);
    sMonth = (iMonth < 10) ? "0"+iMonth : String(iMonth);
    iDay = Number(MyArray[1]);
    sDay = (iDay < 10) ? "0"+iDay : String(iDay);
    sDate = String(iYear)+"-"+sMonth+"-"+sDay;
  }
  return sDate;
}

function TestDateFR(strDate)
{ // format testé : date francaise JJ/MM/AAAA
  re1 = /^(\d{1,2})[- \/](\d{1,2})[- \/](\d{2}|\d{4})$/;
  MyArray = re1.exec(strDate);
  if (MyArray) {
    iDay = Number(MyArray[1]);
    iMonth = Number(MyArray[2]);
    iYear = Number(MyArray[3]);
    if (!checkDate(iDay, iMonth, iYear)) return false;
    return true;
  }
  return false;
}

function SetFRDateToSql(strDate) {
//Passe une date francaise 28/04/1977 en date 1977-04-28 - Modif Dam accepte JJMMAA(AA)
  //if (!TestDateFR(strDate)) return strDate;
  sDate = strDate;
  re1 = /^(\d{1,2})[- \/](\d{1,2})[- \/](\d{2}|\d{4})$/;
  MyArray = re1.exec(strDate);
  bFormatOK = false;
  if (MyArray) {
    iYear = Number(MyArray[3]);
    iMonth = Number(MyArray[2]);
    iDay = Number(MyArray[1]);
    bFormatOK = true;
  } else {
    re1 = /^(\d{2})(\d{2})(\d{2}|\d{4})$/;
    MyArray = re1.exec(strDate);
    if (MyArray) {
      iYear = Number(MyArray[3]);
      iMonth = Number(MyArray[2]);
      iDay = Number(MyArray[1]);
      bFormatOK = true;
    }
  }
  if (!bFormatOK) return strDate;
  if (!checkDate(iDay, iMonth, iYear)) return strDate;
  if (iYear < 100) iYear+=2000;
  sMonth = (iMonth < 10) ? "0"+iMonth : String(iMonth);
  sDay = (iDay < 10) ? "0"+iDay : String(iDay);
  sDate = String(iYear)+"-"+sMonth+"-"+sDay;
  return sDate;
}

function SetSqlDateToFrDat(strDate) {
//Passe une date sql courte 1977-04-28 en date francaise courte 28/04/1977
  if (!TestDate(strDate)) return strDate;
  sDate = strDate;
  re1 = /^(\d{4})[- \/](\d{1,2})[- \/](\d{2}|\d{1,2})$/;
  MyArray = re1.exec(strDate);
  if (MyArray) {
    iYear = Number(MyArray[1]);
    if (iYear < 100) iYear+=2000;
    iMonth = Number(MyArray[2]);
    sMonth = (iMonth < 10) ? "0"+iMonth : String(iMonth);
    iDay = Number(MyArray[3]);
    sDay = (iDay < 10) ? "0"+iDay : String(iDay);
    sDate = sDay+"/"+sMonth+"/"+String(iYear);
  }
  return sDate;
}

function SetFullSqlDateToFrDat(strDate) {
//Passe une date sql longue 1977-04-28 00:00:00 en date francaise courte 28/04/1977
  if (!TestDate(strDate)) return strDate;
  sDate = strDate;
  adat = (strDate.split(" "))[0];
  strDate=adat;  
  re1 = /^(\d{4})[- \/](\d{1,2})[- \/](\d{2}|\d{1,2})$/;
  MyArray = re1.exec(strDate);
  if (MyArray) {
    iYear = Number(MyArray[1]);
    if (iYear < 100) iYear+=2000;
    iMonth = Number(MyArray[2]);
    sMonth = (iMonth < 10) ? "0"+iMonth : String(iMonth);
    iDay = Number(MyArray[3]);
    sDay = (iDay < 10) ? "0"+iDay : String(iDay);
    sDate = sDay+"/"+sMonth+"/"+String(iYear);
  }
  return sDate;
}

function SetFullSqlDateToFullFrDat(strDate) {
//Passe une date sql longue 1977-04-28 00:00:00 en date francaise  28/04/1977 00:00:00
  if (!TestDate(strDate)) return strDate;
  sDate = strDate;
  adat = (strDate.split(" "))[0];
    aheure = (strDate.split(" "))[1];
  strDate=adat;  
  re1 = /^(\d{4})[- \/](\d{1,2})[- \/](\d{2}|\d{1,2})$/;
  MyArray = re1.exec(strDate);
  if (MyArray) {
    iYear = Number(MyArray[1]);
    if (iYear < 100) iYear+=2000;
    iMonth = Number(MyArray[2]);
    sMonth = (iMonth < 10) ? "0"+iMonth : String(iMonth);
    iDay = Number(MyArray[3]);
    sDay = (iDay < 10) ? "0"+iDay : String(iDay);
    sDate = sDay+"/"+sMonth+"/"+String(iYear)+" "+aheure;
  }
  return sDate;
}

function GetSqlDat(strDate){
//date sql -> Date sql sans l'heure
  adat = (strDate.split(" "))[0];
  return adat;
}

function GetSqlHeure(strDate){
//date sql (2000-28-04 09:12:25) -> heure (09:12:25)
  adat = (strDate.split(" "))[1];
  return adat;
}

function GetTime(strDate){
//date -> heure
  adat = (strDate.split(" "))[1];
  return adat;
}

function GetCurDate() {
//Date courante
  d = new Date();
  iYear = Number(d.getYear()); if (iYear < 100) iYear+=2000;
  iMonth = Number(d.getMonth())+1; sMonth = (iMonth < 10) ? "0"+iMonth : String(iMonth);
  iDay = Number(d.getDate());  sDay = (iDay < 10) ? "0"+iDay : String(iDay);
  iHour = Number(d.getHours());  sHour = (iHour < 10) ? "0"+iHour : String(iHour);
  iMn = Number(d.getMinutes());  sMn = (iMn < 10) ? "0"+iMn : String(iMn);
  iSec = Number(d.getSeconds());  sSec = (iSec < 10) ? "0"+iSec : String(iSec);
  df = String(iYear)+"-"+sMonth+"-"+sDay+" "+sHour+":"+sMn+":"+sSec;
  return df;
}

function AddTimeToDate(addTime) {
//addTime est une valeur en semaines
  dat = new Date();
  dateInMs = dat.getTime();
  dateInMs += (addTime*7*24*3600*1000) ;
  d = new Date(dateInMs)
  iYear = Number(d.getYear()); if (iYear < 100) iYear+=2000;
  iMonth = Number(d.getMonth())+1; sMonth = (iMonth < 10) ? "0"+iMonth : String(iMonth);
  iDay = Number(d.getDate());  sDay = (iDay < 10) ? "0"+iDay : String(iDay);
  iHour = Number(d.getHours());  sHour = (iHour < 10) ? "0"+iHour : String(iHour);
  iMn = Number(d.getMinutes());  sMn = (iMn < 10) ? "0"+iMn : String(iMn);
  iSec = Number(d.getSeconds());  sSec = (iSec < 10) ? "0"+iSec : String(iSec);
  df = String(iYear)+"-"+sMonth+"-"+sDay+" "+sHour+":"+sMn+":"+sSec;
  return df;
}
//*******************************************************************************
//-------------------------------------------------------------------------------
// UTILS.JS
//-------------------------------------------------------------------------------
//*******************************************************************************
// ********************************** PRINT +
// The code by Captain <cerebrum@iname.com>
// Mead & Company, http://www.meadroid.com/wpm/
// fake print() for IE4.x
function printFrame(frame, onfinish) {
  if ( !frame ) frame = window;
//  if ( frame.document.readyState != "complete" &&
//       !confirm("Le document a imprimer n'est pas encore completement telecharge! Continuer l'impression?") )
//  {
//    if ( onfinish ) onfinish();
//    return;
//  }
  isMinIE4 = (document.all) ? 1 : 0;
  if (!isMinIE4) {
    frame.print();
    return;
  }
  if (printIsNativeSupport() ) {
    /* focus handling for this scope is IE5Beta workaround,
       should be gone with IE5 RTM.
    */
    var focused = document.activeElement; 
    frame.focus();
    frame.self.print();
    if ( onfinish ) onfinish();
    if ( focused && !focused.disabled ) focused.focus();
    return;
  }
  var eventScope = printGetEventScope(frame);
  var focused = document.activeElement;
  window.printHelper = function() {
    execScript("on error resume next: printWB.ExecWB 6, 1", "VBScript");
    printFireEvent(frame, eventScope, "onafterprint");
    printWB.outerHTML = "";
    if ( onfinish ) onfinish();
    if ( focused && !focused.disabled ) focused.focus();
    window.printHelper = null;
  }
  document.body.insertAdjacentHTML("beforeEnd",
    "<object id=\"printWB\" width=0 height=0 \
    classid=\"clsid:8856F961-340A-11D0-A96B-00C04FD705A2\"></object>");
  printFireEvent(frame, eventScope, "onbeforeprint");
  frame.focus();
  window.printHelper = printHelper;
  setTimeout("window.printHelper()", 0);
}
// helpers
function printIsNativeSupport() {
  var agent = window.navigator.userAgent;
  var i = agent.indexOf("MSIE ")+5;
  return parseInt(agent.substr(i)) >= 5 && agent.indexOf("5.0b1") < 0;
}
function printFireEvent(frame, obj, name) {
  var handler = obj[name];
  switch ( typeof(handler) ) {
    case "string": frame.execScript(handler); break;
    case "function": handler();
  }
}
function printGetEventScope(frame) {
  var frameset = frame.document.all.tags("FRAMESET");
  if ( frameset.length ) return frameset[0];
  return frame.document.body;
}
// ********************************** PRINT -

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function animages(iCollection,iFreq) {
	var i = 0;
	var max = iCollection.length-1;
	for (i = 0 ; i < max ; i++) {
		if (i == iTemoin) {
			obj = iCollection[i];
			obj.src = "images/" + iCollection[i+1]+".gif";
			i = i + 2;
			if (i < max) continue;
		}
		if (i != iTemoin) {
			obj = iCollection[i];
			obj.src = "images/" + iCollection[i+2]+".gif";
			i = i + 2;
			if (i < max) continue;
		}
	}
	iTemoin = iTemoin + 3;
	if ( iTemoin> (max - 1) ) iTemoin = 0;
	strTimer=iCollection;
	timer=window.setTimeout("animages(strTimer,iFreq)",iFreq);
}

// Get var of an object 
function getProperties(obj) 
{   
  var result = "";
  for (var i in obj)      
    result += i + ": " + obj[i] + "\n";
  return result;
}
//*******************************************************************************
//-------------------------------------------------------------------------------
// GFS.JS
//-------------------------------------------------------------------------------
//*******************************************************************************
//************************************************ GESTION DES FRAME AVEC SOURCES ET SCROLL COMPATIBLE NETSCAPE 4.0 *******
// (c) 2001 Operationnelle Interactive - Groupe Operationnelle - JlR/NG
// V.2.01 23/09/01
//************************************************ ---------------------------------------------------------------- *******
//************************************************ Variables
var Gfs_RessourceUrl = "http://adminvt75.vtech.fr";
// debug 
var Gfs_DbgSet = false;
var Gfs_DbgFormName = "F1";
var Gfs_DbgTextAreaName = "DBG";
// Interval
var Gfs_Down;
var Gfs_Up;
var Gfs_Right;
var Gfs_Left;
// Ensemble de pointeurs sur les objets Accroche
var Gfs_Tab = new Array(); //Tableau qui contient l'ensemble des FrameGfs
var Gfs_iNum, Gfs_iTypeCurs;

var Gfs_DateJour = new Date();
//************************************************ Utilitaires
function Gfs_max(a,b) { return (a>b) ? a : b;}
function Gfs_Debug ( strDbg ) {
  if (!Gfs_DbgSet) return;
  pZone = eval("document."+Gfs_DbgFormName+"."+Gfs_DbgTextAreaName);
  if (pZone) 
	{
    strVal = pZone.value;
    pZone.value = Gfs_DateJour.getHours()+":"+Gfs_DateJour.getMinutes()+":"+Gfs_DateJour.getSeconds()+" ";
    pZone.value += strDbg + "\n" + strVal;
  }  
}
// scroll Up & down
function Gfs_StartMoveUp(iNum) { Gfs_Tab[iNum].bIsScrolling = true; Gfs_Up = setInterval("Gfs_Tab["+iNum+"].MoveUp();", 10); }
function Gfs_StartMoveDown(iNum) {Gfs_Tab[iNum].bIsScrolling = true; Gfs_Down = setInterval("Gfs_Tab["+iNum+"].MoveDown();", 10); }
function Gfs_StartMoveLeft(iNum) { Gfs_Tab[iNum].bIsScrolling = true; Gfs_Left = setInterval("Gfs_Tab["+iNum+"].MoveLeft();", 10); }
function Gfs_StartMoveRight(iNum) { Gfs_Tab[iNum].bIsScrolling = true; Gfs_Right = setInterval("Gfs_Tab["+iNum+"].MoveRight();", 10); }
function Gfs_EndMove(iNum)
{
  if (Gfs_Tab[iNum].bIsToBeRedraw && Gfs_Tab[iNum].bIsScrolling )
	{
	  hideLayer(Gfs_Tab[iNum].pageLay);
    setTimeout('showLayer(Gfs_Tab['+iNum+'].pageLay)', 100);
  }  
  Gfs_Tab[iNum].IsScrolling = false;
}
// end scroll
function Gfs_EndMoveUp(iNum) { clearInterval(Gfs_Up); Gfs_EndMove(iNum) }
function Gfs_EndMoveDown(iNum) { clearInterval(Gfs_Down); Gfs_EndMove(iNum) }
function Gfs_EndMoveLeft(iNum) { clearInterval(Gfs_Left); Gfs_EndMove(iNum) }
function Gfs_EndMoveRight(iNum) { clearInterval(Gfs_Right); Gfs_EndMove(iNum) }

// scroll cursor by Click
function Gfs_SetClickOn(event, iNum, iTypeCurs) { 
  document.captureEvents(Event.MOUSEDOWN);
  document.onmousedown = Gfs_SetClick;
  Gfs_iNum = iNum; 
  Gfs_iTypeCurs = iTypeCurs;
}
function Gfs_SetClickOff(event, iNum, iTypeCurs) { 
	document.releaseEvents(Event.MOUSEDOWN);
  document.onmousedown = null;
  Gfs_iNum = 0; 
  Gfs_iTypeCurs = 0;
}
function Gfs_SetClick(e) {
  layCurs = (Gfs_iTypeCurs == 1) ? Gfs_Tab[Gfs_iNum].CursH.Id : Gfs_Tab[Gfs_iNum].CursV.Id;
  curX = getPageX(e);	
	curY = getPageY(e);	
  bIsIn = (Gfs_iTypeCurs == 1) ? ((curX > getPageLeft(layCurs)) && (curX < getPageRight(layCurs))) : ((curY > getPageTop(layCurs)) && (curY < getPageBottom(layCurs)));
  if (bIsIn) return Gfs_SetDragOn(e, Gfs_iNum, Gfs_iTypeCurs);
  Gfs_SetDrag(e, Gfs_iNum, Gfs_iTypeCurs, true);
  Gfs_SetDragOff(e, Gfs_iNum, Gfs_iTypeCurs);
}
// scroll cursor by Move
function Gfs_SetDragOn(event, iNum, iTypeCurs) { 
  pCurs = (iTypeCurs == 1) ? Gfs_Tab[iNum].CursH : Gfs_Tab[iNum].CursV;  
  if (pCurs.bDrag) return;
	pCurs.curX = getPageX(event);	
	pCurs.curY = getPageY(event);	
	pCurs.bDrag = true;
  document.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP);
  document.onmouseup = Gfs_SetDragOff;
  document.onmousemove = Gfs_SetDrag;
  document.onmousedown = Gfs_SetDragOff;
  Gfs_iNum = iNum; 
  Gfs_iTypeCurs = iTypeCurs;
}
function Gfs_SetDragOff(event, iNum, iTypeCurs) { 
  isDrag = false;
  if (iTypeCurs == null) { iNum = Gfs_iNum; iTypeCurs = Gfs_iTypeCurs; }
  if (iTypeCurs != null) {
    pCurs = (iTypeCurs == 1) ? Gfs_Tab[iNum].CursH : Gfs_Tab[iNum].CursV;  
    isDrag = pCurs.bDrag;  
  }
  if (!isDrag) return;  
  pCurs.bDrag = false;
  document.onmousedown = Gfs_SetClick;
	document.releaseEvents(Event.MOUSEMOVE|Event.MOUSEUP);
  document.onmouseup = null;
  document.onmousemove = null;
  if (Gfs_Tab[iNum].bIsToBeRedraw) {
    hideLayer(Gfs_Tab[iNum].mainLay);
    setTimeout('showLayer(Gfs_Tab['+iNum+'].mainLay)', 100);
  }  
}
function Gfs_SetDrag(event, iNum, iTypeCurs, isClick) {
  if (event.type != "mousemove" && !isClick) return;
  if (iTypeCurs == null) { iNum = Gfs_iNum; iTypeCurs = Gfs_iTypeCurs; }
  isDrag = (iTypeCurs == 1) ? Gfs_Tab[iNum].CursH.bDrag : Gfs_Tab[iNum].CursV.bDrag; 
	if (!isDrag && !isClick) return;
	layCurs = (iTypeCurs == 1) ? Gfs_Tab[iNum].CursH.Id : Gfs_Tab[iNum].CursV.Id;
	layScroll = (iTypeCurs == 1) ? Gfs_Tab[iNum].scrZHLay : Gfs_Tab[iNum].scrZVLay; 	
	if (iTypeCurs == 1)	{
	  if (Gfs_Tab[iNum].CursH.curX == getPageX(event)) return;	
	  iPosE = getPageX(event) - (Gfs_Tab[iNum].CursH.Img.width/2) ;
		if (iPosE < getPageLeft(layScroll)) iPosE = getPageLeft(layScroll) ;
		if (iPosE + getWidth(layCurs) <= getPageRight(layScroll))
			moveLayerBy(layCurs, iPosE-getPageLeft(layCurs) ,0);
	}	else {
	  if (Gfs_Tab[iNum].CursV.curY == getPageY(event)) return;	
	  iPosE = getPageY(event) - (Gfs_Tab[iNum].CursV.Img.height/2) ;
		if (iPosE < getPageTop(layScroll)) iPosE = getPageTop(layScroll) ;
		if (iPosE + getHeight(layCurs) <= getPageBottom(layScroll))
			moveLayerBy(layCurs, 0, iPosE-getPageTop(layCurs));
	}
  Gfs_Tab[iNum].MoveLay(iTypeCurs);
  return false;
}
//************************************************ functions Objets
function Gfs_ChangeSrc(pstrSrc, piNum, iScroll) { // iScroll = 0 -> nada, 1 to top, 2 to bottom
  var pObj = (piNum != null && piNum != -1) ? Gfs_Tab[piNum] : this ;
  pObj.pageLay = (isIENS6) ? getLayer(pObj.strId) : getLayer("LS"+pObj.strId);
  pObj.pageLay.src = pstrSrc;
  if (iScroll && (isMinNS4)) {
    switch (parseInt(iScroll)) {
      case 1 : setTimeout('Gfs_ScrollLayToTop('+pObj.Num+')', 800); break;
      case 2 : setTimeout('Gfs_ScrollLayToBottom('+pObj.Num+')', 800); break;
    }
  }
  this.strSrc = pstrSrc;
}

function Gfs_MoveLeft() { this.ScrollLay(-1,0); this.MoveCurs(1); }
function Gfs_MoveRight(){ this.ScrollLay(1,0); this.MoveCurs(1); }
function Gfs_MoveUp(){ this.ScrollLay(0,-1); this.MoveCurs(2); }
function Gfs_MoveDown(){ this.ScrollLay(0,1); this.MoveCurs(2); }
// synchro parent fils
function Gfs_Move(paddX, paddY) {
  moveLayerBy(this.mainLay, paddX ,paddY);
  iX = (getPageLeft(this.mainLay))-(getPageLeft(this.IdParent.pageLay)+getClipLeft(this.IdParent.pageLay));
  iY = (getPageTop(this.mainLay))-(getPageTop(this.IdParent.pageLay)+getClipTop(this.IdParent.pageLay));
  if (iX < 0 || iY < 0) {
    iX = (iX < 0) ? -iX : getClipLeft(this.mainLay);
    iY = (iY < 0) ? -iY : getClipTop(this.mainLay);
    clipLayer(this.mainLay, iX, iY, getClipRight(this.mainLay), getClipBottom(this.mainLay));
  } else {
    clipLayer(this.mainLay, 0, 0, getClipRight(this.mainLay), getClipBottom(this.mainLay));
  }  
}
// synchro lay - cursor
function Gfs_MoveCurs(iTypeCurs) {
  var layCurs = (iTypeCurs == 1) ? this.CursH.Id : this.CursV.Id; 	
	var layScroll = (iTypeCurs == 1) ? this.scrZHLay : this.scrZVLay; 	
  var iX = (iTypeCurs == 1) ? Math.round((( (getWidth(layScroll)-this.CursH.Img.width) * getClipLeft(this.pageLay) ) / ( getWidth(this.pageLay) - this.iWidth))) : 0;
  var iY = (iTypeCurs == 1) ? 0 : Math.round((( (getHeight(layScroll)-this.CursV.Img.height) * getClipTop(this.pageLay) ) / ( getHeight(this.pageLay) - this.iHeight)));
	moveLayerTo(layCurs, iX ,iY);
}
function Gfs_MoveLay(iTypeCurs) {
	var layScroll = (iTypeCurs == 1) ? this.scrZHLay : this.scrZVLay; 	
  var layCurs = (iTypeCurs == 1) ? this.CursH.Id : this.CursV.Id; 	
  var iX = (iTypeCurs == 1) ? Math.round(( ((getWidth(this.pageLay) - this.iWidth) * (getLeft(layCurs))) / (getWidth(layScroll)-this.CursH.Img.width) )) - getClipLeft(this.pageLay) : 0;
  var iY = (iTypeCurs == 1) ? 0 : Math.round((((getHeight(this.pageLay) - this.iHeight) * (getTop(layCurs))) / (getHeight(layScroll)-this.CursV.Img.height) )) - getClipTop(this.pageLay);
  this.ScrollLay(iX, iY);
}
// scrolling lay
function Gfs_ScrollLay(paddX, paddY) {
  var iX = getLeft(this.pageLay);
  var iY = getTop(this.pageLay);
	// Clip plus grand que taille du doc
	if (getClipHeight(this.pageLay) > this.pageLay.document.height) paddY = 0;
	if (getClipWidth(this.pageLay) > this.pageLay.document.width) paddX = 0;
	scrollLayerBy(this.pageLay, paddX, paddY, true);
  if (iX != getLeft(this.pageLay) || iY != getTop(this.pageLay)) 
    for (i=0; i<this.aIdFils.length; i++) this.aIdFils[i].Move(-paddX, -paddY);
}
function Gfs_ScrollLayToBottom(piNum) {
  var pObj = (piNum && piNum != -1) ? Gfs_Tab[piNum] : this ;
  iY = getHeight(pObj.pageLay);
  pObj.ScrollLay(0, iY);
  pObj.MoveCurs(2);
}
function Gfs_ScrollLayToTop(piNum) {
  var pObj = (piNum && piNum != -1) ? Gfs_Tab[piNum] : this ;
  iY = getTop(pObj.pageLay);
  pObj.ScrollLay(0, -iY);
  if (isMinNS4) pObj.MoveCurs(2);
}
function Gfs_Attach(pObj) { this.aIdFils[this.aIdFils.length] = pObj; }

function Gfs_SetFrameHide(piNum) { // uniquement si bAbsolute a ete sete a true
  var pObj = (piNum && piNum != -1) ? Gfs_Tab[piNum] : this ;
  hideLayer(pObj.mainLay);
}

function Gfs_SetFrameShow(piNum) { // uniquement si bAbsolute a ete sete a true
  var pObj = (piNum && piNum != -1) ? Gfs_Tab[piNum] : this ;
  showLayer(pObj.mainLay);
}

function Gfs_SetFramePos(iCx, iCy, pWidth, pHeight, piNum) { // uniquement si bAbsolute a ete sete a true
  var pObj = (piNum && piNum != -1) ? Gfs_Tab[piNum] : this ;
//  this.iPosY = (isIENS6) ? getPageTop(this.mainLay) : getPageTop(this.mainLay);
//  this.iPosX = (isIENS6) ? getPageLeft(this.mainLay) : getPageLeft(this.mainLay);
//  alert(this.mainLay+" PosX="+this.iPosX+"->"+iCx+" PosY="+this.iPosY+"->"+iCy);
  if (!iCy) iCy = 0;
  if (!iCx) iCx = 0;
  moveLayerTo(pObj.mainLay, iCx, iCy);
//  alert(this.mainLay+" PosX="+getPageLeft(this.mainLay)+" PosY="+getPageTop(this.mainLay));
  if (pWidth && pWidth != 0 && pHeight && pHeight != 0) {
    resizeLayerTo(pObj.mainLay, pWidth, pHeight);
    clipLayer(pObj.mainLay, 0, 0, pWidth, pHeight);
    if (isMinNS4) {
    	iWidth = (pObj.bScrollV) ? pWidth-pObj.iSizeZoneScrollV : pWidth;
  	  iHeight = (pObj.bScrollH) ? pHeight-pObj.iSizeZoneScrollH : pHeight;
      resizeLayerTo(pObj.pageLay, iWidth, iHeight);
      clipLayer(pObj.pageLay, 0, 0, iWidth, iHeight);
    }
  }
//  alert(this.mainLay+" W="+getWidth(this.mainLay)+" H="+getHeight(this.mainLay));
}

function Gfs_SetFrameAdjust(pWidth, pHeight, piNum) { // uniquement si bAbsolute a ete sete a true
  var pObj = (piNum && piNum != -1) ? Gfs_Tab[piNum] : this ;
//  alert(this.mainLay+" W="+getWidth(this.mainLay)+" H="+this.mainLay.document.body.scrollHeight);
//  alert(pObj.mainLay+" X="+getContentWidth(pObj.mainLay)+" Y="+getContentHeight(pObj.mainLay));
  if (!pWidth || !pHeight) {
  	if (isIENS6) {
      if (!pWidth) pWidth = getWindowWidth(pObj.pageLay);
      if (!pHeight) pHeight = getWindowHeight(pObj.pageLay);
    } else {
      if (!pWidth) pWidth = getContentWidth(pObj.pageLay);
      if (!pHeight) pHeight = getContentHeight(pObj.pageLay);
    }
  }
  resizeLayerTo(pObj.mainLay, pWidth, pHeight);
  clipLayer(pObj.pageLay, 0, 0, pWidth, pHeight);
//  alert(this.mainLay+" W="+this.mainLay.height+" H="+this.mainLay.width);
}

function Gfs_SetFrame(IdParent, bDown) { // bDown aligne sur le bas
  this.IdParent = IdParent;
	this.posLay = getLayer(this.strId+"p");
  this.iPosY = (isIENS6) ? getPageTop(this.posLay)+2 : getPageTop(this.posLay);
  this.iPosX = (isIENS6) ? getPageLeft(this.posLay)+2 : getPageLeft(this.posLay);
	if (isIENS6) {
		document.write('<IFRAME id="'+this.strId+'" name="'+this.strId+'" src="'+this.strSrc+'" marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="0" scrolling="'+this.scroll+'" style="position:absolute; visibility:hidden; '+this.sBorder+' width:'+this.iWidth+';height:'+this.iHeight+'">');
    document.write('</IFRAME>');
  	this.mainLay = getLayer(this.strId);
    moveLayerTo(this.mainLay, this.iPosX, this.iPosY);
  	clipLayer(this.mainLay, 0, 0, this.iWidth, this.iHeight);
    this.pageLay = this.mainLay;
    showLayer(this.mainLay);
  } else {
  	var ilWidth = (this.bScrollV) ? this.iWidth-this.iSizeZoneScrollV : this.iWidth;
	  var ilHeight = (this.bScrollH) ? this.iHeight-this.iSizeZoneScrollH : this.iHeight;
    if (!this.bIsToBeReload) {
      document.write('<LAYER id="'+this.strId+'" width="'+this.iWidth+'" height="'+this.iHeight+'" clip="0 0 '+this.iWidth+' '+this.iHeight+'" visibility="hide" >');
      document.write('<LAYER bgcolor="#'+this.strBg+'" id="LS'+this.strId+'" src="'+this.strSrc+'" top=0 left=0 width='+ilWidth+' height='+ilHeight+' clip="0 0 '+ilWidth+' '+ilHeight+'" ></LAYER>');
    }  
  	if (this.bScrollV) {
      document.write('<LAYER id="SV'+this.strId+'" top=0 left='+ilWidth+' width='+this.iSizeZoneScrollV+' height='+ilHeight+' clip="0 0 '+this.iSizeZoneScrollV+' '+ilHeight+'" visibility="hide">');
      document.write("<layer top=0 left="+((this.iSizeZoneScrollV/2)-(this.imgUp.width/2))+" width="+this.imgUp.width+" height="+this.imgUp.height+">");
      document.write("<a href='javascript:;' OnMouseDown='Gfs_StartMoveUp("+this.Num+");' OnMouseUp='Gfs_EndMoveUp("+this.Num+");' onmouseout='Gfs_EndMoveUp("+this.Num+");'>");
      document.write("<img src='"+this.imgUp.src+"' width="+this.imgUp.width+" height="+this.imgUp.height+" border=0></a></layer>");
      document.write("<layer id='ZSV"+this.strId+"' bgcolor='Silver' top="+this.imgUp.height+" left="+((this.iSizeZoneScrollV/2)-(this.imgCenterV.width/2))+" width="+this.imgCenterV.width+" height="+(ilHeight-(this.imgDown.height+this.imgUp.height)));		
  		document.write(" OnMouseOver='Gfs_SetClickOn(event, "+this.Num+", 2)' OnMouseOut='Gfs_SetClickOff(event, "+this.Num+", 2);'>");
      this.CursV = new Gfs_Curseur(this, 2, this.strId+"CursV", this.imgCenterV);
      document.write('</layer>');
      document.write("<layer top="+(ilHeight-this.imgDown.height)+" left="+((this.iSizeZoneScrollV/2)-(this.imgDown.width/2))+" width="+this.imgDown.width+" height="+this.imgDown.height+">");
      document.write(" <a href='javascript:;' OnMouseDown='Gfs_StartMoveDown("+this.Num+");' OnMouseUp='Gfs_EndMoveDown("+this.Num+");' onmouseout='Gfs_EndMoveDown("+this.Num+");'>");
      document.write("<img src='"+this.imgDown.src+"' width="+this.imgDown.width+" height="+this.imgDown.height+" border=0></a></layer>");
      document.write('</LAYER>');
  	}
  	if (this.bScrollH) {
      document.write('<LAYER id="SH'+this.strId+'" top='+ilHeight+' left=0 width='+ilWidth+' height='+this.iSizeZoneScrollH+' clip="0 0 '+ilWidth+' '+this.iSizeZoneScrollH+'" visibility="hide">');
      document.write("<layer top="+((this.iSizeZoneScrollH/2)-(this.imgLeft.height/2))+" left=0 width="+this.imgLeft.width+" height="+this.imgLeft.height+">");
      document.write("<a href='javascript:;' OnMouseDown='Gfs_StartMoveLeft("+this.Num+");' OnMouseUp='Gfs_EndMoveLeft("+this.Num+");' onmouseout='Gfs_EndMoveLeft("+this.Num+");'>");
      document.write("<img src='"+this.imgLeft.src+"' width="+this.imgLeft.width+" height="+this.imgLeft.height+" border=0></a></layer>");
      document.write("<layer id='ZSH"+this.strId+"' bgcolor='Silver' top="+((this.iSizeZoneScrollH/2)-(this.imgCenterH.height/2))+" left="+this.imgLeft.width+" width="+(ilWidth-(this.imgRight.width+this.imgLeft.width))+" height="+this.imgCenterH.height);		
  		document.write(" OnMouseOver='Gfs_SetClickOn(event, "+this.Num+", 2)' OnMouseOut='Gfs_SetClickOff(event, "+this.Num+", 2);'>");
      this.CursH = new Gfs_Curseur(this, 1, this.strId+"CursH", this.imgCenterH);
      document.write('</layer>');
      document.write("<layer top="+((this.iSizeZoneScrollH/2)-(this.imgRight.height/2))+" left="+(ilWidth-this.imgRight.width)+" width="+this.imgRight.width+" height="+this.imgRight.height+">");
      document.write(" <a href='javascript:;' OnMouseDown='Gfs_StartMoveRight("+this.Num+");' OnMouseUp='Gfs_EndMoveRight("+this.Num+");' onmouseout='Gfs_EndMoveRight("+this.Num+");'>");
      document.write("<img src='"+this.imgRight.src+"' width="+this.imgRight.width+" height="+this.imgRight.height+" border=0></a></layer>");
      document.write('</LAYER>');
  	}
    if (this.bIsToBeReload) {
      document.write('<LAYER id="LS'+this.strId+'" width='+ilWidth+' height='+ilHeight+' clip="0 0 '+ilWidth+' '+ilHeight+'" visibility="hide" ></LAYER>');
    } else document.write('</LAYER>');
    this.pageLay = getLayer("LS"+this.strId);
    if (this.bScrollV) {
      this.scrVLay = getLayer("SV"+this.strId);
      this.scrZVLay = getLayer("ZSV"+this.strId);
    }  
    if (this.bScrollH) {
      this.scrHLay = getLayer("SH"+this.strId);
      this.scrZHLay = getLayer("ZSH"+this.strId);
    }  
    if (this.IdParent && !this.bIsToBeReload) this.IdParent.Attach(this);
    if (this.bIsToBeReload) {
    	this.mainLay = this.pageLay;
      this.pageLay.moveToAbsolute(this.iPosX, this.iPosY);
      if (this.bScrollV) {
        moveLayerTo(this.scrVLay, this.iPosX+getWidth(this.pageLay), this.iPosY);
        showLayer(this.scrVLay);
      }  
      if (this.bScrollH) {
        moveLayerTo(this.scrHLay, this.iPosX, this.iPosY+getHeight(this.pageLay));
        showLayer(this.scrHLay);
      }  
      
      sAction = "Gfs_ChangeSrc('"+this.strSrc+"', "+this.Num+")";
      setTimeout(sAction, 3000);
      showLayer(this.mainLay);
    } else {
    	this.mainLay = getLayer(this.strId);
      moveLayerTo(this.mainLay, this.iPosX, this.iPosY);
    	clipLayer(this.mainLay, 0, 0, this.iWidth, this.iHeight);
      if (this.bScrollV) showLayer(this.scrVLay);
      if (this.bScrollH) showLayer(this.scrHLay);
      showLayer(this.mainLay);
    }  
    if (bDown) setTimeout("Gfs_ScrollLayToBottom("+this.Num+")", 200);
  }  
}
//************************************************ Objets
function Gfs_Curseur(pIdFrame, iTypCurs, strId, pImg) {
	this.strId = strId;
	this.IdFrame = pIdFrame; // Frame pere
  this.Img = pImg;
	this.bDrag = false;
  this.curX = 0;
  this.curY = 0;
  document.write("<LAYER name='"+this.strId+"' id='"+this.strId+"' visibility=show top=0 left=0 width="+pImg.width+" height="+pImg.height+">");
  document.write("<a href='javascript:;' OnMouseDown='Gfs_SetDragOn(event, "+this.IdFrame.Num+", "+iTypCurs+")' OnMouseUp='Gfs_SetDragOff(event, "+this.IdFrame.Num+", "+iTypCurs+")'>");
  document.write("<img name='Img"+this.strId+"' src='"+pImg.src+"' width="+pImg.width+" height="+pImg.height+" border=0></a></LAYER>");
  this.Id = getLayer(this.strId);
}

function Gfs_Frame(pstrId, pstrSrc, pstrBg, pbBorder, piCx, piCy, piScrollV, piScrollH, pstrScroll) {
//pstrId : nom de la GfsFrame
//pstrSrc : source de -------
//pstrBg : couleur de fond
//pbBorder : booleen : bordure visible ou non
//piCx , PiCy taille de la barre de navigation
//piScrollV, piScrollH quantité de déplacement dans la frame gfs en X,Y
//pParam si il y a des parametres apres l'url (ex:TOTO=1)
	this.Num = Gfs_Tab.length + 1;
  //on ajoute cette frame a GfsTab
 	Gfs_Tab[this.Num] = this;
 	// Variables
	this.strId = pstrId;  // name
	this.strBg = (pstrBg != "") ? pstrBg : "FFFFFF";  // background color
  arrayOfWords = pstrSrc.split("?");
	this.strSrc = arrayOfWords[0]+"?BG="+this.strBg;  // source de la frame
  if (arrayOfWords.length > 1) this.strSrc += "&"+arrayOfWords[1];
  this.sBorder = (pbBorder && isIENS6) ? "border: 1px #000000 solid;" : "";
	this.iPosX = 0; 
	this.iPosY = 0; 
	this.iWidth = piCx;
	this.iHeight = piCy;
	this.IdParent = null;
	this.aIdFils = new Array();
  // functions
  this.Attach = Gfs_Attach;
  this.SetFrame = Gfs_SetFrame;
  this.SetFramePos = Gfs_SetFramePos;
  this.SetFrameAdjust = Gfs_SetFrameAdjust;
  this.SetFrameHide = Gfs_SetFrameHide;
  this.SetFrameShow = Gfs_SetFrameShow;

  this.MoveLay = Gfs_MoveLay;
  this.ScrollLay = Gfs_ScrollLay;
  this.ScrollLayToBottom = Gfs_ScrollLayToBottom;
  this.ScrollLayToTop = Gfs_ScrollLayToTop;
  this.MoveCurs = Gfs_MoveCurs;
  this.Move = Gfs_Move;
  this.MoveLeft = Gfs_MoveLeft;
  this.MoveRight= Gfs_MoveRight;
  this.MoveUp = Gfs_MoveUp;
  this.MoveDown = Gfs_MoveDown;
  this.ChangeSrc = Gfs_ChangeSrc;
  // layers
  this.posLay = null;
  this.mainLay = null;
  this.pageLay = null;
  this.scrHLay = null;
  this.scrZHLay = null;
  this.scrVLay = null;
  this.scrZVLay = null;
  //scrolls
  this.bIsToBeReload = false;
  //Permet un reload de la frame Gfs
  //mettre bIsToBeReload à vrai pour activer les scrollings et les changeSrc
  this.bIsToBeRedraw = false;
  this.bIsScrolling = false;
	this.paddX=1;
	this.paddY=1;
	this.bScrollH = (piScrollH != 0 && piScrollH != null);
	this.iSizeZoneScrollH = piScrollH;
  this.CursH = null;
	this.bScrollV = (piScrollV != 0 && piScrollV != null);
	this.iSizeZoneScrollV = piScrollV;
  this.CursV = null;
	this.scroll = (pstrScroll) ? pstrScroll : "no";
  if (isIENS6 && (this.bScrollH || this.bScrollV) ) {
  	this.bScrollH=false;
	  this.bScrollV=false;
    this.scroll="auto";
	}	
	// Images
  if (piScrollV || piScrollH) {
  	this.imgUp = new Image();
  	this.imgUp.src = Gfs_RessourceUrl+"/images/im_scrollup0.gif";
  	this.imgDown = new Image();
  	this.imgDown.src = Gfs_RessourceUrl+"/images/im_scrolldown0.gif";
  	this.imgLeft = new Image();
  	this.imgLeft.src = Gfs_RessourceUrl+"/images/im_scrollleft0.gif";
  	this.imgRight = new Image();
  	this.imgRight.src = Gfs_RessourceUrl+"/images/im_scrollright0.gif";
  	this.imgCenterV = new Image();
  	this.imgCenterV.src = Gfs_RessourceUrl+"/images/im_scrollcurv.gif";
  	this.imgCenterH = new Image();
  	this.imgCenterH.src = Gfs_RessourceUrl+"/images/im_scrollcurh.gif";
  }
	if (isIENS6){
		document.write("<div id='"+this.strId+"p' style='visibility:hidden;height:"+this.iHeight+";width:"+this.iWidth+";'></div>");
	} else {
		document.write("<ilayer id='"+this.strId+"p' visibility='hide' height='"+this.iHeight+"' width='"+this.iWidth+" margin='0 0 0 0''></ilayer>");
  }
}
//*******************************************************************************
//-------------------------------------------------------------------------------
// IMG.JS
//-------------------------------------------------------------------------------
//*******************************************************************************
//-----------------------------------------------------------------------------
// Image utilities.
//-----------------------------------------------------------------------------
function getImage(name) {
 if (document.all) return document.all(name);
 if (document.getElementById && document.getElementById(name)) return (document.getElementById(name));
 if (document.images && document.images[name]) return document.images[name];
 return findImage(name, document);
}

function findImage(name, doc) {
  var i, img;
  if (doc == null) doc = window.document;
  if (doc.images) {
    for (i = 0; i < doc.images.length; i++) if (doc.images[i].name == name) return doc.images[i];
  }
  if (doc.layers) {
    for (i = 0; i < doc.layers.length; i++) if ((img = findImage(name, doc.layers[i].document)) != null) {
      img.container = doc.layers[i];
      return img;
    }
  }
  return null;
}

function getImagePageLeft(img) {
  var x, obj;
  if (isMinNS4) {
    if (img.container != null)
      return img.container.pageX + img.x;
    else
      return img.x;
  }
  if (isIENS6) {
    x = 0;
    obj = img;
    while (obj.offsetParent != null) {
      x += parseInt(obj.offsetLeft);
      obj = obj.offsetParent;
    }
    x += parseInt(obj.offsetLeft);
    return x;
  }
  return -1;
}

function getImagePageTop(img) {
  var y, obj;

  if (isMinNS4) {
    if (img.container != null)
      return img.container.pageY + img.y;
    else
      return img.y;
  }
  if (isIENS6) {
    y = 0;
    obj = img;
    while (obj.offsetParent != null) {
      y += parseInt(obj.offsetTop);
      obj = obj.offsetParent;
    }
    y += parseInt(obj.offsetTop);
    return y;
  }
  return -1;
}

function MM_findObj(n, d) { //v3.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i < d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i < d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i < a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_preloadImages() { //v3.0
  var d=document; 
	if(d.images){ 
		if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; 
		for(i=0; i < a.length; i++)
    	if (a[i].indexOf("#")!=0)
			{ 
				d.MM_p[j]=new Image; 
				d.MM_p[j++].src=a[i];
			}
	}
}
//*******************************************************************************
//-------------------------------------------------------------------------------
// FORM.JS
//-------------------------------------------------------------------------------
//*******************************************************************************
// +/+ Tests Formulaire ----------------------------------------------------------
function TestCpFrance(strCp, bShort)
{
  var iDpt = 0; 
  var iVil = 0; 
  var iSiz = (bShort) ? 2 : 5;
  if (strCp.length < iSiz) return false;
  iDpt = parseInt(strCp.substr(0,2));
  if (isNaN(iDpt)) return false;
  if (!bShort) {
    iVil = parseInt(strCp.substr(3,3));
    if (isNaN(iVil)) return false;
  }
  if (iDpt < 1 || iDpt > 95) {
    if (iDpt != 97 && iDpt != 98) return false;
  }
  return true;
}

function isValidMail(Email) {
  var strTmp = Email;
  re1 = /^www\./i;
  MyArray = re1.exec(strTmp);
  if (MyArray) return false;
  re1 = /^[a-z0-9][-_a-z0-9.]+@[a-z0-9][-a-z0-9]+(\.[a-z][-_a-z0-9]+)+$/i;
  MyArray = re1.exec(strTmp);
  if (!MyArray) return false;
  return true;
}

function isValidTelephone(strTel, bMobile, bFrance) {
  if (bFrance) re1 = (bMobile) ? /^\+?\(?(\+?33)?\)?[-\.\s]*06([-\.\s]*\d\d){4}/ : /^\+?\(?(\+?33)?\)?[-\.\s]*([-\.\s]*\d\d){5}/;
  else re1 = /^[0-9][-\.0-9\s]+/;
  MyArray = re1.exec(strTel);
  if (!MyArray) return false;
  return true;
}
// -/- Tests Formulaire ----------------------------------------------------------
// +/+ Pour les champs de type datetime dans les formulaires de la BIV ------------------------------
// +/+ GL 05/04/2004 ------------------------------
function SetMajDateTime(sDate,sTime,sName,bTestDate,bTestTime,sFormName) {
  if (!sFormName) sFormName = 'F1_MODULE';
  if (bTestDate) {
    if (sDate != '' && !TestDate(sDate)) {
      alert('Cette date a un format incorrect.');
      eval('document.'+sFormName+'.speDATE_'+sName+'.focus();');
      return;
    }
  }
  re1 = /^(\d\d)$/;
  MyArray1 = re1.exec(sTime);
  if (MyArray1) sTime += ':00:00';
  else {
    re1 = /^(\d\d)(:|h)(\d\d)$/i;
    MyArray1 = re1.exec(sTime);
    if (MyArray1) sTime = MyArray1[1]+':'+MyArray1[3]+':00';
  }
  if (bTestTime) {
    if (sTime != '' &&  !TestTime(sTime)) {
      alert('Cette heure a un format incorrect.');
      eval('document.'+sFormName+'.speTIME_'+sName+'.focus();');
      return;
    }
  }
  else {
    if (!TestTime(sTime)) sTime = '00:00:00';
  }
  re1 = /^(\d{1,2})[- \/](\d{1,2})[- \/](\d{2}|\d{4})$/;
  MyArray = re1.exec(sDate);
  var sSQLDate = '';
  if (MyArray) {
    iYear = Number(MyArray[3]);
    if (iYear < 100) iYear+=2000;
    iMonth = Number(MyArray[2]);
    sMonth = (iMonth < 10) ? "0"+iMonth : String(iMonth);
    iDay = Number(MyArray[1]);
    sDay = (iDay < 10) ? "0"+iDay : String(iDay);
    sSQLDate = (sTime.length < 8) ? String(iYear)+"-"+sMonth+"-"+sDay+" "+sTime+":00":String(iYear)+"-"+sMonth+"-"+sDay+" "+sTime;
  }
  if (sDate == '' && sTime == '') sSQLDate = '';
  eval('document.'+sFormName+'.'+sName+'_STRINFO.value = sSQLDate;');
  eval('document.'+sFormName+'.'+sName+'_STRINFO_M.value = 1;');
}
// -/- Pour les champs de type datetime dans les formulaires de la BIV ------------------------------


// +/+ Manipulation objet form ----------------------------------------------------------
function GetRadioValue(pRadioButton) {
  var checkedButton = "";
  if (!pRadioButton.length) {
    if (pRadioButton.checked == true) {
      checkedButton = pRadioButton.value;
    }
  } else {
    for (i = 0; i < pRadioButton.length; i++) {
      if (pRadioButton[i].checked == true) {
        checkedButton = pRadioButton[i].value;
      }
    }
  }
  return checkedButton;
}

function SelectRadioByValue(pRadioButton, value) {
  for (i = 0; i < pRadioButton.length; i++) {
    if (pRadioButton[i].value == value) {
      pRadioButton[i].checked = true;
      break;
    }
  }
}

function m_UGetElement(strNam, pForm) {
  if (!pForm) return;
  var i0;
  for (i0 = 0; i0 < pForm.elements.length; i0++)
    if (pForm.elements[i0].name == strNam) return pForm.elements[i0];
  return false;
}

function AddElement(s_select, s_value, s_text, selected, doc) {
	if (!doc) doc = document;
	if (document.all){ // explorer
  	newOpt = doc.createElement("OPTION") ; 
		newOpt.text = s_text ;
		newOpt.value = s_value ;
		s_select.options.add(newOpt, s_select.length, false, selected) ;
	}
	else { // netscape
		var newOpt = new Option(s_text,s_value, false, selected);
		s_select.options[s_select.length]	= newOpt ;
	}
}

function m_UGetSelect(strObj, pForm) {
  var pSel = m_UGetElement(strObj, pForm);
  if (!pSel) return 0;
  return (pSel.length > 0 && pSel.selectedIndex >= 0) ? parseInt(pSel.options[pSel.selectedIndex].value) : 0;
}

function m_UcleanSelect(strObj, pForm) {
  var pSel = m_UGetElement(strObj, pForm);
  if (!pSel) return ;
  while (pSel.length > 0) pSel.options[0] = null;
}

function m_UAddSelect(strObj, strTxt, strVal, pForm, bSelected) {
  var pSel = m_UGetElement(strObj, pForm);
  if (!pSel) return ;
  sel=(bSelected)?true:false;
  AddElement(pSel, strVal, strTxt, sel);
}
function m_UAddAllSelect(strObj, aOption, pForm, selected, aStyles) {
  if (isNS || isMac) {
    m_UcleanSelect(strObj, pForm) ;
    for (i in aOption) m_UAddSelect(strObj, aOption[i], i, pForm) ;
    if (selected) m_USetSelectByVal(strObj, selected, pForm);
    else m_USetSelect(strObj, 0, pForm);
  } else {
    var pSel = m_UGetElement(strObj, pForm);
    if (!pSel) return ;
    var aTab = pSel.outerHTML.match(/(<select[^>]*>)/i);
    var strText = "" ;
    for (i in aOption) {
      if (i==selected) {
				// modif GL - 30/09/2003 - ajout des styles
				if (aStyles) strText += "<OPTION selected value=\""+i+"\" style=\""+aStyles[i]+"\">"+aOption[i]+"</OPTION>" ; 
				else strText += "<OPTION selected value=\""+i+"\">"+aOption[i]+"</OPTION>" ; 
			}
      else {
				if (aStyles) strText += "<OPTION value=\""+i+"\" style=\""+aStyles[i]+"\">"+aOption[i]+"</OPTION>" ; 
				else strText += "<OPTION value=\""+i+"\">"+aOption[i]+"</OPTION>" ; 
			}
    }
    pSel.outerHTML = aTab[1] + strText + "</SELECT>" ;
  }
}
function m_USetSelectByVal(strObj, sVal, pForm) {
  var pSel = m_UGetElement(strObj, pForm);
  if (!pSel) return ;
  s = "(^|\\|)("+sVal+")(\\||$)";
  re = new RegExp(s);
  for (i=0; i<pSel.length; i++) {
    if (pSel.options[i].value.match(re)) {
      pSel.options[i].selected = true;
    }
  }
}
function m_USetSelect(strObj, iNum, pForm) {
  var pSel = m_UGetElement(strObj, pForm);
  if (!pSel || pSel.length <= 0) return ;
  pSel.options[iNum].selected = true;
}

function m_USelectUnSel(strObj, pForm) {
  var pSel = m_UGetElement(strObj, pForm);
  if (!pSel) return ;
  for (i=0;i<pSel.options.length;i++)  pSel.options[i].selected = false;
}

function m_UCopySelect(pSelSrc, pSelDest, strValue, bSelect)
{
  if (pSelSrc.name == pSelDest.name) return ; // evite de boucler
  for (i=0;i<pSelSrc.options.length;i++)
  {
    if (!bSelect || pSelSrc.options[i].selected == true) {
      AddElement(pSelDest, pSelSrc.options[i].value, pSelSrc.options[i].text, false);
      if (pSelSrc.options[i].value == strValue) pSelDest.options[i].selected = true;
    }
  }
}

function m_USetSelectByValue(strObj, strValue, pForm)
{
  var pSel = m_UGetElement(strObj, pForm);
  for (i=0;i<pSel.options.length;i++)
    if (pSel.options[i].value == strValue) m_USetSelect(strObj, i, pForm);
}

function m_USetValue(pObj, value) {
  if (pObj.innerText) {
    pObj.innerText = value;
  } else {
    pObj.value = value;
  }
}

// -/- Manipulation select ----------------------------------------------------------
//*******************************************************************************
//-------------------------------------------------------------------------------
// TOOLTIP.JS
//-------------------------------------------------------------------------------
//*******************************************************************************
/*************** Script functions in this file **************
Filename: tooltip.js; as of 09/20/2001
  FUNCTION:                                               LINE:
  TT_SetToolTip(sLayName, bOff, e)                         7      // sLayName = nom du layer, bOff = true si hide sinon show, e = event
************ (end Script functions in this file) ***********/
// sLayName = nom du layer, bOff = true si hide sinon show, e = event
function TT_SetToolTip(sLayName, bOff, e, dx, dy) {
  pObj = getLayer(sLayName);
  if (!pObj) return false;
  if (!bOff) {
    if (!e) return false;
    if (isNaN(dx)) dx = 0;
    if (isNaN(dy)) dy = 0;
    iCx = getPageX(e) + dx;
    iCy = getPageY(e) + dy;
    moveLayerToInScreen(pObj, iCx, iCy);
//    moveLayerTo(pObj, iCx, iCy);
    showLayer(pObj);
  } else hideLayer(pObj);
  return false;
}

function TT_create(Id, sMesg, sTitle, iWidth)
{
  if (sTitle == null) sTitle = "Aide" ;
  if (iWidth == null) iWidth = 180 ;
  var ContentToolTip ="<TABLE WIDTH="+iWidth+" BORDER=0 CELLPADDING=2 CELLSPACING=0 BGCOLOR=#006666><TR><TD><TABLE WIDTH=100% BORDER=0 CELLPADDING=0 CELLSPACING=0><TR><TD><CENTER><FONT FACE=TAHOMA COLOR=#FFFFFF SIZE=1><B>"+sTitle+"</B></FONT></CENTER></TD></TR></TABLE><TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=0 BGCOLOR=lightblue><TR><TD><FONT FACE=TAHOMA COLOR=#000000 SIZE=1>"+sMesg+"</FONT></TD></TR></TABLE></TD></TR></TABLE>";
  document.write("<div id='"+Id+"' style='position:absolute;visibility:hidden'>"+ContentToolTip+"</div>");
  return false;
}

function TT_show(Id, e, dx ,dy)
{
  if (isNaN(dx)) dx = 15 ;
  if (isNaN(dy)) dy = 10 ;
  return TT_SetToolTip(Id, 0, e, dx, dy);
}

function TT_hide(Id, e)
{
  return TT_SetToolTip(Id, 1, e);
}

// Pour compatibilité avec BO damien

//FONCTIONS POUR AFFICHAGE DE L'AIDE
var nav = (document.layers); 
var iex = (document.all);
var skn;

//FONCTIONS POUR L'AIDE EN DIV
function pop(msg, titre, largeur, dx, dy, bAbsolutePos, bgColorTitre, bgColorCorps, ColorTitre, ColorCorps, e) {
	// modif GL - 22/08/2003 ajout des params de couleur
  if (!e) e = event;
  skn = getLayer("topdeck");
  if (!skn) return;
//  skn = (nav) ? skn : skn.style;
  if (titre == null) titre = "Aide" ;
  if (largeur == null) largeur = 180 ;
  if (!dx) dx = -60;
  if (!dy) dy = 20;
  if (bgColorTitre == null) bgColorTitre = '#006666';
  if (bgColorCorps == null) bgColorCorps = 'lightblue';
  if (ColorTitre == null) ColorTitre = '#FFFFFF';
  if (ColorCorps == null) ColorCorps = '#000000';
  var ContentToolTip ="<TABLE WIDTH="+largeur+" BORDER=0 CELLPADDING=2 CELLSPACING=0 BGCOLOR="+bgColorTitre+"><TR><TD><TABLE WIDTH=100% BORDER=0 CELLPADDING=0 CELLSPACING=0><TR><TD><CENTER><FONT FACE=TAHOMA COLOR="+ColorTitre+" SIZE=1><B>"+titre+"</B></FONT></CENTER></TD></TR></TABLE><TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=0 BGCOLOR="+bgColorCorps+"><TR><TD><FONT FACE=TAHOMA COLOR="+ColorCorps+" SIZE=1>"+msg+"</FONT></TD></TR></TABLE></TD></TR></TABLE>";
  writeLayer(skn, ContentToolTip); 
  moveLayerToEvent(skn, e, dx, dy, true);
//  alert("x="+(getPageX(e)+dx)+" y="+(getPageY(e)+dy) );
  showLayer(skn);
}

//FONCTIONS POUR L'AIDE EN DIV POS 00
function pop2(msg, titre, largeur, bAbsolutePos, bgColorTitre, bgColorCorps, ColorTitre, ColorCorps) {
	// modif GL - 22/08/2003 ajout des params de couleur
  skn = getLayer("topdeck");
  if (!skn) return;
//  skn = (nav) ? skn : skn.style;
  if (titre == null) titre = "Aide" ;
  if (largeur == null) largeur = 180 ;
  if (bgColorTitre == null) bgColorTitre = '#006666';
  if (bgColorCorps == null) bgColorCorps = 'lightblue';
  if (ColorTitre == null) ColorTitre = '#FFFFFF';
  if (ColorCorps == null) ColorCorps = '#000000';
  var ContentToolTip ="<TABLE WIDTH="+largeur+" BORDER=0 CELLPADDING=2 CELLSPACING=0 BGCOLOR="+bgColorTitre+"><TR><TD><TABLE WIDTH=100% BORDER=0 CELLPADDING=0 CELLSPACING=0><TR><TD><CENTER><FONT FACE=TAHOMA COLOR="+ColorTitre+" SIZE=1><B>"+titre+"</B></FONT></CENTER></TD></TR></TABLE><TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=0 BGCOLOR="+bgColorCorps+"><TR><TD><FONT FACE=TAHOMA COLOR="+ColorCorps+" SIZE=1>"+msg+"</FONT></TD></TR></TABLE></TD></TR></TABLE>";
  writeLayer(skn, ContentToolTip); 
//  alert("x="+(getPageX(event)+dx)+" y="+(getPageY(event)+dy) );
  showLayer(skn);
}

function popscroll(msg, titre, largeur, dx, dy, bAbsolutePos, bgColorTitre, bgColorCorps, ColorTitre, ColorCorps, e) {
	// modif GL - 22/08/2003 ajout des params de couleur
  if (!e) e = event;
  skn = getLayer("topdeck");
  if (!skn) return;
//  skn = (nav) ? skn : skn.style;
  if (titre == null) titre = "Aide" ;
  if (largeur == null) largeur = 180 ;
  if (!dx) dx = -60;
  if (!dy) dy = 20;
  if (bgColorTitre == null) bgColorTitre = '#006666';
  if (bgColorCorps == null) bgColorCorps = 'lightblue';
  if (ColorTitre == null) ColorTitre = '#FFFFFF';
  if (ColorCorps == null) ColorCorps = '#000000';
  var ContentToolTip = " <TABLE WIDTH=100% HEIGHT=100% style='border:2px solid "+bgColorTitre+"' BORDER=0 CELLPADDING=0 CELLSPACING=0> \
        <TR> \
          <TD BGCOLOR="+bgColorTitre+"><CENTER><FONT FACE=TAHOMA COLOR="+ColorTitre+" SIZE=1><B>"+titre+"</B></FONT></CENTER></TD> \
        </TR> \
        <TR> \
           <TD BGCOLOR="+bgColorCorps+"><FONT FACE=TAHOMA COLOR="+ColorCorps+" SIZE=1>"+msg+"</FONT></TD> \
         </TR> \
      </TABLE> ";
  ContentToolTipContent = ContentToolTip;
  ContentToolTip = '<iframe src="" name="topdeckfr" id="topdeckfr" width="'+largeur+'" border="0"></iframe>';
  writeLayer(skn, ContentToolTip); 
  setTimeout("l = document.frames.item('topdeckfr');l.document.body.style.margin='0px 0px 0px 0px';l.document.body.innerHTML = ContentToolTipContent;",100);
  moveLayerToEvent(skn, e, dx, dy, true);
//  alert("x="+(getPageX(e)+dx)+" y="+(getPageY(e)+dy) );
  showLayer(skn);
}

function kill() {
  hideLayer(skn);
}
//FONCTIONS POUR LE FORM EN IFRAME
function showEditor(TEXTOBJ,IDINFOBASE,IDINFTYP,CSS,GAB) {
  var paramURL = "TEXTOBJ="+TEXTOBJ;
  if ((IDINFOBASE != null) && (IDINFOBASE != "")) paramURL += "&IDINFOBASE="+IDINFOBASE;
  if ((IDINFTYP != null) && (IDINFTYP != "")) paramURL += "&IDINFTYP="+IDINFTYP;
  if ((CSS != null) && (CSS != "")) paramURL += "&CSS="+CSS;
  if ((GAB != null) && (GAB != "")) paramURL += "&GAB="+GAB;
  if (isIE4) {
    Pop2ShowCNM("/JSEditor/BO_Editor.htm?"+paramURL, "contentEditor", 560, 350);
  } else {
    document.all("Content").src = "/JSEditor/BO_Editor.htm?"+paramURL;
    document.all("contentEditor").style.visibility="visible";
  }
}

function bi_frame_filterHTML(str, bAll) {
  // Traitement des marques de paragraphe
  str=str.replace(/<p[^>]*>/ig,'');
  str=str.replace(/<\/p[^>]*>/ig,'<br>');
  // Traitement des espaces multiples
  // str=str.replace(/\s\s/ig, ' ');
  // Traitement des apostrophes
  str=str.replace(/'/g,"'");
	str=str.replace(/’/g,"'");
	str=str.replace(/…/g,"'");
  // Traitement de caractères spéciaux
	str=str.replace(/œ/g,"oe");
	str=str.replace(/€/g,"&#128;");
  if (bAll) {
  // Traitement des éventuels tags ASP
    str=str.replace(/<\%[^\>]*\%\>/gi,"");
  // Traitement des éventuels tags PHP
    str=str.replace(/<\?[^\>]*\?\>/gi,"");
  // Traitement des éventuels scripts
    str=str.replace(/<script[^\/]*>.*\/script>/gi,"");
  // Traitement des éventuels styles
    str=str.replace(/<style[^\/]*>.*\/style>/gi,"");
  // Traitement des éventuels commentaires
    str=str.replace(/<\!--[^\>]*--\>/gi,"");
  // Traitement des balises HTML
    tags=[ "[^\\w\\/]",                  // par un symbole non-alphanumérique ou
           "\\d",                        // par un chiffre                    ou
           "[c-df-rtu-z]",                // par une lettre sauf A, B, E, S, T ou
           "a[^(>\\shref=)]",            // par A mais n'est pas A HREF=      ou
           "b[^r>]",                     // par B mais n'est pas B ni BR      ou
           "e[^m]",                      // par E mais n'est pas EM           ou
           "i[^>]",                      // par I mais n'est pas I            ou
           "strike",                     // par STRIKE                        ou
           "s[^(trong)]",                // par S mais n'est pas STRONG       ou
           "tt" ]                        // par TT
    re="/<\\/?"+tags[0]+"[^>]*>";
    for (i=1 ; i<tags.length ; i++) re+="|<\\/?"+tags[i]+"[^>]*>";
    eval("re="+re+"/gi");
    str=str.replace(re, "");
  // Traitement des "pseudo-balises HTML"
    str=str.replace(/&lt;([a-zA-Z!])/gi, "&lt; $1");
  // Traitement du '<' final
    str=str.replace(/&lt;$/gi,"&lt; ");
  }
  return str;
}

function getEventButton(e) {
  var button = e.button;
  
  if ( e.button != 0 && e.button != 2 && ( typeof(e.which) == 'undefined' || e.which > 0 ) ) 
  {
    /* Mozilla, Safari et Opera */
    if( typeof(e.which) != 'undefined' ) { button = e.which; }
    button--;
    /* Correction Opera et MS */
    if( button == 2 || button == 3) { button = 1; }
  }
  return button;
}
