
/**
* 	Soca script : Simple and Object oriented Cross browser API Javascript 
* 	Copyright (C) 2007 Gaesys - www.gaesys.com
* 	licensed under GPL (GPL-license.txt) license.
* 	
* 	@author: Julien Poveda
* 	@author: Stéphane Seyer
*
*/
var XHTMLNS = "http://www.w3.org/1999/xhtml";
var documentHead = document.head;
if (!document.all) {
document.write = function(str){
    var moz = !window.opera && !(/Apple/).test(navigator.vendor);           // Watch for writing out closing tags, we just    // ignore these (as we auto-generate our own)    if ( str.match(/^<\//) ) 
    {
    	return;
    }    // Make sure & are formatted properly, but Opera    // messes this up and just ignores it    if ( !window.opera )
    {        str = str.replace(/&(?![#a-z0-9]+;)/g, "&amp;");
    }    // Watch for when no closing tag is provided    // (Only does one element, quite weak)    str = str.replace(/<([a-z]+)(.*[^\/])>$/, "<$1$2></$1>");           // Mozilla assumes that everything in XHTML innerHTML    // is actually XHTML - Opera and Safari assume that it's XML    if ( !moz ) {        str = str.replace(/(<[a-z]+)/g, "$1 xmlns='http://www.w3.org/1999/xhtml'");
    }           // The HTML needs to be within a XHTML element    var div = document.createElementNS("http://www.w3.org/1999/xhtml","div");    div.innerHTML = str;           // Find the last element in the document    var pos;           // Opera and Safari treat getElementsByTagName("*") accurately    // always including the last element on the page    if ( !moz ) {        pos = document.getElementsByTagName("*");        pos = pos[pos.length - 1];                       // Mozilla does not, we have to traverse manually    } else {        pos = document;        while ( pos.lastChild && pos.lastChild.nodeType == 1 ) {            pos = pos.lastChild;
        }    }           // Add all the nodes in that position    var nodes = div.childNodes;    while ( nodes.length ) {        pos.parentNode.appendChild( nodes[0] );
    }};
}
/*------------------------------------------------------------------------------------
	OBJECT $
	Permet d'unifier pour tous les navigateurs la gestion des événements.
-------------------------------------------------------------------------------------*/

