//////////	CARACTERISTIQUES DU CLIENT	//////////



//////////////////////////////////////////////////////////////////////////////////
//	version 1.20 du 11 Septembre 2007
//////////////////////////////////////////////////////////////////////////////////



//	On lance l'administration du site
preferences.mode = 'admin';

//////////	CHARGEMENT AJAX DES TEMPLATES	//////////
pageLoaderOK = function( t )
{
	pageLoader.__load();
}
function pageLoaderDef ( objName )
{
	pageLoaderDef.prototype.objName = objName;
	pageLoaderDef.prototype.pageList = new Array();
	pageLoaderDef.prototype.pageListIndex = 0;
	pageLoaderDef.prototype.pageComplete = false;

	pageLoaderDef.prototype.__load = function ()
	{
		if ( this.pageListIndex < this.pageList.length )
		{
			new Ajax.Updater(
					this.pageList[this.pageListIndex][0] ,
					k_pathBackofficeThemesTemplates + "page/" + this.pageList[this.pageListIndex][1],
					{
						method:'get',
						asynchronous:true,
						evalScripts:true,
						onComplete:pageLoaderOK
					}
			);
			this.pageListIndex++;
		}
		else
		{
			this.pageComplete = true;
		}
	};
	pageLoaderDef.prototype.loadPages = function ( pagesList )
	{
		for ( var i = 0; i < pagesList.length; i++ ) this.pageList[this.pageList.length] = pagesList[i];
		this.pageListIndex = 0;
		this.pageComplete = false;
		this.__load();
	};
}
var pageLoader = new pageLoaderDef('pageLoader');

/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function loadPage2()
{
	loadTopOuter();
}
/*--------------------------------------------------------------------------------------------------------------------------\
|	CHARGEMENT DU TOP																										|
\--------------------------------------------------------------------------------------------------------------------------*/
function loadTopOuter()
{
	var thisLink = k_pathBackofficeThemesTemplates + "page/top.php";
	new Ajax.Updater('topOuter', thisLink, {method:'get', asynchronous:true, evalScripts:true, onComplete:loadLeftOuter });
}
/*--------------------------------------------------------------------------------------------------------------------------\
|	CHARGEMENT DU LEFT																										|
\--------------------------------------------------------------------------------------------------------------------------*/
function loadLeftOuter()
{
	var thisLink = k_pathBackofficeThemesTemplates + "page/left.php";
	new Ajax.Updater('leftOuter', thisLink, {method:'get', asynchronous:true, evalScripts:true, onComplete:loadMainOuter });
}
/*--------------------------------------------------------------------------------------------------------------------------\
|	CHARGEMENT DU MAIN																										|
\--------------------------------------------------------------------------------------------------------------------------*/
function loadMainOuter()
{
	var thisLink = k_pathBackofficeThemesTemplates + "home/home.php";
	new Ajax.Updater('mainOuter', thisLink, {method:'get', asynchronous:true, evalScripts:true, onComplete:onloadCheck });
}
/*--------------------------------------------------------------------------------------------------------------------------\
|	TESTS DE CHARGEMENTS DE LA PAGE																							|
\--------------------------------------------------------------------------------------------------------------------------*/
// Attend le chargement complet du code HTML par ajax
var onloadCheckTimer = "";
var topLoaded				= "false";
var leftLoaded				= "false";
var mainLoaded				= "false";
var pageLoaded				= "false";


function loadPage()
{
	var thisLink = k_pathBackofficeThemesTemplates + "page/top.php";
	new Ajax.Updater('topOuter', thisLink, {method:'get', asynchronous:true, evalScripts:true });
	thisLink = k_pathBackofficeThemesTemplates + "page/left.php";
	new Ajax.Updater('leftOuter', thisLink, {method:'get', asynchronous:true, evalScripts:true });
	thisLink = k_pathBackofficeThemesTemplates + "home/home.php";
	new Ajax.Updater('mainOuter', thisLink, {method:'get', asynchronous:true, evalScripts:true, onComplete:onloadCheck });
}



function onloadCheck()
{
	if ( topLoaded == "true" && leftLoaded == "true" && mainLoaded == "true" )
	{
		clearTimeout(onloadCheckTimer);
		completeLoading();
	}
	else
	{
		onloadCheckTimer = setTimeout( 'onloadCheck()', 1000 );
	}
}
/*--------------------------------------------------------------------------------------------------------------------------\
|	CHARGEMENT DES TEMPLATES COMPOSANT LA PAGE																				|
\--------------------------------------------------------------------------------------------------------------------------*/
function loadTemplate(thisTemplate, thisContainer)
{
	var thisLink = "";
	switch( thisTemplate )
	{
		default :
		case "top"		: thisLink = k_pathBackofficeThemesTemplates + "top/top.php";		break;
		case "left"		: thisLink = k_pathBackofficeThemesTemplates + "left/left.php";		break;
		case "bottom"	: thisLink = k_pathBackofficeThemesTemplates + "bottom/bottom.php"; break;
	}
	new Ajax.Updater(thisContainer, thisLink, {method:'get', asynchronous:true, evalScripts:true});
}
/*--------------------------------------------------------------------------------------------------------------------------\
|	CHARGEMENT DES FICHIERS JS EXTERNES																						|
\--------------------------------------------------------------------------------------------------------------------------*/
function includeFile(thisFile)
{
	var script = document.createElement("script");
	script.type = "text/javascript";
	script.src  = k_templatesPath + thisFile;
	var head = document.getElementsByTagName("head");
	head[0].appendChild(script);
}

/*--------------------------------------------------------------------------------------------------------------------------\
|	Gestion des chargements par Ajax																						|
\--------------------------------------------------------------------------------------------------------------------------*/
function ajaxLoadDef( objName )
{
	this.objName	= objName;
	this.Container	= "";
	this.Path		= "";
	this.Params		= "";
	this.CallBack	= null;

	ajaxLoadDef.prototype.get = function ( obj )
	{
		if ( obj.divid )
		{
			if ( obj.divid != "" )
			{
				new Ajax.Updater(
					obj.divid,
					obj.source,
					{
						method:'get',
						asynchronous:true,
						parameters:obj.params,
						onComplete:obj.callBack,
						evalScripts:true
					}
				);	
			}
			else
			{
				new Ajax.Request(
					obj.source,
					{
						method:'get',
						asynchronous:true,
						parameters:obj.params,
						onComplete:obj.callBack,
						evalScripts:true
					}
				);
			}
		}
		else
		{
			new Ajax.Request(
				obj.source,
				{
					method:'get',
					asynchronous:true,
					parameters:obj.params,
					onComplete:obj.callBack,
					evalScripts:true
				}
			);
		}
	};
	ajaxLoadDef.prototype.post = function ( obj )
	{
		if ( obj.divid != "" )
		{
			new Ajax.Updater(
				obj.divid,
				obj.source,
				{
					method:'post',
					asynchronous:true,
					parameters:obj.params,
					onComplete:obj.callBack,
					evalScripts:true
				}
			);	
		}
		else
		{
			new Ajax.Request(
				obj.source,
				{
					method:'post',
					asynchronous:true,
					parameters:obj.params,
					onComplete:obj.callBack,
					evalScripts:true
				}
			);	
		}
	}
}
var oxyAjax = new ajaxLoadDef( 'oxyAjax' );



evtlistOnComplete = function ()
{
	resizePage();
	resizeAllColumns();
}


