<!-- 
//Auteur : Yvan VANWYNSBERGHE, yvanwnsberghe@devparadise.com

var ns4 = (document.layers)? true:false;         //NS 4 
var ie4 = (document.all)   ? true:false;         //IE 4 
var dom = (document.getElementById)? true:false; //DOM

var PreloadFlag = false;

function getWindowSize()
/******************************************************
Cette fonction permet d'obtenir la taille de la fenêtre. 
On ne tient en compte que la partie affichage de la page 
HTML. On ne tient pas compte du menu ou de la barre d'état 
de la fenêtre.
Retourne un tableau à 2 dimensions (largeur,hauteur).
*******************************************************/
{
	var MySize = new Array();

	if (window.innerWidth) MySize[0] = window.innerWidth;
	else                   MySize[0] = document.body.clientWidth;
	if (window.innerHeight)MySize[1] = window.innerHeight;
	else                   MySize[1] = document.body.clientHeight;

	return MySize;	
}


function getLeft(MyObject)
/******************************************************
Fonction permettant de connaître la position d'un objet
par rapport au bord gauche de la page.
Cet objet peut être à l'intérieur d'un autre objet.
*******************************************************/
{
	if (dom || ie4)
	    if (MyObject.offsetParent)
	        return (MyObject.offsetLeft + getLeft(MyObject.offsetParent));
	    else 
		return (MyObject.offsetLeft);
	else if (ns4)
		return (MyObject.x);
}

function getTop(MyObject)
/******************************************************
Fonction permettant de connaître la position d'un objet
par rapport au bord haut de la page.
Cet objet peut être à l'intérieur d'un autre objet.
*******************************************************/
{
	if (dom || ie4)
		if (MyObject.offsetParent)
			return (MyObject.offsetTop + getTop(MyObject.offsetParent));
		else
			return (MyObject.offsetTop);
	else if (ns4)
		return (MyObject.y);
}


function getHeight(DivId)
/******************************************************
Fonction permettant de connaître la hauteur d'un DIV.
*******************************************************/
{
	if      (dom) return (document.getElementById(DivId).offsetHeight);
	else if (ie4) return (document.all[DivId].clientHeight);
	else if (ns4) return (document.layers[DivId].clip.height);
}


function getWidth(DivId)
/******************************************************
Fonction permettant de connaître la largeur d'un DIV.
*******************************************************/
{
	if      (dom) return (document.getElementById(DivId).offsetWidth);
	else if (ie4) return (document.all[DivId].clientWidth);
	else if (ns4) return (document.layers[DivId].clip.width);
}


function ExtractClip(MyString)
/************************************************
fonction faisant l'extraction des valeurs du clip
Paramètre :
	MyString	-> clip, exemple : rect(0px 50px 50px 0px)
*************************************************/
{
	var MyClip = new Array();
	if (MyString == "")
	{
		MyClip[0] = 0;
		MyClip[1] = 0;
		MyClip[2] = 0;
		MyClip[3] = 0;
	}
	else
	{
   		MyClip = MyString.split("rect(")[1].split(" ");
	   	for (var i=0;i<MyClip.length;i++)
   			MyClip[i] = parseInt(MyClip[i]);
	}
	return MyClip;
}


function getClip(DivId)
/******************************************************
Fonction retournant les valeurs du clip d'un DIV :
	(top, right, bottom, left)
Paramètre :
	DivId	->	propriété ID du DIV
*******************************************************/
{
	var MyClip = new Array();
	var MyString = "";
	if (dom)
	{
		MyString = document.getElementById(DivId).style.clip;
		MyClip = ExtractClip(MyString);
	}
	else if (ie4) 
	{
		MyString = document.all[DivId].style.clip;
		MyClip = ExtractClip(MyString);
	}
	else if (ns4)
	{
		MyClip[0] = document.layers[DivId].clip.top;
		MyClip[1] = document.layers[DivId].clip.right;
		MyClip[2] = document.layers[DivId].clip.bottom;
		MyClip[3] = document.layers[DivId].clip.left;
	}
	var MyVal = ""
	for (var i=0;i<MyClip.length;i++) MyVal = MyVal + " "  + MyClip[i];

	return MyClip;
}


function SetToXY(DivId,Coordinates)
/*********************************************
Fonction permettant de positionner un DIV.
Paramètres : 
			DivId 		->	propriété ID du <DIV>
			Coordinates	->	tableau (X,Y)
**********************************************/
{
	if (dom)
	{
       	document.getElementById(DivId).style.left = Coordinates[0];
		document.getElementById(DivId).style.top = Coordinates[1];
	}
	else if (ie4) 
	{
		document.all[DivId].style.posLeft = Coordinates[0];
		document.all[DivId].style.posTop = Coordinates[1];
	}
	else if (ns4)
	{
		document.layers[DivId].pageX = Coordinates[0];
		document.layers[DivId].pageY = Coordinates[1];
	}
}