var $ = {
	"version" : "Soca 1.0 Alpha",
	"includedFiles" : [],
	"instanciatesModules" : [],
	"objectCounter" : 0,
	
	// Construction
	"init" : function ()
	{
		this.detectClientCaps ();
		// Add Cross Browser DOM Standard
		if (!window.addEventListener) {		    window.addEventListener = this._addEventListener;		}
		if (!document.importNode || window.webkit) {			document.importNode = this._importNode;		}
		Function.prototype.extendsClass = this._extendsClass;
		window.getInnerSize = this._getInnerSize;
	},
	"detectClientCaps" : function ()
	{
		window.xpath = !!(document.evaluate);
		if (window.ActiveXObject) {
			window.ie = window[window.XMLHttpRequest ? 'ie7' : 'ie6'] = true;
		}
		else if (document.childNodes && !document.all && !navigator.taintEnabled) {
			window.webkit = window[window.xpath ? 'webkit420' : 'webkit419'] = true;
		}
		else if (document.getBoxObjectFor != null) {
			window.gecko = true;
		}
		
	},
	// Fonctions utilitaires
	"isDef" : function $defined (obj) {
		return (obj != undefined);
	},
	"include" : function (filename)	{
		for (i=0; i < this.includedFiles.length; i++) {
			if (this.includedFiles[i] == filename) {
				return false;
			}
		}
		var script = document.createElementNS(XHTMLNS, "script");
		script.setAttribute("type", "text/javascript");
		script.setAttribute("src", filename);
		document.getElementsByTagName("head")[0].appendChild(script);
		this.includedFiles.push (filename);
		return true;
	},
	"parseUri" : function (sourceUri) {			var uriPartNames = ["source","protocol","authority","domain","port","path","directoryPath","fileName","query","anchor"];			var uriParts = new RegExp("^(?:([^:/?#.]+):)?(?://)?(([^:/?#]*)(?::(\\d*))?)?((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[\\?#]|$)))*/?)?([^?#/]*))?(?:\\?([^#]*))?(?:#(.*))?").exec(sourceUri);			var uri = {};						for (var i = 0; i < uriPartNames.length; i++)
			{
				uri[uriPartNames[i]] = (uriParts[i] ? uriParts[i] : "");
			}						// Always end directoryPath with a trailing backslash if a path was present in the source URI			// Note that a trailing backslash is NOT automatically inserted within or appended to the "path" key			if(uri.directoryPath.length > 0) {				uri.directoryPath = uri.directoryPath.replace(/\/?$/, "/");			}			return uri;
	},
	"getElementsByClassName" : function (cName)
	{
		var coll = [];
		if (document.evaluate)
		{
			xpathQuery = "//*[contains(@class,'"+cName+"')]";
			reval = document.evaluate(xpathQuery, document, null, XPathResult.ANY_TYPE, null);
			thisElement = reval.iterateNext();
			while (thisElement) {
		 		coll.push(thisElement);
		 		thisElement = reval.iterateNext();
			}
		}
		else
		{
			elements = document.getElementsByTagName("*");
			for (i=0; i<elements.length; i++)
			{
				try {
					if (elements.item(i).className.indexOf(cName) != -1) {
						coll.push(elements.item(i));
					}
				}
				catch (e)
				{
					alert(elements.item(i));
				}
			}
		}
		return coll;
	},
	"urlEncode" : function (sStr) {
	    return escape(sStr).replace(/\+/g, '%2B').replace(/\"/g,'%22').replace(/\'/g, '%27').replace(/\//g,'%2F');
	},
	"getType" : function (mixed) {
		if (!this.isDef(mixed)) {
			return false;
		}
		var type = typeof obj;
		if (type == "object" && obj.nodeName) {
			switch (obj.nodeType) {
				case 1: 
					return 'element';
				case 3: 
					return (/\S/).test(obj.nodeValue) ? 'textnode' : 'whitespace';
				default:
					break;
			}
		}
		if (type == "object" || type == "function") {
			switch (obj.constructor) {
				case Array: 
					return "array";
				case RegExp: 
					return "regexp";
				case Class: 
					return "class";
				default:
					break;
			}
			if (typeof obj.length == "number") {
				if (obj.item) {
					return "collection";
				}
				if (obj.callee) {
					return 'arguments';
				}
			}
		}
		return type;
	},
	"serialize" : function (mixed) {
		var serializedString = "";
		switch (this.getType(mixed))
		{
			case "string":
				serializedString = "'"+mixed+"'";
				break;
			case "object":
				for (var prop in mixed)
				{
					serializedString += "'"+prop+"':"+this.serialize("prop")+",";
				}
				serializedString = "{"+serializedString.substr(0,serializedString.length-1)+"}";
				break;
			case "array":
				for (var i=0; i<mixed.length; i++)
				{
					serializedString += "'"+prop+"',";
				}
				serializedString = "["+serializedString.substr(0,serializedString.length-1)+"]";
				break;
			default:
				serializedString = mixed;
				break;
		}
		return serializedString;
	},
	"unserialize" : function (mixed) {
		
	},
	"_getInnerSize" : function () {		
		var winWidth = 0, winHeight = 0;
	  		if( typeof( window.innerWidth ) == 'number' ) {
			// Non IE6			winWidth = window.innerWidth;			winHeight = window.innerHeight;	  	} 
	  	else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		    //IE 6+ in 'standards compliant mode'	    	winWidth = document.documentElement.clientWidth;		    winHeight = document.documentElement.clientHeight;	  	} 
	  	else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {		    //IE 4 compatible		    winWidth = document.body.clientWidth;		    winHeight = document.body.clientHeight;		}
		return {"width":winWidth,"height":winHeight};	},
	"_addEventListener" : function(eventName, func, capture)  {
        if (this.attachEvent) { 
        	this.attachEvent('on' + eventName, func); 
        }	},
	"_importNode" : function(node, deep) {		var imported;
		var attrs;		if (node.nodeType == 1)  {
			imported = document.createElement(node.nodeName);			attrs = node.attributes;			for (i = attrs.length - 1; i >= 0; i--) {				imported.setAttribute(attrs[i].name, attrs[i].value);
			}			if (node.style && node.style.cssText) {
				imported.style.cssText = node.style.cssText;
			}		} 
		else if (node.nodeType == 3) {
			imported = document.createTextNode(node.nodeValue);
		}		if(deep && node.hasChildNodes()) {		   var oChild = node.firstChild;		   do {				imported.appendChild(document.importNode(oChild, true));				oChild = oChild.nextSibling;			} while (oChild);		}		return imported;	},
	"_extendsClass" : function (classHandler) {	    var prop;	    for (prop in classHandler.prototype) {
	      this.prototype[prop] = classHandler.prototype[prop];
	    }
	    this.prototype._className = this.toString().match(/function\s*(\w+)/)[1];
	    if (arguments.length == 2) {
	    	this.prototype._moduleName = arguments[1].toString().match(/function\s*(\w+)/)[1];
	    }	},
	"createElement" : function (mixed) {
		var element = false;
		var classHandler = false;
		if (typeof mixed == "string") {
			element = document.createElement(tagName);
			classHandler = Element;
		}
		else if ("prototype" in mixed) {
			if ("_tagName" in mixed.prototype) {
				element = document.createElement(mixed.prototype._tagName);
			}
			classHandler = mixed;
		}
		var prop = false;			
    	for (prop in classHandler.prototype) {
			element[prop] = classHandler.prototype[prop];
		}
		var args = new Array ();
		for (var i=1; i<arguments.length; i++) {
			args.push(arguments[i]);
		}
		classHandler.call(element,args);
		if (!"addEventListener" in element) {
			element.addEventListener = $._addEventListener;
		}
		return element;
	}
};

$.init();
/*------------------------------------------------------------------------------------
	CLASSE Element
-------------------------------------------------------------------------------------*/

function Element () {
	this._currentTimeout = false;
	this.xpath = false;
	var eid = this.getAttribute("id");
	if (eid != null && eid.length != 0)	{
		this.uid = this.htmlElement.getAttribute ("id");
	}
	else {
		this.uid = "obj"+$.objectCounter++;
		this.setAttribute ("id", this.uid);
	}
	this.attachEvents();
	
	if ("_arguments" in this)
	{
		var i=0;
		for (var prop in this._args) {
			this._args[prop] = arguments[0][0][i++];
		}
	}
}

Element.prototype.getClass = function () {
	return this.getAttribute("class");
};
Element.prototype.setAttributes = function (oList) {
	var prop = false;
	for (prop in oList) {
		this.setAttribute(prop, oList[prop]);
	}
};
Element.prototype.attachEvents = function () {
	var	evt = false;
	for (var prop in this)
	{
		evt = prop.match(/(.*)Event$/);
		if (evt != null) {
			this.addEventListener(evt [1], this.onevent, true);
		}
	}
};
Element.prototype.onevent = function (evt) {
	try 
	{
		var cbEvent = new Event(evt);
		node = cbEvent.target;
		while (!("_currentTimeout" in node)) {
			node = node.parentNode;
		}
		if ((cbEvent.eventHandler.type+"Event" in node)) {	
			return node[cbEvent.eventHandler.type+"Event"](cbEvent);
		}
		else if (("parentObject" in node) && (cbEvent.eventHandler.type+"Event" in node.parentObject)) {
			return node.parentObject[cbEvent.eventHandler.type+"Event"](cbEvent);
		}
	}
	catch (e) {	}
	return true;
};
Element.prototype.destruct = function () {
	this.parentNode.removeChild(this);
};
Element.prototype.setPersistentAttribute = function (name, value)
{
	name = this.uid+"__"+name;
	var now = new Date();	var expires = new Date (now.getFullYear()+1, now.getMonth(), now.getDate());
	var path;
	if (arguments.length == 2) {		path  = window.location.pathname;
	}
	else {
		path = "/";
	}
	var domain = window.location.hostname;	var secure = false;	document.cookie=name+"="+escape($.serialize(value))+		((expires==null) ? "" : ("; expires="+expires.toGMTString()))+		((path==null) ? "" : ("; path="+path))+		((domain==null) ? "" : ("; domain="+domain))+		((secure==true) ? "; secure" : "");
};
Element.prototype.getPersistentAttribute = function (name)
{
	name = this.uid+"__"+name;
	var arg=name+"=";	var alen=arg.length;	var clen=document.cookie.length;	var i=0;
	var attVal = false;	while (i<clen) {		var j=i+alen;		if (document.cookie.substring(i, j)==arg) { 			var endstr=document.cookie.indexOf (";", j);			if (endstr==-1) {	    		endstr=document.cookie.length;
			}
			attVal = unescape(document.cookie.substring(j, endstr));
			if (attVal.substr(0,1) == "{") {
				eval("var attObject = "+attVal+";");
				return attObject;
			}
			else {				return attVal;
			}		}
      i = document.cookie.indexOf(" ",i)+1;
      if (i==0) {
      	break;
      }
   }	return false;};

/*------------------------------------------------------------------------------------
	CLASSE Event
	Permet d'unifier pour tous les navigateurs la gestion des événements.
-------------------------------------------------------------------------------------*/
function Event (evt)
{
	this.eventHandler = evt;
	this.firstParentWithObject = false;
	if (window.event)
	{
		this.eventHandler = window.event;
		this.target = window.event.srcElement;
	}
	else
	{
		this.target = evt.currentTarget;
	}
	if (this.target.nodeType != 1)
	{
		node = this.target;
		while (node.nodeType != 1) {
			node = node.parentNode;
		}
		this.target = node;
	}
}

Event.prototype.clearEvent = function () {
	if (window.event) {
		window.event.cancelBubble = true;
		window.event.returnValue = false;
	}
	else
	{
		this.eventHandler.stopPropagation();
		this.eventHandler.preventDefault();
	}
	return false;
};

/*------------------------------------------------------------------------------------
	CLASSE CrossBrowserEvent
	Permet d'unifier pour tous les navigateurs la gestion des événements.
-------------------------------------------------------------------------------------*/
function CrossBrowserEvent (evt)
{
	this.eventHandler = evt;
	this.firstParentWithObject = false;
	this.originalTarget = false;
	if (window.event)
	{
		this.eventHandler = window.event;
		this.target = window.event.srcElement;
		this.originalTarget  = window.event.srcElement;
	}
	else
	{
		this.target = evt.currentTarget;
		this.originalTarget  = evt.target;
	}
	if (this.target.nodeType != 1)
	{
		node = this.target;
		while (node.nodeType != 1) {
			node = node.parentNode;
		}
		this.target = node;
	}
}

CrossBrowserEvent.prototype.clearEvent = function () {
	if (window.event) {
		window.event.cancelBubble = true;
		window.event.returnValue = false;
	}
	else
	{
		this.eventHandler.stopPropagation();
		this.eventHandler.preventDefault();
	}
	return false;
};

/*------------------------------------------------------------------------------------
	CLASSE BaseElement
	Element de Base avec comportement
-------------------------------------------------------------------------------------*/
function BaseElement (mixed)
{
	this._currentTimeout = false;
	this.xpath = false;
	if ("_moduleName" in this && this._moduleName+"Instance" in window)
	{
		var tabInstance = window[this._moduleName+"Instance"].instanciatesBehaviors;
		if (!(this._className in tabInstance))
		{
			tabInstance[this._className]=1;
		}
		else
		{
			tabInstance[this._className]++;
		}
	}	

	if (mixed)
	{
		if ((typeof(mixed) == "array" || typeof(mixed) == "object") && mixed.length != 0) {
			mixed = mixed[0];
		}
		
		if (typeof(mixed) == "string")
		{
			this.htmlElement = document.createElement(mixed);
			this.htmlElement.className = this._className;
		}
		else	{	
			this.htmlElement = mixed;
		}
	}
	if (!this.htmlElement && "createHtmlElement" in this) {
			this.htmlElement = this.createHtmlElement();
	}
		
	if (this.htmlElement)
	{
		// Ajout de addEventListener
		if (!this.htmlElement.addEventListener) {
			this.htmlElement.addEventListener = $._addEventListener;
		}
		this.htmlElement.jsobject = this;
		var eid = this.htmlElement.getAttribute("id");
		if (eid != null && eid.length != 0)
		{
			this.uid = this.htmlElement.getAttribute ("id");
		}
		else
		{
			this.uid = "obj"+$.objectCounter++;
			this.htmlElement.setAttribute ("id", this.uid);
		}
		this.attachEvents();
		if (this.uid) 
		{
			this.pageUid = "#"+this.uid;
		}
	}
}
BaseElement.prototype.attachEvents = function () {
	var	evt = false;
	for (var prop in this)
	{
		evt = prop.match(/(.*)Event$/);
		if (evt != null) 
		{
			this.htmlElement.addEventListener(evt [1], this.onevent, true);
		}
	}
	
};
BaseElement.prototype.destruct = function (evt) {
	this.htmlElement.parentNode.removeChild(this.htmlElement);
};

BaseElement.prototype.setPersistentAttribute = function (name, value)
{
	name = this.uid+"__"+name;
	var now = new Date();	var expires = new Date (now.getFullYear()+1, now.getMonth(), now.getDate());
	var path;
	if (arguments.length == 2) {		path  = window.location.pathname;
	}
	else {
		path = "/";
	}
	if (typeof(value) == "object")
	{
		var serializedString = "";
		for (var prop in value)
		{
			serializedString += "'"+prop+"':[";
			for (var i=0; i<value[prop].length; i++)
			{
				serializedString += "'"+value[prop][i]+"',";
			}
			serializedString = serializedString.substr(0,serializedString.length-1);
			serializedString += "],";
		}
		serializedString = "{"+serializedString.substr(0,serializedString.length-1)+"}";
		value = serializedString;
	}
	var domain = window.location.hostname;	var secure = false;	document.cookie=name+"="+escape(value)+		((expires==null) ? "" : ("; expires="+expires.toGMTString()))+		((path==null) ? "" : ("; path="+path))+		((domain==null) ? "" : ("; domain="+domain))+		((secure==true) ? "; secure" : "");
};
BaseElement.prototype.getPersistentAttribute = function (name)
{
	name = this.uid+"__"+name;
	var arg=name+"=";	var alen=arg.length;	var clen=document.cookie.length;	var i=0;
	var attVal = false;	while (i<clen) {		var j=i+alen;		if (document.cookie.substring(i, j)==arg) { 			var endstr=document.cookie.indexOf (";", j);			if (endstr==-1) {	    		endstr=document.cookie.length;
			}
			attVal = unescape(document.cookie.substring(j, endstr));
			if (attVal.substr(0,1) == "{") {
				eval("var attObject = "+attVal+";");
				return attObject;
			}
			else {				return attVal;
			}		}
      i = document.cookie.indexOf(" ",i)+1;
      if (i==0) {
      	break;
      }
   }	return false;};
BaseElement.prototype.onevent = function (evt) {
	try 
	{
		var cbEvent = new CrossBrowserEvent(evt);
		node = cbEvent.target;
		while (typeof(node.jsobject) !== "object" || !("htmlElement" in node.jsobject)) {
			node = node.parentNode;
		}
		if ((cbEvent.eventHandler.type+"Event" in node.jsobject)) {	
			return node.jsobject[cbEvent.eventHandler.type+"Event"](cbEvent);
		}
		else if (("parentObject" in node.jsobject) && (cbEvent.eventHandler.type+"Event" in node.jsobject.parentObject)) {
			return node.jsobject.parentObject[cbEvent.eventHandler.type+"Event"](cbEvent);
		}
	}
	catch (e) {	}
	return true;
};

BaseElement.prototype.insertIn = function (parentElement) {
	parentElement.appendChild(this.htmlElement);
};
BaseElement.prototype.insertBefore = function (parentElement, referenceNode) {
	parentElement.insertBefore(this.htmlElement, referenceNode);
};
BaseElement.prototype.insertAfter = function (parentElement, referenceNode) {
	if (referenceNode.nextSibling) {
		parentElement.insertBefore(this.htmlElement, referenceNode.nextSibling);
	}
	else {
		parentElement.appendChild(this.htmlElement);
	}
};
BaseElement.prototype.getChildren = function () {
	var items = this.htmlElement.childNodes;
	var len = items.length;
	var i = 0;
	var children = [];
	if (len != 0)
	{		do	{
			if (items[i].nodeType == 1) {
				children.push(items[i]);
			}
		}		while (++i < len);
	}	return children;
};
BaseElement.prototype.setStyles = function (Rule) {
	Module.prototype.addRule("#"+this.uid+" "+Rule);
};

BaseElement.prototype.setTimeout = function (cmethod, interval) {
	this.clearTimeout();
	var cmdString = "document.getElementById('"+ this.uid +"').jsobject."+cmethod+"();";
	this._currentTimeout = window.setTimeout(cmdString, interval);
};
BaseElement.prototype.clearTimeout = function () {
	if (this._currentTimeout) {
		window.clearTimeout(this._currentTimeout);
	}
};
BaseElement.prototype.display = function () {
	this.htmlElement.style.display = "block";
};
BaseElement.prototype.hide = function () {
	this.htmlElement.style.display = "none";
};
BaseElement.prototype.setVisible = function () {
	this.htmlElement.style.visibility = "visible";
};
BaseElement.prototype.setHidden = function () {
	this.htmlElement.style.visibility = "hidden";
};
BaseElement.prototype.setAttribute = function (aname, avalue) {
	if (aname == "class")
	{
		this.htmlElement.className = avalue;
	}
	else
	{
		this.htmlElement.setAttribute(aname, avalue);
		if (aname == "id") {
			this.uid = avalue;
		}
	}
};
BaseElement.prototype.setStyle = function (astyle, avalue) {
	this.htmlElement.style[astyle] = avalue;
};
/*------------------------------------------------------------------------------------
	CLASSE BaseRequestElement
	Element de Base avec gestion des requêtes HTTP.
-------------------------------------------------------------------------------------*/
BaseRequestElement.extendsClass(BaseElement);
function BaseRequestElement (mixed)
{
	BaseElement.call(this, mixed);
	this.xmlResponse = false;
	this.textResponse = false;
	this.currentUrl = false;
	this.currentParamaters = false;
	this.currentData = null;
	this.currentMethod = "GET";
	this.inProgress = false;
	this.isRefreshOnce = false;
}

BaseRequestElement.prototype._getHTTPObject = function (tt) {
     var http_request = false;       if (window.XMLHttpRequest)    {        try        {            http_request = new XMLHttpRequest();        }        catch (e)        {            http_request = false;        }    }    else    {        try        {            http_request = new ActiveXObject("Msxml2.XMLHTTP");        }        catch (e)        {            try            {                http_request = new ActiveXObject("Microsoft.XMLHTTP");            }            catch (e)            {                http_request = false;            }        }    }    return http_request;};
BaseRequestElement.prototype._SendHTTPRequest = function (rurl, method, data) 
{
	if (!this.xmlReqObject) {
   	this.xmlReqObject = this._getHTTPObject();
	}
   	var target;		if (this.xmlReqObject)
	{
		try 
		{
			if (this.xmlReqObject.status !== 0) {
				this.xmlReqObject.abort();
			}
		}
		catch (e) {}
		
		this.inProgress = true;
		this.currentUrl = rurl;
		this.currentMethod = method;
		this.currentData = data;
	
		if ("addThrobber" in this) {
			this.addThrobber();
		}
			
		this.xmlReqObject.open(method, rurl); 
		if (method == "POST") {
			this.xmlReqObject.setRequestHeader("Content-type","application/x-www-form-urlencoded");
			this.xmlReqObject.setRequestHeader("Content-length",data.length);
		}
		target = this.htmlElement;
		this.xmlReqObject.onreadystatechange = function () {
			var xmlreq = target.jsobject.xmlReqObject;
			if (xmlreq.readyState == 4)
			{
				if (xmlreq.status == 200 || xmlreq.status == 204)
				{
					if (xmlreq.responseXML && xmlreq.responseXML.documentElement.tagName != "parsererror" && xmlreq.responseXML.documentElement.childNodes.length !== 0) {
						target.jsobject.xmlResponse = xmlreq.responseXML;
					}
					else {
						target.jsobject.xmlResponse = false;
					}
					target.jsobject.textResponse = xmlreq.responseText;
					target.jsobject.inProgress = false;
				}
				else
				{
					target.jsobject.xmlResponse = false;
					target.jsobject.textResponse = "Erreur "+xmlreq.status+" url : "+target.jsobject.currentUrl;
				}
				target.jsobject.doRequest();
		  	}
		};
		this.xmlReqObject.send(data); 
	}
};
BaseRequestElement.prototype._SendGETRequest = function (rurl) 
{
	this._SendHTTPRequest (rurl, "GET", null);
};
BaseRequestElement.prototype._getParentJsObject = function (node)
{
	while (node.tagName.toLowerCase() != "body" && !node.jsobject.HTMLElement){
		node = node.parentNode;
	}
	return node;
};
BaseRequestElement.prototype.refresh = function ()
{
	if (arguments.length != 0) {
		this.currentUrl = arguments[0];
	}
	if (this.currentUrl)
	{
		if ("content" in this) {
			this.content.innerHTML = "";
		}
		else {
			this.htmlElement.innerHTML = "";
		}
		this.isRefreshOnce = true;
		var curl = this.currentUrl;
		if ("currentParameters" in this && this.currentParameters.length != 0)
		{
			curl = curl+"&"+this.currentParameters.substr(1);
		}
		this._SendHTTPRequest (curl, this.currentMethod, this.currentData);
	}
};

BaseRequestElement.prototype.doRequest = function () 
{
	this.inProgress = false;
};

/*------------------------------------------------------------------------------------
	CLASSE Module
	Module avec chargement des comportements et règles CSS
-------------------------------------------------------------------------------------*/
function Module ()
{
	this._currentTimeout = false;
	this.instanciatesBehaviors = new Object ();
	window[this._className+"Instance"] = this;
	eval ("var fHandler = function () {"+this._className+"Instance.initBehavior();}");
	window.addEventListener("load", fHandler, false);
	
	if ("addCssRules" in this) {
		this.addCssRules();
	}
	
	if ("destruct" in this) {
		eval ("var fHandler = function () {"+this._className+"Instance.destruct();}");
		window.addEventListener("beforeunload", fHandler, false);
	}
	$.instanciatesModules.push(this._className+"Instance");
}
Module.prototype.setTimeout = function (cmethod, interval) {
	this.clearTimeout();
	var cmdString = "window['"+this._className+"Instance']."+cmethod+"();";
	this._currentTimeout = window.setTimeout(cmdString, interval);
};
Module.prototype.clearTimeout = function () {
	if (this._currentTimeout) {
		window.clearTimeout(this._currentTimeout);
	}
};
Module.prototype.addRule = function (rule) {
	var style = false;
	try {
	if(document.styleSheets)
	{
		if (!document.styleSheets.length && document.head) {
			style = document.head.appendChild(document.createElement("style"));
		}
		if (!window.webkit)
		{
		 	var a   = document.styleSheets[0];
	 		var arr = rule.replace(/}.*/,'').split('{');
	 		if	(a.insertRule) {
	 			a.insertRule(rule,a.cssRules.length);
	 		}
	 		else if(a.addRule)
	 		{
	  			var arr2 = arr[0].split(/,/);
	  			for(var i=0;i<arr2.length;i++) {
	  				a.addRule(arr2[i],arr[1]);
	  			}
	  		}
 		}
 		else
 		{
			if (!style)
			{
	 			style = document.head.getElementsByTagName("style").item(0);
	 			if (!style)
	 			{
	 				style = document.head.appendChild(document.createElement("style"));
	 			}
			}
			style.appendChild(document.createTextNode(rule));
 		}
 	}
	}
	catch (e) {}
};
Module.prototype._getCName = function (fHandler)
{
	return fHandler.toString().match(/function\s*(\w+)/)[1];
};
Module.prototype.attachBehavior = function (className, ClassHandler)
{
	var coll = new Array ();
	var i=0;
	if (arguments.length == 3 && arguments[2] != document)
	{
		var refNode = arguments[2];
		var allChilds = refNode.getElementsByTagName("*");
		for (i=0; i<allChilds.length; i++)
		{
			if (allChilds.item(i).className.indexOf(className) != -1) {
				coll.push(allChilds.item(i));
			}
		}
	}
	else {
		coll = $.getElementsByClassName (className);
	}
	i = 0;
	var exists = false;
	while (coll.length) 
	{
		object = new ClassHandler (coll[0], i++);
  		coll.shift();
  	}
};
Module.prototype.attachInputBehavior = function (type, ClassHandler)
{
	var coll = [];
	var refNode = document;
	if (arguments.length == 3 && arguments[2] != document) {
		refNode = arguments[2];
	}
	if (type == "textarea")
	{
		for (j=0; j < refNode.getElementsByTagName("textarea").length; j++) {
			coll.push(refNode.getElementsByTagName("textarea").item(j));
		}
	}
	else if (type == "select")
	{
		for (j=0; j < refNode.getElementsByTagName("select").length; j++) {
			coll.push(refNode.getElementsByTagName("select").item(j));
		}
	}
	else
	{
		if (document.evaluate && refNode == document)
		{
			xpathQuery = "//*[@type='"+type+"']";
			reval = document.evaluate(xpathQuery, document, null, XPathResult.ANY_TYPE, null);
			thisElement = reval.iterateNext();
			while (thisElement) {
		 		coll.push(thisElement);
		 		thisElement = reval.iterateNext();
			}
		}
		else
		{
			elements = refNode.getElementsByTagName("input");
			for (i=0; i < elements.length; i++) {
				try {
					if (elements.item(i).getAttribute("type") == type) {
						coll.push(elements.item(i));
					}
				}
				catch (e)
				{
					alert(elements.item(i));
				}
			}
		}
	}
	
	i = 0;
	while (coll.length) 
	{
  		object = new ClassHandler (coll[0], i++);
  		coll.shift();
  	}
};


/************************************************** * dom-drag.js * 09.25.2001 * www.youngpup.net * Script featured on Dynamic Drive (http://www.dynamicdrive.com) 12.08.2005 ************************************************** * 10.28.2001 - fixed minor bug where events * sometimes fired off the handle, not the root. **************************************************/var Drag = {	"obj" : null,	"init" : function(o, oRoot, minX, maxX, minY, maxY, bSwapHorzRef, bSwapVertRef, fXMapper, fYMapper)	{		o.onmousedown	= Drag.start;		o.hmode			= bSwapHorzRef ? false : true ;		o.vmode			= bSwapVertRef ? false : true ;		o.root = oRoot && oRoot != null ? oRoot : o ;		if (o.hmode  && isNaN(parseInt(o.root.style.left  ))) { o.root.style.left   = "0px"; }		if (o.vmode  && isNaN(parseInt(o.root.style.top   ))) { o.root.style.top    = "0px"; }		if (!o.hmode && isNaN(parseInt(o.root.style.right ))) { o.root.style.right  = "0px"; }		if (!o.vmode && isNaN(parseInt(o.root.style.bottom))) { o.root.style.bottom = "0px"; }		o.minX	= typeof minX != 'undefined' ? minX : null;		o.minY	= typeof minY != 'undefined' ? minY : null;		o.maxX	= typeof maxX != 'undefined' ? maxX : null;		o.maxY	= typeof maxY != 'undefined' ? maxY : null;		o.xMapper = fXMapper ? fXMapper : null;		o.yMapper = fYMapper ? fYMapper : null;		o.root.onDragStart	= new Function();		o.root.onDragEnd	= new Function();		o.root.onDrag		= new Function();	},	"start" : function(e)	{		var o = Drag.obj = this;		//e = Drag.fixE(e);		var y = parseInt(o.vmode ? o.root.style.top  : o.root.style.bottom);		var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right );		o.root.onDragStart(x, y);		o.lastMouseX	= e.clientX;		o.lastMouseY	= e.clientY;		if (o.hmode) {			if (o.minX != null)	{ o.minMouseX	= e.clientX - x + o.minX; }			if (o.maxX != null)	{ o.maxMouseX	= o.minMouseX + o.maxX - o.minX; }		} else {			if (o.minX != null) { o.maxMouseX = -o.minX + e.clientX + x; }			if (o.maxX != null) { o.minMouseX = -o.maxX + e.clientX + x; }		}		if (o.vmode) {			if (o.minY != null)	{ o.minMouseY	= e.clientY - y + o.minY; }			if (o.maxY != null)	{ o.maxMouseY	= o.minMouseY + o.maxY - o.minY; }		} else {			if (o.minY != null) { o.maxMouseY = -o.minY + e.clientY + y; }			if (o.maxY != null) { o.minMouseY = -o.maxY + e.clientY + y; }		}		document.onmousemove	= Drag.drag;		document.onmouseup		= Drag.end;		return false;	},	"drag" : function(e)	{		//e = Drag.fixE(e);		var o = Drag.obj;		var ey	= e.clientY;		var ex	= e.clientX;		var y = parseInt(o.vmode ? o.root.style.top  : o.root.style.bottom);		var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right );		var nx, ny;		if (o.minX != null) { ex = o.hmode ? Math.max(ex, o.minMouseX) : Math.min(ex, o.maxMouseX); }		if (o.maxX != null) { ex = o.hmode ? Math.min(ex, o.maxMouseX) : Math.max(ex, o.minMouseX); }		if (o.minY != null) { ey = o.vmode ? Math.max(ey, o.minMouseY) : Math.min(ey, o.maxMouseY); }		if (o.maxY != null) { ey = o.vmode ? Math.min(ey, o.maxMouseY) : Math.max(ey, o.minMouseY); }		nx = x + ((ex - o.lastMouseX) * (o.hmode ? 1 : -1));		ny = y + ((ey - o.lastMouseY) * (o.vmode ? 1 : -1));		if (o.xMapper)	{ 
			nx = o.xMapper(y);
		} else if (o.yMapper) {
			ny = o.yMapper(x);
		}		Drag.obj.root.style[o.hmode ? "left" : "right"] = nx + "px";		Drag.obj.root.style[o.vmode ? "top" : "bottom"] = ny + "px";		Drag.obj.lastMouseX	= ex;		Drag.obj.lastMouseY	= ey;		Drag.obj.root.onDrag(nx, ny);		return false;	},	"end" : function()	{		document.onmousemove = null;		document.onmouseup   = null;		Drag.obj.root.onDragEnd(	parseInt(Drag.obj.root.style[Drag.obj.hmode ? "left" : "right"]), 									parseInt(Drag.obj.root.style[Drag.obj.vmode ? "top" : "bottom"]));		Drag.obj = null;	},	"fixE" : function(e)	{		if (typeof e == 'undefined') { e = window.event;		if (typeof e.layerX == 'undefined') { e.layerX = e.offsetX; }		if (typeof e.layerY == 'undefined') { e.layerY = e.offsetY; }		return e;	}}};
// Modules et extensions
BaseModule.extendsClass(Module);
function BaseModule () 
{
	Module.call (this);
	this.cframe = false;
}
BaseModule.prototype.initBehavior = function ()
{
//	var a = $.createElement(Anchor, "/", "titre");
//	document.body.appendChild(a);
};
BaseModule.prototype.setClientReference = function (egClient)
{
	this.client = egClient;
};
BaseModule.prototype.openFrame = function (furl)
{
	this.cframe = new BaseIFrame(furl);
	this.cframe.insertIn(document.body);
	this.cframe.open();
};
BaseModule.prototype.showFrame = function (furl)
{
	this.cframe.setVisible();
};

BaseModule.prototype.addCssRules = function ()
{
	this.addRule("#dialog {width : 90%;left : 5%;position : absolute;z-index : 10000;opacity : 1;}");
	this.addRule(".fdialog {width : 90%;left : 5%;position : absolute;z-index : 10000;opacity : 1; height:300px; top : 40px;border : 1px solid #999;}");
	this.addRule("#mainContent {overflow : auto;position : relative;}");
	this.addRule(".titlebar {padding : 5px;height : 20px;font-weight : bold;}");
	this.addRule(".titlebar img {float : right;cursor : pointer;}");
};
new BaseModule ();
/*------------------------------------------------------------------------------------
	CLASSE BaseIFrame
-------------------------------------------------------------------------------------*/
BaseIFrame.extendsClass(BaseElement);
function BaseIFrame (furl)
{
	BaseElement.call(this, ["iframe"]);
	this.setHidden();
	this.currentUrl = furl;
	this.htmlElement.setAttribute("frameborder", "0");
	this.htmlElement.setAttribute("src", "about:blank");
	this.htmlElement.className = "fdialog";
	this.htmlElement.style.height = (window.getInnerSize().height-80)+"px";
}
BaseIFrame.prototype.loadEvent = function () {
};
BaseIFrame.prototype.open = function () {
	this.overlay = new OverlayFrame (this, false);
};
BaseIFrame.prototype.display = function () {
	this.htmlElement.setAttribute("src", this.currentUrl);
};


/*------------------------------------------------------------------------------------
	CLASSE Dialog
	Boite de dialogue javascript avec Overlay.
	oButton			Boutton lié à l'ouverture (lien)
	oTitle			Titre de la boite de dialogue
	[content]		Noeud XML de contenu
-------------------------------------------------------------------------------------*/
BaseDialog.extendsClass (BaseRequestElement);
function BaseDialog (oButton, oTitle) {
	
	
	this.destroyOnClose = true; 				// Indique si la fenêtre est détruite à la fermeture
	this.mainContent = false;					// Noeud de contenu de la boîte
	this.clickElement = oButton.jsobject;		// Object de l'élément cliqué

	this.redirectLink = true;
	
	var args = ["div"];
	
	// Le troisième parmètre est le contenu de la boîte						
	if (arguments.length == 3) {
		args = [arguments[2]];
		this.mainContent = arguments[2].firstChild;
		if (this.mainContent.nodeType != 1) {
			this.mainContent = this.mainContent.nextSibling;
		}
	}

	// Création de la boite de dialogue
	BaseRequestElement.call(this, args);

	var closeButton = new BaseButton(this, "close", "/skin/images/dialog/close.png");
	this.htmlElement.setAttribute("id", "dialog");
	this.htmlElement.style.top = (document.documentElement.scrollTop+document.body.scrollTop+10)+"px";
	
	if (!this.clickElement.imageElement) 
	{
		// Création de la barre de titre
		var oTitleBar = document.createElement("div");
		if (this.mainContent) {
			this.htmlElement.insertBefore(oTitleBar, this.mainContent);
		}
		else {
			this.htmlElement.appendChild(oTitleBar);
		}
		oTitleBar.className = "titlebar";
	
		closeButton.insertIn(oTitleBar);
	
		var oSpanTitle = oTitleBar.appendChild(document.createElement("span"));
		oSpanTitle.appendChild(document.createTextNode(oTitle));
		oTitleBar.appendChild(document.createElement("hr"));
	}
	else
	{
		closeButton.insertIn(this.htmlElement);
	}
	
	
	// Ajout de la div de contenu 
	this.currentUrl = "";
	if (!this.mainContent) {
		this.mainContent = this.htmlElement.appendChild(document.createElement("div"));
		if (this.clickElement.imageElement)
		{
			this.setHidden();
			this.currentImage = new BaseImage ();
			this.currentImage.dialog = this;
			if (document.all)
			{
				this.currentImage.htmlElement.detachEvent("onload", BaseElement.prototype.onevent);
				this.currentImage.htmlElement.setAttribute("height", "480px");
				this.currentImage.htmlElement.setAttribute("width", "640px");
				this.currentImage.setImage(this.clickElement.imageElement.src.replace(".140.105",".640.480"));
				this.setVisible();
			}
			else {
				this.currentImage.setImage(this.clickElement.imageElement.src.replace(".140.105",".100"));
			}
			this.currentImage.insertIn(this.htmlElement);

			if ("tasksElement" in this.clickElement) {
				this.htmlElement.appendChild(this.clickElement.tasksElement.cloneNode(true));
			}
		}
		else if (this.clickElement.htmlElement.hasAttribute("href"))
		{
			this.currentUrl = this.clickElement.htmlElement.getAttribute("href");
			this._SendGETRequest (this.currentUrl+"?output=body", this.htmlElement);
		}
	}
	if (!this.clickElement.imageElement) {
		this.mainContent.setAttribute("id", "mainContent");
		this.mainContent.style.height = (window.getInnerSize().height-80)+"px";
	}
	else {
		this.htmlElement.className = "image";
	}
}
BaseDialog.prototype.doRequest = function ()
{
	var xmlDocument = this.xmlResponse;
	var rootNode;
	try {
		if (xmlDocument.documentElement.getElementsByTagName("body").length !== 0) {
			rootNode = xmlDocument.documentElement.getElementsByTagName("body").item(0);
		}
		else if (xmlDocument.documentElement.getElementsByTagName("div").length !== 0) {
			rootNode = xmlDocument.documentElement.getElementsByTagName("div").item(0);
		}
		else {
			rootNode = xmlDocument.documentElement.getElementsByTagName("ul").item(0);
		}
		var childs = rootNode.childNodes;
		var full = false;
		for (var i = 0; i< childs.length; i++)
		{
			if (childs.item(i).nodeType == "1")
			{
				full = true;
				break;
			}
		}
		if (full)
		{
			var mainTarget = this.mainContent;
			mainTarget.innerHTML = "";
    		var node = document.importNode(rootNode, true);
   			node = mainTarget.appendChild(node);
   			if (this.redirectLink)
   			{
				var cAnchors = mainTarget.getElementsByTagName("a");
				for (i = 0; i < cAnchors.length; i++)
				{
					var curl = cAnchors.item(i).getAttribute("href");
					//if (curl.substr(curl.length-1) != "/")
					//	cAnchors.item(i).setAttribute("href", "/#"+curl)
					cAnchors.item(i).onclick = this.refresh;
					cAnchors.item(i).jsobject = this;
				}
   			}
    	}
	}
	catch (e) {
		alert("An exception occurred in the script. Error name: " + e.name + ". Error message: " + e.message);
	}
};

BaseDialog.prototype.refresh = function (evt) {
	var tAnchor;
	var cbevent = new CrossBrowserEvent (evt);
	cbevent.clearEvent();
	switch (cbevent.target.tagName.toLowerCase())
	{
		case "div":
		case "h3":
			tAnchor = cbevent.target.parentNode;
			break;
		case "object":
		case "img":
			if (cbevent.target.parentNode.tagName == "a")
			{
				tAnchor = cbevent.target.parentNode;
			}
			else
			{
				tAnchor = cbevent.target.parentNode.parentNode;
			}
			break;
		case "a":
			tAnchor = cbevent.target;
			break;
		default:
			alert ("Dialog : impossible de trouver le lien href");
			break;
	}
	if (tAnchor.getAttribute("href").indexOf("#") != -1)
	{
		tAnchor.jsobject.clickElement.updateRelatedElement(tAnchor.getAttribute("href").substr(tAnchor.getAttribute("href").indexOf("#")+1));
		tAnchor.jsobject.close();
	}	
	else {
		tAnchor.jsobject._SendGETRequest (tAnchor.getAttribute("href")+"&output=htmlContent", tAnchor.jsobject.htmlElement);
	}
};
BaseDialog.prototype.open = function () {
	this.overlay = new OverlayFrame (this, false);
};

BaseDialog.prototype.close = function (closeButton) {
	this.hide();
	this.overlay.setTimeout("decreaseOpacity", 5);
	//setTimeout("document.getElementById('dialog').jsobject.minimize()", 1);
};

BaseDialog.prototype.minimize = function () {
	mheight = getWinInnerSize().height-120;
	if (this.htmlElement.clientHeight > 80)
	{
		this.htmlElement.style.height = (this.htmlElement.clientHeight-80)+"px";
		this.htmlElement.style.opacity = (this.htmlElement.clientHeight-80)/mheight;
		setTimeout("if (document.getElementById('dialog')) document.getElementById('dialog').jsobject.minimize()", 1);
	}
	else {
		document.getElementById("dialog").parentNode.removeChild(document.getElementById("dialog"));
	}
};

BaseDialog.prototype.maximize = function () {
	mheight = getWinInnerSize().height-200;
	if (this.htmlElement.clientHeight < mheight)
	{
		this.htmlElement.style.height = (this.htmlElement.clientHeight+80)+"px";
		this.htmlElement.style.opacity = (this.htmlElement.clientHeight+80)/mheight;
		setTimeout("if (document.getElementById('dialog')) document.getElementById('dialog').jsobject.maximize()", 1);
	}
};
/*------------------------------------------------------------------------------------
	CLASSE BaseFrame
	Boite de dialogue javascript avec Overlay.
	oButton			Boutton lié à l'ouverture (lien)
	oTitle			Titre de la boite de dialogue
	[content]		Noeud XML de contenu
-------------------------------------------------------------------------------------*/
BaseFrame.extendsClass (BaseRequestElement);
function BaseFrame (oButton, oTitle) {
	
	
	this.destroyOnClose = true; 				// Indique si la fenêtre est détruite à la fermeture
	this.mainContent = false;					// Noeud de contenu de la boîte
	this.clickElement = oButton.jsobject;		// Object de l'élément cliqué

	this.redirectLink = true;
	
	var args = ["div"];
	
	// Le troisième parmètre est le contenu de la boîte						
	if (arguments.length == 3) {
		args = [arguments[2]];
		this.mainContent = arguments[2].firstChild;
		if (this.mainContent.nodeType != 1) {
			this.mainContent = this.mainContent.nextSibling;
		}
	}

	// Création de la boite de dialogue
	BaseRequestElement.call(this, args);

	this.htmlElement.setAttribute("id", "bframe");
	
	// Ajout de la div de contenu 
	this.currentUrl = "";
	if (!this.mainContent) {
		this.mainContent = this.htmlElement.appendChild(document.createElement("div"));
		if (this.clickElement.imageElement)
		{
			this.setHidden();
			this.currentImage = new BaseImage ();
			this.currentImage.dialog = this;
			if (document.all)
			{
				this.currentImage.htmlElement.detachEvent("onload", BaseElement.prototype.onevent);
				this.currentImage.htmlElement.setAttribute("height", "480px");
				this.currentImage.htmlElement.setAttribute("width", "640px");
				this.currentImage.setImage(this.clickElement.imageElement.src.replace(".140.105",".640.480"));
				this.setVisible();
			}
			else {
				this.currentImage.setImage(this.clickElement.imageElement.src.replace(".140.105",".100"));
			}
			this.currentImage.insertIn(this.htmlElement);

			if ("tasksElement" in this.clickElement) {
				this.htmlElement.appendChild(this.clickElement.tasksElement.cloneNode(true));
			}
		}
		else if (this.clickElement.htmlElement.hasAttribute("href"))
		{
			if (this.clickElement.htmlElement.getAttribute("href") != "#") {
				this.currentUrl = this.clickElement.htmlElement.getAttribute("href");
				this._SendGETRequest (this.currentUrl+"?output=body", this.htmlElement);
			}
		}
	}
}
BaseFrame.prototype.doRequest = function ()
{
	var xmlDocument = this.xmlResponse;
	var rootNode;
	try {
		if (xmlDocument.documentElement.getElementsByTagName("body").length !== 0) {
			rootNode = xmlDocument.documentElement.getElementsByTagName("body").item(0);
		}
		else if (xmlDocument.documentElement.getElementsByTagName("div").length !== 0) {
			rootNode = xmlDocument.documentElement.getElementsByTagName("div").item(0);
		}
		else {
			rootNode = xmlDocument.documentElement.getElementsByTagName("ul").item(0);
		}
		var childs = rootNode.childNodes;
		var full = false;
		for (var i = 0; i< childs.length; i++)
		{
			if (childs.item(i).nodeType == "1")
			{
				full = true;
				break;
			}
		}
		if (full)
		{
			var mainTarget = this.mainContent;
			mainTarget.innerHTML = "";
    		var node = document.importNode(rootNode, true);
   			node = mainTarget.appendChild(node);
   			if (this.redirectLink)
   			{
				var cAnchors = mainTarget.getElementsByTagName("a");
				for (i = 0; i < cAnchors.length; i++)
				{
					var curl = cAnchors.item(i).getAttribute("href");
					//if (curl.substr(curl.length-1) != "/")
					//	cAnchors.item(i).setAttribute("href", "/#"+curl)
					cAnchors.item(i).onclick = this.refresh;
					cAnchors.item(i).jsobject = this;
				}
   			}
    	}
	}
	catch (e) {
		alert("An exception occurred in the script. Error name: " + e.name + ". Error message: " + e.message);
	}
};

BaseFrame.prototype.refresh = function (evt) {
	var tAnchor;
	var cbevent = new CrossBrowserEvent (evt);
	cbevent.clearEvent();
	switch (cbevent.target.tagName.toLowerCase())
	{
		case "div":
		case "h3":
			tAnchor = cbevent.target.parentNode;
			break;
		case "object":
		case "img":
			if (cbevent.target.parentNode.tagName == "a")
			{
				tAnchor = cbevent.target.parentNode;
			}
			else
			{
				tAnchor = cbevent.target.parentNode.parentNode;
			}
			break;
		case "a":
			tAnchor = cbevent.target;
			break;
		default:
			alert ("Dialog : impossible de trouver le lien href");
			break;
	}
	if (tAnchor.getAttribute("href").indexOf("#") != -1)
	{
		tAnchor.jsobject.clickElement.updateRelatedElement(tAnchor.getAttribute("href").substr(tAnchor.getAttribute("href").indexOf("#")+1));
		tAnchor.jsobject.close();
	}	
	else {
		tAnchor.jsobject._SendGETRequest (tAnchor.getAttribute("href")+"&output=htmlContent", tAnchor.jsobject.htmlElement);
	}
};
BaseFrame.prototype.open = function () {
	this.display();
};

BaseFrame.prototype.close = function (closeButton) {
	this.hide();
};

/*------------------------------------------------------------------------------------
	CLASSE BaseButton
-------------------------------------------------------------------------------------*/
BaseButton.extendsClass(BaseElement);
function BaseButton (targetObject, targetMethod, imageSrc)
{
	BaseElement.call(this, ["img"]);
	this.targetObject = targetObject;
	this.targetMethod = targetMethod;
	this.htmlElement.setAttribute("src", imageSrc);
}
BaseButton.prototype.clickEvent = function (cbevent) {
	return this.targetObject[this.targetMethod](this);
};
BaseButton.prototype.enable = function () {
	this.htmlElement.style.opacity = 0.5;
};
BaseButton.prototype.disable = function () {
	this.htmlElement.style.opacity = 1;
};
/*------------------------------------------------------------------------------------
	CLASSE BaseList
-------------------------------------------------------------------------------------*/
BaseList.extendsClass(BaseElement);
function BaseList ()
{
	BaseElement.call(this, ["ul"]);
	this.items = new Array ();
}
BaseList.prototype.insertItem = function (label) {
	var item = new BaseItem();
	this.items.push (item);
	item.setLabel(label);
	item.insertIn(this.htmlElement);
	return item;
};
/*------------------------------------------------------------------------------------
	CLASSE BaseItem
-------------------------------------------------------------------------------------*/
BaseItem.extendsClass(BaseElement);
function BaseItem ()
{
	BaseElement.call(this, ["li"]);
	this.activeElement = this.htmlElement.appendChild(document.createElement("a"));
}
BaseItem.prototype.setLabel = function (label) {
	this.activeElement.innerHTML = "";
	this.activeElement.appendChild(document.createTextNode(label));
};

/*------------------------------------------------------------------------------------
	CLASSE BaseScroller
-------------------------------------------------------------------------------------*/
BaseScroller.extendsClass(BaseElement);
function BaseScroller (targetObject, scrollStep, className)
{
	BaseElement.call(this, ["div"]);
	this.htmlElement.className = className;
	this.targetObject = targetObject;
	this.originalStep = scrollStep;
	if (this.originalStep < 0) {
		this.htmlElement.appendChild(document.createTextNode("«"));
	}
	else {
		this.htmlElement.appendChild(document.createTextNode("»"));
	}
	this.maxTime = 200;
}
BaseScroller.prototype.mouseoverEvent = function (cbevent) {
	this.targetObject.noscroll = true;
	this.setTimeout("scrollTarget", this.maxTime);
};
BaseScroller.prototype.scrollTarget = function (cbevent) {
	this.targetObject.scrollStep(this.originalStep);
	this.setTimeout("scrollTarget", this.maxTime);
	if (this.maxTime > 10) {
		this.maxTime = this.maxTime-10;
	}
};
BaseScroller.prototype.mouseoutEvent = function (cbevent) {
	this.clearTimeout();
	this.maxTime = 200;
	this.targetObject.noscroll = false;
};

/*------------------------------------------------------------------------------------
	CLASSE BaseLinkButton
-------------------------------------------------------------------------------------*/
BaseLinkButton.extendsClass(BaseElement);
function BaseLinkButton (targetObject, targetMethod, atext)
{
	var className = false;
	if (arguments.length == 4) {
		className = arguments[3];
	}
	 
	BaseElement.call(this, ["a"]);
	this.targetObject = targetObject;
	this.targetMethod = targetMethod;
	this.htmlElement.setAttribute("href", "#");
	if (className)
	{
		this.htmlElement.className = className;
		this.setStyles("{background : url(/skin/tasks/"+className+".png) no-repeat top left; padding-left : 20px;}");
	}
	this.htmlElement.appendChild(document.createTextNode(atext));
}
BaseLinkButton.prototype.clickEvent = function (cbevent) {
	cbevent.clearEvent();
	return this.targetObject[this.targetMethod](this);
};
BaseLinkButton.prototype.enable = function () {
	if (!document.all) {		this.htmlElement.style.opacity = 1;
	}	this.htmlElement.style.color = "#000";};BaseLinkButton.prototype.disable = function () {	if (!document.all) {		this.htmlElement.style.opacity = 0.5;
	}	this.htmlElement.style.color = "#999";};
/*------------------------------------------------------------------------------------
	CLASSE BaseImage
-------------------------------------------------------------------------------------*/
BaseImage.extendsClass(BaseElement);
function BaseImage ()
{
	BaseElement.call(this, ["img"]);
	this.htmlElement.className = "mimg";
	this.tempImage;
}
BaseImage.prototype.loadEvent = function (event) {

	var wImg = this.tempImage.width;
	var hImg = this.tempImage.height;

	var wMax = getWinInnerSize().width-50;
	var hMax = getWinInnerSize().height-120;
	if ("viewElement" in this)
	{
		wMax = this.viewElement.htmlElement.clientWidth-50;
		hMax = hImg;
	}
	var wFinal;
	var hFinal;
	var ratio = 1;
	if (wImg > wMax && hImg > hMax) {
		if (wMax/wImg < hMax/hImg) {
			ratio = wMax/wImg;
		}
		else {
			ratio = hMax/hImg;
		}
	}
	else if (wImg > wMax) {
		ratio = wMax/wImg;
	}
	else if (hImg > hMax) {
		ratio = hMax/hImg;
	}
	this.htmlElement.width = Math.round(wImg*ratio);
	this.htmlElement.height = Math.round(hImg*ratio);
	var dLeft = Math.round((getWinInnerSize().width - this.htmlElement.width - 10)/2);
	var dTop = document.documentElement.scrollTop+document.body.scrollTop + Math.round((getWinInnerSize().height - this.htmlElement.height - 60)/2);
	if ("dialog" in this)
	{
		this.dialog.htmlElement.style.left = dLeft+"px";
		this.dialog.htmlElement.style.top = dTop+"px";
		this.dialog.setVisible();
	}
};
BaseImage.prototype.setImage = function (imgSrc) {
	this.tempImage = new Image ();
	this.tempImage.src = imgSrc;
	this.htmlElement.src = imgSrc;
};
/*------------------------------------------------------------------------------------
	CLASSE OverlayFrame
-------------------------------------------------------------------------------------*/
OverlayFrame.extendsClass(BaseElement);
function OverlayFrame (elementToShow)
{
	BaseElement.call(this, ["div"]);
	this.elementToShow = elementToShow;
	this.opacity = 0;
	
	this.setHidden();
	this.setStyles("{"+
		"z-index : 8000;"+
		"position : absolute;"+
		"top : "+(document.documentElement.scrollTop+document.body.scrollTop)+"px;"+
		"left : 0;"+
		"height: "+window.getInnerSize().height+"px;"+
		"width: "+window.getInnerSize().width+"px;"+
		"background-color : #888;"+
		"opacity : 0;"+
		"filter : alpha(opacity:0);"+
		"}");
	this.insertIn(document.getElementsByTagName("body").item(0));
	document.getElementsByTagName("body").item(0).style.overflow = "hidden";
	this.setTimeout("increaseOpacity", 5);
	
}
OverlayFrame.prototype.increaseOpacity = function ()
{
	this.setVisible();
	this.opacity = this.opacity+0.2;
	this.htmlElement.style.opacity = this.opacity;
	this.htmlElement.style.filter = "alpha(opacity:"+this.opacity*100+")";
	if (this.opacity < 0.6)	{
		this.setTimeout("increaseOpacity", 5);
	}
	else {
		this.clearTimeout();
		this.elementToShow.display ();
	}
};
OverlayFrame.prototype.decreaseOpacity = function ()
{
	this.opacity = this.opacity-0.2;
	this.htmlElement.style.opacity = this.opacity;
	this.htmlElement.style.filter = "alpha(opacity:"+this.opacity*100+")";
	if (this.opacity > 0) {
		this.setTimeout("decreaseOpacity", 5);
	}
	else {
		this.clearTimeout();
		document.getElementsByTagName("body").item(0).style.overflow = "auto";
		this.destruct();
	}
};
/*------------------------------------------------------------------------------------
	CLASSE CanvasElement
-------------------------------------------------------------------------------------*/
CanvasElement.extendsClass(BaseElement);
function CanvasElement ()
{
	BaseElement.call(this, ["canvas"]);
	this.context = this.htmlElement.getContext('2d');
	if (arguments.length == 2) {
		this.htmlElement.width = arguments[0];
		this.htmlElement.height = arguments[1];
	}	
}
CanvasElement.prototype.roundedRect = function (x,y,width,height,radius){  this.context.beginPath();  this.context.moveTo(x,y+radius);  this.context.lineTo(x,y+height-radius);  this.context.quadraticCurveTo(x,y+height,x+radius,y+height);  this.context.lineTo(x+width-radius,y+height);  this.context.quadraticCurveTo(x+width,y+height,x+width,y+height-radius);  this.context.lineTo(x+width,y+radius);  this.context.quadraticCurveTo(x+width,y,x+width-radius,y);  this.context.lineTo(x+radius,y);  this.context.quadraticCurveTo(x,y,x,y+radius);  this.context.fill();  this.context.stroke();};
	

// Modules et extensions
google_ad_client = "pub-5580890984055999";/* 250x250, date de création 30/01/08 */google_ad_slot = "6803896608";google_ad_width = 250;google_ad_height = 250;ReeflexModule.extendsClass(Module);
function ReeflexModule () 
{
	Module.call (this);
}
ReeflexModule.prototype.initBehavior = function ()
{
	this.attachInputBehavior("select", FormField);
	this.attachInputBehavior("text", FormField);
	this.attachInputBehavior("checkbox", FormField);
};
ReeflexModule.prototype.addCssRules = function ()
{
//	this.addRule(".blockview {clear : both !important;}");
};
new ReeflexModule ();

/*------------------------------------------------------------------------------------
	CLASSE AutoscrollBlock
	Element de type block en autoscroll
-------------------------------------------------------------------------------------*/
FormField.extendsClass(BaseRequestElement);
function FormField ()
{
	if (arguments[0].parentNode.getAttribute("class") && arguments[0].parentNode.getAttribute("class").indexOf("islisten") !== -1)
	{
		BaseRequestElement.call(this, arguments);
	}
}
FormField.prototype.blurEvent = function ()
{
	this.changeEvent();
};
FormField.prototype.changeEvent = function ()
{
	var faction = this.htmlElement.form.action+"&nextModule=cmdstate";
	var fvalue = this.getValue();
	var param = this.htmlElement.name+"=";
	var params = new Array ();
	
	var sparams;
	if (fvalue.split(",").length > 1)
	{
		for (var i=0; i<fvalue.split(",").length; i++)
		{
			params.push(param+fvalue.split(",")[i]);
		}
		sparams = params.join("&");
	}
	else {
		sparams = param+fvalue;
	}
	this._SendHTTPRequest(faction, "POST", sparams);
};
FormField.prototype.doRequest = function () 
{
	if (document.getElementById("cmdmod"))
	{
		var pNode = document.getElementById("cmdmod").parentNode;
		pNode.removeChild(document.getElementById("cmdmod"));
	}
	var node = document.importNode(this.xmlResponse.getElementById("cmdmod"), true);
	document.getElementById("mcontext").insertBefore(node, document.getElementById("mcontext").firstChild);
};

FormField.prototype.getValue = function ()
{
	var rvalue = false;
	if (this.htmlElement.tagName.toLowerCase() == "select")
	{
		for (var i=0; i<this.htmlElement.getElementsByTagName("option").length; i++)
		{
			if (this.htmlElement.getElementsByTagName("option").item(i).selected)
			{
				if (rvalue)	{
					rvalue = rvalue +","+this.htmlElement.getElementsByTagName("option").item(i).value;
				}
				else {
					rvalue = this.htmlElement.getElementsByTagName("option").item(i).value;					
				}
			}	
		}
	}
	else if (this.htmlElement.tagName.toLowerCase() == "input")
	{
		switch (this.htmlElement.type)
		{
			case "text":
				rvalue = this.htmlElement.value;
				break;
			case "checkbox":
				rvalue = this.htmlElement.checked?"true":"false";
				break;
			default:
				break;
		}
	}
	return rvalue;
};

/*------------------------------------------------------------------------------------
	CLASSE TabTable
	Element de type block en autoscroll
-------------------------------------------------------------------------------------*/
TabTable.extendsClass(BaseElement);
function TabTable ()
{
	BaseElement.call(this, arguments);
	
	this.tabs = new Array ();
	this.containers = new Array ();
	
	var currentChild = false;
	var currentTab = false;
	var currentContainer = false;
	
	for (var i=0; i < this.htmlElement.childNodes.length; i++)
	{
		currentChild = this.htmlElement.childNodes.item(i);
		if (currentChild.nodeType == 1)
		{
			switch(currentChild.tagName.toLowerCase())
			{
				case "h3":
					currentTab = this.tabs.push(currentChild);
					currentChild.onclick = this.tabclk;
					break;
				case "div":
					currentContainer = this.containers.push(currentChild);
					currentContainer.jsobject = this;
					currentTab.jsobject = currentContainer;
					break;
				default:
					break;
			}
		}
	}
	for (i=0; i < this.tabs.length; i++)
	{
		this.htmlElement.insertBefore(this.tabs[i], this.containers[0]);
	}

}
TabTable.prototype.activateTab = function (cont)
{
	for (var i=0; i < this.containers.length; i++)
	{
		if (this.tabs[i].className.indexOf("curtab") != -1)
		{
			this.containers[i].className = "";
			this.tabs[i].className = "";
		}
		if (this.tabs[i] == cont)
		{
			this.containers[i].className = "curcont";
			this.tabs[i].className = "curtab";
		}
	}
};

TabTable.prototype.tabclk = function (evt)
{
	var event = new CrossBrowserEvent(evt);
	var tabMgr = event.target.parentNode.jsobject;
	tabMgr.activateTab(event.target);
	
};

/*------------------------------------------------------------------------------------
	CLASSE MainmenuElement
	Gère un diaporama de photos
-------------------------------------------------------------------------------------*/
MainmenuElement.extendsClass(BaseElement);
function MainmenuElement ()
{
	BaseElement.call(this, arguments);
	var oUls = this.htmlElement.parentNode.getElementsByTagName("ul");
	// Construction des sous-menus
	this.submenus = [];
	for (var i=0; i<oUls.length; i++) 
	{
		if (oUls.item(i).className.indexOf("submenu") != -1)
		{
			var newmenu = new SubmenuElement(oUls.item(i));
			newmenu.mainmenu = this;
			this.submenus.push(newmenu);
		}
	}
	// Attachement de sous menus au menu principal, ajout du hover
	var oLis = this.htmlElement.getElementsByTagName("li");
	this.mainitems = [];
	this.currentMenu = 0;
	for (i=0; i<oLis.length; i++) 
	{
		if (oLis.item(i).className == "current")
		{
			this.currentMenu = i;
		}
		var newitem = new MainitemElement(oLis.item(i));
		newitem.submenu = this.submenus[i];
		newitem.submenu.mainitem = newitem;
		newitem.mainmenu = this;
		this.mainitems.push(newitem);
	}
	this.hideSubmenus();
	this.showCurrent();
	
}
MainmenuElement.prototype.hideSubmenus = function (currentMenu)
{
	for (var i=0; i<this.submenus.length; i++)
	{
		if (this.submenus[i] !== currentMenu)
		{
			this.submenus[i].hide();
		}
	}
	for (i=0; i<this.mainitems.length; i++)
	{
		this.mainitems[i].setAttribute("class", "");
	}
};
MainmenuElement.prototype.showCurrent = function ()
{
	this.hideSubmenus(this.submenus[this.currentMenu]);
	this.submenus[this.currentMenu].display();
	this.mainitems[this.currentMenu].setAttribute("class", "current");
};

/*------------------------------------------------------------------------------------
	CLASSE MainmenuElement
	Gère un diaporama de photos
-------------------------------------------------------------------------------------*/
MainitemElement.extendsClass(BaseElement);
function MainitemElement ()
{
	BaseElement.call(this, arguments);
	this.submenu = false;
	this.mainmenu = false;
}
MainitemElement.prototype.mouseoverEvent = function ($evt)
{
	this.mainmenu.hideSubmenus(this.submenu);
	this.setAttribute("class", "current");
	this.submenu.display();
};
MainitemElement.prototype.mouseoutEvent = function ($evt)
{
	this.mainmenu.showCurrent();
};
/*------------------------------------------------------------------------------------
	CLASSE SubmenuElement
	Gère un diaporama de photos
-------------------------------------------------------------------------------------*/
SubmenuElement.extendsClass(BaseElement);
function SubmenuElement ()
{
	BaseElement.call(this, arguments);
	this.mainmenu = false;
	this.mainitem = false;
	this.ison = false;
}
SubmenuElement.prototype.mouseoverEvent = function ($evt)
{
	this.ison = true;
	this.mainmenu.hideSubmenus(this);
	this.mainitem.setAttribute("class", "current");
	this.display();
	this.ison=false;
};
SubmenuElement.prototype.mouseoutEvent = function ($evt)
{
	if (!this.ison)
	{
		this.mainmenu.showCurrent();
	}
};
/*------------------------------------------------------------------------------------
	CLASSE GalerieElement
	Gère un diaporama de photos avec titre
-------------------------------------------------------------------------------------*/
GalerieElement.extendsClass(BaseElement);
function GalerieElement ()
{
	BaseElement.call(this, arguments);
	this.containers = this.htmlElement.getElementsByTagName("div");
	this.currentIndex = 1;
	this.nbImages = this.containers.length;
	this.setTimeout("showNextImage", 6000);
}
GalerieElement.prototype.showNextImage = function ()
{
	// Cache l'image active
	if (this.currentIndex != 0)
	{
		this.containers.item(this.currentIndex).style.display = "none";
	}
	this.currentIndex += 1;
	/// Retour au début si on est à la fin
	if (this.currentIndex+1 > this.nbImages)
	{
		this.currentIndex = 1;
	}
	// Active la nouvelle image
	var currentContainer = this.containers.item(this.currentIndex);
	currentContainer.style.backgroundImage = "url("+currentContainer.getAttribute("href")+")";
	this.containers.item(this.currentIndex).style.display = "block";
	this.setTimeout("showNextImage", 2000);
};


/*------------------------------------------------------------------------------------
	CLASSE DiaporamaElement
	Gère un diaporama de photos
-------------------------------------------------------------------------------------*/
function DiaporamaElement (oDiv)
{
	/*---------------------
			PROPRIETES
	---------------------*/
	/* Element a à transformer */
	this.htmlElement = oDiv;
	this.images = new Array();
	this.currentImage = 0;
	this.img = document.createElement("img");
	this.title = document.createElement("h2");
	this.previous = document.createElement("a");
	this.next = document.createElement("a");
	this.pause = document.createElement("a");
	this.isStopped = false;
	this.timeout;

	/*---------------------
			METHODES
	---------------------*/
	this.goPrevious = function (evt)
	{
		if (evt != null)
		{
			var cbevent = new CrossBrowserEvent(evt);
		}

		var DiapElement = document.getElementById('_diaporama').jsobject;
		
		if (DiapElement.currentImage > 0)
		{
			DiapElement.currentImage--;
			DiapElement.img.setAttribute("src", DiapElement.images[DiapElement.currentImage][0]);
			DiapElement.title.firstChild.nodeValue = DiapElement.images[DiapElement.currentImage][1];
		}
		if (!DiapElement.isStopped)
		{
			clearTimeout(DiapElement.timeout);
			DiapElement.timeout = setTimeout("document.getElementById('_diaporama').jsobject.goNext(null);",3000);
		}
		
		DiapElement.updateNavig();
		if (evt != null)
		{
			return cbevent.clearEvent();
		}
	};
	
	this.goStop = function (evt)
	{
		if (evt != null)
		{
			var cbevent = new CrossBrowserEvent(evt);
		}

		var DiapElement = document.getElementById('_diaporama').jsobject;
		var tbutton = DiapElement.pause;
		clearTimeout(DiapElement.timeout);
		if (!DiapElement.isStopped)
		{
			tbutton.removeChild(tbutton.firstChild);
			tbutton.appendChild(document.createTextNode("Reprendre"));
			DiapElement.isStopped = true;
		}
		else
		{
			tbutton.removeChild(tbutton.firstChild);
			tbutton.appendChild(document.createTextNode("Pause"));
			DiapElement.isStopped = false;
			DiapElement.timeout = setTimeout("document.getElementById('_diaporama').jsobject.goNext(null);",3000);
		}	

		if (evt != null)
		{
			return cbevent.clearEvent();
		}
	};
	
	this.goNext = function (evt)
	{
		if (evt != null)
		{
			var cbevent = new CrossBrowserEvent(evt);
		}
		
		var DiapElement = document.getElementById('_diaporama').jsobject;

		if (DiapElement.currentImage < (DiapElement.images.length-1))
		{
			DiapElement.currentImage++;
			DiapElement.img.setAttribute("src", DiapElement.images[DiapElement.currentImage][0]);
			DiapElement.title.firstChild.nodeValue = DiapElement.images[DiapElement.currentImage][1];
		}
		else
		{
			if (evt == null)
			{
				DiapElement.currentImage = 0;
				DiapElement.img.setAttribute("src", DiapElement.images[DiapElement.currentImage][0]);
				DiapElement.title.firstChild.nodeValue = DiapElement.images[DiapElement.currentImage][1];
			}
		}
		
		if (!DiapElement.isStopped)
		{
			clearTimeout(DiapElement.timeout);
			DiapElement.timeout = setTimeout("document.getElementById('_diaporama').jsobject.goNext(null);",3000);
		}
			
		DiapElement.updateNavig();
		if (evt != null)
		{
			return cbevent.clearEvent();
		}
	};
	
	this.updateNavig = function ()
	{
		if (this.currentImage == 0)
		{
			this.previous.removeAttribute("href");
			this.previous.onclick = null;
	
			this.next.setAttribute("href",  "#");
			this.next.onclick = this.goNext;
		}
		else if (this.currentImage == (this.images.length-1))
		{
			this.previous.setAttribute("href", "#");
			this.previous.onclick = this.goPrevious;
	
			this.next.removeAttribute("href");
			this.next.onclick = null;
		}
		else
		{
			this.previous.setAttribute("href",  "#");
			this.previous.onclick = this.goPrevious;
			
			this.next.setAttribute("href",  "#");
			this.next.onclick = this.goNext;
		}
	};
	
	/*---------------------
			CONSTRUCTEUR
	---------------------*/
	this.htmlElement.jsobject = this;
	this.htmlElement.setAttribute("id","_diaporama");
	var licoll = this.htmlElement.getElementsByTagName("li");
	for (var i=0; i<licoll.length; i++)
	{
		var anchor = licoll.item(i).getElementsByTagName("a").item(0);
		this.images.push(new Array(anchor.getAttribute("href"), anchor.firstChild.nodeValue));
	}
	
	var odiv  = document.createElement("div");
	
	this.previous.setAttribute("class", "previous");
	this.previous.appendChild(document.createTextNode("« Précédent"));

	this.next.setAttribute("class", "next");
	this.next.appendChild(document.createTextNode("Suivant »"));
	
	this.pause.setAttribute("class", "pause");
	this.pause.appendChild(document.createTextNode("Pause"));
	this.pause.setAttribute("href",  "#");
	this.pause.onclick = this.goStop;

	this.updateNavig();
	odiv.appendChild(this.previous);
	odiv.appendChild(this.next);
	this.title.appendChild(document.createTextNode(this.images[0][1]));
	odiv.appendChild(this.title);
	odiv.appendChild(this.pause);
	this.htmlElement.appendChild(odiv);
	
	this.img.setAttribute("src", this.images[0][0]);
	this.img.setAttribute("width", "600px");
	this.img.setAttribute("height", "400px");
	this.htmlElement.appendChild(this.img);
	
	
	this.timeout = setTimeout("document.getElementById('_diaporama').jsobject.goNext(null);",3000);
}
DiaporamaElement.prototype = new BaseElement;


// Modules et extensions
MainModule.extendsClass(Module);
function MainModule () 
{
	Module.call (this);
}
MainModule.prototype.initBehavior = function ()
{
	this.attachBehavior("mainmenu", MainmenuElement);
};
new MainModule ();

/*------------------------------------------------------------------------------------
	CLASSE MainmenuElement
	Gère un diaporama de photos
-------------------------------------------------------------------------------------*/
MainmenuElement.extendsClass(BaseElement);
function MainmenuElement ()
{
	BaseElement.call(this, arguments);
	var oUls = this.htmlElement.parentNode.getElementsByTagName("ul");
	// Construction des sous-menus
	this.submenus = [];
	for (var i=0; i<oUls.length; i++) 
	{
		if (oUls.item(i).className.indexOf("submenu") != -1)
		{
			var newmenu = new SubmenuElement(oUls.item(i));
			newmenu.mainmenu = this;
			this.submenus.push(newmenu);
		}
	}
	// Attachement de sous menus au menu principal, ajout du hover
	var oLis = this.htmlElement.getElementsByTagName("li");
	this.mainitems = [];
	this.currentMenu = 0;
	for (i=0; i<oLis.length; i++) 
	{
		if (oLis.item(i).className == "current")
		{
			this.currentMenu = i;
		}
		var newitem = new MainitemElement(oLis.item(i));
		newitem.submenu = this.submenus[i];
		newitem.submenu.mainitem = newitem;
		newitem.mainmenu = this;
		this.mainitems.push(newitem);
	}
	this.hideSubmenus();
	this.showCurrent();
}
MainmenuElement.prototype.hideSubmenus = function (currentMenu)
{
	for (var i=0; i<this.submenus.length; i++)
	{
		if (this.submenus[i] !== currentMenu)
		{
			this.submenus[i].hide();
		}
	}
	for (i=0; i<this.mainitems.length; i++)
	{
		this.mainitems[i].setAttribute("class", "");
	}
};
MainmenuElement.prototype.showCurrent = function ()
{
	this.hideSubmenus();
//	this.submenus[this.currentMenu].display();
	this.mainitems[this.currentMenu].setAttribute("class", "current");
};

/*------------------------------------------------------------------------------------
	CLASSE MainmenuElement
	Gère un diaporama de photos
-------------------------------------------------------------------------------------*/
MainitemElement.extendsClass(BaseElement);
function MainitemElement ()
{
	BaseElement.call(this, arguments);
	this.submenu = false;
	this.mainmenu = false;
}
MainitemElement.prototype.mouseoverEvent = function ($evt)
{
	this.mainmenu.hideSubmenus(this.submenu);
	this.setAttribute("class", "current");
	this.submenu.htmlElement.style.left = this.htmlElement.offsetLeft+"px";
	this.submenu.display();
};

MainitemElement.prototype.mouseoutEvent = function ($evt)
{
	this.mainmenu.showCurrent();
	
};

/*------------------------------------------------------------------------------------
	CLASSE SubmenuElement
	Gère un diaporama de photos
-------------------------------------------------------------------------------------*/
SubmenuElement.extendsClass(BaseElement);
function SubmenuElement ()
{
	BaseElement.call(this, arguments);
	this.mainmenu = false;
	this.mainitem = false;
	this.ison = false;
}
SubmenuElement.prototype.mouseoverEvent = function ($evt)
{
	this.ison = true;
	this.mainmenu.hideSubmenus(this);
	this.mainitem.setAttribute("class", "current");
	this.display();
	this.ison=false;
};

SubmenuElement.prototype.mouseoutEvent = function ($evt)
{
	if (!this.ison)
	{
		this.hide();
	}
};