//////////////////////////////////////////////////////////////////////////////////////////
//	gestion des template monster
//////////////////////////////////////////////////////////////////////////////////////////
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function findPos(obj)
{
	var curleft = curtop = 0;
	if (obj.offsetParent)
	{
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj == obj.offsetParent)
		{
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft,curtop];
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function showPreview( p, id)
{
	var pos = findPos( $( "tm" + id ) );
	var prevId = $( "preview" );
	if ( prevId )
	{
		prevId.style.left = pos[0] + "px";
		prevId.style.top = pos[1] + "px";

		var html = "<img src=\"http://www.mytemplatestorage.com/aff/preview.php?aff=stuartc1&i=" + p + "&skin=17\">";
		prevId.innerHTML = html;
		prevId.style.display = 'block';
	}
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function hidePreview()
{
	//var prevId = $( "preview" );
	//prevId.style.display = 'none';
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function preview()
{

}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function spinner( s )
{
	var html = "";
	if ( s == true )
	{
		html  = "<table align=\"center\"><tr>";
		html += "<td valign=\"middle\"><img src=\"img/spinner.gif\" width=\"32\" height=\"32\"></td>";
		html += "<td style=\"vertical-align=middle\">Chargement en cours....</td>";
		html += "</tr></table>";
	}
	var wDiv = $('mainOuter');
	if ( wDiv )
	{
		wDiv.innerHTML = html;
	}
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
listTemplateByCatOK = function ( t )
{
	var wDiv = $('mainOuter');
	if ( wDiv )
	{
		wDiv.innerHTML = t.responseText;
	}
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function listTemplateByCat( cat, name, pg )
{
	spinner( true );
	var thisLink = k_pathBackofficeThemesTemplates + "appgraph/tm-center.php";
	var thisPars = "cat=" + cat + "&category=" + escape(name) + "&pg=" + pg;
	new Ajax.Request( thisLink, {method: 'get', parameters: thisPars, asynchronous:true, onSuccess:listTemplateByCatOK, evalScripts:true });
	//spinner( false );
}
/*--------------------------------------------------------------------------------------------------------------------------\
|	ECRITURE DU CHEMIN DANS LE TOP																							|
\--------------------------------------------------------------------------------------------------------------------------*/
var registeredText = "none";
function writePath( menu, subMenu )
{
	registeredText = new Array( menu, subMenu );
	if ( $('documentLoc') ) $('documentLoc').innerHTML = menu[lg];
	else alert( "Error 1 writePath" );
	if ( $('documentLoc_2') ) $('documentLoc_2').innerHTML = subMenu[lg];
	else alert( "Error 2 writePath" );
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function writeRegisteredPath()
{
	if ( registeredText != "none" )
	{
		$('documentLoc').innerHTML = registeredText[0][lg];
		$('documentLoc_2').innerHTML = registeredText[1][lg];
	}
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function oxyPathDef()
{
	this.registeredText = new Array();
	this.wLocMenu		= null;
	this.wLocSubMenu	= null;
	this.statusLoc		= false;

	oxyPathDef.prototype.initPath = function ( )
	{
		this.wLocMenu  		= $('documentLoc');
		this.wLocSubMenu	= $('documentLoc_2');
		if ( !this.wLocMenu || !this.wLocSubMenu ) this.statusLoc = false;
		else this.statusLoc = true;
	};
	oxyPathDef.prototype.writePath = function ( menu, subMenu )
	{
		this.registeredText[0] = menu;
		this.registeredText[1] = subMenu;
		this.writeRegisteredPath();
	};
	oxyPathDef.prototype.writeRegisteredPath = function ( )
	{
		if ( ( this.statusLoc ) && ( this.registeredText.length > 0 ) )
		{
			if ( this.wLocMenu )	this.wLocMenu.innerHTML		= this.registeredText[0][lg];
			if ( this.wLocSubMenu ) this.wLocSubMenu.innerHTML	= this.registeredText[1][lg];
		}
	};
	this.initPath();
}
//var oxyPath = new oxyPathDef();

/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function writeTexts_A( thisLang, theDiv )
{
	if ( theDiv == "all" )
	{
		var allDivs = document.getElementsByTagName("abbr");
		
		if ( allDivs.length > 0 )
		{
			for ( var i = 0; i < allDivs.length; i++ ) 
			{
				if ( ( typeof  allDivs[i].id != 'undefined' ) && ( allDivs[i].id != '' ) )
				{
					allDivs[i].innerHTML = eval(allDivs[i].id + "_text['" + thisLang + "']");
				}
			}
//			//	Affectation du style Ã  l'Ã©lÃ©ment, si il existe
//			if ( eval( allDivs[i].id + "_text['" + thisLang + "']['style']" ) )
//			{
//				allTexts_A[i].className = allTexts_A[i].className + " " + eval( allDivs[i].id + "_text['" + thisLang + "']['style']" );
//			}
		}
	}
	else
	{
		var theDivObj = $(theDiv);
		
		if ( theDivObj != null )
		{
			var allDivs = theDivObj.getElementsByTagName("abbr");
			
			if ( allDivs.length > 0 )
			{
				for ( var i = 0; i < allDivs.length; i++ ) 
				{
					if ( ( typeof  allDivs[i].id != 'undefined' ) && ( allDivs[i].id != '' ) )
					{
						allDivs[i].innerHTML = eval(allDivs[i].id + "_text['" + thisLang + "']");
					}
				}
	//			//	Affectation du style Ã  l'Ã©lÃ©ment, si il existe
	//			if ( eval( allDivs[i].id + "_text['" + thisLang + "']['style']" ) )
	//			{
	//				allTexts_A[i].className = allTexts_A[i].className + " " + eval( allDivs[i].id + "_text['" + thisLang + "']['style']" );
	//			}
			}
		}
	}
}

/*--------------------------------------------------------------------------------------------------------------------------\
|	CHANGE LA LANGUE DE TOUS LES TEXTES DE LA PAGE																			|
\--------------------------------------------------------------------------------------------------------------------------*/
function writeAllTexts_A( thisLang )
{
	lg = thisLang;				//	Change la langue en cours

	var allDivs = new Array();
	var allDivs = document.getElementsByTagName("div");

	if ( allDivs.length )
	{
		var attr = "";
		for ( var i = 0; i < allDivs.length; i++ )
		{
			attr = allDivs[i].attributes["oxytextadmin"];
			if ( attr != "" )
			{
				//	On se sert de la propriÃ©tÃ© << oxytextadmin >> du calque qui contient le texte
				var theText = eval(allDivs[i].attributes["oxytextadmin"].value + "_text");

				allDivs[i].innerHTML = theText[thisLang];

				//	Affectation du style Ã  l'Ã©lÃ©ment, si il existe
				if ( theText["style"] )
				{
					allDivs[i].className = allDivs[i].className + " " + theText["style"];
				}
			}
		}
	}

	//	RÃ©Ã©crit les objets
	for ( var j = 0; j < registeredObjects.length; j++ )
	{
		updateObject( registeredObjects[j][0] , registeredObjects[j][1] , thisLang , registeredObjects[j][3] , registeredObjects[j][4] );
	}

	writeRegisteredPath();		//	RafraÃ®chit le chemin de la page en cours dans le TOP

	reloadHelp();				//	Recharge le fichier d'aide
}
/*--------------------------------------------------------------------------------------------------------------------------\
|	ECRITURE DES INDICATEURS																								|
|																															|
|		Ecrit les indicateurs d'Ã©tats ainsi que leur symbole graphique associÃ©												|
|		setIndicator( id du DIV contenant le texte , texte )																|
\--------------------------------------------------------------------------------------------------------------------------*/
function setIndicator( theIndicator, indicatorText )
{
	var theText = eval( indicatorText + "_text");
	$( theIndicator ).innerHTML = theText[lg];

	//	Affectation du style Ã  l'Ã©lÃ©ment
	if ( theText["style"] )
	{
		$( theIndicator ).className = $( theIndicator ).className + " " + theText["style"];
	}

	//	Si le texte est liÃ© Ã  un bouton on change la source du bouton
	var theStatus = theIndicator + "_status";

	if ( theText["status"] )
	{
		$( theStatus ).src = "img/" + theText["status"];
	}
}
/*--------------------------------------------------------------------------------------------------------------------------\
|	RECHARGE LE FICHIER D'AIDE																								|
\--------------------------------------------------------------------------------------------------------------------------*/
function reloadHelp()
{
	var script = document.createElement("script");
	script.type = "text/javascript";
	script.src  = k_helpTextsPath + "help.js";
	var head = document.getElementsByTagName("head");
	head[0].appendChild(script);
}/*--------------------------------------------------------------------------------------------------------------------------\
|	AFFECTATION DE LA FEUILLE DE STYLES																						|
\--------------------------------------------------------------------------------------------------------------------------*/
function setStyleSheet(thisSkin)
{
	//	STEF
	$('styleSheet').href = k_urlBackofficeThemesCss + "admin.css";
}
/*--------------------------------------------------------------------------------------------------------------------------\
|	CHARGEMENT DES OBJETS																									|
\--------------------------------------------------------------------------------------------------------------------------*/
var registeredIndex = -1;
var registeredObjects = new Array();

function loadObject( thisContainer , thisObject , thisLanguage , thisWidth , thisHeight )
{
	var divHtml =	"";
	
	divHtml +=	"<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='" + thisWidth + "' height='" + thisHeight + "' id='" + thisObject + "' align='middle' />";
	divHtml +=	"<param name='allowScriptAccess' value='sameDomain' />";
	divHtml +=	"<param name='wmode' value='transparent' />";
	divHtml +=	"<param name='movie' value='flash/" + thisObject + ".swf?flashlanguage=" + thisLanguage + "' />";
	divHtml +=	"<param name='quality' value='high' />";
	divHtml +=	"<embed src='flash/" + thisObject + ".swf?flashlanguage=" + thisLanguage + "' swLiveConnect='true' quality='high' width='" + thisWidth + "' height='" + thisHeight + "' name='" + thisObject + "' align='middle' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />";
	divHtml +=	"</object />";
	
	$(thisContainer).innerHTML = divHtml;
}

//////////	ACTIVATION DES OBJETS ACTIVE X	//////////

var	activexElements;	//	Variable globale
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function activeX()
{
	activexElements = new Array(3);
	activexElements[0] = "object";
	activexElements[1] = "embed";
	activexElements[2] = "applet";
	for (n = 0; n < activexElements.length; n++)
	{
		replaceObj = document.getElementsByTagName(activexElements[n]);
		for (i = 0; i < replaceObj.length; i++ )
		{
			parentObj = replaceObj[i].parentNode;
			newHTML = parentObj.innerHTML;
			parentObj.removeChild(replaceObj[i]);
			parentObj.innerHTML = newHTML;
		}
	}
}



//////////	CHARGEMENT DES LIBRAIRIES DU TEMPLATE CLIENT	//////////
var clientLibrariesLoaded = false;
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
var clientdef_puid = "";
var clientdef_bodytype = "";

function loadClientDef( puid, bodytype )
{
	clientdef_puid = puid;
	currentPageBodyType = bodytype;

	//	Si les librairies du Client on dÃ©ja Ã©tÃ© chargÃ©es on charge le template CLient
	if( clientLibrariesLoaded == true )
	{
		loadClientTemplate( puid, bodytype );
	}
	else
	{
		//	Charge le fichier de configuration du template
		var theClientDef = document.createElement("script");
		if ( theClientDef )
		{
			theClientDef.type = "text/javascript";
			theClientDef.src = k_clientTemplatePath + "def/oxygenn_def.js";
			document.body.appendChild( theClientDef );

			//	Test du chargement du fichier de configuration
			checkDefLoaded();
		}
	}
}

//	Variable globale du nombre de fichiers Ã  charger dÃ©finie Ã  -1 car on l'incrÃ©mente en entrÃ©e de fonction
var currentFileNumber = 0;

//	Chargement du fichier externe
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function loadNextFile()
{
	if( currentFileNumber < pageFiles.length )
	{
		//	Nom et chemin du fichier Ã  charger
		var theFile = pageFiles[currentFileNumber];

		//	Le fichier javascript charge lui mÃªme le suivant
		bodyAppendChild( theFile );
	}

	if( currentFileNumber == pageFiles.length )
	{
		//	Chargement de la feuille de style du Client
		loadClientCss();

		//	Les librairies du Client sont chargÃ©es
		clientLibrariesLoaded = true;

		loadClientTemplate( clientdef_puid, currentPageBodyType );

		//////	La page du Client est chargÃ©e	//////
	}
}

//////////	CHARGEMENT DYNAMIQUE DES FICHIERS EXTERNES	//////////

//	Fonction d'inclusion dans le body du document
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function bodyAppendChild( theFile )
{
	var thePointPosition = theFile.lastIndexOf(".");										//	Position du point dans la chaÃ®ne
	var theTypeLength = theFile.length - thePointPosition - 1;								//	Longueur de l'extension
	var fileType = theFile.substring(theFile.length - theTypeLength, theFile.length);		//	Extension du fichier en cours de chargement

	switch( fileType )
	{
		case "js" :					//	appendChild Javascript
			var theClientJs = document.createElement("script");
			theClientJs.type = "text/javascript";
			theClientJs.src = k_clientTemplatePath + theFile;
			document.body.appendChild(theClientJs);
		break;

		case "css" :				//	appendChild CSS
			var theClientCss = document.createElement("link");
			theClientCss.rel = "stylesheet";
			theClientCss.type = "text/css";
			theClientCss.href = k_clientTemplatePath + theFile;
			document.body.appendChild(theClientCss);
		break;
	}
}

//	ContrÃ´le du chargement du fichier
var loadingDefTimer;
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function checkDefLoaded()
{
	try
	{
		if ( oxygenn_def == "loaded" )
		{
			throw "ok";
		}
		else
		{
			throw "ko";
		}
	}
	catch (e)
	{
		if ( e == "ok" )
		{
			clearTimeout(loadingDefTimer);
			//	Chargement du premier fichier externe
			loadNextFile();
		}
		else
		{
			loadingDefTimer = setTimeout("checkDefLoaded()",100);
		}
	}
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function loadClientCss()
{
	bodyAppendChild( pageStyle );

	//	Chargement de la OXYBAR contenant les blocks Client
	loadOxybar();
}

//////////	CHARGEMENT DU TEMPLATE CLIENT	//////////
preferences.displayMode = "admin";

var displayMode = "admin";
var actualClientPage = "";
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
completeTest = function ( t )
{
	$('clientSiteContainer').innerHTML = t.responseText; 
}
function loadClientTemplate( puid, bodytype )
{
	showLoading();
	
	
	//////////
	//var html = '<img src=\'http://localhost/tools.oxygenbay.com/images/common/ajax-loader.gif\' />';
	//$('clientSiteContainer').innerHTML = html;
	
	//	R.A.Z du nombre de fichiers Ã  charger
	currentFileNumber = 0;

	//	Chargement de << body.php >> qui va lancer le chargement Ajax des parties de la page
	var thisLink = k_commonTemplatePath + "templates/loadbody.php";
	var thisPars = "clientPage=" + actualClientPage + "&pid=" + puid + "&bodytype=" + bodytype + "&from=admin";
	new Ajax.Updater('clientSiteContainer', thisLink, {method:'get', parameters:thisPars, asynchronous:true, evalScripts:true});

	hideLoading();
}

//////////	CHARGEMENT DES COMPOSANTS DE LA PAGE	//////////

var componentsLoaded_C = 0;
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function loadClientPageComponents_C_old2()
{
	if ( componentsLoaded_C < pageComponents.length )
	{
		//	On incremente << componentsLoaded_C >> en premier
		componentsLoaded_C++;
		//	On envoit << componentsLoaded_C  -  1 >> Ã  la fonction
		loadTemplate_C(componentsLoaded_C - 1);
	}
	else
	{
		//	Remise Ã  zÃ©ro de la variable
		componentsLoaded_C = 0;
		//	La page est chargÃ©e
		//	Mode admin avec Drag & Drop
		if ( preferences.displayMode == "admin" )
		{
			//	Resize
			resizePage();
			//	Initialise les Tabpanes
			//setTab();
			//	Initialisation du Drag & Drop
			initDragDrop();
		}
	}
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function loadTemplate_C( thisNumber )
{
	//var thePath = k_clientTemplatePath + "templates/" + pageComponents[thisNumber][0];
	var thePath = pageComponents[thisNumber][0];
	var params = "from=admin&pid=" + persoPages.loadedPageId + "&lg=FR";
	new Ajax.Updater( pageComponents[thisNumber][1], thePath, { method:"get", parameters: params, onComplete:loadClientPageComponents_C, asynchronous:true, evalScripts:true } );

	pageComponents[thisNumber][2] = true;
}

//////////	TABPANES	//////////

//	Cette fonction utilise des variables globales !!!
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/

var oldTab;
var activeTab;

function tab( theTab )
{
	//	Tabpanes de la page Client
	$( "tab" + theTab ).className = oldTab;
	//	Tabpanes de l'Ã©dition des blocks
	$( "edit_tab" + theTab ).className = oldTab;
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function tab_hover( theTab )
{
	var thisTab = $( "tab" + theTab );
	var edit_thisTab = $( "edit_tab" + theTab );

	oldTab = thisTab.className;

	thisTab.className = "tab_hover";
	edit_thisTab.className = "tab_hover";
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function setTab()
{
	var thisTab;
	switch( lg )
	{
		default :
		case "EN" : thisTab = 1; break;
		case "ES" : thisTab = 2; break;
		case "FR" : thisTab = 3; break;
		case "DE" : thisTab = 4; break;
		case "IT" : thisTab = 5; break;
		case "PT" : thisTab = 6; break;

	}
	tab_active(thisTab);
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function tab_active( theTab )
{
	switch( theTab )
	{
		default :
		case 1 : clientLanguage = "EN"; thisText = common_030_text[lg]; break;
		case 2 : clientLanguage = "ES"; thisText = common_031_text[lg]; break;
		case 3 : clientLanguage = "FR"; thisText = common_032_text[lg]; break;
		case 4 : clientLanguage = "DE"; thisText = common_033_text[lg]; break;
		case 5 : clientLanguage = "IT"; thisText = common_034_text[lg]; break;
		case 6 : clientLanguage = "PT"; thisText = common_035_text[lg]; break;
	}

	//writeAllTexts( clientLanguage );

	//	Change le texte du language
	$( "tabLanguage" ).innerHTML = thisText;
	$( "edit_tabLanguage" ).innerHTML = thisText;

	activeTab = theTab;
	for ( i=1; i<=6; i++ )
	{
		$( "tab" + i ).className = "tab";
		$( "tab" + i + "Bottom" ).className = "";

		$( "edit_tab" + i ).className = "tab";
		$( "edit_tab" + i + "Bottom" ).className = "";
	}

	$( "tab" + theTab ).className = "tab_active";
	$( "tab" + theTab + "Bottom" ).className = "bgFFFFFF";

	$( "edit_tab" + theTab ).className = "tab_active";
	$( "edit_tab" + theTab + "Bottom" ).className = "bgFFFFFF";

	oldTab = "tab_active";
}

//////////	TABPANES	//////////
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function oxyTab( theTabpane, theTab )
{
	$( theTabpane + theTab ).className = oldTab;
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function oxyTab_hover( theTabpane, theTab )
{
	var thisTab = $( theTabpane + theTab );

	oldTab = thisTab.className;
	thisTab.className = "tab_hover";
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function oxyTab_setTab( theTabpane )
{
	var thisTab;
	switch( lg )
	{
		default :
		case "EN" : thisTab = 1; break;
		case "ES" : thisTab = 2; break;
		case "FR" : thisTab = 3; break;
		case "DE" : thisTab = 4; break;
		case "IT" : thisTab = 5; break;
		case "PT" : thisTab = 6; break;

	}
	oxyTab_active( theTabpane , thisTab);
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function setActiveLanguage( theTab, f )
{
	//	sauvegarde du texte du fckeditor dans un hidden de sauvegarde
	//	texte
	var oEditor = FCKeditorAPI.GetInstance('oxyEditorEvents') ;
	txt = oEditor.GetXHTML();
	//$( f )['txt-tab'+].value = txt;

	switch( theTab )
	{
		default :
		case 1 : clientLanguage = "EN"; thisText = common_030_text[lg]; break;
		case 2 : clientLanguage = "ES"; thisText = common_031_text[lg]; break;
		case 3 : clientLanguage = "FR"; thisText = common_032_text[lg]; break;
		case 4 : clientLanguage = "DE"; thisText = common_033_text[lg]; break;
		case 5 : clientLanguage = "IT"; thisText = common_034_text[lg]; break;
		case 6 : clientLanguage = "PT"; thisText = common_035_text[lg]; break;
	}

	//	Change le texte du language
	$( theTabpane + "_Language" ).innerHTML = thisText;
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function oxyTab_activeStef( theTabpane, theTab, f, p1 )
{
	eval( f + "( theTab, p1 );" );

	//lastActiveTab =
	activeTab = theTab;
	for ( i = 1; i <= 6; i++ )
	{
		$( theTabpane + i ).className = "tab";
		$( theTabpane + i + "Bottom" ).className = "";
	}
	$( theTabpane + theTab ).className = "tab_active";
	$( theTabpane + theTab + "Bottom" ).className = "bgFFFFFF";

	oldTab = "tab_active";
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function oxyTab_active( theTabpane, theTab )
{
	switch( theTab )
	{
		default :
		case 1 : clientLanguage = "EN"; thisText = common_030_text[lg]; break;
		case 2 : clientLanguage = "ES"; thisText = common_031_text[lg]; break;
		case 3 : clientLanguage = "FR"; thisText = common_032_text[lg]; break;
		case 4 : clientLanguage = "DE"; thisText = common_033_text[lg]; break;
		case 5 : clientLanguage = "IT"; thisText = common_034_text[lg]; break;
		case 6 : clientLanguage = "PT"; thisText = common_035_text[lg]; break;
	}

	//	Change le texte du language
	$( theTabpane + "_Language" ).innerHTML = thisText;

	activeTab = theTab;
	for ( i = 1; i <= 6; i++ )
	{
		$( theTabpane + i ).className = "tab";
		$( theTabpane + i + "Bottom" ).className = "";
	}

	$( theTabpane + theTab ).className = "tab_active";
	$( theTabpane + theTab + "Bottom" ).className = "bgFFFFFF";

	oldTab = "tab_active";
}

//////////	SCRIPT OUVERTURE FERMETURE DES BLOCKS	//////////
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
var fmodifierEvenementOK = function( t )
{
	var resultTexte = t.responseText;

	$( "mainOuter" ).innerHTML = resultTexte;
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function modiferevt( uid, from )
{
	goTo( K_MODIFIER_EVENEMENT, uid, from );
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
var fdelEvenementOK = function( t )
{
	goTo( K_LISTE_EVENEMENTS );
	hideHtml();
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function deleteEvent( uid )
{
	theMessage += '<table id="htmlAdjustTable" cellspacing="0" cellpadding="0" border="0">';
	theMessage += '<tr>';
	theMessage += '	<td align="center"><img src="img/icon_048.gif" width="48" height="48"></td>';
	theMessage += '</tr>';
	//--> Start
	theMessage += '<tr>';
	theMessage += '	<td class="padT5 common_fontColor_8" align="center">' + liste_evenements_admin_6_text[lg] + '</td>';
	theMessage += '</tr>';
	//--> End
	theMessage += '<tr>';
	theMessage += '	<td><img src="img/pixel.gif" width="230" height="1"></td>';//	minimum width = 230px
	theMessage += '</tr>';
	theMessage += '<tr>';
	theMessage += '	<td align="center" class="padT10">';
	theMessage += '		<table border="0" cellpadding="0" cellspacing="0">';
	theMessage += '			<tr>';
	theMessage += '				<td>';
	theMessage += '					<table border="0" cellpadding="0" cellspacing="0" class="hand" onclick="hideHtml();">';
	theMessage += '						<tr>';
	theMessage += '							<td><img src="img/button21_01.png" width="10" height="26"></td>';
	theMessage += '							<td class="padB3 font5 font91 fontFFFFFF" align="center" style="background-image:url(img/button21_02.png); background-repeat:repeat-x;">' + common_043_text[lg] + '</td>';
	theMessage += '							<td><img src="img/button21_03.png" width="12" height="26"></td>';
	theMessage += '						</tr>';
	theMessage += '					</table>';
	theMessage += '				</td>';
	theMessage += '				<td><img src="img/pixel.gif" width="10" height="1"></td>';
	theMessage += '				<td>';
	theMessage += '					<table border="0" cellpadding="0" cellspacing="0" class="hand" onclick="supprimerevt(\'' + uid + '\');">';
	theMessage += '						<tr>';
	theMessage += '							<td><img src="img/button20_01.png" width="10" height="26"></td>';
	theMessage += '							<td class="padB3 font5 font91 fontFFFFFF" align="center" style="background-image:url(img/button20_02.png); background-repeat:repeat-x;">' + common_115_text[lg] + '</td>';
	theMessage += '							<td><img src="img/button20_03.png" width="12" height="26"></td>';
	theMessage += '						</tr>';
	theMessage += '					</table>';
	theMessage += '				</td>';
	theMessage += '			</tr>';
	theMessage += '		</table>';
	theMessage += '	</td>';
	theMessage += '</tr>';
	theMessage += '</table>';
	
	//--> Message
	showHtml( theMessage );
}

function supprimerevt( uid )
{
	var params = "uid=" + uid;
	var url = k_path_root + "library/php/oxygenn/oxy-deleteevent.php";
	var myAjaxCompletion = new Ajax.Request(url, {method: 'post', parameters: params, onSuccess:fdelEvenementOK });
}

/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function mkEditor()
{
	oFCKeditorFra.ReplaceTextarea() ;
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
var fcreerEvenementOK = function( t )
{
	var resultTexte = t.responseText;

	$( "mainOuter" ).innerHTML = resultTexte;
}

//////////	ECRITURE DES TEXTES		//////////
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function textWrite( that )
{
	var theTd = that + "Td";
	var theText = eval(that + "[lg]");
	$(theTd).innerHTML = theText;
}

//////////	COMPTAGE DES TEXTES		//////////
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function textCount()
{
	var allTexts = document.getElementsByTagName('text');
	for ( var i = 0; i < allTexts.length; i++ )
	{
		textWrite("text" + i );
	}
}

//////////	INITIALISATION DU MENU DE GAUCHE	//////////

/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/

var stretchers;
var toggles;
var oxyMenu;

function initMenu()
{
	stretchers = $$('div.stretcher');
	toggles = $$('td.display');
	oxyMenu = new Fx.Accordion( toggles, stretchers, {opacity: true, duration: 400} );

	oxyMenu.showThisHideOpen( 0 );
}

//////////	PRELOADER DE L'ADMINISTRATION	//////////

var preloadVar = 0;

var isIExplore = document.all?true:false // On test le navigateur pour IE

// Ajoute un zero devant les chiffres
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function add0(chiffre)
{
	if (chiffre == 0) { chiffre = 000; }
	if (chiffre > 0 && chiffre <= 9) { chiffre = "00"+chiffre; }
	if (chiffre > 9 && chiffre < 100) { chiffre = "0"+chiffre; }
	if (chiffre >= 100) { chiffre = 100; }
	return chiffre;
}

//////////	ENVOI DES FORMULAIRES	//////////

var allForms;
var progressVar = 0;
var theProgressUnit = 0;
var submitedFormNumber = 0;
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
var setLoaded = function ()
{
	//	Mise a jour de la barre de progression
	progressVar = progressVar + theProgressUnit;
	updateProgress();

	//	Envoi du formulaire suivant
	if ( submitedFormNumber < allForms.length )
	{
		submitForm( submitedFormNumber );
	}

	//	Si tous les formulaires ont Ã©tÃ© envoyÃ©s, on affiche le calque << enregistrÃ© >>
	else
	{
		//	Remise Ã  zÃ©ro gÃ©nÃ©rale
		theProgressUnit = 0;
		progressVar = 0;
		submitedFormNumber = 0;
		$("savingPercent").innerHTML = "enregistrement <font class='font5 common_fontColor_1'>000</font> %";
		$("loadedGreenProgress").style.width = 0 + "px";		// Dimensionnement de la barre de progression
		$("loadedRedProgress").style.width = 150 + "px";		// Dimensionnement du fond de la barre de progression
		//	Affichage de << enregistrÃ© >>
		showCompleted();
	}
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function submitPage()
{
	allForms = document.all.tags("form");
	theProgressUnit = Math.round( 100 / allForms.length );
	progressVar = theProgressUnit;
	showProgress();
	submitForm(submitedFormNumber);
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function submitForm( formNumber )
{
	document.forms[formNumber].submit();
	submitedFormNumber++;
}

//////////	OUVERTURE / FERMETURE CALQUE	//////////
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function openClose( thisDiv )
{
	var thisObject = $(thisDiv);

	if ( thisObject.style.display == "none" || thisObject.style.display == "" )
	{
		thisObject.style.display = "block";
	}
	else
	{
		thisObject.style.display = "none";
	}
}

//////////	OUVERTURE / FERMETURE CALQUE - TOGGLE	//////////
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function toggleDiv( toOpenDiv, toCloseDiv )
{
	var thisObject1 = $(toOpenDiv);
	var thisObject2 = $(toCloseDiv);
	thisObject2.style.display = "none";

	if ( thisObject1.style.display == "none" || thisObject1.style.display == "" )
	{
		thisObject1.style.display = "block";
	}
	else
	{
		thisObject1.style.display = "none";
	}
}

///*--------------------------------------------------------------------------------------------------------------------------\
//|																															|
//\--------------------------------------------------------------------------------------------------------------------------*/
function fixNumber( theNumber, fix )
{
	//if (theNumber > 0 && theNumber <= 9) { theNumber = "0" + theNumber; }
	if ( theNumber.toString().length < 2 ) theNumber = "0" + theNumber.toString();
	return theNumber;
}

//	Objet calendrier sur base de calendrier dojo
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function updateBegCalendar ()
{
	oxyCalendar.updateBegCalendar();
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function updateEndCalendar ()
{
	oxyCalendar.updateEndCalendar();
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function oxyCalendarDef( objname )
{
	this.objname	= objname;
	this.isdebug	= false;

//	this.begCalendarWidget;
//	this.endCalendarWidget;

	this.begDate;
	this.endDate;

	this.setBegDate;
	this.setEndDate;

	this.begCalendarOpened	= false;
	this.endCalendarOpened	= false;

	this.clientDate			= "";

	//	fonction de debug
	/*--------------------------------------------------------------------------\
	|																			|
	\--------------------------------------------------------------------------*/
	oxyCalendarDef.prototype.debug = function ( t )
	{
		if ( this.isdebug )
		{
			var wDebug = $('debug');
			if ( wDebug )
			{
				wDebug.innerHTML += t + "<br>";
			}
		}
	};

	//	ajoute un 0 en debut de nombre si le nombre est compris entre 0 et 9
	/*--------------------------------------------------------------------------\
	|																			|
	\--------------------------------------------------------------------------*/
	oxyCalendarDef.prototype.fixNumber = function ( theNumber )
	{
		var result = new String( theNumber );
		this.debug('in  --> fixNumber');
		if ( result.length < 2 ) result = "0" + result;

		this.debug('result = ' + result );
		this.debug('out --> fixNumber');
		return ( result );
	};

	//	donne la date du jour suivant le format YYYYMMJJ
	/*--------------------------------------------------------------------------\
	|																			|
	\--------------------------------------------------------------------------*/
	oxyCalendarDef.prototype.getClientDate = function ()
	{
		this.debug('in  --> getClientDate');
		var today = new Date();

		var wDate = new String(today.getYear());
		this.debug('wDate : ' + wDate );

		var wMonth = new String( this.fixNumber(( today.getMonth() + 1 )) );
		this.debug('wMonth : ' + wMonth );

		var wDay = new String(this.fixNumber( today.getDate() ));
		this.debug('wDay : ' + wDay );

		wDate += "-" + wMonth + "-" + wDay;
		this.debug('wDate : ' + wDate );
		this.debug('out --> getClientDate');
		return (  wDate );
	};

	//	initialisation des calendriers
	/*--------------------------------------------------------------------------\
	|																			|
	\--------------------------------------------------------------------------*/
	oxyCalendarDef.prototype.init = function ()
	{
		this.debug('in  --> init');

		//	lecture de la date du client
		this.clientDate			= this.getClientDate();

		this.begDate = $("beginCalendar_hidden");
		this.endDate = $("endCalendar_hidden");

		if ( this.begDate )
		{
			openDatepicker('beginCalendar', 'beginCalendar_display', 'beginCalendar_hidden', 'beginCalendar_mode', '', '', '', false, false);
		}

		if ( this.endDate )
		{
			openDatepicker('endCalendar', 'endCalendar_display', 'endCalendar_hidden', 'endCalendar_mode', '', '', '', false, false);
		}
	};

//	//	Positionner la date sur le calendrier de debut
//	/*--------------------------------------------------------------------------\
//	|																			|
//	\--------------------------------------------------------------------------*/
//	oxyCalendarDef.prototype.initBeginCalendar = function()
//	{
//		this.debug('in  --> initBeginCalendar');
//
//		var wBegDate = $("beginCalendar_hidden");
//		if ( wBegDate )
//		{
//			if ( wBegDate.value == "" )
//			{
//				wBegDate.value = this.clientDate;
//			}
//			this.begCalendarWidget.setDate( wBegDate.value );
//
//			this.debug('beginCalendar_hidden = ' + wBegDate.value );
//		}
//		this.debug('out --> initBeginCalendar');
//	};
	//	Checkdate
	/*--------------------------------------------------------------------------\
	|																			|
	\--------------------------------------------------------------------------*/
	oxyCalendarDef.prototype.checkdate = function( theDate )
	{
		this.debug('in  --> checkdate');

		var wBegDate = $("beginCalendar_hidden").value;
		var wEndDate = $("endCalendar_hidden").value;
		
		wBegDate = parseInt( wBegDate , 10 );
		wEndDate = parseInt( wEndDate , 10 );
		
		switch( theDate )
		{
			case "begin" :
								if ( wBegDate >= wEndDate )
								{
									$("endCalendar_hidden").value = this.addRemoveDays ( wBegDate, 1 );
									openDatepicker('endCalendar', 'endCalendar_display', 'endCalendar_hidden', 'endCalendar_mode', '', '', '', false, false);
								}
			break;
			
			case "end" :
								if ( wBegDate >= wEndDate )
								{
									$("beginCalendar_hidden").value = this.addRemoveDays ( wEndDate, -1 );
									openDatepicker('beginCalendar', 'beginCalendar_display', 'beginCalendar_hidden', 'beginCalendar_mode', '', '', '', false, false);
								}
			break;
		}
		
		//alert(wBegDate + " _ " + wEndDate);
		
		this.debug('out --> checkdate');
	};
	/*--------------------------------------------------------------------------\
	|																			|
	\--------------------------------------------------------------------------*/
	oxyCalendarDef.prototype.addRemoveDays = function ( theDate, i )
	{
		theDate = theDate.toString(10);
		
		var theDateYear = theDate.substr(0,4);
		var theDateMonth = theDate.substr(4,2);
		var theDateDay = theDate.substr(6,2);
		
		var myDate = new Date( theDateYear, theDateMonth, theDateDay,0,0 );
		
		myDate.setDate( myDate.getDate() + i );
		var nowStr =	myDate.getFullYear().toString() + ( myDate.getMonth() < 10 ? "0" + myDate.getMonth().toString() : myDate.getMonth().toString()) + ( myDate.getDate()  < 10 ? "0" + myDate.getDate().toString()  : myDate.getDate().toString());

	  	return( nowStr );
	};
//	/*--------------------------------------------------------------------------\
//	|																			|
//	\--------------------------------------------------------------------------*/
//	oxyCalendarDef.prototype.addDays = function ( theDate, i )
//	{
//		var myDate = new Date( theDate );
//		myDate.setDate( myDate.getDate() + i );
//		var nowStr =	myDate.getFullYear().toString()
//		+ "-" +
//	  	( (myDate.getMonth()+1) < 10 ? "0" + (myDate.getMonth()+1).toString() : (myDate.getMonth()+1).toString())
//	  	+ "-" +
//	  	( myDate.getDate()  < 10 ? "0" + myDate.getDate().toString()  : myDate.getDate().toString());
//
//	  	return( nowStr );
//	};
//	/*--------------------------------------------------------------------------\
//	|																			|
//	\--------------------------------------------------------------------------*/
//	oxyCalendarDef.prototype.getSavedDate = function ( field )
//	{
//		var wDate = "";
//		var wDateHidden = $( field );
//		if ( wDateHidden )
//		{
//			var wDateA = wDateHidden.value.toString().split('-');
//			wDate = wDateA[0] + this.fixNumber( wDateA[1] ) + this.fixNumber( wDateA[2] );
//		}
//		return( wDate );
//	};
//	/*--------------------------------------------------------------------------\
//	|																			|
//	\--------------------------------------------------------------------------*/
//	oxyCalendarDef.prototype.initEndCalendar = function()
//	{
//		this.debug('in  --> initEndCalendar');
//	
//		var wBegDateHidden = $("beginCalendar_hidden");
//		var wEndDateHidden = $("endCalendar_hidden");
//
//		if ( wBegDateHidden && wEndDateHidden )
//		{
//			next = true;
//			//	premier calendrier OK ?
//			if ( ( wBegDateHidden.value == "" ) && next )
//			{
//				wBegDateHidden.value = this.clientDate;
//				this.begCalendarWidget.setDate( wBegDateHidden.value );
//			}
//
//			//	verifier si la date du 2ieme calendrier est definie
//			if ( ( wEndDateHidden.value == "" ) && next )
//			{
//				wEndDateHidden.value = this.addDays( this.begCalendarWidget.getDate(), 1 );
//				next = false;
//			}
//
//			this.debug('begDateHidden = ' + wBegDateHidden.value );
//			this.debug('endCalendar_hidden = ' + wEndDateHidden.value );
//
//			//	verifier la coherence des 2 dates
//			//	la date debut doit etre < a la date de fin
//			var wDebDateA = wBegDateHidden.value.toString().split('-');
//			var wFinDateA = wEndDateHidden.value.toString().split('-');
//
//			var wDebDate = wDebDateA[0] + this.fixNumber( wDebDateA[1] ) + this.fixNumber( wDebDateA[2] );
//			var wFinDate = wFinDateA[0] + this.fixNumber( wFinDateA[1] ) + this.fixNumber( wFinDateA[2] );
//
//			if ( ( this.getSavedDate('endCalendar_hidden') == this.getSavedDate('beginCalendar_hidden') ) && next )
//			{
//				//	la date de fin est anterieure a la date de debut
//				wEndDateHidden.value = this.addDays( this.begCalendarWidget.getDate(), 1 );
//				next = false;
//			}
//
//			if ( ( this.getSavedDate('endCalendar_hidden') < this.getSavedDate('beginCalendar_hidden') ) && next )
//			{
//				//	la date de fin est anterieure a la date de debut
//				wEndDateHidden.value = this.addDays( this.begCalendarWidget.getDate(), 1 );
//				next = false;
//			}
//
//			//	positionner la date sur le calendrier
//			this.endCalendarWidget.setDate(wEndDateHidden.value);
//		}
//		this.debug('out --> initEndCalendar');
//	};
//	/*--------------------------------------------------------------------------\
//	|																			|
//	\--------------------------------------------------------------------------*/
//	oxyCalendarDef.prototype.updateBegCalendar = function ()
//	{
//		this.debug('in  --> updateBegCalendar');
//
//		var wBegDateHidden = $("beginCalendar_hidden");
//
//		if ( wBegDateHidden )
//		{
//			wBegDateHidden.value = this.addDays( this.begCalendarWidget.getDate(), 0 );
//
//			if ( this.getSavedDate('endCalendar_hidden') < this.getSavedDate('beginCalendar_hidden') )
//			{
//				//	la date de fin est anterieure a la date de debut
//				var wEndDateHidden = $("endCalendar_hidden");
//				wEndDateHidden.value = this.addDays( this.begCalendarWidget.getDate(), 1 );
//
//				//	positionner la date sur le calendrier
//				this.endCalendarWidget.setDate(wEndDateHidden.value);
//			}
//		}
//		this.debug('out --> updateBegCalendar');
//	};
//	/*--------------------------------------------------------------------------\
//	|																			|
//	\--------------------------------------------------------------------------*/
//	oxyCalendarDef.prototype.updateEndCalendar = function ()
//	{
//		this.debug('in  --> updateEndCalendar');
//
//		var wEndDateHidden = $("endCalendar_hidden");
//
//		if ( wEndDateHidden )
//		{
//			wEndDateHidden.value = this.addDays( this.endCalendarWidget.getDate(), 0 );
//
//
//			if ( ( this.getSavedDate('endCalendar_hidden') == this.getSavedDate('beginCalendar_hidden') ) )
//			{
//				showMessage('warning','common_044_text','button_6','common_041_text','selectTypeEvenement(\'1\');hideMessage();','button_3','common_042_text','hideMessage();');
//			}
//
//			if ( ( this.getSavedDate('endCalendar_hidden') < this.getSavedDate('beginCalendar_hidden') ) )
//			{
//				//	la date de fin est anterieure a la date de debut
//				var wBegDateHidden = $("beginCalendar_hidden");
//				wBegDateHidden.value = this.addDays( this.endCalendarWidget.getDate(), -1 );
//
//				//	positionner la date sur le calendrier
//				this.begCalendarWidget.setDate(wBegDateHidden.value);
//			}
//		}
//		this.debug('out --> updateEndCalendar');
//	};
}
var oxyCalendar = new oxyCalendarDef( 'oxyCalendar' );
////////////////////////////////////////////////////////////////////////////////////////////////////


//////////	CHOIX DU TYPE D'EVENEMENT	//////////

var typeEvenement = "";
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function selectTypeEvenement( thisType )
{
	//	On definit la variable globale : typeEvenement
	typeEvenement = thisType;

	var thisObject1 = $("beginCalendarContainer");
	var thisObject2 = $("endCalendarContainer");
	var thisObject3 = $("dateSpacer");
	var thisObject4 = $("noCalendarContainer");
	
	switch( thisType )
	{
		case "1" :
			if ( thisObject1 ) thisObject1.style.display = "block";
			if ( thisObject2 ) thisObject2.style.display = "none";
			if ( thisObject3 ) thisObject3.style.display = "none";
			if ( thisObject4 ) thisObject4.style.display = "none";

			//	Affichage des textes correspondants et masquage des autres
			if ( $("typeEvenement_1_text") ) $("typeEvenement_1_text").style.display = "block";
			if ( $("typeEvenement_2_text") ) $("typeEvenement_2_text").style.display = "none";
			if ( $("typeEvenement_3_text") ) $("typeEvenement_3_text").style.display = "none";
			if ( $("typeEvenement_4_text") ) $("typeEvenement_4_text").style.display = "none";
			if ( $("typeEvenement_5_text") ) $("typeEvenement_5_text").style.display = "none";
			
			if ( $("typeEvenement_1_button") ) $( "typeEvenement_1_button" ).className = "button_bg_color_1";
			if ( $("typeEvenement_2_button") ) $( "typeEvenement_2_button" ).className = "button_bg_color_5";
			if ( $("typeEvenement_3_button") ) $( "typeEvenement_3_button" ).className = "button_bg_color_5";
			if ( $("typeEvenement_4_button") ) $( "typeEvenement_4_button" ).className = "button_bg_color_5";
			if ( $("typeEvenement_5_button") ) $( "typeEvenement_5_button" ).className = "button_bg_color_5";

			$("typeEvenement").value = 1;

			break;

		case "2" :
			if ( thisObject1 ) thisObject1.style.display = "block";
			if ( thisObject2 ) thisObject2.style.display = "block";
			if ( thisObject3 ) thisObject3.style.display = "block";
			if ( thisObject4 ) thisObject4.style.display = "none";

			//	Affichage des textes correspondants et masquage des autres
			if ( $("typeEvenement_1_text") ) $("typeEvenement_1_text").style.display = "none";
			if ( $("typeEvenement_2_text") ) $("typeEvenement_2_text").style.display = "none";
			if ( $("typeEvenement_3_text") ) $("typeEvenement_3_text").style.display = "none";
			if ( $("typeEvenement_4_text") ) $("typeEvenement_4_text").style.display = "block";
			if ( $("typeEvenement_5_text") ) $("typeEvenement_5_text").style.display = "block";
			
			if ( $("typeEvenement_1_button") ) $( "typeEvenement_1_button" ).className = "button_bg_color_5";
			if ( $("typeEvenement_2_button") ) $( "typeEvenement_2_button" ).className = "button_bg_color_1";
			if ( $("typeEvenement_3_button") ) $( "typeEvenement_3_button" ).className = "button_bg_color_5";
			if ( $("typeEvenement_4_button") ) $( "typeEvenement_4_button" ).className = "button_bg_color_5";
			if ( $("typeEvenement_5_button") ) $( "typeEvenement_5_button" ).className = "button_bg_color_5";

			$("typeEvenement").value = 2;

			break;

		case "3" :
			if ( thisObject1 ) thisObject1.style.display = "none";
			if ( thisObject2 ) thisObject2.style.display = "none";
			if ( thisObject3 ) thisObject3.style.display = "none";
			if ( thisObject4 ) thisObject4.style.display = "block";

			//	Affichage des textes correspondants et masquage des autres
			if ( $("typeEvenement_1_text") ) $("typeEvenement_1_text").style.display = "none";
			if ( $("typeEvenement_2_text") ) $("typeEvenement_2_text").style.display = "none";
			if ( $("typeEvenement_3_text") ) $("typeEvenement_3_text").style.display = "none";
			if ( $("typeEvenement_4_text") ) $("typeEvenement_4_text").style.display = "none";
			if ( $("typeEvenement_5_text") ) $("typeEvenement_5_text").style.display = "none";
			
			if ( $("typeEvenement_1_button") ) $( "typeEvenement_1_button" ).className = "button_bg_color_5";
			if ( $("typeEvenement_2_button") ) $( "typeEvenement_2_button" ).className = "button_bg_color_5";
			if ( $("typeEvenement_3_button") ) $( "typeEvenement_3_button" ).className = "button_bg_color_1";
			if ( $("typeEvenement_4_button") ) $( "typeEvenement_4_button" ).className = "button_bg_color_5";
			if ( $("typeEvenement_5_button") ) $( "typeEvenement_5_button" ).className = "button_bg_color_5";

			$("typeEvenement").value = 3;

			break;

		case "4" :
			if ( thisObject1 ) thisObject1.style.display = "block";
			if ( thisObject2 ) thisObject2.style.display = "none";
			if ( thisObject3 ) thisObject3.style.display = "none";
			if ( thisObject4 ) thisObject4.style.display = "none";

			//	Affichage des textes correspondants et masquage des autres
			if ( $("typeEvenement_1_text") ) $("typeEvenement_1_text").style.display = "none";
			if ( $("typeEvenement_2_text") ) $("typeEvenement_2_text").style.display = "block";
			if ( $("typeEvenement_3_text") ) $("typeEvenement_3_text").style.display = "none";
			if ( $("typeEvenement_4_text") ) $("typeEvenement_4_text").style.display = "none";
			if ( $("typeEvenement_5_text") ) $("typeEvenement_5_text").style.display = "none";
			
			if ( $("typeEvenement_1_button") ) $( "typeEvenement_1_button" ).className = "button_bg_color_5";
			if ( $("typeEvenement_2_button") ) $( "typeEvenement_2_button" ).className = "button_bg_color_5";
			if ( $("typeEvenement_3_button") ) $( "typeEvenement_3_button" ).className = "button_bg_color_5";
			if ( $("typeEvenement_4_button") ) $( "typeEvenement_4_button" ).className = "button_bg_color_1";
			if ( $("typeEvenement_5_button") ) $( "typeEvenement_5_button" ).className = "button_bg_color_5";

			$("typeEvenement").value = 4;

			break;

		case "5" :
			if ( thisObject1 ) thisObject1.style.display = "block";
			if ( thisObject2 ) thisObject2.style.display = "none";
			if ( thisObject3 ) thisObject3.style.display = "none";
			if ( thisObject4 ) thisObject4.style.display = "none";

			//	Affichage des textes correspondants et masquage des autres
			if ( $("typeEvenement_1_text") ) $("typeEvenement_1_text").style.display = "none";
			if ( $("typeEvenement_2_text") ) $("typeEvenement_2_text").style.display = "none";
			if ( $("typeEvenement_3_text") ) $("typeEvenement_3_text").style.display = "block";
			if ( $("typeEvenement_4_text") ) $("typeEvenement_4_text").style.display = "none";
			if ( $("typeEvenement_5_text") ) $("typeEvenement_5_text").style.display = "none";
			
			if ( $("typeEvenement_1_button") ) $( "typeEvenement_1_button" ).className = "button_bg_color_5";
			if ( $("typeEvenement_2_button") ) $( "typeEvenement_2_button" ).className = "button_bg_color_5";
			if ( $("typeEvenement_3_button") ) $( "typeEvenement_3_button" ).className = "button_bg_color_5";
			if ( $("typeEvenement_4_button") ) $( "typeEvenement_4_button" ).className = "button_bg_color_5";
			if ( $("typeEvenement_5_button") ) $( "typeEvenement_5_button" ).className = "button_bg_color_1";

			$("typeEvenement").value = 5;

			break;
	}
}

//////////	MESSAGES ET ALERTES DHTML	//////////
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function showMessage( messageType, thisMessageF, button1TypeF, button1TextF, button1ActionF, button2TypeF, button2TextF, button2ActionF )
{
	maskFlashObject();
	$("messageBg").style.display = "block";
	$("messageDiv").style.display = "block";

	thisMessageF = eval(thisMessageF);
	$("messageContainer").innerHTML = thisMessageF[lg];

	switch( messageType )
	{
		//	Couleur grise
		case "message" :	$("adjustTable").className = "bgFFFFFF border2 common_borderColor_5"; $("messageIcon").src = "img/icon_050.gif"; break;
		//	Couleur orange
		case "warning" :	$("adjustTable").className = "bgFFFFFF border2 common_borderColor_4"; $("messageIcon").src = "img/icon_048.gif"; break;
		//	Couleur rouge
		case "alert" :		$("adjustTable").className = "bgFFFFFF border2 common_borderColor_3"; $("messageIcon").src = "img/icon_047.gif"; break;
		//	Couleur bleue
		case "help" :		$("adjustTable").className = "bgFFFFFF border2 common_borderColor_5"; $("messageIcon").src = "img/icon_049.gif"; break;
	}

	if ( button1TypeF != "" )
	{
		button1TextF = eval(button1TextF);
		$("button1").innerHTML = '<div style="width:75px;height:26px" class="' + button1TypeF + '" onMouseOver="this.className=\'' + button1TypeF + '_hover\';" onMouseOut="this.className=\'' + button1TypeF + '\';" onClick="' + button1ActionF + '"><div class="padT5">' + button1TextF[lg] + '</div></div>';
	}

	if ( button2TypeF != "" )
	{
		button2TextF = eval(button2TextF);
		$("button2Container").style.display = "block";
		$("button2").innerHTML = '<div style="width:75px;height:26px" class="' + button2TypeF + '" onMouseOver="this.className=\'' + button2TypeF + '_hover\';" onMouseOut="this.className=\'' + button2TypeF + '\';" onClick="' + button2ActionF + '"><div class="padT5">' + button2TextF[lg] + '</div></div>';
	}

	//	On ajuste l'hombre simulÃ©e du calque
	$("adjustImg").style.height = $("adjustTable").clientHeight + "px";
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function hideMessage()
{
	if ( $("messageBg") ) $("messageBg").style.display = "none";
	if ( $("messageDiv") ) $("messageDiv").style.display = "none";
	if ( $("messageContainer") ) $("messageContainer").innerHTML = "";
	if ( $("button2Container") ) $("button2Container").style.display = "none";
}

//////////	DIMENSIONNEMENT DU CALQUE BODY	//////////
var pageType = "";
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
var windowHeight;
function getWindowHeight()
{
	windowHeight = 0;
	if ( typeof( window.innerHeight ) == 'number' )
	{
		windowHeight = window.innerHeight;
	}
	else
	{
		if ( document.documentElement && document.documentElement.clientHeight )
		{
			windowHeight = document.documentElement.clientHeight;
		}
		else
		{
			if ( document.body && document.body.clientHeight )
			{
				windowHeight = document.body.clientHeight;
			}
		}
	}
}

var pageHeight;
function getPageHeight()
{
	if ( browserIE )
	{
		pageHeight = document.body.scrollHeight;
	}
	else
	{
		pageHeight = document.documentElement.scrollHeight;
	}
}

var pageWidth;
function getPageWidth()
{
	if ( browserIE )
	{
		pageWidth = document.body.clientWidth;
	}
	else
	{
		pageWidth = document.documentElement.clientWidth;
	}
}

var pageScrollTop;
function getScrollTop()
{
	if ( browserIE || browserFF )
	{
		pageScrollTop = document.documentElement.scrollTop;
		return(pageScrollTop);
	}
	else
	{
		pageScrollTop = document.body.scrollTop;
		return(pageScrollTop);
	}
}

var resizePageTimer;
function resizePageDelayed()
{
	resizePageTimer = setTimeout("resizePage()",350);
}

function resizePage()
{
	hideHelp();
	
	clearTimeout(resizePageTimer);
	
	//	Fonction de Resize du calque << mainOuter >> en mode << Ã©dition >>
	if ( pageType == "edit" )
	{
		resizeBody_2();
	}
	//	Fonction de Resize du calque << mainOuter >>
	else
	{
		resizeBody();
	}
	
	//	Ajuste la position du container " htmlDiv " des messages et alertes
	setHtmlDivPosition();
	positionVirtualWindow();
	positionProductWindow();
}

var oxyvar_1 = 55;			//	Nombre de pixels entre le calque des listes et le bas de la fenÃªtre

/*--------------------------------------------------------------------------------------------------------------------------\
|	Resize de la page en mode << normal >>																					|
\--------------------------------------------------------------------------------------------------------------------------*/
function resizeBody()
{
	if ( $("statsContainer") ) { $("statsContainer").style.height = ( windowHeight - 145 ) + "px"; }

	getPageWidth();
	getWindowHeight();

	var theMainOuterDiv = $('mainOuter');
	var theTopOuterDiv = $('topOuter');
	var theLeftOuterDiv = $('leftOuter');
	var theBottomHTMLDiv = $('bottomHtmlContainer');
	var thePropertiesHTMLDiv = $('blockPropertiesHtmlContainer');
	
	var a = windowHeight - theTopOuterDiv.offsetHeight;
	
	theLeftOuterDiv.style.height = a + "px";

	theMainOuterDiv.style.height = a + "px";
	theMainOuterDiv.style.width = pageWidth - theLeftOuterDiv.clientWidth + "px";
	theMainOuterDiv.style.overflowX = "hidden";
	
	//	Si la page contient une liste, on supprimer le scroll Y du calque mainOuter et on retaille le calque contenant les listes
	//	La variable globale : oxyvar_1 est prÃ©sente dans chaque page de liste et fixe le nombre de pixels entre le calque des listes et le bas de la fenÃªtre suivant s'il y a ou non un bouton dans la barre de boutons du bas
	if( $('listContent') )
	{
		theMainOuterDiv.style.overflowY = "hidden";
		$('listContent' ).style.height = a - $('listContentTop' ).offsetTop - oxyvar_1 + "px";
	}
	else
	{
		theMainOuterDiv.style.overflowY = "scroll";
	}
	
	//	Calque de preview
	$("fullscreenOuterBg").style.width = pageWidth + "px";
	$("fullscreenOuterBg").style.height = windowHeight + "px";
	$("fullscreenOuter").style.width = pageWidth + "px";
	$("fullscreenOuter").style.height = windowHeight + "px";
	$("fullscreenOuterContainer").style.width = ( pageWidth - 80 ) + "px";
	$("fullscreenOuterContainer").style.height = ( windowHeight - 90 ) + "px";
	
	//	Calque HTML Container
	if ( theBottomHTMLDiv )
	{
		if ( previewOpened == false )
		{
			theBottomHTMLDiv.style.left = theLeftOuterDiv.clientWidth + "px";
			theBottomHTMLDiv.style.width = 785 + "px";
		}
		else
		{
			theBottomHTMLDiv.style.left = "0px";
			theBottomHTMLDiv.style.width = pageWidth + "px";
		}
	}
	
	if ( thePropertiesHTMLDiv )
	{
		if ( previewOpened == false )
		{
			thePropertiesHTMLDiv.style.left = theLeftOuterDiv.clientWidth + "px";
			thePropertiesHTMLDiv.style.width = 785 + "px";
		}
		else
		{
			thePropertiesHTMLDiv.style.left = "0px";
			thePropertiesHTMLDiv.style.width = pageWidth + "px";
		}
	}
}

/*--------------------------------------------------------------------------------------------------------------------------\
|	Resize du conteneur de listes																							|
\--------------------------------------------------------------------------------------------------------------------------*/
function resizeListContainer()
{
	getWindowHeight();
	
	var theTopOuterDiv = $('topOuter');
	var theMainOuterDiv = $('mainOuter');
	
	if( $('listContent') )
	{
		theMainOuterDiv.style.overflowY = "hidden";
		$('listContent' ).style.height = windowHeight - theTopOuterDiv.offsetHeight - $('listContentTop' ).offsetTop - oxyvar_1 + "px";
	}
	else
	{
		theMainOuterDiv.style.overflowY = "scroll";
	}
}

/*--------------------------------------------------------------------------------------------------------------------------\
|	Resize de la page en mode << edition de pages perso >>																	|
\--------------------------------------------------------------------------------------------------------------------------*/
function resizeBody_2()
{
	getPageWidth();
	getWindowHeight();

	var theTopOuterDiv = $('topOuter');
	var theMainOuterDiv = $('mainOuter');
	var theLeftOuterDiv = $('leftOuter');
	var theSiteContainer = $('clientSiteContainer');
	var theImageEditorContainer = $('imageEditorContainer');
	
	var theVirtualContainer = $('virtualSiteContainer');
	var theHeaderContainer = $('headerZone');
	var theBottomHTMLDiv = $('bottomHtmlContainer');
	var thePropertiesHTMLDiv = $('blockPropertiesHtmlContainer');

	theMainOuterDiv.style.overflowX = "hidden";
	theMainOuterDiv.style.overflowY = "hidden";
	
	
	
	theMainOuterDiv.style.height = windowHeight + "px";

	theSiteContainer.style.height = windowHeight - 103 + "px";
	theVirtualContainer.style.height = windowHeight - 103 + "px";

	theSiteContainer.style.overflowX = "hidden";
	theSiteContainer.style.overflowY = "scroll";
	
	var a;
	var b;
	
	a = pageWidth - theMainOuterDiv.offsetLeft;
	b = theMainOuterDiv.offsetLeft;
	
	theMainOuterDiv.style.width = a + "px";
	theSiteContainer.style.width = a - 44 + "px";
	theVirtualContainer.style.width = a - 44 + "px";
	
	//	Calque de preview
	$("fullscreenOuterBg").style.width = pageWidth + "px";
	$("fullscreenOuterBg").style.height = windowHeight + "px";
	$("fullscreenOuter").style.width = pageWidth + "px";
	$("fullscreenOuter").style.height = windowHeight + "px";
	$("fullscreenOuterContainer").style.width = ( pageWidth - 80 ) + "px";
	$("fullscreenOuterContainer").style.height = ( windowHeight - 90 ) + "px";
	
	if ( theBottomHTMLDiv )
	{
		theBottomHTMLDiv.style.left = b + "px";
		theBottomHTMLDiv.style.width = a + "px";
	}
	
	if ( thePropertiesHTMLDiv )
	{
		thePropertiesHTMLDiv.style.left = b + "px";
		thePropertiesHTMLDiv.style.width = a + "px";
	}

	//	Retaillage de la Oxybar
	resizeOxybars();
}



//////////	FONCTION DE GESTION DES BLOCKS DU TEMPLATE CLIENT	//////////

var theDroppedBlock = "";
var theDroppedBlockContent = "";
var theDroppedBlockParent = "";
var theColumn = "";
var theSpans = "";
var theSpansLength = 0;
var theBlockPosition = 0;

//	Fonction d'initialisation du comptage des blocks et affectation des valeurs aux variables globales
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function initCounting( theBlock )
{
	theColumn = $( theBlock );
	if ( theColumn )
	{
		theSpans = theColumn.getElementsByTagName( "span" );
		theSpansLength = theSpans.length;
	}
}

//	Fonction de recherche de la position du block droppÃ© dans la colonne
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function findBlockPosition()
{
	if( theSpansLength == 1 )
	{
		theBlockPosition = 0;
	}
	else
	{
		for ( var i = 0 ; i < theSpansLength ; i++ )
		{
			if( theSpans[i].id == theDroppedBlock )
			{
				//	Comptage Ã  partir de 0
				theBlockPosition = i;
			}
		}
	}
}

//	Fonction de rÃ© Ã©criture des blocks
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function processSetTxtBlockAttributes( elemObj, elemID, blockID )
{
	elemObj.id			= elemID;
	//elemObj.onmouseover	= "oxyText.setTextStyle(this)";
	//elemObj.onmouseout	= "oxyText.removeTextStyle(this)";
	elemObj.onclick		= "oxyText.editText(this,this.id,'" + blockID + "')";
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function getUrlParam( srcUrl , paramName )
{
	var done = "";
	var url1 = srcUrl.split('?');
	if ( url1.length > 1 )
	{
		var url2 = url1[1].split('&');
		for ( var i = 0; i < url2.length; i++ )
		{
			if ( url2[i].match( paramName ) != null )
			{
				var tmpParams = url2[i].split('=');
				done = tmpParams[1];
				break;
			}
		}
	}
	return( done );
}
function changeUrlParam( srcUrl , paramName, paramValue )
{
	var done = false;
	var url1 = srcUrl.split('?');
	if ( url1.length > 1 )
	{
		var url2 = url1[1].split('&');
		for ( var i = 0; i < url2.length; i++ )
		{
			if ( url2[i].match( paramName ) != null )
			{
				url2[i] = paramName + "=" + paramValue;
				url1[1] = url2.join("&");
				done = true;
				break;
			}
		}
		if ( !done )
		{
			url2[url2.length] = paramName + "=" + paramValue;
			url1[1] = url2.join("&");
		}
	}
	return( url1.join("?") );
}

function processSetImgBlockAttributes( dropzoneid, elemObj, elemID, blockID )
{
	//	lecture des attributs du container
	var theContainer = $( blockID + "_container" );
	if ( theContainer )
	{
		//	recuperer le type de bloc
		var blockAttribute = readBlockOxyType( theContainer );
		if ( blockAttribute != "" )
		{
			//	recuperer la taille de l'image associÃ©e Ã  la dropzone et au type de bloc
			var wImg = blocsConfiguration[currentPageBodyType][dropzoneid][blockAttribute]['wimg'];
			if ( elemObj.hasChildNodes() )
			{
				var wNodes = elemObj.childNodes;
				for ( var i = 0; i < wNodes.length; i++ )
				{
					if ( wNodes.item(i).tagName == "IMG" )
					{
						wNodes.item(i).width = wImg;
						wNodes.item(i).style.width = wImg + "px";
						wNodes.item(i).src = changeUrlParam( wNodes.item(i).src, "width", wImg );
					}
				}
			}
		}
	}
	//if ( elemID != "" ) elemObj.id			= elemID;
	elemObj.id			= elemID;
	elemObj.onmouseover	= "oxyText.setImgStyle(this);";
	elemObj.onmouseout	= "oxyText.removeImgStyle(this);";
	elemObj.onclick		= "oxyText.editImage( this.id,'" + blockID + "')";
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function setBlockAttributes( dropZoneId, theBlockID, isNew )
{
	theNewId = theBlockID;
	var wDiv = $(theNewId + "_content");

	//	taille du bloc
	if ( wDiv ) wDiv.style.width = blocsConfiguration[currentPageBodyType][dropZoneId]["width"] + "px";

	var tagsArray = new Array( 'div', 'p', 'samp' );
	divTextID	= "userText";
	divImgID	= "userImg";
	var idxText = 0;
	var idxImg = 0;
	var allDivs = null;
	for ( var i = 0; i < tagsArray.length; i++ )
	{
		allDivs = wDiv.getElementsByTagName( tagsArray[i] );
		for ( var j = 0; j < allDivs.length; j++ )
		{
			//	si le bloc est nouveau, l'identifier tel que
			if ( isNew )
			{
				divTextID	= "userText";
				divImgID	= "userImg";
			}
			else
			{
				divTextID	= idxText + "_userText_" + theNewId;
				divImgID	= idxImg + "_userImg_"  + theNewId;
			}
			if ( allDivs[j].id == divTextID )
			{
				/*
				if ( isNew ) processSetTxtBlockAttributes( allDivs[j], idxText + "_userText_" + theNewId, theNewId );
				else processSetTxtBlockAttributes( allDivs[j], '', theNewId );
				*/
				processSetTxtBlockAttributes( allDivs[j], divTextID, theNewId );
				idxText++;
			}
			if ( allDivs[j].id == divImgID )
			{
				/*
				if ( isNew ) processSetImgBlockAttributes( dropZoneId, allDivs[j], idxImg + "_userImg_" + theNewId, theNewId );
				else processSetImgBlockAttributes( dropZoneId, allDivs[j], '', theNewId );
				*/
				processSetImgBlockAttributes( dropZoneId, allDivs[j], divImgID, theNewId );
				idxImg++;
			}
		}
	}
}

//	RÃ©gÃ©ration du block droppÃ©
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function reInsertBlock( theDroppedBlock, theDroppedBlockContent )
{
	//if( window.console ) window.console.log( '--> reInsertBlock' );
	//if( window.console ) window.console.log( 'theDroppedBlock : ' + theDroppedBlock + ' / theDroppedBlock : ' + theDroppedBlock );
	//	Id du block droppÃ©
	var thisBlock = $( theDroppedBlock );
	if( thisBlock )
	{
		//if( window.console ) window.console.log( '3100' );
		//	On extrait les propriÃ©tÃ©s du block droppÃ©
		var a_1 = thisBlock.getAttribute("oxysource");
		var a_2 = thisBlock.getAttribute("oxyposition");
		var a_3 = thisBlock.getAttribute("oxyorigin");
		var a_4 = thisBlock.getAttribute("oxyvisibility");		
		var a_5 = thisBlock.getAttribute("oxyfile");		
		var a_6 = thisBlock.getAttribute("oxytitle");
		var a_7 = thisBlock.getAttribute("oxyparams");
		var a_7_1 = thisBlock.getAttribute("oxyicnt");
		var a_8 = thisBlock.getAttribute("class");

		var reInsertedBlock = document.createElement("div");
	
		//var newId = reInsertedBlock.id = thisBlock.id;
		var newId = thisBlock.id;
		reInsertedBlock.id = thisBlock.id;
		
		//	On affecte les propriÃ©tÃ©s au nouveau block
		reInsertedBlock.setAttribute("oxyblock", "source");
		reInsertedBlock.setAttribute("oxysource", a_1);
		reInsertedBlock.setAttribute("oxyposition", a_2);
		reInsertedBlock.setAttribute("oxyorigin", a_3);
		reInsertedBlock.setAttribute("oxyvisibility", a_4);
		reInsertedBlock.setAttribute("oxyfile", a_5);
		reInsertedBlock.setAttribute("oxytitle", a_6);
		reInsertedBlock.setAttribute("oxyparams", a_7);
		reInsertedBlock.setAttribute("oxyicnt", a_7_1);
		//	reInsertedBlock.setAttribute("class", a_8);
		
		//	Suppression 
		//reInsertedBlock.innerHTML = theDroppedBlockContent;
	
		//	On Ã©crit le contenu du nouveau block
		reInsertedBlock.innerHTML = theDroppedBlockContent;
		
		reInsertedBlock.className = "clearBoth " + a_8;

		//	Appendchild du nouveau block dans sa colonne correspondante de la Oxybar
		$( a_3 ).appendChild( reInsertedBlock );
		//	Positionnement du nouveau block dans sa colonne
		var the_Position = newId.lastIndexOf( "_" );
		var theTypeLength = newId.length - the_Position - 1;
		var theBeginning = newId.substring( 0, newId.length - theTypeLength );
		var fileSubstring = newId.substring( newId.length - theTypeLength, newId.length );
	
		var num = parseInt(fileSubstring) + 1;
		var idlastBlock = theBeginning + num;
		if ( $(idlastBlock) )
		{
			$( a_3 ).insertBefore( reInsertedBlock, $(idlastBlock) );
		}
		else $( a_3 ).insertBefore( reInsertedBlock );
		
		//if( window.console ) window.console.log( '3144' );
		parseToolbar( a_3, theBeginning + fileSubstring, a_6, a_7 );
		resetImageToolbar( a_3, theBeginning + fileSubstring );
	}
	//if( window.console ) window.console.log( '<-- reInsertBlock' );
}

//	IncrÃ©mentation de la position des blocks se situant en dessous du block droppÃ©
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function arrangeBlocks()
{
	if( theSpansLength > 1 )
	{
		for ( var i = theBlockPosition ; i < theSpansLength ; i++ )
		{
			theSpans[i].oxyposition = i;
		}
	}
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function sortBlocks( dropZoneID )
{
	// if( window.console ) window.console.log( 'sortBlocks(' + dropZoneID + ')\n' ) ;
	var ids = new Array();
	var pos = new Array();
	
	//var allBlocks = $(dropZoneID).getElementsByTagName('span');
	var allBlocks = $$( '#' + dropZoneID + ' div.blockcontainer');

	for (var i = 0; i < allBlocks.length; i++ )
	{
		//alert($(allBlocks[i]).id);
		ids[ids.length] = $(allBlocks[i]).id;
		pos[pos.length] = i;
	}
	//	sauvegarde de la position des blocs
	//	envoyer l'identifiant de la page, l'identifiant du block et la position du block
	persoPages.saveblockposition( ids.join(','), pos.join(',') );
}

//	Variable qui contient le block avec un style actif appliquÃ© par l'Ã©vÃ©nement << onMouseOver >>
var activeBlock = "";
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function applyBlockStyle( theBlock )
{
	if ( isFullScreen == "yes" && isDragging == false )
	{
		var theId = theBlock.id;

		activeBlock = theBlock.id;		// Block avec style actif

		$( theId + "_toolbar" ).style.display = "block";
	}
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function removeBlockStyle( theBlock )
{
	if ( isFullScreen == "yes" )
	{
		var theId = theBlock.id;

		$( theId + "_toolbar" ).style.display = "none";
		activeBlock = "";			// R.A.Z
	}
}

//	Toolbar au survol des blocks
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function parseToolbar( dragZoneId, theBlock, titre, hasParams )
{
	var innerHTMLCode =	"";
	innerHTMLCode += "	<table border='0' cellpadding='0' cellspacing='0' class='move'>";
	innerHTMLCode += "		<tr>";
	innerHTMLCode += "			<td width='40' onMouseOver='showHelp(help_6[lg])' onMouseOut='hideHelp()'><img src='img/pixel.gif' width='40' height='27'></td>";
	innerHTMLCode += "			<td width='210' align='center'>" + titre + "</td>";
	innerHTMLCode += "			<td width='13'><img src='img/pixel.gif' width='13' height='27'></td>";
	innerHTMLCode += "		</tr>";
	innerHTMLCode += "	</table>";

	$(theBlock).setAttribute( 'oxytitle', titre );
	$(theBlock).setAttribute( 'oxyparams', hasParams );
	if ( $( theBlock + "_toolbarContent" ) ) $( theBlock + "_toolbarContent" ).innerHTML = innerHTMLCode;
	else alert( 'no toolbar' );
}

/*--------------------------------------------------------------------------------------------------------------------------\
|	TOOLBAR des images																										|
\--------------------------------------------------------------------------------------------------------------------------*/
function resetImageToolbar( dragZoneId, theBlock )
{
	var theImageToolbar = $( theBlock + "_imageToolbar" );
	if ( theImageToolbar ) 
	{
		theImageToolbar.innerHTML = "";
	}
}

var theEditedBlock = "";
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function editBlock( startPos, theBlock )
{
	showeditingOuter();
	theEditedBlock = theBlock;

	var theBlockContainer = $( 'blockContainer' );

	//	Transfert des donnÃ©es vers le block Ã©ditable
	var thisBlock = $( theBlock );
	theBlockContainer.innerHTML = thisBlock.innerHTML;

	//	Resize
	var theEditMeas = $('editMeas');
	theEditMeas.style.width = pageWidth + "px";
	theEditMeas.style.height = windowHeight + "px";

	//	Ouverture du calque de l'Ã©dition
	dojo.lfx.explode(startPos, "editDiv", 300).play();
	//$('editDiv').style.display = "block";

	//	On masque la Toolbar du block
	var thisBlockToolbar = $( theBlock + "_toolbar" );
	thisBlockToolbar.style.display = "none";

	//	Resize de l'Ã©diteur
	resizeEditor();
}

/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function maskBlock( theBlock )
{
	var thisBlock = $( theBlock );
	//	Masque appliquÃ© sur le contenu car le << SPAN >> ne le prend pas en compte
	var thisBlockContent = $( theBlock + "_content" );

	if ( thisBlock.attributes["oxyvisibility"].value == "mask" )
	{
		thisBlock.attributes["oxyvisibility"].value = "show";
		thisBlockContent.className = "on";
	}
	else
	{
		thisBlockContent.className = "t30";
		thisBlock.attributes["oxyvisibility"].value = "mask";
	}
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
var loadOK = function ( t )
{
	oxyButton.loadOK( t );
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
var myEndEditBlock = function ( )
{
	oxyText.endEditText();
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
var myEditedPage = function () { editPage( persoPages.editablePageId );}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
var mySaveText = function () { oxyText.saveText(); }

/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
var theEditedText = "";
function editText( theText )
{
	theEditedText = theText;
	thisText = theText.innerHTML;

	var theEditor = FCKeditorAPI.GetInstance('oxyEditor');
	theEditor.SetHTML( thisText );
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function saveText()
{
	var thisText = FCKeditorAPI.GetInstance('oxyEditor').GetHTML();
	theEditedText.innerHTML = thisText;
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
//	Changement du style des textes, au survol, en mode << edition >>
var oldTextStyle = "";
function setTextStyle( theText )
{
	oldTextStyle = theText.className;
	var newTextStyle = oldTextStyle + " fontFFFFFF toolbarBg";
	theText.className = newTextStyle;
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function removeTextStyle( theText )
{
	theText.className = oldTextStyle;
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function setDraggingStatus( e )
{
	// if( window.console ) window.console.log( '--> setDraggingStatus\n' ) ;
	isDragging = true;
	var wId = '';
	if ( e.srcElement )
	{
		wId = e.srcElement.parentElement.id;
	}
	else
	{
		if ( e.originalTarget ) wId = e.originalTarget.parentNode.id;
		// else if( window.console ) window.console.log( '!!! bad e !!!\n' ) ;
	}
	if ( wId != '' )
	{
		var wObj = $(wId).getAttribute('oxbobj');
		if ( wObj != null )	eval( 'if ( ' + wObj + '.DDCollapse ) ' + wObj + '.DDCollapse(true);');
	}
	else
	{
		// if( window.console ) window.console.log( '!!! no wId !!!\n' ) ;
	}
	// if( window.console ) window.console.log( '<-- setDraggingStatus\n' ) ;
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function setEndDraggingStatus( e )
{
	isDragging = false;
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function showDDHelp( that, thisText )
{
	var theDiv = $( that );
	var showDDHelpContent = eval(thisText + "[lg]");

	theDiv.innerHTML = showDDHelpContent;
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function hideDDHelp( that )
{
	var theDiv = $( that );

	theDiv.innerHTML = "&nbsp;";
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
//////////	DIMENSIONNEMENT DE L'EDITEUR DE BLOCKS	//////////
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function resizeEditor()
{
	var theClientWidth = document.body.clientWidth;
	var theClientHeight = document.body.clientHeight;
	var theHalfHeight = ( theClientHeight / 2 );

	var theBlockDiv = $('blockContainer');
	var theEditorIframe = $('oxyEditor___Frame');

	theBlockDiv.style.width = theClientWidth - 46 + "px";
	theBlockDiv.style.height = theHalfHeight - 69 + "px";

	theEditorIframe.style.width = theClientWidth - 40 + "px";
	theEditorIframe.style.height = theHalfHeight - 109 + "px";
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function createEditor( theEditor )
{
	var oFCKeditorEvents										= new FCKeditor( theEditor );
	oFCKeditorEvents.BasePath									= k_host + 'library/js/FCKeditor/';
	oFCKeditorEvents.Config[ "CustomConfigurationsPath" ]		= k_host + "data/FCKeditor/oxygenn.js";
	oFCKeditorEvents.Config[ "EditorAreaCSS" ]					= k_host + "styles/FCKeditor.css";
	oFCKeditorEvents.ToolbarSet									= 'Oxygenn';
	//oFCKeditorEvents.Create();
	oFCKeditorEvents.ReplaceTextarea();
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function showSaveButton()
{
	var thisImage = $( "saveButton" ).style.display = "block";
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function hideSaveButton()
{
	var thisImage = $( "saveButton" ).style.display = "none";
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
//	GESTION DES BOUTONS PRINIPAUX

var oxyButton_oxygenn_action = "";
var oxyButton_1_action = "";
var oxyButton_2_action = "";
var oxyButton_3_action = "";
var oxyButton_4_action = "";
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function loadButton( theButton, theFunction )
{
	var thisButtonsDiv = $("button-container");
	var thisButton = $( theButton );

	switch( theButton )
	{
		case "oxyButton_oxygenn"	: theButton = "oxyButton_oxygenn";	thisButtonsDiv.style.bottom = "-20px";	break;		// Bouton Oxygenn
		case "oxyButton_1"			: theButton = "oxyButton_1";		thisButtonsDiv.style.bottom = "0px";		break;		// Bouton enregistrer
		case "oxyButton_2"			: theButton = "oxyButton_2";		thisButtonsDiv.style.bottom = "0px";		break;		// Bouton plein Ã©cran
		case "oxyButton_3"			: theButton = "oxyButton_3";		thisButtonsDiv.style.bottom = "0px";		break;		// Bouton fermer
		case "oxyButton_4"			: theButton = "oxyButton_4";		thisButtonsDiv.style.bottom = "0px";		break;		// Bouton annuler
	}

	thisButton.style.display = "block";
	thisButton.onclick = theFunction;
	/**/
	//thisButton.attachEvent( 'onclick', theFunction );
	/**/
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function unloadButtons()
{
	// R.A.Z de tous les boutons
	$( "oxyButton_oxygenn" ).style.display = "none";
	$( "oxyButton_1" ).style.display = "none";
	$( "oxyButton_2" ).style.display = "none";
	$( "oxyButton_3" ).style.display = "none";
	$( "oxyButton_4" ).style.display = "none";
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function doNothing()
{
	//	Do nothing
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
//	Fonction de changement de style
function selectCell( theCell, theSelectedCell, totalCell )
{
	//	Pars : ( dÃ©but du nom de la cellule,	cellule sÃ©lectionnÃ©e,	nombre total de choix possibles )

	//	Suppression du style des autres cellules
	for ( var i = 1; i <= totalCell; i++ )
	{
		//	Affectation du style Ã  l'Ã©lÃ©ment
		if ( theSelectedCell != i )
		{
			if ( $( theCell + "_" + i + "_cell" ) ) $( theCell + "_" + i + "_cell" ).className = "table_style_1";
		}
	}
	if ( $( theCell + "_" + theSelectedCell + "_cell" ) ) $( theCell + "_" + theSelectedCell + "_cell" ).className = "table_style_1_selected";
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
//	Fonction de positionnement de la vignette des Ã©vÃ©nements
function selectEventImgPosition( thePosition )
{
	switch ( thePosition )
	{
		default :
		case  0	:
			$("previewDisplayDiv").className = "floatLeft padR10 padT3 padB4";
			
			$( "eventImgPosition_1_img" ).src = "img/pic_151_selected.png";
			$( "eventImgPosition_1_cell" ).className = "table_style_1_selected";
			//$( "eventImgPosition_1" ).value = 1;
			$( "eventImgPosition" ).value = 0;
			
			$( "eventImgPosition_2_img" ).src = "img/pic_151.png";
			$( "eventImgPosition_2_cell" ).className = "table_style_1";
			//$( "eventImgPosition_2" ).value = 0;
		break;
		case  1	:
			$("previewDisplayDiv").className = "floatRight padL10 padT3 padB4";
			
			$( "eventImgPosition_2_img" ).src = "img/pic_151_selected.png";
			$( "eventImgPosition_2_cell" ).className = "table_style_1_selected";
			//$( "eventImgPosition_2" ).value = 1;
			$( "eventImgPosition" ).value = 1;
			
			$( "eventImgPosition_1_img" ).src = "img/pic_151.png";
			$( "eventImgPosition_1_cell" ).className = "table_style_1";
			//$( "eventImgPosition_1" ).value = 0;
		break;
	}
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
//	Fonction de positionnement de la vignette des Ã©vÃ©nements
function selectEventLocation( theLocation )
{
	switch ( theLocation )
	{
		default :
		case  1	:
			if ( $( "eventLocation_1" ).value == 1 )
			{
				$( "eventLocation_1_img" ).src = "img/pic_152.png";
				$( "eventLocation_1_cell" ).className = "table_style_1";
				
				$( "eventLocation_1" ).value = 0;
			}
			else
			{
				$( "eventLocation_1_img" ).src = "img/pic_152_selected.png";
				$( "eventLocation_1_cell" ).className = "table_style_1_selected";
				
				$( "eventLocation_1" ).value = 1;
			}
		break;
		case  2	:
			if ( $( "eventLocation_2" ).value == 1 )
			{
				$( "eventLocation_2_img" ).src = "img/pic_152.png";
				$( "eventLocation_2_cell" ).className = "table_style_1";
				
				$( "eventLocation_2" ).value = 0;
			}
			else
			{
				$( "eventLocation_2_img" ).src = "img/pic_152_selected.png";
				$( "eventLocation_2_cell" ).className = "table_style_1_selected";
				
				$( "eventLocation_2" ).value = 1;
			}
		break;
	}
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
//	Fonction de sÃ©lection du type de lien de l'Ã©vÃ©nement
function selectEventTarget( theTarget )
{
	switch ( theTarget )
	{
		default :
		case  1	:
			if ( $( "eventTarget_1_button" ) ) $( "eventTarget_1_button" ).className = "button_bg_color_1";
			if ( $( "eventTarget_2_button" ) ) $( "eventTarget_2_button" ).className = "button_bg_color_5";
			
			$( "eventTarget_1" ).value = 1;
			$( "eventTarget_2" ).value = 0;
		break;
		case  2	:
			if ( $( "eventTarget_1_button" ) ) $( "eventTarget_1_button" ).className = "button_bg_color_5";
			if ( $( "eventTarget_2_button" ) ) $( "eventTarget_2_button" ).className = "button_bg_color_1";
			
			$( "eventTarget_1" ).value = 0;
			$( "eventTarget_2" ).value = 1;
		break;
	}
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
//
//	definition de l'objet onglets
//
function oxyTabsDef( objName )
{
	this.objName = objName;
	this.isdebug = true;
	oxyTabsDef.prototype.debug = function ( t )
	{
		if ( $('debug') )
		{
			$('debug').innerHTML += t + "<br/>";
		}
	};
	this.number					= 0;		//	nombre de tabs
	this.firstActivate			= true;
	this.lastActiveTabIndex		= 0;		//	dernier onglet actif
	this.activeTabIndex			= 0;		//	nouvel onglet actif

	this.lastActivateTabClass	= '';
	this.contents				= null;

	oxyTabsDef.prototype.init = function ( n, o )
	{
		this.debug( 'in..--> ' + this.objName + '.init' );
		this.number = n;
		this.lastActiveTabIndex = o;
		this.firstActivate			= true;

		this.contents = new Array( this.number + 1 );
		for ( i = 0; i <= this.number; i++ ) this.contents[i] = "";

		this.debug( 'out.--> ' + this.objName + '.init' );
	};

	//	activation d'une tab
	oxyTabsDef.prototype.activate = function( theTabpane, theTab )
	{
		this.debug( 'in..--> ' + this.objName + '.activate' );

		if ( this.lastActiveTabIndex == 0 )  this.lastActiveTabIndex = theTab;

		//	desactiver l'ancien onglet
		if ( !this.firstActivate ) this.desactivate( theTabpane, this.lastActiveTabIndex );
		else this.firstActivate = false;

		//	activer le nouvel onglet
		if ( $( theTabpane + theTab ) )
		{
			$( theTabpane + theTab ).className = "tab_active";
			$( theTabpane + theTab + "Bottom" ).className = "bgFFFFFF";
		}

		this.lastActivateTabClass = "tab_active";

		//	lancer la methode onactivate
		this.onActivate( theTabpane, theTab );

		//	et oui, le nouvel onglet devient l'ancien onglet
		this.lastActiveTabIndex = theTab;

		this.debug( 'out.--> ' + this.objName + '.activate' );
	};

	//	desactivation d'une tab
	oxyTabsDef.prototype.desactivate = function( theTabpane, tabIndex )
	{
		this.debug( 'in..--> ' + this.objName + '.desactivate' );

		//	lancer la methode ondesactivate de l'onglet
		this.onDesactivate( theTabpane, tabIndex );


		$( theTabpane + tabIndex ).className = "tab";
		$( theTabpane + tabIndex + "Bottom" ).className = "";

		this.debug( 'out.--> ' + this.objName + '.activate' );
	};
	oxyTabsDef.prototype.onActivate = function( theTabpane, theTab )
	{
		this.debug( 'in..--> ' + this.objName + '.onActivate' );
		this.debug( 'out.--> ' + this.objName + '.onActivate' );
	};
	oxyTabsDef.prototype.onDesactivate = function( theTabpane, theTab )
	{
		this.debug( 'in..--> ' + this.objName + '.onDesactivate' );
		this.debug( 'out.--> ' + this.objName + '.onDesactivate' );
	};
	oxyTabsDef.prototype.onMouseOver = function( theTabpane, theTab )
	{
		this.debug( 'in..--> ' + this.objName + '.onMouseOver' );

		var thisTab = $( theTabpane + theTab );

		this.lastActivateTabClass = thisTab.className;
		thisTab.className = "tab_hover";

		this.debug( 'out.--> ' + this.objName + '.onMouseOver' );
	};
	oxyTabsDef.prototype.onMouseOut = function( theTabpane, theTab )
	{
		this.debug( 'in..--> ' + this.objName + '.onMouseOut' );
		$( theTabpane + theTab ).className = this.lastActivateTabClass;
		this.debug( 'out.--> ' + this.objName + '.onMouseOut' );
	};
}
var oxyTabs = new oxyTabsDef( 'oxyTabs' );

//	tabs
//	methode appelee a l'activation d'un onglet
oxyTabs.onActivate = function ( theTabpane, theTab )
{
	this.debug('in..--> onActivate');

	this.debug('( theTabpane, theTab ) : ( ' + theTabpane + ',' + theTab + ' )');

	if ( testInstanceOK ) this.debug('testInstanceOK = true');
	else this.debug('testInstanceOK = false');

	var clientLanguage = "";
	var thisText = "";

	switch( theTab )
	{
		default :
		case 1 : clientLanguage = "EN"; thisText = common_030_text[lg]; break;
		case 2 : clientLanguage = "ES"; thisText = common_031_text[lg]; break;
		case 3 : clientLanguage = "FR"; thisText = common_032_text[lg]; break;
		case 4 : clientLanguage = "DE"; thisText = common_033_text[lg]; break;
		case 5 : clientLanguage = "IT"; thisText = common_034_text[lg]; break;
		case 6 : clientLanguage = "PT"; thisText = common_035_text[lg]; break;
	}

	//	Change le texte du language
	var wElem = $( theTabpane + "_Language" );
	if ( wElem ) wElem.innerHTML = thisText;

	//	afficher le titre de l'evenement
	wElem = $('fevenement');
	if ( wElem ) wElem.evtTitle.value = this.readTitle(theTab);

	//	afficher le contenu dans fckeditor
	if ($('oxyEditorEvents')) {
		var oEditor = FCKeditorAPI.GetInstance('oxyEditorEvents');
		if (oEditor) 
			oEditor.SetHTML(this.readContent(theTab));
	}
	//	afficher le titre dans le preview
	previewTitle = $('previewTitleDiv');
	if ( previewTitle ) previewTitle.innerHTML = this.readTitle(theTab);
	
	//	afficher le contenu dans le preview
	var previewText = $( "previewTextDiv" );
	if ( previewText ) previewText.innerHTML = this.readContent(theTab);
	
	else this.debug('no instance');

	this.debug('out.--> onActivate');
}

//	methode appelee a la desactivation d'un onglet
oxyTabs.onDesactivate = function ( theTabpane, theTab )
{
	this.debug('in..--> onDesactivate');
	//	sauvegarder le titre de l'evenement
	wForm = $('fevenement');
	if ( wForm ) this.writeTitle( theTab, wForm.evtTitle.value );

	//	sauvegarder le contenu de fckeditor dans la zone de sauvegarde associee a l'onglet
	var oEditor = FCKeditorAPI.GetInstance('oxyEditorEvents') ;
	if ( oEditor ) this.writeContent( theTab, oEditor.GetXHTML() );
	this.debug('out.--> onDesactivate');
}
oxyTabs.readTitle = function ( tabindex )
{
	this.debug('in..--> readTitle');
	this.debug('tabindex = ' + tabindex);
	this.debug('title = ' + unescape(this.titles[tabindex]) );
	this.debug('out.--> readTitle');
	return( unescape(this.titles[tabindex]) );
}
oxyTabs.writeTitle = function ( tabindex, value )
{
	this.titles[tabindex] = value;
}
oxyTabs.readContent = function ( tabindex )
{
	return( unescape(this.contents[tabindex]) );
}
oxyTabs.writeContent = function ( tabindex, value )
{
	this.contents[tabindex] = escape(value);
}

/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function Dec2Hex(Decimal)
{
	var hexChars = "0123456789ABCDEF";
	var a = Decimal % 16;
	var b = (Decimal - a)/16;
	hex = hexChars.charAt(b) + hexChars.charAt(a);
	return hex;
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function ascii2hex( theStr )
{
	var result = "";
	for ( var i = 0; i < theStr.length; i++ )
	{
		result += Dec2Hex( theStr.charCodeAt(i) );
	}
	return( result );
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function parseBlocTags()
{

}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
//	Fonction de rÃ© Ã©criture des blocks
function setBlockAttributes2( dropZoneId, theBlockID, isNew )
{
	theNewId = theBlockID;
	var wDiv = $(theNewId + "_content");
	wDiv.style.filter = "alpha(opacity=30)";
	var idxText = 0;
	var idxImg = 0;
	var allDivs = wDiv.getElementsByTagName('div');
	for ( i = 0; i < allDivs.length; i++ )
	{
		if ( allDivs[i].id == "userText" )
		{
			allDivs[i].id			= idxText + "_userText_" + theNewId;
			idxText++;
			allDivs[i].onclick		= "oxyText.editText(this,this.id,'" + theNewId + "')";
		}
		if ( allDivs[i].id == "userImg" )
		{
			allDivs[i].id			= idxImg + "_userImg_" + theNewId;
			idxImg++;
			allDivs[i].onmouseover	= "this.style.cursor='pointer';";
			allDivs[i].onmouseout	= "this.style.cursor='default';";
			allDivs[i].onclick		= "oxyText.editImage( this.id,'" + theNewId + "')";
		}
	}
	allDivs = wDiv.getElementsByTagName('p');
	for ( i = 0; i < allDivs.length; i++ )
	{
		if ( allDivs[i].id == "userText" )
		{
			allDivs[i].id			= idxText + "_userText_" + theNewId;
			idxText++;
			allDivs[i].onclick		= "oxyText.editText(this,this.id,'" + theNewId + "')";
		}
		if ( allDivs[i].id == "userImg" )
		{
			allDivs[i].id			= idxImg + "_userImg_" + theNewId;
			idxImg++;
			allDivs[i].onmouseover	= "this.style.cursor='pointer';";
			allDivs[i].onmouseout	= "this.style.cursor='default';";
			allDivs[i].onclick		= "oxyText.editImage( this.id,'" + theNewId + "')";
		}
	}
	allDivs = wDiv.getElementsByTagName('samp');
	for ( i = 0; i < allDivs.length; i++ )
	{
		if ( allDivs[i].id == "userText" )
		{
			allDivs[i].id			= idxText + "_userText_" + theNewId;
			idxText++;
			allDivs[i].onclick		= "oxyText.editText(this,this.id,'" + theNewId + "')";
		}
		if ( allDivs[i].id == "userImg" )
		{
			allDivs[i].id			= idxImg + "_userImg_" + theNewId;
			idxImg++;
			allDivs[i].onmouseover	= "this.style.cursor='pointer';";
			allDivs[i].onmouseout	= "this.style.cursor='default';";
			allDivs[i].onclick		= "oxyText.editImage( this.id,'" + theNewId + "')";
		}
	}
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function readBlockOxyType( objBlock )
{
	var blockAttribute = "";
	if ( objBlock )
	{
		//	recuperer le type de bloc
		blockAttribute = objBlock.getAttribute('oxybtype');
	}
	return( blockAttribute );
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
//	Fonction de rÃ© Ã©criture des blocks
function remakeBlock( dropZoneId, blockID )
{
	var theNewId = blockID;

	quit = false;
	var blkNum = 1000;
	var thisBlock = null;
	while ( !quit && ( blkNum > 0 ) )
	{
		//	attente pour etre sur que le bloc est dispo
		thisBlock = $( blockID );
		if ( !thisBlock ) blkNum--;
		else quit = true;
	}
	if ( quit )
	{
		//	RÃ© Ã©criture de la propriÃ©tÃ© << oxyblock >> du block
		thisBlock.oxyblock = "block";

		//	Ajouter la barre d'outils a ce bloc
		setBlockToolbar( dropZoneId, blockID );
		
		//	Ajouter la barre d'outils a ce bloc
		resetImageToolbar( dropZoneId, blockID );

		//	On compte et on rend Ã©ditables les textes dans 'content'
		setBlockAttributes( dropZoneId, blockID, false );
	}
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------\
|	Gestion de l'edition des textes des blocs								|
\--------------------------------------------------------------------------*/
function oxyTextDef( name )
{
	this.objName = name;
	this.isEditing = true;
	this.theTextID = "";
	this.theBlockID = "";
	this.theEditedText = "";
	this.oldTextStyle = "";
	oxyTextDef.prototype.endEditText = function( )
	{
		this.isEditing = false;
		$('oxeditorcontainer').style.display = 'none';
		$('oxeditorimg').style.display = 'none';
		$('oxeditorimg').innerHTML = '';
	};
	oxyTextDef.prototype.startEditText = function( )
	{
		this.isEditing = true;
	};
	oxyTextDef.prototype.editText = function( theText, textID, blockID )
	{
		if ( this.isEditing )
		{
			this.theTextID = textID;
			this.theBlockID = blockID;
			this.theEditedText = theText;
			thisText = theText.innerHTML;

			var theEditor = FCKeditorAPI.GetInstance('oxyEditor');
			theEditor.SetHTML( thisText );

			$('oxeditorcontainer').style.display = 'block';
		}
	};
	oxyTextDef.prototype.setImage = function( imageSrc, isDirect )
	{
		var wDiv = $( this.theImageID );
		if ( wDiv )
		{
			if ( isDirect )
			{
				persoPages.saveblockcontent( this.theBlockID, escape(imageSrc), this.theImageID );
			}
			else
			{
				if ( wDiv.hasChildNodes() )
				{
					var wNodes = wDiv.childNodes;
					for ( var i = 0; i < wNodes.length; i++ )
					{
						if ( wNodes.item(i).tagName == "IMG" )
						{
							wNodes.item(i).src = imageSrc;
							persoPages.saveblockcontent( this.theBlockID, escape(imageSrc), this.theImageID );
						}
					}
				}
			}
		}
	};
	oxyTextDef.prototype.editImage = function( imageID, blockID )
	{
		if ( this.isEditing )
		{
			this.theImageID = imageID;
			this.theBlockID = blockID;

			//	le click agit sur la balise <div>
			//	l'image est fille de ce div

			var wDiv = $( imageID );
			if ( wDiv )
			{
				if ( wDiv.hasChildNodes() )
				{
					var wNodes = wDiv.childNodes;
					for ( var i = 0; i < wNodes.length; i++ )
					{
						if ( wNodes.item(i).tagName == "IMG" )
						{
							var url = k_host + "library/js/oxygenn/oxy-imgbrowser/oxy-imgbrowser.php?self=yes&miw=" + wNodes.item(i).width;
							imageBrowser = window.open( url , "", "top=0px,left=0px,toolbar=no,status=no,resizable=yes,dependent=yes,width=" + document.body.clientWidth + ",height=" + document.body.clientHeight + "" );
							imageBrowser.focus();
						}
					}
				}
				else this.debug( 'no node' );
			}
		}
	};
	oxyTextDef.prototype.saveText = function( )
	{
		var thisText = FCKeditorAPI.GetInstance('oxyEditor').GetHTML();
		var wTarget = $( this.theEditedText.id );
		if ( wTarget )
		{
			thisText = thisText.replace( '<p>' , '' ) ;
			thisText = thisText.replace( '</p>' , '' ) ;
			wTarget.innerHTML = thisText;
		}
		persoPages.saveblockcontent( this.theBlockID, escape(thisText), this.theTextID );
	};
	oxyTextDef.prototype.setTextStyle = function( theText )
	{
		if ( this.isEditing )
		{
			this.oldTextStyle = theText.className;
			var newTextStyle = this.oldTextStyle + " fontFFFFFF editTxtBg";
			theText.className = newTextStyle;
		}
	};
	oxyTextDef.prototype.removeTextStyle = function ( theText )
	{
		if ( this.isEditing )
		{
			theText.className = this.oldTextStyle;
		}
	};
	oxyTextDef.prototype.setImgStyle = function( theImg )
	{
		if ( this.isEditing )
		{
			theImg.style.cursor = 'pointer';
		}
	};
	oxyTextDef.prototype.removeImgStyle = function ( theImg )
	{
		if ( this.isEditing )
		{
			theImg.style.cursor = 'default';
		}
	};
}
var oxyText = new oxyTextDef( 'oxyText' );

var imageBrowser = null;

/*--------------------------------------------------------------------------\
|	Gestion ecriture dans la base de donnÃ©es								|
\--------------------------------------------------------------------------*/
function oxyDataBase()
{
	oxyDataBase.prototype.save = function ( table, field, value, where )
	{
		var url = k_path_root + "library/js/oxygenn/oxyDbSave.php";
		var pars = "table=" + table + "&field=" + field + "&value=" + value + "&where=" + where;
		//var myAjaxCompletion = new Ajax.Request( url, {method: 'post', parameters: pars });
	}
}
var oxyDB = new oxyDataBase();
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------\
|	Gestion des preferences													|
\--------------------------------------------------------------------------*/
function oxyPreferencesDef ()
{
	oxyPreferencesDef.prototype.save = function ( key, value )
	{
		var url = k_path_root + "library/js/oxygenn/oxyPrefSave.php";
		var pars = "key=" + key + "&value=" + value;
		var myAjaxCompletion = new Ajax.Request( url, {method: 'post', parameters: pars });
	}
	oxyPreferencesDef.prototype.read = function ( key )
	{
		var url = k_path_root + "library/js/oxygenn/oxyPrefRead.php";
		var pars = "key=" + key;
		var myAjaxCompletion = new Ajax.Request( url, {method: 'post', parameters: pars, onComplete:function (t ){return(t.responseText);} });
	}
}
var oxyPref = new oxyPreferencesDef();
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------\
|	Gestion des variables "globales" javascript								|
\--------------------------------------------------------------------------*/
function oxyNameSpace()
{
	oxyNameSpace.prototype.create = function ( n )
	{
		eval( "this." + n + " = new Object();" );
	};
	oxyNameSpace.prototype.free = function ( n )
	{
		eval ( "var tmp = this." + n + ";" );
		if ( tmp )
		{
			eval( "delete( this." + n + ");" );
		}
	};
}
var oxyVar = new oxyNameSpace();
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/

/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function initClientDragSources()
{
 	// R.A.Z
 	isDragging = false;

	for ( var i = 0; i < dragSources.length; i++ ) initClientDragSource( i );
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
// Initialisation d'une Drag source client
function initClientDragSource( theIndex )
{
	var dragSource = $( dragSources[theIndex][0] );
	if ( dragSource )
	{
		//var theBlocks = dragSource.getElementsByTagName("span");
		var theBlocks = $$('div.blockcontainer');
		for( var x = 0; x < theBlocks.length; x++ )
		{
			// Stockage des Ã©lÃ©ments dans le Array << dragSources >> Ã  la suite de dragSources[0][0] ( dragSources[0][1], dragSources[0][2], ... )
			// Les dragSources crÃ©es pourront ainsi Ãªtre << unregistered >>
			// << dragSources[theIndex][x + 1] >> car << dragSources[theIndex][0] >> est occupÃ© par le nom de la dragSource
			//dragSources[theIndex][x + 1] = new dojo.dnd.HtmlDragSource(theBlocks[x], dragSources[theIndex][0]);
			dragSources[theIndex][x + 1] = new dojo.dnd.HtmlDragSource(theBlocks[x], ["*"] );
			dragSources[theIndex][x + 1].dragClass = 'dragblock';
		}
	}
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function SetUrl( imgsrc )
{
	oxyText.setImage( imgsrc, 0 );
}
function SetUrl2( imgsrc )
{
	oxyText.setImage( imgsrc, 1 );
}

/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function initfluxrss( ) { }
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function goClientPage( pg ) { }
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/


function serialize(obj)
{
  var returnVal;
  if(obj != undefined){
  switch(obj.constructor)
  {
   case Array:
    var vArr="[";
    for(var i=0;i<obj.length;i++)
    {
     if(i>0) vArr += ",";
     vArr += serialize(obj[i]);
    }
    vArr += "]"
    return vArr;
   case String:
    returnVal = escape("'" + obj + "'");
    return returnVal;
   case Number:
    returnVal = isFinite(obj) ? obj.toString() : null;
    return returnVal;    
   case Date:
    returnVal = "#" + obj + "#";
    return returnVal;  
   default:
    if(typeof obj == "object"){
     var vobj=[];
     for(attr in obj)
     {
      if(typeof obj[attr] != "function")
      {
       vobj.push('"' + attr + '":' + serialize(obj[attr]));
      }
     }
      if(vobj.length >0)
       return "{" + vobj.join(",") + "}";
      else
       return "{}";
    }  
    else
    {
     return obj.toString();
    }
  }
  }
  return null;
}

function eventsDef ( objName )
{
	this.objName	= objName;
	this.eventID	= "";
	this.eventImgID = "";
	this.width		= 40;
	this.height		= 30;

	eventsDef.prototype.setimage = function( f, imgID )
	{
		var wForm = $(f);
		if ( wForm )
		{
			//	recherche de la taille selectionnÃ©e pour la vignette

			var wImg = $( imgID );
			if ( wImg )
			{
				/**/
				//	ouverture du div obligatoire pour avoir le width de l'image
				var lastdisplay = $('previewDisplayDiv').style.display;
				$('previewDisplayDiv').style.display = 'block';
				var wWidth = wImg.width;
				$('previewDisplayDiv').style.display = lastdisplay;
				/**/
				
				this.eventImgID = imgID;
				//var url = k_host + "library/js/oxygenn/oxy-imgbrowser/oxy-imgbrowser.php?self=yes&callback=" + this.objName + ".insertimgevent&miw=" + wImg.width;
				//imageBrowser = window.open( url , "", "top=0px,left=0px,toolbar=no,status=no,resizable=yes,dependent=yes,width=" + document.body.clientWidth + ",height=" + document.body.clientHeight + "" );
				//imageBrowser.focus();
				
				//	Masquages des boutons et des FLASH
				maskAdminFlash();
				$('level_1_hiding').style.display = 'none';
				$('level_2_hiding').style.display = 'none';
				
				innerHTMLCode = '	<table align="center" border="0" cellpadding="0" cellspacing="0">';
				innerHTMLCode += '		<tr>';
				innerHTMLCode += '			<td>';
				innerHTMLCode += '				<table border="0" cellpadding="0" cellspacing="0" class="hand" onclick="closeImageBrowser();">';
				innerHTMLCode += '					<tr>';
				innerHTMLCode += '						<td><img src="img/button21_01.png" width="10" height="26"></td>';
				innerHTMLCode += '						<td width="100" class="padL10 padR10 padB3 font5 font91 fontFFFFFF" align="center" style="background-image:url(img/button21_02.png); background-repeat:repeat-x;">' + common_007_text[lg] + '</td>';
				innerHTMLCode += '						<td><img src="img/button21_03.png" width="12" height="26"></td>';
				innerHTMLCode += '					</tr>';
				innerHTMLCode += '				</table>';
				innerHTMLCode += '			</td>';
				innerHTMLCode += '		</tr>';
				innerHTMLCode += '	</table>';
				
				$('ImageBrowserBttomHTML').innerHTML = innerHTMLCode;
				$('ImageBrowserBttomHTMLContainer').style.display = 'block';
								
				//alert( imgID + ' / ' + wImg.src + ' / ' + wImg.width );
				$('fullscreenOuterContainer').src = k_host + "library/js/oxygenn/oxy-imgbrowser/oxy-imgbrowser.php?openmode=iframe&self=yes&callback=" + this.objName + ".insertimgevent&miw=" + wWidth;
				$('fullscreenOuter').style.display = 'block';
				$('fullscreenOuterBg').style.display = 'block';
			}
		}
	};
	eventsDef.prototype.deleteimage = function( imgID )
	{
		//	On vÃ©rifie qu'il y a une image du client !
		if ( $( imgID ).src.indexOf("pic_081.jpg") == -1 )
		{
			theMessage = '<table id="htmlAdjustTable" cellspacing="0" cellpadding="0" border="0">';
			theMessage += '<tr>';
			theMessage += '	<td align="center"><img src="img/icon_048.gif" width="48" height="48"></td>';
			theMessage += '</tr>';
			//--> Start
			theMessage += '<tr>';
			theMessage += '	<td class="padT5 common_fontColor_8" align="center">' + creer_evenement_admin_73_text[lg] + '</td>';
			theMessage += '</tr>';
			//--> End
			theMessage += '<tr>';
			theMessage += '	<td><img src="img/pixel.gif" width="230" height="1"></td>';//	minimum width = 230px
			theMessage += '</tr>';
			theMessage += '<tr>';
			theMessage += '	<td align="center" class="padT10">';
			theMessage += '		<table border="0" cellpadding="0" cellspacing="0">';
			theMessage += '			<tr>';
			theMessage += '				<td>';
			theMessage += '					<table border="0" cellpadding="0" cellspacing="0" class="hand" onclick="hideHtml();">';
			theMessage += '						<tr>';
			theMessage += '							<td width="10"><img src="img/button21_01.png" width="10" height="26" /></td>';
			theMessage += '							<td class="padL10 padR10 padB3 font5 font91 fontFFFFFF" align="center" style="background-image:url(img/button21_02.png); background-repeat:repeat-x;">' + common_043_text[lg] + '</td>';
			theMessage += '							<td width="10"><img src="img/button21_03.png" width="10" height="26" /></td>';
			theMessage += '						</tr>';
			theMessage += '					</table>';
			theMessage += '				</td>';
			theMessage += '				<td><img src="img/pixel.gif" width="10" height="1"></td>';
			theMessage += '				<td>';
			theMessage += '					<table border="0" cellpadding="0" cellspacing="0" class="hand" onclick="hideHtml();' + this.objName + '.deleteimageConfirmed(\'' + imgID + '\');">';
			theMessage += '						<tr>';
			theMessage += '							<td width="10"><img src="img/button20_01.png" width="10" height="26" /></td>';
			theMessage += '							<td class="padL10 padR10 padB3 font5 font91 fontFFFFFF" align="center" style="background-image:url(img/button20_02.png); background-repeat:repeat-x;">' + common_115_text[lg] + '</td>';
			theMessage += '							<td width="10"><img src="img/button20_03.png" width="10" height="26" /></td>';
			theMessage += '						</tr>';
			theMessage += '					</table>';
			theMessage += '				</td>';
			theMessage += '			</tr>';
			theMessage += '		</table>';
			theMessage += '	</td>';
			theMessage += '</tr>';
			theMessage += '</table>';
		}
		else
		{
			theMessage = '<table id="htmlAdjustTable" cellspacing="0" cellpadding="0" border="0">';
			theMessage += '<tr>';
			theMessage += '	<td align="center"><img src="img/icon_048.gif" width="48" height="48"></td>';
			theMessage += '</tr>';
			//--> Start
			theMessage += '<tr>';
			theMessage += '	<td class="padT5 common_fontColor_8" align="center">' + creer_evenement_admin_74_text[lg] + '</td>';
			theMessage += '</tr>';
			//--> End
			theMessage += '<tr>';
			theMessage += '	<td><img src="img/pixel.gif" width="230" height="1"></td>';//	minimum width = 230px
			theMessage += '</tr>';
			theMessage += '<tr>';
			theMessage += '	<td align="center" class="padT10">';
			theMessage += '		<table border="0" cellpadding="0" cellspacing="0">';
			theMessage += '			<tr>';
			theMessage += '				<td>';
			theMessage += '					<table border="0" cellpadding="0" cellspacing="0" class="hand" onclick="hideHtml();">';
			theMessage += '						<tr>';
			theMessage += '							<td width="10"><img src="img/button21_01.png" width="10" height="26" /></td>';
			theMessage += '							<td class="padL10 padR10 padB3 font5 font91 fontFFFFFF" align="center" style="background-image:url(img/button21_02.png); background-repeat:repeat-x;">' + common_007_text[lg] + '</td>';
			theMessage += '							<td width="10"><img src="img/button21_03.png" width="10" height="26" /></td>';
			theMessage += '						</tr>';
			theMessage += '					</table>';
			theMessage += '				</td>';
			theMessage += '			</tr>';
			theMessage += '		</table>';
			theMessage += '	</td>';
			theMessage += '</tr>';
			theMessage += '</table>';
		}
		//--> Message
			showHtml( theMessage );
	};
	eventsDef.prototype.deleteimageConfirmed = function( imgID )
	{
		this.eventImgID = imgID;
		var wImg = $( this.eventImgID );
		
		if ( wImg ) wImg.src = k_host + "library/php/images/rip.php?uid=0&width=90&blank=pic_081.jpg";
		
		$('previewDisplayDivNone').style.display = 'block';
		$('previewDisplayDiv').style.display = 'none';
	};
	eventsDef.prototype.closeFullscreen = function (  )
	{

	};
	eventsDef.prototype.insertimgevent = function ( imgsrc )
	{
		if (imgsrc != '')
		{
			$('previewDisplayDivNone').style.display = 'none';
			$('previewDisplayDiv').style.display = 'block';
			var wImg = $(this.eventImgID);
			if (wImg) wImg.src = imgsrc;
		}
	};
	eventsDef.prototype.insertdirectimgevent = function ( imgsrc, imgid )
	{
		if (imgsrc != '')
		{
			$('previewDisplayDivNone').style.display = 'none';
			$('previewDisplayDiv').style.display = 'block';
			var wImg = $(imgid);
			if (wImg) wImg.src = imgsrc;
		}
	};
	eventsDef.prototype.chgUrlParam = function ( oriquery, key, val )
	{
		var query = oriquery.split("?");

		var vars = query[1].split("&");

		var resParams = "";
		var sep = "";
		for (var i=0;i<vars.length;i++)
		{
			var pair = vars[i].split("=");
			if ( pair[0] == key ) pair[1] = val;
			resParams += sep + pair[0] + "=" + pair[1];
			sep = "&";
		}
		return( query[0] + "?" + resParams );
	};
	eventsDef.prototype.selectImageSize = function ( theImage, theSize, theWidth, theHeight, totalCell )
	{
		var thisImage = $( theImage );

		if ( thisImage )
		{
			thisImage.src = this.chgUrlParam( thisImage.src, "width", theWidth );
			thisImage.style.width = theWidth + "px";
		}

		this.width		= theWidth;
		this.height		= theHeight;

		//	Affectation du style au choix sÃ©lectionnÃ©
		this.selectEventImgSize( theSize, totalCell );
	};
	eventsDef.prototype.selectEventImgSize = function ( theSize, totalCell )
	{
		//	On affecte le style au choix sÃ©lectionnÃ©
		//this.selectCell(theSize, totalCell);
	};
	eventsDef.prototype.selectCell = function( theSelectedCell, totalCell )
	{
		//	Pars : ( cellule sÃ©lectionnÃ©e,	nombre total de choix possibles )
		
		//	Suppression du style des autres cellules
		for ( var i = 1; i <= totalCell; i++ )
		{
			//	Affectation du style Ã  l'Ã©lÃ©ment
			if ( theSelectedCell != i )
			{
				$( "eventImgSize_" + i + "_cell" ).className = "table_style_1";
				$( "eventImgSize_" + i + "_img" ).src = "img/pic_151.png";
				$( "eventImgSize_" + i ).value = 0;
			}
		}
		
		$( "eventImgSize_" + theSelectedCell + "_cell" ).className = "table_style_1_selected";
		$( "eventImgSize_" + theSelectedCell + "_img" ).src = "img/pic_151_selected.png";
		$( "eventImgSize_" + theSelectedCell ).value = 1;
	};
	eventsDef.prototype.deletelink = function ( f, s )
	{
		var wForm = $( f );
		if ( wForm )
		{
			wForm[s].value = "";
			selectEventTarget( 1 );
		}
	};
}
var oxyEvents = new eventsDef( 'oxyEvents' );

/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function oxyMenuEngineDef()
{
	this.maup = new Image();

	this.madown = new Image();

	oxyMenuEngineDef.prototype.imgOnMouseOver = function ( m )
	{
		//	l'image
		var elemID = $( "mitemi-" + m );
		if ( elemID )
		{
			elemID.style.cursor = "hand";
			elemID.src = this.maup.src;
			elemID = $( "mitema-" + m );
			if ( elemID )
			{
				elemID.style.cursor = "hand";
				elemID.style.marginLeft = "15px";
			}
		}
	};
	oxyMenuEngineDef.prototype.imgOnMouseOut = function ( m )
	{
		//	l'image
		var elemID = $( "mitemi-" + m );
		if ( elemID )
		{
			elemID.style.cursor = "default";
			elemID.src = this.madown.src;
			elemID = $( "mitema-" + m );
			if ( elemID )
			{
				elemID.style.cursor = "default";
				elemID.style.marginLeft = "10px";
			}
		}
	};
	oxyMenuEngineDef.prototype.setmenuup = function ( m )
	{
		//	l'image
		var elemID = $( "mitem" + m + "i" );
		if ( elemID )
		{
			elemID.style.cursor = "hand";
			elemID.src = this.maup.src;
			elemID = $( "mitem" + m + "t" );
			if ( elemID )
			{
				elemID.style.cursor = "hand";
				elemID.style.marginLeft = "15px";
			}
		}
	};
	oxyMenuEngineDef.prototype.setmenudown = function ( m )
	{
		//	l'image
		var elemID = $( "mitem" + m + "i" );
		if ( elemID )
		{
			elemID.style.cursor = "default";
			elemID.src = this.madown.src;
			elemID = $( "mitem" + m + "t" );
			if ( elemID )
			{
				elemID.style.cursor = "default";
				elemID.style.marginLeft = "10px";
			}
		}
	};
	oxyMenuEngineDef.prototype.goDirect = function ( m )
	{
		var url		= k_path_root + "dispatcher.php";
		var pars	= "p1=" + m;
		var myAjaxCompletion = new Ajax.Updater( 'container-middle-center' , url, {method: 'get', parameters: pars, evalScripts:true });
	};
	oxyMenuEngineDef.prototype.go = function ( m )
	{
		var elemID = $( "mitem" + m + "t" );
		if ( elemID )
		{
			var wAttibute = elemID.getAttribute( "oxyaction" );
			if ( wAttibute ) oxyMenuEngine.goDirect( wAttibute );
		}
	};
	oxyMenuEngineDef.prototype.loadXMLMenuBar = function ( mBId, xslFile, divId )
	{
		oxyXML.loadXML( k_path_root + "library/php/oxygenn/oxy-loadMenuBarXML.php?mbarid=" + mBId + "&out=xml" , xslFile, divId );
	};
	oxyMenuEngineDef.prototype.loadXMLMenuFile = function ( xmlFile, xslFile, divId )
	{
		oxyXML.loadXML( xmlFile , xslFile, divId );
	};
}
var oxyMenuEngine = new oxyMenuEngineDef();
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
goPage = function ( uid )
{
	//var url = k_host + "templates/blasco/blasco_skin/index.php?pgid=" + uid;
	var url = k_host + "evts/" + uid + "/0/12";
	//evtPage = window.open( url , "", "top=0px,left=0px,toolbar=no,status=no,resizable=yes,dependent=yes,width=" + document.body.clientWidth + ",height=" + document.body.clientHeight + "" );
	var evtPage = window.open( url , "" );
	evtPage.focus();
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
goPagePreview = function ( uid, lnk )
{
	//var url = k_host + "evts/" + uid + "/0/12";
	//var url = k_host + "pg-" + k_prjName + "-" + k_prjName + "-" + uid + ".html";
	
	//alert( 'url = ' + url );
	//openPreview( url );
	openPreview( lnk );
}


/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
var testInstanceOK = false;
var oxyEditorEventsReady = 0;

OnAfterLinkedFieldUpdate = function () { alert(' OnAfterLinkedFieldUpdate'); }
OnAfterSetHTML = function () { alert('OnAfterSetHTML'); }
OnFocus = function () { alert('OnFocus'); }
OnPaste = function () { alert('OnPaste'); }
OnStatusChange = function () { alert('OnStatusChange'); }
OnSelectionChange = function () { alert('OnSelectionChange'); }

fckEditorReady = function ()
{
	this.OxyEditorEvents 	= false;
	this.OxygennEditor		= false;
	
	fckEditorReady.prototype.isOxyEditorEvents = function ()
	{
		return(this.OxyEditorEvents);
	};
	fckEditorReady.prototype.isOxygennEditor = function ()
	{
		return(this.OxygennEditor);
	};
	fckEditorReady.prototype.clearAll = function ()
	{
		this.OxyEditorEvents 	= false;
		this.OxygennEditor		= false;
	};
}
var oxyEditorStatus = new fckEditorReady();

function FCKeditor_OnComplete( editorInstance )
{
    if ( editorInstance.Name == 'oxyEditorEvents' )
    {
    	testInstanceOK = true;
    	oxyEditorStatus.OxyEditorEvents = true;
    }
    if ( editorInstance.Name == 'oxygennEditor' )
    {
    	oxyEditorStatus.OxygennEditor = true;
    }
}


/*----------------------------------*/
/*--------------------------------------------------------------------------------------------------------------------------\
|	Classe			:	dadiDef																								|
|						classe assurant le drag and drop des images dans l'edition des blocs								|
\--------------------------------------------------------------------------------------------------------------------------*/
function dadiDef( objName )
{
	this.objName = objName;
	dadiDef.prototype.droplst = new Array();
	dadiDef.prototype.copysrclst = new Array();
	dadiDef.prototype.initDropImg = function( dropzone, wmin )
	{
		var dl = dojo.byId( dropzone );
		var wDrop = new dojo.dnd.HtmlDropTarget( dl , ["*"]);
		this.droplst[this.droplst.length] = wDrop;
		dojo.event.connect(wDrop, "onDrop", function(e)
		{
			var dl = dojo.byId( dropzone );
			if ( dl )
			{
				var tags = dl.getElementsByTagName('img');
				var wClass = '';
				var wAlign = '';
				for ( var i = 0; i < tags.length; i++ )
				{
					if ( ( tags[i].className != '' ) && ( tags[i].getAttribute( "align" ) != '' ) )
					{
						wClass = tags[i].className;
						wAlign = tags[i].getAttribute( "align" );
					}
				}
			}
			dl.innerHTML = "";
			var wSrc = this.chgUrlParam( e.dragObject.domNode.src, 'height', '*' );
			wmin = wmin.replace('"','');
			wSrc = chgUrlParam( wSrc, 'width', wmin.replace('px','') );

			var html = "<img src='"	+ wSrc + "'>";
			SetUrl2( wSrc );
			dl.innerHTML = html;
			if ( dl )
			{
				if ( dl.hasChildNodes() )
				{
					var wNodes = dl.childNodes;
					for ( var i = 0; i < wNodes.length; i++ )
					{
						if ( ( wNodes.item(i).tagName == "IMG" ) || ( wNodes.item(i).tagName == "img" ) )
						{
							wNodes.item(i).className = wClass;
							wNodes.item(i).setAttribute( "align", wAlign );
							break;
						}
					}
				}
			}
		} );
	};
	dadiDef.prototype.initDragImg = function()
	{
		var dl = dojo.byId("imglist");
		var lis = dl.getElementsByTagName("img");
		for(var x=0; x<lis.length; x++)
		{
			wSource = new dojo.dnd.HtmlDragCopySource(lis[x], "li1", x == 1 );
			wSource.dragClass = 'dragimg';
			this.copysrclst[this.copysrclst.length] = wSource;
		}
	};
	dadiDef.prototype.unregisterAll = function ()
	{
		// drop target
		for ( var i = 0; i < this.droplst.length; i++ )
		{
			dojo.dnd.dragManager.unregisterDropTarget( this.droplst[i] );
		}
		for ( i = 0; i < this.copysrclst.length; i++ )
		{
			dojo.dnd.dragManager.unregisterDragSource( this.copysrclst[i] );
		}
	};
	dadiDef.prototype.chgUrlParam = function ( oriquery, key, val )
	{
		var query = oriquery.split("?");

		var vars = query[1].split("&");

		var resParams = "";
		var sep = "";
		for (var i=0;i<vars.length;i++)
		{
			var pair = vars[i].split("=");
			if ( pair[0] == key ) pair[1] = val;
			resParams += sep + pair[0] + "=" + pair[1];
			sep = "&";
		}
		return( query[0] + "?" + resParams );
	};
}
var dadi = new dadiDef('dadi');

/*----------------------------------*/


/*--------------------------------------------------------------------------------------------------------------------------\
|	Gestion des accordions moofx																							|
|																															|
|	usage :																													|
|				var mesAccordions = new oxyAccordionDef();																	|
\--------------------------------------------------------------------------------------------------------------------------*/
oxyAccordionDef = function ( objName )
{
	this.objName					= objName;
	this.blockaccordion1			= null;
	this.blockaccordion1Clicks		= null;
	this.blockaccordion1Contents	= null;
	oxyAccordionDef.prototype.initAccordions = function( headName )
	{
		this.blockaccordion1Clicks = $$( 'div.' + headName + 'titleMoo');
		this.blockaccordion1Contents = $$( 'div.' + headName + 'contentMoo');
		this.blockaccordion1 = new Fx.Accordion( this.blockaccordion1Clicks, this.blockaccordion1Contents,
			{
				//	No parameters
			}
		);
		this.blockaccordion1.showThisHideOpen( 0 );
	}
}

/*--------------------------------------------------------------------------\
|	Gestion des boutons <input type="button" ...							|
\--------------------------------------------------------------------------*/

var regButtonIndex = -1;
var regButtons = new Array();
function writeButton( theContainer, theText, theFunction, theWidth, theHeight, theClass, theMouseOverFunction, theMouseOutFunction, theStatus )
{
	thisText = eval(theText)[lg];
	thisContainer = $( theContainer );
	
	thisContainer.onmouseover = theMouseOverFunction;
	thisContainer.onmouseout = theMouseOutFunction;
	
	thisContainer.innerHTML = "<input id='" + theContainer + "_button' type='button' class='" + theClass + "' style='width:" + theWidth + "px;height:" + theHeight + "px;'>";
	
	//	Affectation du lien au click du bouton
	$( theContainer + "_button" ).onclick = theFunction;
	
	//	Affectation du texte au bouton
	$( theContainer + "_button" ).value = "Â» " + thisText + " Â»";
	
	if ( theStatus == "disabled" )
	{
		$( theContainer + "_button" ).setAttribute("disabled", "true");
	}
	
	// On enregistre les boutons dans un Array afin de permettre le changement du language
	regButtonIndex++;
	regButtons[regButtonIndex] = new Array( theContainer , theText );
}

/*--------------------------------------------------------------------------\
|	CrÃ©er une page - Choix de la structure de la page						|
\--------------------------------------------------------------------------*/

function selectPageStructure( theStructure )
{
	$( "radio_" + theStructure ).checked = true;
}

/*--------------------------------------------------------------------------\
|	Copier les adresses des champs MES COORDONNEES							|
\--------------------------------------------------------------------------*/

function replaceBr( expression )
{
	a = "<BR>";
	b = "\n";
	
	var i = 0
	while ( i != -1 )
	{
		i = expression.indexOf( a, i );
		if ( i >= 0 )
		{
			expression = expression.substring( 0, i ) + b + expression.substring( i + a.length );
			i += b.length;
		}
	}
	return expression;
}

function copyAddress( theFields )
{
	switch( theFields )
	{
		case	"1"	:
			$( "ad_2_1" ).value = replaceBr( $( "ad_1_1" ).innerHTML );
			$( "ad_2_2" ).value = $( "ad_1_2" ).innerHTML;
			$( "ad_2_3" ).value = $( "ad_1_3" ).innerHTML;
			if ( browserIE )
			{
				selectOption( 'mes_coordonnees' , 'select_2' , 'cArray' , $( "ad_1_4" ).innerHTML , 452 , 'bgFFFFFF hand border1 borderSolid selectBorderColor' , 'bgFFFFFF border1 borderSolid borderFFFFFF padL5 padR5' , 'common_bgColor_12 border1 borderDotted common_borderColor_9 padL5 padR5' );
				if ( $( "input_sub_select_2" ).value != "none" )
				{
					selectOption( 'mes_coordonnees' , 'sub_select_2' , $( "input_sub_select_2" ).value , $( "ad_1_5" ).innerHTML , 452 , 'bgFFFFFF hand border1 borderSolid selectBorderColor' , 'bgFFFFFF border1 borderSolid borderFFFFFF padL5 padR5' , 'common_bgColor_12 border1 borderDotted common_borderColor_9 padL5 padR5' );
				}
			}
		break;
		case	"2"	:
			$( "ad_3_1" ).value = $( "ad_2_1" ).value;
			$( "ad_3_2" ).value = $( "ad_2_2" ).value;
			$( "ad_3_3" ).value = $( "ad_2_3" ).value;
			if ( browserIE )
			{
				selectOption( 'mes_coordonnees' , 'select_3' , 'cArray' , $( "input_value_select_2" ).value , 452 , 'bgFFFFFF hand border1 borderSolid selectBorderColor' , 'bgFFFFFF border1 borderSolid borderFFFFFF padL5 padR5' , 'common_bgColor_12 border1 borderDotted common_borderColor_9 padL5 padR5' );
				if ( $( "input_sub_select_2" ).value != "none" )
				{
					selectOption( 'mes_coordonnees' , 'sub_select_3' , $( "input_sub_select_2" ).value , $( "input_value_sub_select_2" ).value , 452 , 'bgFFFFFF hand border1 borderSolid selectBorderColor' , 'bgFFFFFF border1 borderSolid borderFFFFFF padL5 padR5' , 'common_bgColor_12 border1 borderDotted common_borderColor_9 padL5 padR5' );
				}
			}
		break;
	}
}

/*--------------------------------------------------------------------------\
|	Calques de chargement													|
\--------------------------------------------------------------------------*/

var oxyLoading = false;

function showLoading()
{
	oxyLoading = true;
	oxyLoader.show();
}

function hideLoading()
{
	oxyLoading = false;
	oxyLoader.hide();
}


oxyLoaderDef = function ( )
{
	this.start	= 0;
	this.stop	= 0;
	
	oxyLoaderDef.prototype.show = function ( )
	{
		this.start++;
		if ( this.start > 0 )
		{
			maskAdminFlash();	//	Masquage des objets Flash
			if ( $("loadingBg") ) $("loadingBg").style.display = "block";
			if ( $('loadingDiv') ) $('loadingDiv').style.display = "block";
		}
	};
	oxyLoaderDef.prototype.hide = function ( )
	{
		if ( this.start > 0 ) this.start--;
		if ( this.start == 0 )
		{
			if ( $("loadingBg") ) $("loadingBg").style.display = "none";
			if ( $('loadingDiv') ) $("loadingDiv").style.display = "none";
			unmaskAdminFlash();	//	DÃ©masquage des objets Flash
		}
	}
}
var oxyLoader = new oxyLoaderDef();

/*--------------------------------------------------------------------------\
|	Aide au survol															|
\--------------------------------------------------------------------------*/

var helpVisible = "no";

function showHideHelp()
{
	var thisDiv = $('divHelp');
	
	if (document.layers)
	{
		if (e.which == 24)
		{
			if (thisDiv.style.display == "none")
			{
				thisDiv.style.display = "block";
			}
			else
			{
				thisDiv.style.display = "none";
			}
		}
	}
	else if (document.all)
	{
		if (event.keyCode == 24)
		{
			if (thisDiv.style.display == "none")
			{
				thisDiv.style.display = "block";
			}
			else
			{
				thisDiv.style.display = "none";
			}
		}
	}
}
var helpStatus = "";
function initHelp( theSatus)
{
	if( theSatus == "enabled" )
	{
		var thisHelp = document.createElement("div");
		thisHelp.name				= "divHelp";
		thisHelp.id					= "divHelp";
		thisHelp.style.position		= "absolute";
		thisHelp.style.zIndex		= 140;
		thisHelp.style.display		= "block";
		document.body.appendChild( thisHelp );
		
		document.onmousemove = update;
		
		if (document.layers)
		{
			document.captureEvents(Event.KEYPRESS);
		}
		document.onkeypress = showHideHelp;
		
		helpStatus = "enabled";
	}
	else
	{
		if( $('divHelp') )
		{
			document.body.removeChild( $('divHelp') );
			document.onmousemove = "";
			document.onkeypress = "";
			
			helpStatus = "disabled";
		}
	}
	oxyPref.set('HELP_ACTIVE_ON_FLY',helpStatus);
}

function update(e)
{
	var z = $('divHelp');
	var zh = z.offsetHeight;
	var w = document.body.offsetWidth;
	var h = document.body.offsetHeight + document.documentElement.scrollTop - 20;
	
	if ( browserIE )
	{
		var x = event.x + document.documentElement.scrollLeft;
		var y = event.y + document.documentElement.scrollTop;
	}
	else
	{
		var x = e.pageX;
		var y = e.pageY;
	}
	
	//	X position
	if ( x < 81 )
	{
		z.style.left = 10 + "px";
	}
	if ( x > 80 && x < w - 100 )
	{
		z.style.left = ( x - 70 ) + "px";
	}
	if ( x > w - 99 )
	{
		z.style.left = ( w - 170 ) + "px";
	}
	// Y position
	if ( y < h - zh - 30 )
	{
		z.style.top = ( y + 30 ) + "px";
	}
	if ( y > h - zh - 29 )
	{
		if ( $('helpContent') ) { z.style.top = ( y - zh - $('helpContent').offsetHeight  - 40 ) + "px"; }
		else { z.style.top = ( y - zh - 140 ) + "px"; }
	}
}

function hideHelp()
{
	if( helpStatus == "enabled" )
	{
		clearTimeout(showHelpDelayedTimer);
		clearTimeout(hideHelpDelayedTimer);
		$('divHelp').innerHTML = "";
		helpVisible = "no";
	}
}

var hideHelpDelayedTimer = "";
function hideHelpDelayed()
{
	hideHelpDelayedTimer = setTimeout( hideHelp ,5000);
}

var showHelpDelayedTimer = "";
function showHelp( thisHelp )
{
	if ( helpStatus == "enabled" && isDragging == false )
	{
		var thisDiv = $('divHelp');
	
		var divHtml =	"";
		divHtml +=	"	<table border='0' cellspacing='0' cellpadding='0'>";
		divHtml +=	"		<tr>";
		divHtml +=	"			<td>";
		divHtml +=	"				<table border='0' cellpadding='0' cellspacing='0' class='w100'>";
		divHtml +=	"					<tr>";
		divHtml +=	"						<td width='15'><img src='img/container_5_01.png' width='15' height='12'></td>";
		divHtml +=	"						<td class='container_5_02'><img src='img/pixel.gif' width='1' height='1'></td>";
		divHtml +=	"						<td width='15'><img src='img/container_5_03.png' width='15' height='12'></td>";
		divHtml +=	"					</tr>";
		divHtml +=	"					<tr>";
		divHtml +=	"						<td width='15' class='container_5_04'><img src='img/pixel.gif' width='15' height='1'></td>";
		divHtml +=	"						<td align='center' class='bgFFFFFF common_fontColor_7'>" + thisHelp + "</td>";
		divHtml +=	"						<td width='15' class='container_5_05'><img src='img/pixel.gif' width='15' height='1'></td>";
		divHtml +=	"					</tr>";
		divHtml +=	"					<tr>";
		divHtml +=	"						<td width='15'><img src='img/container_5_06.png' width='15' height='12'></td>";
		divHtml +=	"						<td class='container_5_07'><img src='img/pixel.gif' width='1' height='1'></td>";
		divHtml +=	"						<td width='15'><img src='img/container_5_08.png' width='15' height='12'></td>";
		divHtml +=	"					</tr>";
		divHtml +=	"				</table>";
		divHtml +=	"			</td>";
		divHtml +=	"		</tr>";
		divHtml +=	"	</table>";
	
		var thisFunction = function() { showHelpDelayed( divHtml ); }
		//	Affiche l'aide au survol au bout de 0.5 seconde
		showHelpDelayedTimer = setTimeout( thisFunction ,500);
	}
}

function showHelpDelayed( divHtml )
{
	clearTimeout(showHelpDelayedTimer);
	if ( helpVisible == "no" )
	{
		$('divHelp').innerHTML = divHtml;
		helpVisible = "yes";
	}
	//	Supprime l'aide au survol au bout de 5 secondes
	hideHelpDelayed();
}

/*--------------------------------------------------------------------------\
|	Messages HTML															|
\--------------------------------------------------------------------------*/
/*------------------------------------------------------------------------------------------------------\
|	Code JS de la gestion des alertes																	|
\------------------------------------------------------------------------------------------------------*/
if ( typeof oxbAlertDef == "undefined" || !oxbAlertDef ) 
{
	var oxbAlertDef = 
	{
		init: function()
		{
		},
		show:function()
		{
			maskAdminFlash();
	
			$("messageBg").style.display	= 'block';
			$("htmlDiv").style.display		= 'block';	
			
			setHtmlDivPosition();
		},
		hide:function()
		{
			$("messageBg").style.display	= 'none';
			$("htmlDiv").style.display		= 'none';
			theMessage = "";
			
			unmaskAdminFlash();
		},
		setHeader:function( header )
		{
		},
		setContent:function( content )
		{
			$("htmlContainer").innerHTML = content;
		},
		setFooter:function( footer )
		{
		},
		cleanAll:function()
		{
			$("htmlContainer").innerHTML = '';
		}
	}
}



var theMessage = "";
function showHtml( thisHtml )
{
	maskAdminFlash();
	
	$("messageBg").style.display = "block";
	$("htmlDiv").style.display = "block";
	
	$("htmlContainer").innerHTML = thisHtml;
	
	aoXb.texte.writeTexts_A(lg,"htmlDiv");
	
	setHtmlDivPosition();
}

function clearHtml()
{
	if ( $('htmlContainer') ) $("htmlContainer").innerHTML = '';
}

function setHtmlDivPosition()
{
	getWindowHeight();
	getPageWidth();
	getScrollTop();
	
	var theHtmlDiv = $("htmlDiv");
	
	theHtmlDiv.style.top = pageScrollTop + ( windowHeight / 2 ) - ( theHtmlDiv.offsetHeight / 2 ) + "px";
	//	On mesure la largeur " htmlAdjustTable " du container Ã  afficher afin de le centrer
	theHtmlDiv.style.left = ( pageWidth / 2 ) - ( theHtmlDiv.offsetWidth / 2 ) + "px";
}

function hideHtml()
{
	$("messageBg").style.display = "none";
	$("htmlDiv").style.display = "none";
	theMessage = "";
	
	unmaskAdminFlash();
}

function hideHtmlKeepBg()
{
	//	Efface le message HTML mais conserve le background en vue du chargement de la page suivante
	$("loadingBg").style.display = "block";
	$("messageBg").style.display = "none";
	$("htmlDiv").style.display = "none";
	theMessage = "";
}

/*--------------------------------------------------------------------------------------------------------------------------\
|	FONCTIONS DE GESTION DE LA OXYBAR																						|
\--------------------------------------------------------------------------------------------------------------------------*/
function loadOxybar()
{
	//	Charge les blocks du template Client
	//var thePath = k_clientTemplatePath + "templates/templates.php";
	var thePath = k_commonTemplatePath + "templates/templates.php";

	new Ajax.Updater( "oxybarContent", thePath, { method:"get", asynchronous:true, evalScripts:true });
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
//	Affiche et masque la Oxybar
function toggleOxybar()
{
	if ( oxybarStatus == "closed" )
	{
		//	Ouvre Oxybar
		showOxybar();
	}
	else
	{
		//	Ferme Oxybar
		hideOxybar();
	}
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
var oxybarStatus = "closed";
var blocksAlwaysOpened = true;

function initOxybars()
{
	oxybarVisible();	
	resizeOxybars();
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function resizeOxybars()
{
	getWindowHeight();
	
	$('oxybar').style.height = windowHeight + "px";
	$('oxybarContent').style.height = windowHeight + "px";
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
//	Delai 2000ms pour ouvrir la Oxybar
var showOxybarVar = "";
var hideOxybarVar = "";

function showOxybarDelay()
{
	showOxybarVar = setTimeout( "showOxybar()" ,2000);
	//hideOxybarVar = setTimeout( "hideOxybar()" ,4000);
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/

var theSlide_1 = "";
function showOxybar()
{
	//	Masque l'aide au survol avant le slide
	hideHelp();

	oxybarStatus = "open";

	//	R.A.Z
	clearTimeout(showOxybarVar);

	//	Dojo slide
	theSlide_1 = dojo.lfx.html.slideTo($('oxybar'), {top: 0, left: 0}, 300);
	theSlide_3 = dojo.lfx.html.slideTo($('mainOuter'), {top: 0, left: 340}, 300);
	
	theSlide_1.play();
	theSlide_3.play();
	
	resizePageDelayed();
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function hideOxybar()
{
	//	Masque l'aide au survol avant le slide
	hideHelp();

	//	Dojo slide
	theSlide_1 = dojo.lfx.html.slideTo($('oxybar'), {top: 0, left: -300}, 300);
	theSlide_3 = dojo.lfx.html.slideTo($('mainOuter'), {top: 0, left: 40}, 300);
	
	theSlide_1.play();
	theSlide_3.play();
	
	resizePageDelayed();

	oxybarStatus = "closed";
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
//	Fait apparaitre la OXYBAR
function oxybarVisible()
{
	$('oxybar').style.left = -300 + "px";
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
//	Cache complÃ¨tement la OXYBAR
function closeOxybar()
{
	$('oxybar').style.left = -400 + "px";
	oxybarStatus = "closed";
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
//	Affiche la barre de progression de la OXYBAR
function showOxybarProgress()
{
	$('oxybarLoadingBar').style.display = "block";
	$('oxybarLoadingBg').style.display = "block";
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
//	Masque la barre de progression de la OXYBAR
function hideOxybarProgress()
{
	clearTimeout(hideOxybarProgressVar);
	$('oxybarLoadingBar').style.display = "none";
	$('oxybarLoadingBg').style.display = "none";
}

/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
var hideOxybarProgressVar;
function hideOxybarProgressDelay()
{
	hideOxybarProgressVar = setTimeout("hideOxybarProgress()",1000);
}

/*--------------------------------------------------------------------------------------------------------------------------\
|	Annulation de la crÃ©ation d'un Ã©vÃ©nement																				|
\--------------------------------------------------------------------------------------------------------------------------*/
function cancelCreateEvent()
{
	goTo(K_LISTE_EVENEMENTS);
}
function cancelCreateNews()
{
	goTo(K_LISTE_NEWS);
}

setcountry = function ( cty )
{
	//alert( cty );
}

/*--------------------------------------------------------------------------------------------------------------------------\
|	Annulation de la modification d'une page																				|
\--------------------------------------------------------------------------------------------------------------------------*/
function cancelModifyPage( t )
{
	displayLogo();	//	Removes buttons
	persoPages.list( t );
}

/*--------------------------------------------------------------------------------------------------------------------------\
|	Annulation de la crÃ©ation d'une page																				|
\--------------------------------------------------------------------------------------------------------------------------*/
function cancelCreatePage()
{
	displayLogo();	//	Removes buttons
	persoPages.list();
}

/*--------------------------------------------------------------------------------------------------------------------------\
|	Annulation de la crÃ©ation d'un membre																				|
\--------------------------------------------------------------------------------------------------------------------------*/
function cancelCreateMember( member )
{
	switch( member )
	{
		default :
		case "mem"		: goTo(K_LISTE_MEMBRES);	break;
		case "amb"		: goTo(K_LISTE_AMBASSADES);	break;
		case "vig"		: goTo(K_LISTE_VIGNERONS);	break;
	}
}
/*--------------------------------------------------------------------------------------------------------------------------\
|	Ouverture du preview du site client																						|
\--------------------------------------------------------------------------------------------------------------------------*/
var previewOpened = false;
function openPreview( thisURL )
{
	getPageWidth();
	getWindowHeight();
	
	previewOpened = true;
	resizePage();
	
	maskAdminFlash();
	
	//	Chargement de la page dans le iFrame
	if ( thisURL ) { $("fullscreenOuterContainer").src = thisURL + '?from=admin'; }
	else { $("fullscreenOuterContainer").src = ""; }
	
	//	Affichage du iFrame qui contient le Site Client
	$("fullscreenOuterBg").style.display = "block";
	$("fullscreenOuter").style.display = "block";
	
	//	Buttons & Functions

	var htmlCancelButton 	= '';
	htmlCancelButton 		+= '<table class="hand" border="0" cellspacing="0" cellpadding="0" onclick="closePreview();">';
	htmlCancelButton 		+= '	<tr>';
	htmlCancelButton 		+= '		<td width="10"><img src="img/button21_01.png" width="10" height="26" /></td>';
	htmlCancelButton 		+= '		<td class="padL10 padR10 padB3 font5 font91 fontFFFFFF" style="background-image:url(img/button21_02.png); background-repeat:repeat-x;"><abbr id="common_007">' + common_007_text[lg] + '</abbr></td>';
	htmlCancelButton 		+= '		<td width="12"><img src="img/button21_03.png" width="12" height="26" /></td>';
	htmlCancelButton 		+= '	</tr>';
	htmlCancelButton 		+= '</table>';
		
	var buttons =
	{
		'buttons': [
			{
				'idButton':'',
				'classe':'floatLeft',
				'fct':closePreview,
				'html':htmlCancelButton
			}
		]
	};
	
	FSbottomHTMLObject.loadBar(buttons);
	
}
/*--------------------------------------------------------------------------------------------------------------------------\
|	Fermeture du preview du site client																						|
\--------------------------------------------------------------------------------------------------------------------------*/
function closePreview()
{
	//	Affichage du iFrame qui contient le Site Client
	$("fullscreenOuterBg").style.display = "none";
	$("fullscreenOuter").style.display = "none";
	
	//	Chargement de la page dans le iFrame
	$("fullscreenOuterContainer").src = k_path_root + "backoffice/empty.html";
	
	previewOpened = false;
	resizePage();
	
	unmaskAdminFlash();
	
	FSbottomHTMLObject.unloadBar();
}
/*--------------------------------------------------------------------------------------------------------------------------\
|	Ouverture et fermeture des calques de listes avec overflow																|
\--------------------------------------------------------------------------------------------------------------------------*/
function openCollapse( theDiv )
{
	theDiv = $(theDiv);
	theDivClassname = theDiv.className;
	
	if ( theDiv.style.overflowY == "visible" )
	{			
		theDiv.style.overflowY = "hidden";
		theDiv.style.height = "1.5em";
		theDiv.style.paddingBottom = "0px";
	}
	else
	{			
		theDiv.style.overflowY = "visible";
		theDiv.style.height = "100%";
		theDiv.style.paddingBottom = "3px";
	}
}

/*--------------------------------------------------------------------------------------------------------------------------\
|	Retaillage des calques de listes avec overflow																			|
\--------------------------------------------------------------------------------------------------------------------------*/
function resizeOverflows( thisColumn )
{
	var allDivs = document.getElementsByTagName("div");
	
	var attrib;
	var theCellSize;
	
	for ( var i = 0; i < allDivs.length; i++ )
	{
		attrib = allDivs[i].getAttribute("oxysize");
		//	Supprime un nombre de pixels en largeur
		var status = oXbUtils.isElement( thisColumn );
		if ( status != null )
		{
			theCellSize = $( thisColumn ).clientWidth - attrib + "px";
			if ( attrib )
			{
				//	On se sert de la propriÃ©tÃ© << oxysize >> du calque qui contient sa taille
				allDivs[i].style.width = theCellSize;
			}
		}
	}
}
/*--------------------------------------------------------------------------------------------------------------------------\
|	Retaillage des cellules des listes																						|
\--------------------------------------------------------------------------------------------------------------------------*/
function resizeColumn( thisColumn )
{
	var status = oXbUtils.isElement( thisColumn );
	if ( status != null )
	{
		var size_1 = $( thisColumn ).clientWidth;
		var size_2 = $( thisColumn + "_headlist").clientWidth;
	
		if ( size_1 > size_2 )
		{
			$( thisColumn + "_headlist").style.width = size_1 + "px";
		}
		else
		{
			$( thisColumn ).style.width = size_2 + "px";
		}
	}
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
//	Fonction de sÃ©lection d'une option de prÃ©fÃ©rences gÃ©nÃ©rales - input RADIO
function selectPref( thePref, theSelected, totalCell, theFunction )
{
	//	Suppression du style des autres cellules
	for ( var i = 1; i <= totalCell; i++ )
	{
		var theCell = $( thePref + "_" + i + "_cell" );
		if ( theCell )
		{
			//	Changement de l'image
			$(thePref + "_" + i).src = "img/pic_151.png";
			//	Affectation du style Ã  la cellule concernÃ©e
			theCell.className = "table_style_1";
		}
	}
	$( thePref + "_" + theSelected ).src = "img/pic_151_selected.png";
	$( thePref + "_" + theSelected + "_cell" ).className = "table_style_1_selected";
	
	theFunction();
}

/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
//	Fonction de sÃ©lection d'une option de prÃ©fÃ©rences gÃ©nÃ©rales - input RADIO
function selectPref( thePref, theSelected, totalCell, theFunction )
{
	//	Suppression du style des autres cellules
	for ( var i = 1; i <= totalCell; i++ )
	{
		var theCell = $( thePref + "_" + i + "_cell" );
		if ( theCell )
		{
			//	Changement de l'image
			$(thePref + "_" + i).src = "img/pic_151.png";
			//	Affectation du style Ã  la cellule concernÃ©e
			theCell.className = "table_style_1";
		}
	}
	$( thePref + "_" + theSelected ).src = "img/pic_151_selected.png";
	$( thePref + "_" + theSelected + "_cell" ).className = "table_style_1_selected";
	
	theFunction();
}

/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
//	Fonction de sÃ©lection d'une option de prÃ©fÃ©rences gÃ©nÃ©rales - bascule ON / OFF
function switchPref( thePref, theMode, theFunction )
{
	if ( theMode == "enable" )
	{
		$( thePref + "_1" ).src = "img/pic_151_selected.png";
		$( thePref + "_1_cell" ).className = "table_style_1_selected";
		
		$( thePref + "_2" ).src = "img/pic_151.png";
		$( thePref + "_2_cell" ).className = "table_style_1";
	}
	else
	{
		$( thePref + "_2" ).src = "img/pic_151_red.png";
		$( thePref + "_2_cell" ).className = "table_style_1_selected";
		
		$( thePref + "_1" ).src = "img/pic_151.png";
		$( thePref + "_1_cell" ).className = "table_style_1";
	}
	
	theFunction();
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
//	Fonction de sÃ©lection d'une option de prÃ©fÃ©rences gÃ©nÃ©rales - input CHECKBOX
function checkPref( thePref, theSelected, theFunction )
{
	var wCheckSelected =	$( thePref + "_" + theSelected + "_cell" );
	if( wCheckSelected.className == "table_style_1" )
	{
		$( thePref + "_" + theSelected ).src = "img/pic_152_selected.png";
		//	Affectation du style Ã  la cellule concernÃ©e
		wCheckSelected.className = "table_style_1_selected";
	}
	else
	{
		$( thePref + "_" + theSelected ).src = "img/pic_152.png";
		wCheckSelected.className = "table_style_1";
	}
	//	Affectation de la valeur au INPUT
	theFunction();
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
//	Blasco
deleteMenuOK = function ( t )
{
	goTo( K_LISTE_MENUS );
}
function blascoMenusDef ()
{
	blascoMenusDef.prototype.saveMenu = function ( f, callback )
	{
		var wForm = $( f );
		if ( wForm )
		{
			var params   = "uid="  + wForm.uid.value;
			params 		+= "&t=" + escape(wForm.t.value);
			params 		+= "&p=" + escape(wForm.p.value);
			params 		+= "&m=" + escape(wForm.m.value);

			var url = k_pathBackofficeThemesTemplates + "menus/scripts/php/oxy-savemenu.php";
			var myAjaxCompletion = new Ajax.Request( url, {method: 'post', parameters: params, onSuccess:callback } );
		}
	};
	blascoMenusDef.prototype.editMenu = function ( uid, from )
	{
		var thisLink = k_pathBackofficeThemesTemplates + "menus/creer-menu.php";
		var params = "uid=" + uid + "&from=" + from;
		new Ajax.Updater('mainOuter', thisLink, {method:'get', asynchronous:true, parameters: params, onComplete:resizePage, evalScripts:true });
	};
	blascoMenusDef.prototype.deleteMenu = function ( t, p, uid )
	{
		theMessage += '<table id="htmlAdjustTable" cellspacing="0" cellpadding="0" border="0">';
		theMessage += '<tr>';
		theMessage += '	<td align="center"><img src="img/icon_048.gif" width="48" height="48"></td>';
		theMessage += '</tr>';
		//--> Start
		theMessage += '<tr>';
		theMessage += '	<td class="padT5 common_fontColor_8" align="center">' + liste_pages_admin_9_text[lg] + '</td>';
		theMessage += '</tr>';
		//--> End
		theMessage += '<tr>';
		theMessage += '	<td><img src="img/pixel.gif" width="230" height="1"></td>';//	minimum width = 230px
		theMessage += '</tr>';
		theMessage += '<tr>';
		theMessage += '	<td align="center" class="padT10">';
		theMessage += '		<table border="0" cellpadding="0" cellspacing="0">';
		theMessage += '			<tr>';
		theMessage += '				<td>';
		theMessage += '					<table border="0" cellpadding="0" cellspacing="0" class="hand" onclick="hideHtml();">';
		theMessage += '						<tr>';
		theMessage += '							<td><img src="img/button21_01.png" width="10" height="26"></td>';
		theMessage += '							<td class="padB3 font5 font91 fontFFFFFF" align="center" style="background-image:url(img/button21_02.png); background-repeat:repeat-x;">' + common_043_text[lg] + '</td>';
		theMessage += '							<td><img src="img/button21_03.png" width="12" height="26"></td>';
		theMessage += '						</tr>';
		theMessage += '					</table>';
		theMessage += '				</td>';
		theMessage += '				<td><img src="img/pixel.gif" width="10" height="1"></td>';
		theMessage += '				<td>';
		theMessage += '					<table border="0" cellpadding="0" cellspacing="0" class="hand" onclick="hideHtmlKeepBg();blascoMenus.deleteMenuConfirmed(\'' + t + '\',\'' + p + '\',\'' + uid + '\');">';
		theMessage += '						<tr>';
		theMessage += '							<td><img src="img/button20_01.png" width="10" height="26"></td>';
		theMessage += '							<td class="padB3 font5 font91 fontFFFFFF" align="center" style="background-image:url(img/button20_02.png); background-repeat:repeat-x;">' + common_115_text[lg] + '</td>';
		theMessage += '							<td><img src="img/button20_03.png" width="12" height="26"></td>';
		theMessage += '						</tr>';
		theMessage += '					</table>';
		theMessage += '				</td>';
		theMessage += '			</tr>';
		theMessage += '		</table>';
		theMessage += '	</td>';
		theMessage += '</tr>';
		theMessage += '</table>';
		
		//--> Message
		showHtml( theMessage );
	};
	blascoMenusDef.prototype.deleteMenuConfirmed = function ( t, p, uid )
	{
		var thisLink = k_pathBackofficeThemesTemplates + "menus/scripts/php/oxy-deletemenu.php";

		//	les champs obligatoires sont renseignes, sauvegarder ce membre
		var params	 = "uid=" + uid;

		new Ajax.Request( thisLink, {method: 'get', parameters: params, asynchronous:true, onSuccess:deleteMenuOK });
	};
}
var blascoMenus = new blascoMenusDef();

deleteMenuOK = function ()
{
	goTo( K_LISTE_MENUS );
}

function blascoChambresDef ()
{
	blascoChambresDef.prototype.saveBedroomOK = function ( t )
	{
		goTo( K_LISTE_CHAMBRES );
	};
	blascoChambresDef.prototype.saveBedroom = function ( f, callback )
	{
		var wForm = $( f );
		if ( wForm )
		{
			var params   = "uid="  + wForm.uid.value;
			params 		+= "&t=" + escape(wForm.t.value);
			params 		+= "&p=" + escape(wForm.p.value);
			params 		+= "&m=" + escape(wForm.m.value);

			var url = k_pathBackofficeThemesTemplates + "chambres/scripts/php/oxy-savebedroom.php";
			var myAjaxCompletion = new Ajax.Request( url, {method: 'post', parameters: params, onSuccess:callback } );
		}
	};
	blascoChambresDef.prototype.editBedroom = function ( uid, from )
	{
		var thisLink = k_pathBackofficeThemesTemplates + "chambres/creer-chambre.php";
		var params = "uid=" + uid + "&from=" + from;
		new Ajax.Updater('mainOuter', thisLink, {method:'get', asynchronous:true, parameters: params, onComplete:resizePage, evalScripts:true });
	};
	blascoChambresDef.prototype.deleteBedroom = function ( t, p, uid )
	{
		theMessage += '<table id="htmlAdjustTable" cellspacing="0" cellpadding="0" border="0">';
		theMessage += '<tr>';
		theMessage += '	<td align="center"><img src="img/icon_048.gif" width="48" height="48"></td>';
		theMessage += '</tr>';
		//--> Start
		theMessage += '<tr>';
		theMessage += '	<td class="padT5 common_fontColor_8" align="center">' + liste_pages_admin_9_text[lg] + '</td>';
		theMessage += '</tr>';
		//--> End
		theMessage += '<tr>';
		theMessage += '	<td><img src="img/pixel.gif" width="230" height="1"></td>';//	minimum width = 230px
		theMessage += '</tr>';
		theMessage += '<tr>';
		theMessage += '	<td align="center" class="padT10">';
		theMessage += '		<table border="0" cellpadding="0" cellspacing="0">';
		theMessage += '			<tr>';
		theMessage += '				<td>';
		theMessage += '					<table border="0" cellpadding="0" cellspacing="0" class="hand" onclick="hideHtml();">';
		theMessage += '						<tr>';
		theMessage += '							<td><img src="img/button21_01.png" width="10" height="26"></td>';
		theMessage += '							<td class="padB3 font5 font91 fontFFFFFF" align="center" style="background-image:url(img/button21_02.png); background-repeat:repeat-x;">' + common_043_text[lg] + '</td>';
		theMessage += '							<td><img src="img/button21_03.png" width="12" height="26"></td>';
		theMessage += '						</tr>';
		theMessage += '					</table>';
		theMessage += '				</td>';
		theMessage += '				<td><img src="img/pixel.gif" width="10" height="1"></td>';
		theMessage += '				<td>';
		theMessage += '					<table border="0" cellpadding="0" cellspacing="0" class="hand" onclick="hideHtmlKeepBg();blascoChambres.deleteBedroomConfirmed(\'' + t + '\',\'' + p + '\',\'' + uid + '\');">';
		theMessage += '						<tr>';
		theMessage += '							<td><img src="img/button20_01.png" width="10" height="26"></td>';
		theMessage += '							<td class="padB3 font5 font91 fontFFFFFF" align="center" style="background-image:url(img/button20_02.png); background-repeat:repeat-x;">' + common_115_text[lg] + '</td>';
		theMessage += '							<td><img src="img/button20_03.png" width="12" height="26"></td>';
		theMessage += '						</tr>';
		theMessage += '					</table>';
		theMessage += '				</td>';
		theMessage += '			</tr>';
		theMessage += '		</table>';
		theMessage += '	</td>';
		theMessage += '</tr>';
		theMessage += '</table>';
		
		//--> Message
		showHtml( theMessage );
	};
	blascoChambresDef.prototype.deleteBedroomConfirmed = function ( t, p, uid )
	{
		var thisLink = k_pathBackofficeThemesTemplates + "chambres/scripts/php/oxy-deletebedroom.php";

		var params	 = "uid=" + uid;

		new Ajax.Request( thisLink, {method: 'get', parameters: params, asynchronous:true, onSuccess:deleteBedroomOK });
	};
}
var blascoChambres = new blascoChambresDef();

deleteBedroomOK = function ()
{
	goTo( K_LISTE_CHAMBRES );
}

/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
//	Fonction d'ouverture de la fenÃªtre virtuelle - virtualWindow
var virtualWindowBgTransparent = false;
function openVirtualWindow()
{
	maskAdminFlash();
	$('virtualWindowBg').style.display = "block";
	if ( browserIE )
	{
		$('virtualWindowBg').style.filter = "alpha(opacity=80)";
	}
	else
	{
		$('virtualWindowBg').style.background = "FFFFFF";
	}
	$('virtualWindow').style.display = "block";
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
//	Fonction de centrage de la fenÃªtre virtuelle - virtualWindow
function positionVirtualWindow()
{
	//alert('positionVirtualWindow');
	getPageWidth();
	getWindowHeight();
	
	if ( $("myFCKeditor") )
	{
		$("myFCKeditor").style.height = ( windowHeight / 3 ) + "px";
	}
	
	var thisContainer = $('virtualWindow');
	
	var thisWidth = thisContainer.offsetWidth;
	var thisHeight = thisContainer.offsetHeight;
	
	if ( thisHeight < ( windowHeight - 40 ) )
	{
		thisContainer.style.top = ( windowHeight / 2 ) - ( thisHeight / 2 ) + "px";
	}
	else
	{
		thisContainer.style.top = "20px";
	}
	
	thisContainer.style.left = ( pageWidth / 2 ) - ( thisWidth / 2 ) + "px";
	
	writeTexts_A(lg,"virtualWindow");							//	Ecrit les textes dans la langue choisie
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
//	Fonction de fermeture de la fenÃªtre virtuelle - virtualWindow
function closeVirtualWindow()
{
	$('virtualWindowBg').style.display = "none";
	virtualWindowBgTransparent = false;
	$('virtualWindow').style.display = "none";
	$('virtualWindowContent').innerHTML = "";
	unmaskAdminFlash();
}



/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
//	Fonction d'insertion des boutons dans le calque - virtualWindow
function writeButtons()
{
	var theWindowButtons = "";
	theWindowButtons += '<table align="center" border="0" cellpadding="0" cellspacing="0">';
	theWindowButtons += '	<tr>';
	theWindowButtons += '		<td>';
	theWindowButtons += '			<table border="0" cellpadding="0" cellspacing="0">';
	theWindowButtons += '				<tr>';
	theWindowButtons += '					<td>';
	theWindowButtons += '						<table border="0" cellpadding="0" cellspacing="0" class="hand" onclick="closeVirtualWindow();">';
	theWindowButtons += '							<tr>';
	theWindowButtons += '								<td><img src="img/button21_01.png" width="10" height="26"></td>';
	theWindowButtons += '								<td class="padL10 padR10 padB3 font5 font91 fontFFFFFF" align="center" style="background-image:url(img/button21_02.png); background-repeat:repeat-x;">' + common_007_text[lg] + '</td>';	// text	--> FERMER
	theWindowButtons += '								<td><img src="img/button21_03.png" width="12" height="26"></td>';
	theWindowButtons += '							</tr>';
	theWindowButtons += '						</table>';
	theWindowButtons += '					</td>';
	theWindowButtons += '					<td><img src="img/pixel.gif" width="10" height="1"></td>';
	theWindowButtons += '					<td>';
	theWindowButtons += '						<table border="0" cellpadding="0" cellspacing="0" class="hand" onclick="writeParamsCallBack();">';
	theWindowButtons += '							<tr>';
	theWindowButtons += '								<td><img src="img/button19_01.png" width="10" height="26"></td>';
	theWindowButtons += '								<td class="padL10 padR10 padB3 font5 font91 fontFFFFFF" align="center" style="background-image:url(img/button19_02.png); background-repeat:repeat-x;">' + common_006_text[lg] + '</td>';	// text	--> ENREGISTRER
	theWindowButtons += '								<td><img src="img/button19_03.png" width="12" height="26"></td>';
	theWindowButtons += '							</tr>';
	theWindowButtons += '						</table>';
	theWindowButtons += '					</td>';
	theWindowButtons += '				</tr>';
	theWindowButtons += '				<tr>';
	theWindowButtons += '					<td colspan="3" class="padT5">';
	theWindowButtons += '						<table border="0" cellpadding="0" cellspacing="0" class="w100 hand" onclick="writeParamsCallBack();closeVirtualWindow();">';
	theWindowButtons += '							<tr>';
	theWindowButtons += '								<td width="10"><img src="img/button19_01.png" width="10" height="26"></td>';
	theWindowButtons += '								<td class="padL10 padR10 padB3 font5 font91 fontFFFFFF" align="center" style="background-image:url(img/button19_02.png); background-repeat:repeat-x;">' + common_108_text[lg] + '</td>';
	theWindowButtons += '								<td width="10"><img src="img/button19_03.png" width="12" height="26"></td>';
	theWindowButtons += '							</tr>';
	theWindowButtons += '						</table>';
	theWindowButtons += '					</td>';
	theWindowButtons += '				</tr>';
	theWindowButtons += '			</table>';
	theWindowButtons += '		</td>';
	theWindowButtons += '	</tr>';
	theWindowButtons += '</table>';
	
	openVirtualWindow();
	
	$('virtualWindowButtons').innerHTML = theWindowButtons;
	
	positionVirtualWindow();
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
//	Fonction de bascule ON / OFF
function switchButton( theUid, enabledButton, disabledButton, theFunction )
{
	if( $( theUid + "_" + enabledButton ) ) { $( theUid + "_" + enabledButton ).src = "img/" + enabledButton + "_enabled.png"; }
	if( $( theUid + "_" + disabledButton ) ) { $( theUid + "_" + disabledButton ).src = "img/" + disabledButton + "_disabled.png"; }
	
	theFunction( theUid );
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
//	Fonction de sÃ©lection de la pÃ©riode des rÃ©servations - input RADIO
function selectReservationDateOld( thePref, theSelected, totalCell, theFunction )
{
	//	Suppression du style des autres cellules
	for ( var i = 1; i <= totalCell; i++ )
	{
		var theCell = $( thePref + "_" + i + "_cell" );
		if ( theCell )
		{
			//	Changement de l'image
			$(thePref + "_" + i).src = "img/pic_182_disabled.png";
			//	Affectation du style Ã  la cellule concernÃ©e
			theCell.className = "hand padT5 common_fontColor_12";
		}
	}
	$( thePref + "_" + theSelected ).src = "img/pic_182.png";
	$( thePref + "_" + theSelected + "_cell" ).className = "hand padT5 common_fontColor_5";
	
	theFunction();
}


/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
//	Fonction de sÃ©lection de la pÃ©riode des rÃ©servations - input RADIO
function selectReservationDate2( thePref, theSelected, totalCell, theValue, theFunction )
{
	//	Suppression du style des autres cellules
	for ( var i = 1; i <= totalCell; i++ )
	{
		var theCell = $( thePref + "_" + i + "_cell" );
		if ( theCell )
		{
			//	Changement de l'image
			$(thePref + "_" + i).src = "img/pic_151.png";
			//	Affectation du style Ã  la cellule concernÃ©e
			theCell.className = "table_style_1 hand common_fontColor_12";
		}
	}
	$( thePref + "_" + theSelected ).src = "img/pic_151_selected.png";
	$( thePref + "_" + theSelected + "_cell" ).className = "table_style_1_selected hand common_fontColor_5";
	
	//	Affectation de la valeur au champs hidden ( mode ) du datepicker
	if ( theValue != "" )
	{
		$( "datepicker_1_mode" ).value = theValue;
	}
	else
	{
		$( "datepicker_1_mode" ).value = "day";
	}
	
	//theFunction();
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////		AFFICHAGE DES RÃ‰SERVATIONS PAR DATE		//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//	selectReservationDate( ID du conteneur, cellule sÃ©lectionnÃ©e, nombre total de cellules, valeur sÃ©lectionnÃ©e, fonction, ID du conteneur de la date littÃ©rale, ID du conteneur de la date ( hidden ), ID du conteneur du mode du datepicker )
//
//	Les paramÃ¨tres de la fonction :
//										ParamÃ¨tre " valeur sÃ©lectionnÃ©e "		==>		" day " , " week " , "month " ou " year " ( chaÃ®ne )
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//	Fonction de sÃ©lection de la pÃ©riode des rÃ©servations - input RADIO
function setCalendarMode( thePref, theSelected, totalCell )
{
	//	Suppression du style des autres cellules
	for ( var i = 1; i <= totalCell; i++ )
	{
		var theCell = $( thePref + "_" + i + "_cell" );
		if ( theCell )
		{
			//	Changement de l'image
			$(thePref + "_" + i).src = "img/pic_151.png";
			//	Affectation du style Ã  la cellule concernÃ©e
			theCell.className = "table_style_1 hand";
		}
	}
	$( thePref + "_" + theSelected ).src = "img/pic_151_selected.png";
	$( thePref + "_" + theSelected + "_cell" ).className = "table_style_1_selected hand";
}

displayDateCallBack = function()
{
}

function selectReservationDate( thePref, theSelected, totalCell, datepickerMode, theFunction, thisDatepickerDisplay, thisDatepickerHidden, thisDatepickerMode )
{
	setCalendarMode( thePref, theSelected, totalCell );
	
	//	Affectation de la valeur au champs hidden ( mode ) du datepicker
	if ( datepickerMode != "" )
	{
		$( thisDatepickerMode ).value = datepickerMode;
	}
	else
	{
		$( thisDatepickerMode ).value = "day";
	}
		
	//	Ouverture du datepicker
	openDatepicker('datepicker_1', 'datepicker_1_display', 'datepicker_1_hidden', 'datepicker_1_mode', '', '', '', false, false);
	
	//theFunction();
	selectReservationDateFct();
}

/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
//	Fonction d'ouverture de la fenÃªtre virtuelle - editingOuter
var editingOuterBgTransparent = false;
function openeditingOuter()
{
	maskObjects();
	$('editingOuterBg').style.display = "block";
	if ( browserIE )
	{
		$('editingOuterBg').style.filter = "alpha(opacity=80)";
	}
	else
	{
		$('editingOuterBg').style.background = "FFFFFF";
	}
	positioneditingOuter();
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
//	Fonction de centrage de la fenÃªtre virtuelle - editingOuter
function positioneditingOuter()
{
	getPageWidth();
	getWindowHeight();
	
	thisContainer = $('editingOuter');
	
	thisWidth = thisContainer.offsetWidth;
	thisHeight = thisContainer.offsetHeight;
	
	thisContainer.style.left = ( pageWidth / 2 ) - ( thisWidth / 2 ) + "px";
	thisContainer.style.top = ( windowHeight / 2 ) - ( thisHeight / 2 ) + "px";
}
/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
//	Fonction de fermeture de la fenÃªtre virtuelle - editingOuter
function closeeditingOuter()
{
	$('editingOuterBg').style.display = "none";
	editingOuterBgTransparent = false;
	$('editingOuter').style.top = -1000 + "px";
	$('editingOuter').style.left = -1000 + "px";
	unmaskObjects();
}
/*--------------------------------------------------------------------------\
|	Gestion des objets fenÃªtrÃ©s												|
\--------------------------------------------------------------------------*/
function maskObjects()
{
	var allObjects = new Array();
	var allObjects = document.getElementsByTagName('object');
	if ( document.getElementsByTagName('object').length > 0 )
	{
		for ( var i = 0; i < allObjects.length; i++ )
		{
			allObjects[i].style.visibility = "hidden";
		}
	}
}

function unmaskObjects()
{
	var allObjects = new Array();
	var allObjects = document.getElementsByTagName('object');
	if ( document.getElementsByTagName('object').length > 0 )
	{
		for ( var i = 0; i < allObjects.length; i++ )
		{
			allObjects[i].style.visibility = "visible";
		}
	}
}

function closeFullscreen()
{
	$('fullscreenOuterContainer').src = "";
	$('fullscreenOuter').style.display = 'none';
	$('fullscreenOuterBg').style.display = 'none';
	
	//	EffaÃ§age des boutons contextuels
	$('fullscreenBttomHTMLContainer').style.display = 'none';
	$('fullscreenBttomHTML').innerHTML = "";
	
	//	DÃ©masquage des objets Flash
	unmaskAdminFlash();
	
	//	DÃ©masquage du div bottomHTML
	$('bottomHtmlContainer').style.display = "block";
}

function closeImageBrowser()
{
	$('fullscreenOuterContainer').src = "";
	$('fullscreenOuter').style.display = 'none';
	$('fullscreenOuterBg').style.display = 'none';
	
	//	EffaÃ§age des boutons contextuels
	$('ImageBrowserBttomHTML').innerHTML = "";
	$('ImageBrowserBttomHTMLContainer').style.display = "none";
	
	//	DÃ©masquage des objets Flash
	unmaskAdminFlash();
	
	//	DÃ©masquage des boutons
	$('level_1_hiding').style.display = 'block';
	$('level_2_hiding').style.display = 'block';
}

/*--------------------------------------------------------------------------\
|	Gestion des objets fenÃªtrÃ©s												|
\--------------------------------------------------------------------------*/
function maskAdminFlash()
{
	if ( !browserIE && $("menu") ) { $("menu").style.visibility = "hidden"; }
}

function unmaskAdminFlash()
{
	if ( !browserIE && $("menu") ) { $("menu").style.visibility = "visible"; }
}


/*--------------------------------------------------------------------------\
|	Affichage du logo OXYGENBAY	en bas de page								|
\--------------------------------------------------------------------------*/

function displayLogo()
{
	$("bottomHTML").innerHTML = '<img src="img/pic_221.png" width="150" height="34" />';
	$("bottomHtmlContainer").style.bottom = "-20px";
	$("bottomHtmlContainer").style.display = "block";
}

/*--------------------------------------------------------------------------\
|	Insertion HTML dans le bottom en fullscreen								|
\--------------------------------------------------------------------------*/
var FSbottomHTMLObject =
{
	buttonBarId : 'fullscreenBttomHTML',
	loadBar:function( obj )
	{
		var wTable = document.getElementById(this.buttonBarId);
		if (wTable) 
		{
			$('bottomHtmlContainer').style.display = "none";				//	Masquage du div bottomHTML
			$('fullscreenBttomHTMLContainer').style.display = "block";		//	Masquage du div bottomHTML
			
			var theButton = null;
			for (var i = 0; i < obj.buttons.length; i++) 
			{
				var newDiv				= document.createElement("div");
				//newDiv.onclick		= obj.buttons[i].fct;
				newDiv.innerHTML	= obj.buttons[i].html;
				newDiv.className	= obj.buttons[i].classe;
				newDiv.id			= obj.buttons[i].idButton;
				
				wTable.appendChild(newDiv);
				//newDiv.attachEvent("onclick", obj.buttons[i].fct);
			}
		}
	},
	unloadBar:function()
	{
		var wTable = document.getElementById(this.buttonBarId);
		if ( wTable )
		{
			wTable.innerHTML = "";
			$('fullscreenBttomHTMLContainer').style.display = "none";		//	Masquage du div bottomHTML
			$('bottomHtmlContainer').style.display = "block";				//	DÃ©masquage du div bottomHTML
		}
	}
};

function openCloseShopDir( thisDiv )
{
	var thisObject = $(thisDiv);

	if ( thisObject.style.display == "none" || thisObject.style.display == "" )
	{
		thisObject.style.display = "block";
		resizeOverflow( thisDiv );
	}
	else
	{
		thisObject.style.display = "none";
	}
}

function resizeOverflow( theContainer )
{
	var allDivs = $( theContainer ).getElementsByTagName("div");
	
	//var attrib;
	var theCellSize;
	
	for ( var i = 0; i < allDivs.length; i++ )
	{
		//attrib = allDivs[i].getAttribute("oxysize");
		//	Supprime un nombre de pixels en largeur
		//theCellSize = $( thisColumn ).clientWidth - attrib + "px";
		
		if ( allDivs[i].getAttribute("oxysize") )
		{
			//	On se sert de la propriÃ©tÃ© << oxysize >> du calque qui contient sa taille
			//alert(		allDivs[i].parentNode.clientWidth		);
			//alert(		( allDivs[i].parentNode.clientWidth ) - ( allDivs[i].getAttribute("oxysize") )		);
			theCellSize = ( allDivs[i].parentNode.clientWidth ) - ( allDivs[i].getAttribute("oxysize") )
			if ( theCellSize >= 0 )
			{
				allDivs[i].style.width = theCellSize + "px";
			}
		}
	}
}





if ( typeof oXbUtils == "undefined" || !oXbUtils ) 
{
	var oXbUtils =
	{
		fullscreen : {
			closeFullscreen : function()
			{
				$('fullscreenOuterContainer').src = "";
				$('fullscreenOuter').style.display = 'none';
				$('fullscreenOuterBg').style.display = 'none';
				
				//	EffaÃ§age des boutons contextuels
				$('fullscreenBttomHTMLContainer').style.display = 'none';
				$('fullscreenBttomHTML').innerHTML = "";
				
				//	DÃ©masquage des objets Flash
				unmaskAdminFlash();
				
				//	DÃ©masquage du div bottomHTML
				$('bottomHtmlContainer').style.display = "block";
			}
		},		
		maskObjects : function()
		{
			var allObjects = new Array();
			var allObjects = document.getElementsByTagName('object');
			if ( document.getElementsByTagName('object').length > 0 )
			{
				for ( var i = 0; i < allObjects.length; i++ )
				{
					allObjects[i].style.visibility = "hidden";
				}
			}
		},		
		unmaskObjects : function ()
		{
			var allObjects = new Array();
			var allObjects = document.getElementsByTagName('object');
			if ( document.getElementsByTagName('object').length > 0 )
			{
				for ( var i = 0; i < allObjects.length; i++ )
				{
					allObjects[i].style.visibility = "visible";
				}
			}
		},
		resizeOverflow : function( theContainer )
		{
			//	Recherche des Ã©lÃ©ments DIV qui sont des titres " _title " ou des boutons "_visibility"
			allDivs = $(theContainer).getElementsByTagName('div');

			var theCellSize;
			
			for ( var i = 0; i < allDivs.length; i++ )
			{
				//attrib = allDivs[i].getAttribute("oxysize");
				//	Supprime un nombre de pixels en largeur
				//theCellSize = $( thisColumn ).clientWidth - attrib + "px";
				
				if ( allDivs[i].getAttribute("oxysize") )
				{
					//	On se sert de la propriÃ©tÃ© << oxysize >> du calque qui contient sa taille
					//alert(		allDivs[i].parentNode.clientWidth		);
					//alert(		( allDivs[i].parentNode.clientWidth ) - ( allDivs[i].getAttribute("oxysize") )		);
					theCellSize = ( allDivs[i].parentNode.clientWidth ) - ( allDivs[i].getAttribute("oxysize") )
					if ( theCellSize >= 0 )
					{
						allDivs[i].style.width = theCellSize + "px";
					}
				}
			}
		},
		isElement:function( elem )
		{
			var testElem = document.getElementById( elem );
			return( testElem );
		}
	}
}

/*--------------------------------------------------------------------------\
|	Insertion HTML dans le bottom	 - PropriÃ©tÃ©s de blocks					|
\--------------------------------------------------------------------------*/
var blockPropertiesHTMLObject =
{
	buttonBarId : 'blockPropertiesButtonsHTML',
	buttonBarId2 : 'blockPropertiesContentHTML',
	loadBar:function( obj )
	{
		$('blockPropertiesHtmlContainer').style.display = "block";
		
		var wTable = document.getElementById(this.buttonBarId);
		var wTable2 = document.getElementById(this.buttonBarId2);
		if (wTable && wTable2) 
		{
			var theButton = null;
			var theButton2 = null;
			for (var i = 0; i < obj.propertiesContent.length; i++) 
			{
				var newDiv			= document.createElement("div");
				newDiv.innerHTML	= obj.propertiesContent[i].buttons;
				newDiv.className	= obj.propertiesContent[i].classeButton;
				newDiv.id			= obj.propertiesContent[i].idButton;
				
				var newDiv2			= document.createElement("div");
				newDiv2.innerHTML	= obj.propertiesContent[i].Html;
				newDiv2.className	= obj.propertiesContent[i].classeHtml;
				newDiv2.id			= obj.propertiesContent[i].idHtml;
				
				wTable.appendChild(newDiv);
				wTable2.appendChild(newDiv2);
			}
		}
	},
	unloadBar:function()
	{
		var wTable = document.getElementById(this.buttonBarId);
		var wTable2 = document.getElementById(this.buttonBarId2);
		if ( wTable )
		{
			$("blockPropertiesHtmlContainer").style.bottom = "0px";
			wTable.innerHTML = "";
			wTable2.innerHTML = "";
			
			$('blockPropertiesHtmlContainer').style.display = "none";
		}
	}
};

/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function editBlockParameters()
{
	var theWindowButtons = "";
	theWindowButtons += '<table align="center" border="0" cellpadding="0" cellspacing="0">';
	theWindowButtons += '	<tr>';
	theWindowButtons += '		<td>';
	theWindowButtons += '			<table border="0" cellpadding="0" cellspacing="0">';
	theWindowButtons += '				<tr>';
	theWindowButtons += '					<td>';
	theWindowButtons += '						<table border="0" cellpadding="0" cellspacing="0" class="hand" onclick="closeBlockParametersBar();">';
	theWindowButtons += '							<tr>';
	theWindowButtons += '								<td><img src="img/button21_01.png" width="10" height="26"></td>';
	theWindowButtons += '								<td nowrap class="padL10 padR10 padB3 font5 font91 fontFFFFFF" align="center" style="background-image:url(img/button21_02.png); background-repeat:repeat-x;">' + common_007_text[lg] + '</td>';	// text	--> FERMER
	theWindowButtons += '								<td><img src="img/button21_03.png" width="12" height="26"></td>';
	theWindowButtons += '							</tr>';
	theWindowButtons += '						</table>';
	theWindowButtons += '					</td>';
	theWindowButtons += '					<td><img src="img/pixel.gif" width="10" height="1"></td>';
	theWindowButtons += '					<td>';
	theWindowButtons += '						<table border="0" cellpadding="0" cellspacing="0" class="hand" onclick="writeParamsCallBack();">';
	theWindowButtons += '							<tr>';
	theWindowButtons += '								<td><img src="img/button19_01.png" width="10" height="26"></td>';
	theWindowButtons += '								<td nowrap class="padL10 padR10 padB3 font5 font91 fontFFFFFF" align="center" style="background-image:url(img/button19_02.png); background-repeat:repeat-x;">' + common_006_text[lg] + '</td>';	// text	--> ENREGISTRER
	theWindowButtons += '								<td><img src="img/button19_03.png" width="12" height="26"></td>';
	theWindowButtons += '							</tr>';
	theWindowButtons += '						</table>';
	theWindowButtons += '					</td>';
	theWindowButtons += '					<td><img src="img/pixel.gif" width="10" height="1"></td>';
	theWindowButtons += '					<td>';
	theWindowButtons += '						<table border="0" cellpadding="0" cellspacing="0" class="w100 hand" onclick="writeParamsCallBack();closeBlockParametersBar();">';
	theWindowButtons += '							<tr>';
	theWindowButtons += '								<td width="10"><img src="img/button19_01.png" width="10" height="26"></td>';
	theWindowButtons += '								<td nowrap class="padL10 padR10 padB3 font5 font91 fontFFFFFF" align="center" style="background-image:url(img/button19_02.png); background-repeat:repeat-x;">' + common_108_text[lg] + '</td>';
	theWindowButtons += '								<td width="10"><img src="img/button19_03.png" width="12" height="26"></td>';
	theWindowButtons += '							</tr>';
	theWindowButtons += '						</table>';
	theWindowButtons += '					</td>';
	theWindowButtons += '				</tr>';
	theWindowButtons += '			</table>';
	theWindowButtons += '		</td>';
	theWindowButtons += '	</tr>';
	theWindowButtons += '</table>';
	
	openBlockParametersBar();
	
	$('blockPropertiesButtonsHTML').innerHTML = theWindowButtons;
}

/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
function openBlockParametersBar()
{
	maskAdminFlash();
	$('blockPropertiesHtmlBg').style.display = "block";
	if ( browserIE )
	{
		$('blockPropertiesHtmlBg').style.filter = "alpha(opacity=80)";
	}
	else
	{
		$('blockPropertiesHtmlBg').style.background = "FFFFFF";
	}
	$('blockPropertiesHtmlContainer').style.display = "block";
}

/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
//	Fonction de fermeture de la fenÃªtre virtuelle - virtualWindow
function closeBlockParametersBar()
{
	$('blockPropertiesHtmlBg').style.display = "none";
	$('blockPropertiesHtmlContainer').style.display = "none";
	$('blockPropertiesContentHTML').innerHTML = "";
	unmaskAdminFlash();
}

/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
//	Fonctions de contrÃ´le des valeurs de champs de textes
var displayMessageTimer = "";
var lastChangedField = "";
checkValue = function( thisField, thisMinValue, thisMaxValue )
{
	if ( lastChangedField != "" && $( lastChangedField ) ) { deleteMessage( lastChangedField ); }	// Supprime le dernier message si il existe
	lastChangedField = thisField;		// Affecte l'ID du dernier message affichÃ© Ã  la variable
	
	if ( $( thisField ).value < thisMinValue )
	{
		displayMessage( thisField, thisMinValue, thisMaxValue );
		$( thisField ).value = thisMinValue;
	}
	if ( $( thisField ).value > thisMaxValue )
	{
		displayMessage( thisField, thisMinValue, thisMaxValue );
		$( thisField ).value = thisMaxValue;
	}
}
displayMessage = function( thisField, thisMinValue, thisMaxValue )
{
	$( thisField + "MinValueContainer").innerHTML = thisMinValue;
	$( thisField + "MaxValueContainer").innerHTML = thisMaxValue;
	$( thisField + "Message" ).style.display = "block";
	
	var thisFunction = function() { deleteMessage( thisField ); }
	displayMessageTimer = setTimeout( thisFunction, 3000 );
}
deleteMessage = function( thisField )
{
	clearTimeout(displayMessageTimer);
	if ( $( thisField + "Message" ) ) { $( thisField + "Message" ).style.display = "none"; }
}

/*--------------------------------------------------------------------------------------------------------------------------\
|																															|
\--------------------------------------------------------------------------------------------------------------------------*/
prefGetComplete = function ( t )
{
	alert( t.responseText );
}
function oxyPreferences()
{
	this.getComplete = function ( t )
	{
		alert( t.responseText );
	};
	this.get = function( key )
	{
		new Ajax.Request( k_path_root + 'library/js/oxygenn/oxyPrefRead.php', {method: 'get', parameters: 'key=' + key, onComplete:oxyPref.getComplete });
	};
	this.set = function( key, value )
	{
		new Ajax.Request( k_path_root + 'library/js/oxygenn/oxyPrefSave.php', {method: 'get', parameters: 'key=' + key + '&value=' + value });
	}
}
var oxyPref = new oxyPreferences();


inscriptionMailingListComplete = function ( t )
{
	//alert( t.responseText );
	alert( "Inscription à la lettre de diffusion réussie" );
}
function oxbMailing()
{
	this.inscription = function( fcontact )
	{
		//alert('inscription contact : ' + contact );
		//alert( 'inscription à la lettre de diffusion' );
		var contact = $(fcontact).value;
		//alert( contact );
		
		//alert( oxB.rootPath + 'library/oxygenbay/php/oxy-optin.php' );
		new Ajax.Request( oxB.rootPath + 'library/oxygenbay/php/oxy-optin.php', {method: 'get', parameters: 'contact=' + contact, onComplete:inscriptionMailingListComplete });
	};
	this.desinscription = function( contact )
	{
		alert('desinscription contact : ' + contact );
	};
}

function oxbContact()
{
	this.envoyer = function( contact )
	{
		//alert('envoyer formulaire contact : ' + contact );
		
		if ( $(contact) )
		{
			//alert( $(contact).serialize() );
			alert('envoi du contact');
		}
	};
	this.validerChamp = function( formulaire, champ, original )
	{
		var wForm = $(formulaire);
		if ( wForm )
		{
			var value = $(formulaire)[champ].value;
			if ( value == original )
			{
				$(formulaire)[champ].value = '';
			}
			else
			{
				if ( value == '' ) $(formulaire)[champ].value = original;
			}
		} 
	};
}

if (typeof oxB == "undefined" || !oxB ) 
{
	var oxB = 
	{
		host: '',
		rootPath: '',
		libraryPath: '',
		imagesPath: '',
		init: function(obj)
		{
			this.setHost(obj.host);
			this.setRootPath(obj.rootPath);
			this.setImagesPath(obj.rootPath);
		},
		setHost: function(host)
		{
			this.host = host;
		},
		setRootPath: function(rootPath)
		{
			this.rootPath = rootPath;
			this.libraryPath = this.rootPath + 'library/';
			this.ajaxloader.init();
			this.page.init();
		},
		setImagesPath: function(rootPath)
		{
			this.imagesPath = this.rootPath + 'images/';
		},
		ajaxloader:
		{
			init: function()
			{
			},
			get: function(obj)
			{
				if (obj.divid) 
				{
					if (obj.divid != "") 
					{
						new Ajax.Updater(obj.divid, obj.source, 
						{
							method: 'get',
							asynchronous: true,
							parameters: obj.params,
							onComplete: obj.callBack,
							evalScripts: true
						});
					}
					else 
					{
						new Ajax.Request(obj.source, 
						{
							method: 'get',
							asynchronous: true,
							parameters: obj.params,
							onComplete: obj.callBack,
							evalScripts: true
						});
					}
				}
				else 
				{
					new Ajax.Request(obj.source, 
					{
						method: 'get',
						asynchronous: true,
						parameters: obj.params,
						onComplete: obj.callBack,
						evalScripts: true
					});
				}
			},
			post: function(obj)
			{
				if (obj.divid != "") 
				{
					new Ajax.Updater(obj.divid, obj.source, 
					{
						method: 'post',
						asynchronous: true,
						parameters: obj.params,
						onComplete: obj.callBack,
						evalScripts: true
					});
				}
				else 
				{
					new Ajax.Request(obj.source, 
					{
						method: 'post',
						asynchronous: true,
						parameters: obj.params,
						onComplete: obj.callBack,
						evalScripts: true
					});
				}
			}
		},
		page:
		{
			libraryPhpPath : '',
			templatePath:'',
			templateid:0,
			lg:'fr',
			uid:0,
			bodytype:0,
			init : function ()
			{
				this.libraryPhpPath = oxB.libraryPath + 'oxygenbay/php/pages/';
				this.templatePath = oxB.rootPath + 'templates/' + this.templateid + '/' + this.templateid + '_skin/templates/';
			},
			zone:
			[
				[
					[ 'left_C'	, 'left.php'	],
					[ 'main_C'	, 'home.php'	],
					[ 'right_C'	, 'right.php'	]
				],
				[
					[ 'left_C'	, 'left.php'	],
					[ 'main_C'	, 'home.php'	]
				],
				[
					[ 'main_C'	, 'home.php'	],
					[ 'right_C'	, 'right.php'	]
				],
				[
					[ 'main_C'	, 'home.php'	]
				]
			],
			loadpageOK:function(t)
			{			
			},
			loadpage:function()
			{
				pstruct = this.zone[this.bodytype];
				for ( var i = 0; i < pstruct.length; i++ )
				{
					new Ajax.Updater
					(
						pstruct[i][0], this.templatePath + pstruct[i][1], 
						{
							method: 'get',
							asynchronous: true,
							parameters: 'pid=' +  this.uid + '&lg=' +  this.lg,
							onComplete: oxB.page.loadpageOK,
							evalScripts: true
						}
					);
				}
			}
		},
		text:
		{
			load:function(lg){},
			write:{}
		},
		utils:
		{
			showLoading:function()
			{
				
			},
			openCollapse: function( theDiv )
			{
				//alert('ici');
				if ( theDiv != '' )
				{
					var wDiv = $(theDiv);
					if (wDiv) 
					{
						if (wDiv.style.overflowY == "visible") 
						{
							wDiv.style.overflowY = "hidden";
							wDiv.style.height = "17px";
							wDiv.style.paddingBottom = "0px";
						}
						else 
						{
							wDiv.style.overflowY = "visible";
							wDiv.style.height = "100%";
							wDiv.style.paddingBottom = "3px";
						}
					}
				}
			}
		}
	}
}

function codeTouche(evenement)
{
        for (prop in evenement)
        {
                if(prop == 'which') return(evenement.which);
        }
        return(evenement.keyCode);
}

function isPrice(evenement)
{
	var reCarSpeciaux = /[\x2E]/;
    var reCarValides = /\d/;

    var codeDecimal  = codeTouche(evenement);
    var car = String.fromCharCode(codeDecimal);
    var autorisation = reCarValides.test(car) || reCarSpeciaux.test(car);

    return autorisation;
}

function resizeText( thisText, nblines )
{
	var theLineHeight;
	var needsTruncation = false;
	if (typeof nblines == "undefined" || !nblines ) nblines = 1;
	
	//	Mesure de la taille originale du texte
	var theOriginalHeight = $( thisText + "_text_container" ).offsetHeight;
	//	Stockage du innerHTML dans une var
	var theInnerHTML = $( thisText ).innerHTML;
	//	Vidage du <div> qui contient le texte
	$( thisText ).innerHTML = "";
	//	On insère le nombre de lignes de texte souhaité pour tester la hauteur à tronquer
	var theTestInnerHTML = "0";		// Test avec le chiffre 0 ( zéro )
	for ( var i = 1; i < nblines; i++ )
	{
		theTestInnerHTML += "<br>0";	// Test avec le chiffre 0 ( zéro )
	}
	$( thisText ).innerHTML = theTestInnerHTML;
	//	On mesure la nouvelle hauteur du <div> qui contient le texte
	var theHeight = $( thisText + "_text_container" ).offsetHeight;
	//	On réaffecte le innerHTML original
	$( thisText ).innerHTML = theInnerHTML;
	//	Troncage si nécessaire
	if ( $( thisText + "_text_container" ).offsetHeight > theHeight )
	{
		$( thisText + "_text_container" ).style.overflow = "hidden";
		$( thisText + "_text_container" ).style.height = theHeight + "px";
		
		var thetestLinkTextfield = document.createElement("div");
		thetestLinkTextfield.id = thisText + "_link";
		thetestLinkTextfield.style.paddingTop = "1px";
		thetestLinkTextfield.innerHTML = "<a href='javascript:openText( \"" + thisText + "\" );'>Lire la suite ...</a>";
		$( thisText + "_text_container" ).insert( {after:thetestLinkTextfield} );
	}
}

function openText( thisText )
{
	$( thisText + "_text_container" ).style.overflow = "visible";
	$( thisText + "_text_container" ).style.height = "auto";
	//	Supprime le bouton
	$( thisText + "_link" ).style.display = "none";
}

//ATTENTION ! La function getStyle() semble faire partie de prototype
function getElementStyle( el,styleProp )
{
    //var x = document.getElementById( el );
    var x = el;
    
    if (x.currentStyle)
    {
        var y = x.currentStyle[styleProp];
        
        if (  y == "auto" )
        {
        	y = 0;
        }
    }
    else if (window.getComputedStyle)
    {
       var y =  window.getComputedStyle( x, null ).getPropertyValue(styleProp);
    }
    return y;
}

/*--------------------------------------------------------------------------------------------------------------------------\
|	Retaillage des champs de formulaires																					|
\--------------------------------------------------------------------------------------------------------------------------*/
function resizeFormFields()
{
	var allElements = new Array();
	var allElements = $("bodyInAdmin").getElementsByTagName("*");
	
	for ( var i = 0; i < allElements.length; i++ )
	{
		if ( allElements[i].getAttribute("class") == "autoresizefield" )
		{
			var theMargins = 0;
			var theMargins = parseInt( getElementStyle( allElements[i],"border-left-width" ) ) + parseInt( getElementStyle( allElements[i],"border-right-width" ) ) + parseInt( getElementStyle( allElements[i],"margin-left" ) ) + parseInt( getElementStyle( allElements[i],"margin-right" ) ) + parseInt( getElementStyle( allElements[i],"padding-left" ) ) + parseInt( getElementStyle( allElements[i],"padding-right" ) );
			
			$(allElements[i]).style.width = $(allElements[i]).parentNode.offsetWidth - theMargins + "px";
		}
	}
}

function unResizeFormFields()
{
	var allElements = new Array();
	var allElements = $("bodyInAdmin").getElementsByTagName("*");
	
	for ( var i = 0; i < allElements.length; i++ )
	{
		if ( allElements[i].getAttribute("class") == "autoresizefield" )
		{
			$(allElements[i]).style.width = "90%";
		}
	}
}