/*********************************************
Fonction permettant de positionner un <DIV> 
à une position occupée par une ancre.
Paramètres : 
			AnchorId 	->	propriété ID de l'ancre
			AnchorName	->	propriété NAME de l'ancre
			DivId			-> propriété ID du <DIV>
La fonction retourne les coordonnées de l'ancre 
dans un tableau (X,Y).
**********************************************/
function SetToAnchor(AnchorId,AnchorName,DivId)
{
	SetToAnchor(AnchorId,AnchorName,DivId,0,0);
}
function SetToAnchor(AnchorId,AnchorName,DivId,addx,addy)
{
	var MyCoordinates = new Array();
	var MyAnchor;

	if (dom)      MyAnchor = document.getElementById(AnchorId);
	else if (ie4) MyAnchor = document.all[AnchorId];
	else if (ns4) MyAnchor = document.anchors[AnchorName];

	MyCoordinates[0] = getLeft(MyAnchor) + addx;
	MyCoordinates[1] = getTop(MyAnchor)  + addy;
	SetToXY(DivId, MyCoordinates);

	return MyCoordinates;
}

function SetClip(DivId,MyClip)
/*********************************************************
Fonction permettant de fixer la propriété clip d'un <DIV>.
Paramètres : 
			DivId 	->	propriété ID du <DIV>
			MyClip	->	tableau contenant les valeurs
							du clip (top,right,bottom,left)
**********************************************************/
{
	if (dom)
	{
		document.getElementById(DivId).style.clip = "rect("+MyClip[0]+"px "+
			MyClip[1]+"px "+
			MyClip[2]+"px "+
			MyClip[3]+"px)";
	}
	else if (ie4) 
	{
		document.all[DivId].style.clip = "rect("+MyClip[0]+"px "+
			MyClip[1]+"px "+
			MyClip[2]+"px "+
			MyClip[3]+"px)";
	}
	else if (ns4)
	{
		document.layers[DivId].clip.top = MyClip[0];
		document.layers[DivId].clip.right = MyClip[1];
		document.layers[DivId].clip.bottom = MyClip[2];
		document.layers[DivId].clip.left = MyClip[3];
	}	
}


function Show(DivId)
/*********************************************
Fonction permettant de rendre visible un DIV.
Paramètres : 
			DivId 		->	propriété ID du <DIV>
**********************************************/
{
	if      (dom) document.getElementById(DivId).style.visibility = "visible";
	else if (ie4) document.all[DivId].style.visibility = "visible";
	else if (ns4) document.layers[DivId].visibility = "show";
}


function Hide(DivId)
/*********************************************
Fonction permettant de rendre invisible un DIV.
Paramètres : 
			DivId 		->	propriété ID du <DIV>
**********************************************/
{
	if (dom)      document.getElementById(DivId).style.visibility = "hidden";
	else if (ie4) document.all[DivId].style.visibility = "hidden";
	else if (ns4) document.layers[DivId].visibility = "hide";
}


function PreloadImages()
/*********************************************
Préchargement des images passées en paramètre,
pour rendre fluide les rollover
**********************************************/
{
	var MyArguments = PreloadImages.arguments;
	var MyImages = new Array();
	if (document.images)
	{
		for(var i=0; i<MyArguments.length; i++)
		{
			MyImages[i]= new Image();
			MyImages[i].src = MyArguments[i];
		}
		PreloadFlag = true;
	}
}


function ChangeImages()
/*********************************************
Change la source d'une image.
Paramètres :
	Premier argument	->	Attribut NAME de l'image
	Deuxième argument	->	nouvelle valeur de l'attribut SRC
**********************************************/
{
	var MyArguments = ChangeImages.arguments;
	var ImgName;
	for(var i=0; i<MyArguments.length; i+=2)
	{
		ImgName = MyArguments[i];
		//alert(document.images[ImgName].src);
		document.images[ImgName].src = MyArguments[i+1];
	}
}
function Trim(inputString) {
   // Removes leading and trailing spaces from the passed string. Also removes
   // consecutive spaces and replaces it with one space. If something besides
   // a string is passed in (null, custom object, etc.) then return the input.
   if (typeof inputString != "string") { return inputString; }
   var retValue = inputString;
   var ch = retValue.substring(0, 1);
   while (ch == " ") { // Check for spaces at the beginning of the string
      retValue = retValue.substring(1, retValue.length);
      ch = retValue.substring(0, 1);
   }
   ch = retValue.substring(retValue.length-1, retValue.length);
   while (ch == " ") { // Check for spaces at the end of the string
      retValue = retValue.substring(0, retValue.length-1);
      ch = retValue.substring(retValue.length-1, retValue.length);
   }
   while (retValue.indexOf("  ") != -1) { // Note that there are two spaces in the string - look for multiple spaces within the string
      retValue = retValue.substring(0, retValue.indexOf("  ")) + retValue.substring(retValue.indexOf("  ")+1, retValue.length); // Again, there are two spaces in each of the strings
   }
   return retValue; // Return the trimmed string back to the user
} // Ends the "trim" function




//-->
