	var blnLoadHome										= [ true, false, false, false];
	var Relaxfil												= {Version: '0.2'};
	var gblnCustomSelect_Categories_Focused	= false;
//========================================================================================
//
//	Nom Fonction			: LoadRelaxFil
//	Entrées					: - aucune
//	Sorties					: - aucune
//
//	Description Fonction	: Effectue toutes les actions au lancement de l'application
//
//	Création				: LAPLANCHE Jérémy - 28/10/2005 11:49
//	Dernière modification	: LAPLANCHE Jérémy - 28/10/2005 11:50
//
//----------------------------------------------------------------------------------------
function LoadRelaxFil()
{
	Clock();
	ResizePreviewWindow();
	ResetSearchForm("Text", "", "");
	ResetSearchForm("Forecast", "", "");
	ResetSearchForm("Event", "", "");
		LoadBasket();
		RegisterDraggableElements ("HomeText");
		RegisterDraggableElements ("HomeForecast");
		RegisterDraggableElements ("HomeEvent");
		RegisterDraggableElements ("HomeDiaporama");
		RegisterDraggableElements ("HomeVideo");
	//LoadHomeProduct("HomeText", Relaxfil.Application["url_ConsultText"] + "HomeText.asp", 0, true);
	//LoadRelaxFilEnd();
	$("Mask").style.display = "none";
	$("Mask").removeChild($("Loading"));
	if ($("SpecialFolders")){
		HighLightSpecialFolders();}

//	initAutoComplete(document.getElementById('frmSearchEvent'), document.getElementById('strSearchEventLocationKeywords'));

	setTimeout("ReloadHomeTextContent()", 300000);
}
//========================================================================================
//
//	Nom Fonction			: LoadRelaxFilEnd
//	Entrées					: - aucune
//	Sorties					: - aucune
//
//	Description Fonction	: Effectue toutes les actions au lancement de l'application
//
//	Création				: LAPLANCHE Jérémy - 28/10/2005 11:49
//	Dernière modification	: LAPLANCHE Jérémy - 28/10/2005 11:50
//
//----------------------------------------------------------------------------------------
function LoadRelaxFilEnd()
{
	if (blnLoadHome[0])
	{
		LoadHomeProduct("PreviewWindow", Relaxfil.Application["url_ConsultText"] + "frmLastText.asp", 3, false);
		LoadHomeProduct("HomeForecast", Relaxfil.Application["url_ConsultForecast"] + "HomeForecast.asp", 1, true);
		LoadHomeProduct("HomeEvent", Relaxfil.Application["url_ConsultEvent"] + "HomeEvent.asp", 2, true);
		if ($("SpecialFolders")){
			HighLightSpecialFolders();}
	}
	else {
		setTimeout("LoadRelaxFilEnd()", 100);}
}

function HighLightSpecialFolders ()
{
	new Effect.FadeTo( 'SpecialFolders', .4, 500,  10,  {complete:function() {new Effect.FadeTo( 'SpecialFolders', 1, 500,  10, ''); }} );
	//setTimeout("HighLightSpecialFolders()", 10000);
}
//========================================================================================
//
//	Nom Fonction			: ReloadHomeTextContent
//	Entrées					: - aucune
//	Sorties					: - aucune
//
//	Description Fonction	: Effectue toutes les actions au lancement de l'application
//
//	Création				: LAPLANCHE Jérémy - 28/10/2005 11:49
//	Dernière modification	: LAPLANCHE Jérémy - 28/10/2005 11:50
//
//----------------------------------------------------------------------------------------
function ReloadHomeTextContent()
{
	LoadHomeProduct("HomeText", Relaxfil.Application["url_Includes"] + "cache/HomeText.asp", 0, true);
	setTimeout("ReloadHomeTextContent()", 300000);
}
//========================================================================================
//
//	Nom Fonction			: LoadHomeProduct
//	Entrées					: - aucune
//	Sorties					: - aucune
//
//	Description Fonction	: Affichage de la page d'accueil du service
//
//	Création				: LAPLANCHE Jérémy - 28/10/2005 11:49
//	Dernière modification	: LAPLANCHE Jérémy - 31/10/2005 15:39
//
//----------------------------------------------------------------------------------------
function LoadHomeProduct(strInnerHtmlId, strFormAction, intLoadHome, blnRegisterDraggables)
{
	var objXmlHttpRequest;
	if (!(objXmlHttpRequest = GetXmlHttpRequestObject())) {
		return;}
	objXmlHttpRequest.open("GET", strFormAction, true);
	objXmlHttpRequest.onreadystatechange = function()
	{
		if(objXmlHttpRequest.readyState == 4)
		{
			if (ErrorXmlHttpRequestObject(objXmlHttpRequest, strInnerHtmlId)) {
				$(strInnerHtmlId).innerHTML = objXmlHttpRequest.responseText;}
			if (blnRegisterDraggables){
				RegisterDraggableElements (strInnerHtmlId);}
			blnLoadHome[intLoadHome] = true;
			if (strInnerHtmlId == "PreviewWindow")
			{
				var arrItemPath = $("strPreviewDocumentId").value.split(":");
				var strDocId = arrItemPath[1] + "/" + arrItemPath[2] + "/" + arrItemPath[3];
				$("strPreviewDocumentTextId").value = arrItemPath[3];
				$("strPreviewDocumentTextClass").value = arrItemPath[1];
				$("strPreviewDocumentTextGenre").value = arrItemPath[2];
				$("strPreviewDocumentTextFullId").value = "/" + arrItemPath[1] + "/" + arrItemPath[2] + "/" + arrItemPath[3];
				$("PreviewMailLink").innerHTML = "<a href=\"#\" onclick=\"showWbExport('preview', '" + strDocId + "');\">Envoyer par E-mail</a>";
			}
//			if (strInnerHtmlId == "HomeText")
//			{
//				$("HomeText").innerHTML = "";
//			}
		}
	}
	objXmlHttpRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	objXmlHttpRequest.setRequestHeader("Charset", "iso-8859-1");
	objXmlHttpRequest.send("");
}
//========================================================================================
//
//	Nom Fonction			: Clock
//	Entrées					: - aucune
//	Sorties					: - aucune
//
//	Description Fonction	: Permet l'affichage de l'horloge dans le champs #Clock
//
//	Création				: LAPLANCHE Jérémy - 28/10/2005 11:49
//	Dernière modification	: LAPLANCHE Jérémy - 28/10/2005 11:50
//
//----------------------------------------------------------------------------------------
function Clock()
{
	jour = new Array ("Dimanche","Lundi","Mardi","Mercredi","Jeudi","Vendredi","Samedi");
	mois = new Array ("Janvier","Février","Mars","Avril","Mai","Juin","Juillet","Août","Septembre","Octobre","Novembre","Décembre");
	date = new Date();
	datejour = date.getDate();
	heure = date.getHours();
	minute = date.getMinutes();
	seconde = date.getSeconds();
	if (date.getDate() < 10) {datejour = "0" + datejour};
	if (datejour == "01") {datejour = "1er";}
	if (heure < 10) {heure = "0" + heure;}
	if (minute < 10){ minute = "0" + minute;}
	if (seconde < 10) {seconde = "0" + seconde;}
	$("Clock").innerHTML=jour[date.getDay()]+" "+datejour+"&nbsp;"+mois[date.getMonth()]+"&nbsp;"+heure+":"+minute+":"+seconde;
	setTimeout("Clock()", 1000);
}
//========================================================================================
//
//	Nom Fonction			: RegisterDraggableElement
//	Entrées					: - strInnerHtmlId (string -  Identifiant de la balise a scanner)
//	Sorties					: - aucune
//
//	Description Fonction	: Scanne un élément afin d'enregistrer les sous-éléments draggable
//
//	Création				: LAPLANCHE Jérémy - 25/07/2005 11:39
//	Dernière modification	: LAPLANCHE Jérémy - 25/07/2005 11:39
//
//----------------------------------------------------------------------------------------
function RegisterDraggableElements(strInnerHtmlId)
{
	var arrElements = $(strInnerHtmlId).getElementsByTagName("div");
	for (i = 0; i < arrElements.length; i++){
		if (arrElements[i].className.substring(0, 4) == "Item"){
			dndMgr.registerDraggable(new CustomDraggable(arrElements[i].id, arrElements[i].innerHTML));}}
}
//========================================================================================
//
//	Nom Fonction			: ShowPreview
//	Entrées					: - strPathDocument (string - )
//	Sorties					: - aucune
//
//	Description Fonction	: Envoi des formulaire
//
//	Création				: LAPLANCHE Jérémy - 25/07/2005 11:39
//	Dernière modification	: MULLER William   - 02/02/2006 11:39
//
//----------------------------------------------------------------------------------------
function ShowPreview(strPathDocument)
{
	var objXmlHttpRequest;
	var strDocId = "";
	var strDocGenre = "";
	var arrItemPath = strPathDocument.split(":");
	var strMailStart = "<a href=\"mailto:?";
	var strMailStartEnd = ">";
	var strMailEnd = "</a>"
	var strLink = "Envoyer par E-mail";
	var strMailBodyStart = "&body=<html><head></head><body>";
	var strMailBodyEnd = "</body></html>\"";
	var strMailSubject = "subject=Depeche%20du%20Relaxifl";
	if (!(objXmlHttpRequest = GetXmlHttpRequestObject())){
		return;}
	strDocId = "/" + arrItemPath[1] + "/" + arrItemPath[2] + "/" + arrItemPath[3];
	strDocGenre = arrItemPath[2].toLowerCase();
	switch (arrItemPath[2])
	{
		case "text" :
			$("strPreviewDocumentTextId").value = arrItemPath[3];
			$("strPreviewDocumentTextClass").value = arrItemPath[1];
			$("strPreviewDocumentTextGenre").value = arrItemPath[2];
			$("strPreviewDocumentTextFullId").value = "/" + arrItemPath[1] + "/" + arrItemPath[2] + "/" + arrItemPath[3];
			break;
		case "video" :
			strDocId = "/" + arrItemPath[1] + "/text/" + arrItemPath[3];
			strDocGenre = "text";
			$("strPreviewDocumentVideoId").value = arrItemPath[3];
			$("strPreviewDocumentVideoClass").value = arrItemPath[1];
			$("strPreviewDocumentVideoGenre").value = "text";
			$("strPreviewDocumentVideoFullId").value = "/" + arrItemPath[1] + "/text/" + arrItemPath[3];
			break;
		case "diaporama" :
			$("strPreviewDocumentDiaporamaId").value = arrItemPath[3];
			$("strPreviewDocumentDiaporamaClass").value = arrItemPath[1];
			$("strPreviewDocumentDiaporamaGenre").value = arrItemPath[2];
			$("strPreviewDocumentDiaporamaFullId").value = "/" + arrItemPath[1] + "/" + arrItemPath[2] + "/" + arrItemPath[3];
			break;
		case "forecast" :
			$("strPreviewDocumentForecastId").value = arrItemPath[3];
			$("strPreviewDocumentForecastClass").value = arrItemPath[1];
			$("strPreviewDocumentForecastGenre").value = arrItemPath[2];
			$("strPreviewDocumentForecastFullId").value = "/" + arrItemPath[1] + "/" + arrItemPath[2] + "/" + arrItemPath[3];
			break;
		case "event" :
			$("strPreviewDocumentEventId").value = arrItemPath[3];
			$("strPreviewDocumentEventClass").value = arrItemPath[1];
			$("strPreviewDocumentEventGenre").value = arrItemPath[2];
			$("strPreviewDocumentEventFullId").value = "/" + arrItemPath[1] + "/" + arrItemPath[2] + "/" + arrItemPath[3];
			break;
	}
	$("Preview").style.cursor = "wait";
	$("PreviewWindow").innerHTML = "Chargement en cours ...";
	objXmlHttpRequest.open("POST", Relaxfil.Application["url_Scripts"] + "frmShowPreview.asp", true);
	objXmlHttpRequest.onreadystatechange = function()
	{
		if(objXmlHttpRequest.readyState == 4)
		{
			if (ErrorXmlHttpRequestObject(objXmlHttpRequest, "PreviewWindow")){
				$("PreviewWindow").innerHTML = objXmlHttpRequest.responseText;}
			$("Preview").style.cursor = "auto";
			$("PreviewMailLink").innerHTML = "<a href=\"#\" onclick=\"showWbExport('preview', '" + strDocId + "');\">Envoyer par E-mail</a>";
		}
	}
	objXmlHttpRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	objXmlHttpRequest.send("strDocId=" + strDocId + "&strDocGenre=" + strDocGenre);
}
//========================================================================================
//
//	Nom Fonction			: LaunchQuickSearch
//	Entrées					: - aucune
//	Sorties					: - aucune
//
//	Description Fonction	: Effectue toutes les actions au lancement de l'application
//
//	Création				: LAPLANCHE Jérémy - 28/10/2005 11:49
//	Dernière modification	: LAPLANCHE Jérémy - 28/10/2005 11:50
//
//----------------------------------------------------------------------------------------
function LaunchQuickSearch(strSearchKeywords, strDocGenre, strAction, selectionType)
{
	$("strSearch" + strDocGenre + "Keywords").value = $(strSearchKeywords).value;
	LaunchSearch ("frmSearch" + strDocGenre, strDocGenre, strAction, selectionType);
}
//========================================================================================
//
//	Nom Fonction			: HideSearch
//	Entrées					: - aucune
//	Sorties					: - aucune
//
//	Description Fonction	: Effectue toutes les actions au lancement de l'application
//
//	Création				: LAPLANCHE Jérémy - 28/10/2005 11:49
//	Dernière modification	: LAPLANCHE Jérémy - 28/10/2005 11:50
//
//----------------------------------------------------------------------------------------
function HideSearch(strProductId)
{
	if (strProductId == "Text" || strProductId == "Diaporama") {
		$("Search" + strProductId).style.display = "none";}
	$("Home" + strProductId).style.display = "block";
	$("Search" + strProductId + "Result").style.display = "none";
	ResetSearchForm(strProductId, "", "");
}
//========================================================================================
//
//	Nom Fonction			: LaunchSearch
//	Entrées					: - strFormName (string -  Nom du formulaire)
//							  - strProductId (string - Produit concerné : Text/Forecast/Event)
//							  - strAction (string - )
//							  - selectionType (string - type de sélection pour les catégories : checkbox/selectbox/direct)
//							  - strSelectList (string - liste des éléments selects séparés par des | à prendre en compte pour récup valeurs catégories)
//							  - strSelectInputList (string - liste des éléments inputs séparés par des | à prendre en compte pour stocker valeurs catégories)
//	Sorties					: - aucune
//
//	Description Fonction	: Envoi des formulaire
//
//	Création				: LAPLANCHE Jérémy - 25/07/2005 11:39
//	Dernière modification	: LAPLANCHE Jérémy - 25/07/2005 11:39
//
//----------------------------------------------------------------------------------------
function LaunchSearch (strFormName, strProductId, strAction, selectionType, strCheckBoxList, strCheckBoxInputList, strSelectBoxList, strSelectBoxInputList)
{
	$("Search" + strProductId).style.display = "block";
	$("Home" + strProductId).style.display = "none";
	$("Search" + strProductId + "Result").style.display = "block";

	switch (strFormName)
	{
		case "frmSearchText" :
			if (selectionType != ''){
				GetSearchCategories ("CSL_SearchTextRubrics", "strSearchTextCategories", selectionType);}
			ExecuteQuery (strFormName, "Text", strAction);
			break;
		case "frmSearchDiaporama" :
			if (selectionType != ''){
				GetSearchCategories ("CSL_SearchDiaporamaRubrics", "strSearchDiaporamaCategories", selectionType);}
			ExecuteQuery (strFormName, "Diaporama", strAction);
			break;
		case "frmSearchForecast" :
			if (strSelectBoxList != ''){
				GetSearchCategories (strSelectBoxList, strSelectBoxInputList, 'selectbox');}
			if (strCheckBoxList != ''){
				GetSearchCategories (strCheckBoxList, strCheckBoxInputList, 'checkbox');}
			ExecuteQuery (strFormName, "Forecast", strAction);
			break;
		case "frmSearchEvent" :
			if (selectionType != '')
			{
			if (strSelectBoxList != ''){
				GetSearchCategories (strSelectBoxList, strSelectBoxInputList, 'selectbox');}
			if (strCheckBoxList != ''){
				GetSearchCategories (strCheckBoxList, strCheckBoxInputList, 'checkbox');}
			}
			ExecuteQuery (strFormName, "Event", strAction);
			break;
	}
}
//========================================================================================
//
//	Nom Fonction			: LaunchSpecialFoldersSearch
//	Entrées					: - strFormName (string -  Nom du formulaire)
//	Sorties					: - aucune
//
//	Description Fonction	: Envoi des formulaire
//
//	Création				: LAPLANCHE Jérémy - 25/07/2005 11:39
//	Dernière modification	: LAPLANCHE Jérémy - 25/07/2005 11:39
//
//----------------------------------------------------------------------------------------
function LaunchSpecialFoldersSearch (strCategories, strCaptionLabel, strProduct)
{
	switch (strProduct.toLowerCase())
	{
		case "text":
			strProduct = "Text";
			strOpen = Relaxfil.Application["url_ConsultText"];
			break;
		case "event":
			strProduct = "Event";
			strOpen = Relaxfil.Application["url_ConsultEvent"];
			break;
	}

	ResetSearchForm(strProduct, "", "");
	ShowProduct(strProduct)	;
	$("Search" + strProduct).style.display = "block";
	$("Home" + strProduct).style.display = "none";
	$("Search" + strProduct + "Result").style.display = "block";

	var objXmlHttpRequest;
	if (!(objXmlHttpRequest = GetXmlHttpRequestObject())){
		return;}
	$("Search" + strProduct).style.cursor = "wait";
	objXmlHttpRequest.open("POST", strOpen + "frmSpecialFolders.asp", true);
	objXmlHttpRequest.onreadystatechange = function()
	{
		if(objXmlHttpRequest.readyState == 4)
		{
			$("Search" + strProduct + "Result").innerHTML = objXmlHttpRequest.responseText;
			if ($("Search" +  strProduct + "Content")){
				RegisterDraggableElements ("Search" +  strProduct + "Content");}
			$("Search" + strProduct).style.cursor = "auto";
		}
	}
	if ($("Search" +  strProduct + "Content")){
		$("Search" +  strProduct + "Content").innerHTML = "&nbsp;&nbsp;Recherche en cours ...";}
	objXmlHttpRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	objXmlHttpRequest.send("strProduct=" + strProduct + "&strSearchSpecialFoldersCategories=" + strCategories + "&strSearchSpecialFoldersCaptionLabel=" + strCaptionLabel);
}

//========================================================================================
//
//	Nom Fonction			: ExecuteQuery
//	Entrées					: - strFormName (string -  Nom du formulaire)
//	Sorties					: - aucune
//
//	Description Fonction	: Envoi des formulaire
//
//	Création				: LAPLANCHE Jérémy - 25/07/2005 11:39
//	Dernière modification	: LAPLANCHE Jérémy - 25/07/2005 11:39
//
//----------------------------------------------------------------------------------------
function ExecuteQuery (strFormName, strDocGenre, strAction)
{
	var objXmlHttpRequest;
	if (!(objXmlHttpRequest = GetXmlHttpRequestObject())){
		return;}

	$("Search" + strDocGenre).style.cursor = "wait";
	objXmlHttpRequest.open("POST", strAction, true);
	objXmlHttpRequest.onreadystatechange = function()
	{
		if(objXmlHttpRequest.readyState == 4)
		{
			$("Search" + strDocGenre + "Result").innerHTML = objXmlHttpRequest.responseText;
			if ($("Search" + strDocGenre + "Content")){
				RegisterDraggableElements ("Search" + strDocGenre + "Content");}
			$("Search" + strDocGenre).style.cursor = "auto";
		}
	}
	if ($("Search" + strDocGenre + "Content")){
		$("Search" + strDocGenre + "Content").innerHTML = "&nbsp;&nbsp;Recherche en cours ...";}
	objXmlHttpRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	objXmlHttpRequest.send(GetPostValue(strFormName));
}
//========================================================================================
//
//	Nom Fonction			: BrowseResultQuery
//	Entrées					: - aucune
//	Sorties					: - aucune
//
//	Description Fonction	: Effectue toutes les actions au lancement de l'application
//
//	Création				: LAPLANCHE Jérémy - 28/10/2005 11:49
//	Dernière modification	: LAPLANCHE Jérémy - 28/10/2005 11:50
//
//----------------------------------------------------------------------------------------
function BrowseResultQuery(strFormName, strDocGenre, intPageToDisplay, strAction)
{
	var objXmlHttpRequest;
	if ($("Search" + strDocGenre + "Pag" + intPageToDisplay) && $("Search" + strDocGenre + "Pag" + intPageToDisplay).className == "SearchPag Active"){
		return;}
	if (!(objXmlHttpRequest = GetXmlHttpRequestObject())){
		return;}
	$("Search" + strDocGenre).style.cursor = "wait";
	objXmlHttpRequest.open("POST", strAction.replace(".asp", "Pag.asp"), true);
	objXmlHttpRequest.onreadystatechange = function()
	{
		if(objXmlHttpRequest.readyState == 4)
		{
			$("Search" + strDocGenre + "Result").innerHTML = objXmlHttpRequest.responseText;
			RegisterDraggableElements ("Search" + strDocGenre + "Content");
			$("Search" + strDocGenre).style.cursor = "auto";
		}
	}
	objXmlHttpRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	objXmlHttpRequest.send("Page=" + intPageToDisplay);
}
//========================================================================================
//
//	Nom Fonction			: GetSearchCategorie
//	Entrées					: - aucune
//	Sorties					: - aucune
//
//	Description Fonction	: Effectue toutes les actions au lancement de l'application
//
//	Création				: LAPLANCHE Jérémy - 28/10/2005 11:49
//	Dernière modification	: LAPLANCHE Jérémy - 28/10/2005 11:50
//
//----------------------------------------------------------------------------------------
function GetSearchCategories(strSelectList, strSelectInputList, selectionType)
{
	var strCategories = "";
	var arrCheckBoxList;
	var lngCheckBoxSelected = 0;
	var arrCustomSelectLists = strSelectList.split("|");
	var arrSearchCategories = strSelectInputList.split("|");
	var strSelectInputList = $(strSelectInputList);

	if (selectionType == "direct")
	{
		strSelectInputList.value = strSelectList.item(strSelectList.selectedIndex).value;
	}
	else if (selectionType == "checkbox")
	{
		for (var i = 0; i < arrCustomSelectLists.length; i++)
		{
			arrCheckBoxList	= $(arrCustomSelectLists[i]).getElementsByTagName("a");
			for (var j = 0; j < arrCheckBoxList.length; j++){
				if (arrCheckBoxList[j].className == "checked"){
					strCategories = strCategories + arrCheckBoxList[j].id.split("-")[1] + "|";
					lngCheckBoxSelected++;}}
		$(arrSearchCategories[i]).value = strCategories.substr(0, strCategories.length - 1);
			strCategories = "";
		}
	}
	else if (selectionType == "selectbox")
	{
		var strSelectList = "";
		for (var i = 0; i < arrCustomSelectLists.length; i++)
		{
			strSelectList = $(arrCustomSelectLists[i]);
			$(arrSearchCategories[i]).value = strSelectList.item(strSelectList.selectedIndex).value;
			strSelectList = "";
		}

	}
}
//========================================================================================
//
//	Nom Fonction			: GetSearchEventCategorie
//	Entrées					: - aucune
//	Sorties					: - aucune
//
//	Description Fonction	: Effectue toutes les actions au lancement de l'application
//
//	Création				: LAPLANCHE Jérémy - 28/10/2005 11:49
//	Dernière modification	: LAPLANCHE Jérémy - 28/10/2005 11:50
//
//----------------------------------------------------------------------------------------
function GetSearchEventCategories(strCustomSelectLists, strSearchCategories)
{
	var strSearchCategories = $(strSearchCategories);
	var strCustomSelectLists = $(strCustomSelectLists);
	strSearchCategories.value = strCustomSelectLists.item(strCustomSelectLists.selectedIndex).value;
}
//========================================================================================
//
//	Nom Fonction			: ShowProduct
//	Entrées					: - aucune
//	Sorties					: - aucune
//
//	Description Fonction	: Effectue toutes les actions au lancement de l'application
//
//	Création				: LAPLANCHE Jérémy - 28/10/2005 11:49
//	Dernière modification	: LAPLANCHE Jérémy - 28/10/2005 11:50
//
//----------------------------------------------------------------------------------------
function ShowProduct(strProductId)
{
	HideSearch("Text");
	HideSearch("Forecast");
	HideSearch("Event");
	HideSearch("Diaporama");
	if ($("strCurrentProductId").value == strProductId){
		return;}

	var i;
	var arrProducts = $("Products").getElementsByTagName("div");
	var arrProductsTbs = $("Tabs").getElementsByTagName("li");
	for (i = 0; i < arrProducts.length; i++){
		if (arrProducts[i].className == "Product"){
			$(arrProducts[i].id).style.display = "none";}}
	for (i = 0; i < arrProductsTbs.length; i++){
		$(arrProductsTbs[i].id).className = "Inactive";}
	$("Product" + strProductId).style.display = "block";
	if ($("Tbs" + strProductId)) {
		$("Tbs" + strProductId).className = "Active";}
	$("PreviewWindow").innerHTML = "&nbsp;";
	$("PreviewMailLink").innerHTML = "<a href=\"#\" onclick=\"alert('Aucun élément sélectionné.')\">Envoyer par E-mail</a>";
	$("strCurrentProductId").value = strProductId;
	ResetSearchForm(strProductId, "", "");
}
// FONCTIONS POUR LA LISTE PERSONNALISEE
//========================================================================================
//
//	Nom Fonction			: CustomSelect_Click
//	Entrées					: - aucune
//	Sorties					: - aucune
//
//	Description Fonction	: Effectue toutes les actions au lancement de l'application
//
//	Création				: LAPLANCHE Jérémy - 28/10/2005 11:49
//	Dernière modification	: LAPLANCHE Jérémy - 28/10/2005 11:50
//
//----------------------------------------------------------------------------------------
function CustomSelect_Click(strCustomSelectId)
{
	var cstList		= $("CSL_" + strCustomSelectId);
	if (cstList.style.display != "block")
	{
		CustomSelectList_Show(cstList);
	}
	else
	{
		if (gblnCustomSelect_Categories_Focused == false){
			CustomSelectList_Hide(cstList);}
	}
	gblnCustomSelect_Categories_Focused = false;
}
//========================================================================================
//
//	Nom Fonction			: CustomSelect_Focu
//	Entrées					: - aucune
//	Sorties					: - aucune
//
//	Description Fonction	: Effectue toutes les actions au lancement de l'application
//
//	Création				: LAPLANCHE Jérémy - 28/10/2005 11:49
//	Dernière modification	: LAPLANCHE Jérémy - 28/10/2005 11:50
//
//----------------------------------------------------------------------------------------
function CustomSelect_Focus(strCustomSelectId)
{
	CustomSelectList_Show($("CSL_" + strCustomSelectId));
	gblnCustomSelect_Categories_Focused = true;
}
//========================================================================================
//
//	Nom Fonction			: CustomSelectList_Show
//	Entrées					: - aucune
//	Sorties					: - aucune
//
//	Description Fonction	: Effectue toutes les actions au lancement de l'application
//
//	Création				: LAPLANCHE Jérémy - 28/10/2005 11:49
//	Dernière modification	: LAPLANCHE Jérémy - 28/10/2005 11:50
//
//----------------------------------------------------------------------------------------
function CustomSelectList_Show(objCustomSelectList)
{
	if ((navigator.appName).toLowerCase() != "netscape")
	{
		var arrSelect = $("Window").getElementsByTagName("select");
		for (var i = 0; i < arrSelect.length; i++){
			arrSelect[i].style.display = "none";}
	}
	objCustomSelectList.style.display = "block";
}
//========================================================================================
//
//	Nom Fonction			: CustomSelectList_Hide
//	Entrées					: - aucune
//	Sorties					: - aucune
//
//	Description Fonction	: Effectue toutes les actions au lancement de l'application
//
//	Création				: LAPLANCHE Jérémy - 28/10/2005 11:49
//	Dernière modification	: LAPLANCHE Jérémy - 28/10/2005 11:50
//
//----------------------------------------------------------------------------------------
function CustomSelectList_Hide(objCustomSelectList)
{
	if ((navigator.appName).toLowerCase() != "netscape")
	{
		var arrSelect = document.getElementsByTagName("select");
		for (i = 0; i < arrSelect.length; i++){
			arrSelect[i].style.display = "";}
	}
	objCustomSelectList.style.display = "none";
}
//========================================================================================
//
//	Nom Fonction			: CustomSelectList_OnSave_Edit
//	Entrées					: - aucune
//	Sorties					: - aucune
//
//	Description Fonction	: Effectue toutes les actions au lancement de l'application
//
//	Création				: LAPLANCHE Jérémy - 28/10/2005 11:49
//	Dernière modification	: LAPLANCHE Jérémy - 28/10/2005 11:50
//
//----------------------------------------------------------------------------------------
function CustomSelectList_OnSave_Edit(selectsList,strSearchCategories)
{
	var strCheckBoxSelected		= "";
	var	lngCheckBoxSelected		= 0;
	var list;
	var finalList = "";
	var mainSelected = false;
	selectsList = $(selectsList).value.replace("||","|")
	var arrSelectsList = selectsList.split("|");
	var strSearchCategoriesElement = $(strSearchCategories);
	var arrCheckBoxList;
	var arrRadioList;
	var arrId;

	for (var i = 0; i < arrSelectsList.length; i++)
	{
		list  = arrSelectsList[i];
		arrCheckBoxList	= $("CSL_Search"+ list +"Rubrics").getElementsByTagName("a");
		for (var j = 0; j < arrCheckBoxList.length; j++)
		{
			if (arrCheckBoxList[j].className == "checked")
			{
				arrId = arrCheckBoxList[j].id.split("-");
				strCheckBoxSelected = strCheckBoxSelected + arrId[1] + "|";
				lngCheckBoxSelected++;
			}
		}
	}
	finalList = strCheckBoxSelected.substr(0, strCheckBoxSelected.length - 1);
	finalList = finalList.replace("|||","|");
	finalList = finalList.replace("||","|");
	strSearchCategoriesElement.value = strSearchCategoriesElement.value + '|' + finalList;
	if (strSearchCategoriesElement.value.substr(0,1) == "|") {strSearchCategoriesElement.value = strSearchCategoriesElement.value.substr(1,strSearchCategoriesElement.value.length -1)}
}
//========================================================================================
//
//	Nom Fonction			: CustomSelectList_Click_Edit
//	Entrées					: - aucune
//	Sorties					: - aucune
//
//	Description Fonction	: Effectue toutes les actions au lancement de l'application
//
//	Création				: LAPLANCHE Jérémy - 28/10/2005 11:49
//	Dernière modification	: LAPLANCHE Jérémy - 28/10/2005 11:50
//
//----------------------------------------------------------------------------------------
function CustomSelectList_Click_Edit (strId, strCustomSelectId, strFieldToFeed, strGenre)
{
	var strCheckBoxSelected		= "";
	var	i						= 0;
	var	lngCheckBoxSelected		= 0;
	var chkSelected	;
	var arrCheckBoxList			= $("CSL_" + strCustomSelectId).getElementsByTagName("a");
	var arrId;
	if (strId != '') {
		chkSelected	= $(strId);
		if (chkSelected.className != "checked"){
			chkSelected.className = "checked";}
		else{
			chkSelected.className = "";}
	}
	for (i = 0; i < arrCheckBoxList.length; i++)
	{
		if (arrCheckBoxList[i].className == "checked")
		{
			lngCheckBoxSelected++;
		}
	}
	$("CSF_" + strCustomSelectId).value = lngCheckBoxSelected + " rubrique(s) sélectionnée(s).";
}
//========================================================================================
//
//	Nom Fonction			: CustomSelectList_OnSave
//	Entrées					: - aucune
//	Sorties					: - aucune
//
//	Description Fonction	: Effectue toutes les actions au lancement de l'application
//
//	Création				: LAPLANCHE Jérémy - 28/10/2005 11:49
//	Dernière modification	: LAPLANCHE Jérémy - 28/10/2005 11:50
//
//----------------------------------------------------------------------------------------
function CustomSelectList_OnSave(selectsList,strSearchCategories)
{
	var strCheckBoxSelected		= "";
	var	lngCheckBoxSelected		= 0;
	var list;
	var finalList = "";
	selectsList = $(selectsList).value.replace("||","|")
	var arrSelectsList = selectsList.split("|");
	var strSearchCategoriesElement = $(strSearchCategories);
	var arrCheckBoxList;
	var arrId;
	$(strSearchCategories).value = "";
	for (var i = 0; i < arrSelectsList.length; i++)
	{
		arrCheckBoxList	= $("CSL_Search"+ arrSelectsList[i] +"Rubrics").getElementsByTagName("a");
		for (var j = 0; j < arrCheckBoxList.length; j++)
		{
			if (arrCheckBoxList[j].className == "checked")
			{
				arrId = arrCheckBoxList[j].id.split("-");
				strCheckBoxSelected = strCheckBoxSelected + arrId[1] + "|";
				lngCheckBoxSelected++;
			}
		}
	}
	finalList = strCheckBoxSelected.substr(0, strCheckBoxSelected.length - 1);
	finalList = finalList.replace("|||","|");
	finalList = finalList.replace("||","|");
	strSearchCategoriesElement.value = strSearchCategoriesElement.value + '|' + finalList;
	if (strSearchCategoriesElement.value.substr(0,1) == "|") {strSearchCategoriesElement.value = strSearchCategoriesElement.value.substr(1,strSearchCategoriesElement.value.length -1)}
}
//========================================================================================
//
//	Nom Fonction			: CustomSelectList_Click
//	Entrées					: - aucune
//	Sorties					: - aucune
//
//	Description Fonction	: Effectue toutes les actions au lancement de l'application
//
//	Création				: LAPLANCHE Jérémy - 28/10/2005 11:49
//	Dernière modification	: LAPLANCHE Jérémy - 28/10/2005 11:50
//
//----------------------------------------------------------------------------------------
function CustomSelectList_Click (strId, strCustomSelectId, strFieldToFeed, strGenre)
{
	var strCheckBoxSelected		= "";
	var	i						= 0;
	var	lngCheckBoxSelected		= 0;
	var chkSelected	;
	var arrCheckBoxList			= $("CSL_" + strCustomSelectId).getElementsByTagName("a");
	var arrId;
	if (strId != '')
	{
		chkSelected	= $(strId);
		if (chkSelected.className != "checked"){
			chkSelected.className = "checked";}
		else{
			chkSelected.className = "";}
	}
	for (i = 0; i < arrCheckBoxList.length; i++){
		if (arrCheckBoxList[i].className == "checked"){
			lngCheckBoxSelected++;}}
}
//========================================================================================
//
//	Nom Fonction			: CustomSelectList_Click2
//	Entrées					: - aucune
//	Sorties					: - aucune
//
//	Description Fonction	: Effectue toutes les actions au lancement de l'application
//
//	Création				: LAPLANCHE Jérémy - 28/10/2005 11:49
//	Dernière modification	: LAPLANCHE Jérémy - 28/10/2005 11:50
//
//----------------------------------------------------------------------------------------
function CustomSelectList_Click2 (strId, strCustomSelectId, strFieldToFeed, strGenre)
{
	var strCheckBoxSelected		= "";
	var	i						= 0;
	var	lngCheckBoxSelected		= 0;
	var chkSelected	;
	var arrCheckBoxList			= $("CSL_" + strCustomSelectId).getElementsByTagName("a");
	var arrId;
	if (strId != '') {
		chkSelected	= $(strId);
		if (chkSelected.className != "checked"){
			chkSelected.className = "checked";}
		else{
			chkSelected.className = "";}
	}
	for (i = 0; i < arrCheckBoxList.length; i++)
	{
		if (arrCheckBoxList[i].className == "checked")
		{
			arrId = arrCheckBoxList[i].id.split("-");
			strCheckBoxSelected = strCheckBoxSelected + arrId[1] + "|";
			lngCheckBoxSelected++;
		}
	}
	$(strFieldToFeed).value = strCheckBoxSelected.substr(0, strCheckBoxSelected.length - 1);
	$("CSF_" + strCustomSelectId).value = lngCheckBoxSelected + " rubrique(s) sélectionnée(s).";
}
//========================================================================================
//
//	Nom Fonction			: CustomSelect_Initialize
//	Entrées					: - aucune
//	Sorties					: - aucune
//
//	Description Fonction	: Effectue toutes les actions au lancement de l'application
//
//	Création				: LAPLANCHE Jérémy - 28/10/2005 11:49
//	Dernière modification	: LAPLANCHE Jérémy - 28/10/2005 11:50
//
//----------------------------------------------------------------------------------------
function CustomSelect_Initialize(strCustomSelectId)
{
	var cstList		= $("CSL_" + strCustomSelectId);
	if ((navigator.appName).toLowerCase() == "netscape")
	{
		cstList.style.left = "541px";
	}
	else
	{
		cstList.style.top = 117;
		cstList.style.left = 500;
	}
}
//========================================================================================
//
//	Nom Fonction			: InitializeCustomSelect
//	Entrées					: - aucune
//	Sorties					: - aucune
//
//	Description Fonction	: Effectue toutes les actions au lancement de l'application
//
//	Création				: LAPLANCHE Jérémy - 28/10/2005 11:49
//	Dernière modification	: LAPLANCHE Jérémy - 28/10/2005 11:50
//
//----------------------------------------------------------------------------------------
function InitializeCustomSelect()
{
	if ((navigator.appName).toLowerCase() == "netscape")
	{
		$("CSL_SearchTextRubrics").style.top = "113px";
		$("CSL_SearchTextRubrics").style.left = "93px";
		$("CSL_SearchDiaporamaRubrics").style.top = "113px";
		$("CSL_SearchDiaporamaRubrics").style.left = "93px";
		$("CSL_SearchForecast38372Rubrics").style.top = "113px";
		$("CSL_SearchForecast38372Rubrics").style.left = 98;
		$("CSL_SearchEvent38034Rubrics").style.top = "113px";
		$("CSL_SearchEvent38034Rubrics").style.left = 98;
		$("CSL_SearchEvent5Rubrics").style.top = "222px";
		$("CSL_SearchEvent5Rubrics").style.left = 98;
	}
	else
	{
		$("CSL_SearchTextRubrics").style.top = "115px";
		$("CSL_SearchTextRubrics").style.left = 98;
		$("CSL_SearchDiaporamaRubrics").style.top = "115px";
		$("CSL_SearchDiaporamaRubrics").style.left = 98;
		$("CSL_SearchForecast38372Rubrics").style.top = "115px";
		$("CSL_SearchForecast38372Rubrics").style.left = 98;
		$("CSL_SearchEvent38034Rubrics").style.top = "115px";
		$("CSL_SearchEvent38034Rubrics").style.left = 98;
		$("CSL_SearchEvent5Rubrics").style.top = "234px";
		$("CSL_SearchEvent5Rubrics").style.left = 98;
	}
}
//========================================================================================
//
//	Nom Fonction			: ResetSearchForm
//	Entrées					: - aucune
//	Sorties					: - aucune
//
//	Description Fonction	: Effectue toutes les actions au lancement de l'application
//
//	Création				: LAPLANCHE Jérémy - 28/10/2005 11:49
//	Dernière modification	: LAPLANCHE Jérémy - 28/10/2005 11:50
//
//----------------------------------------------------------------------------------------
function ResetSearchForm(strProductId, strDateFrom, strDateTo)
{

	if ($("frmSearch" + strProductId)){
		document.forms["frmSearch" + strProductId].reset();}
//	$("strSearch" + strProductId + "DateFrom").disabled = true;
//	$("strSearch" + strProductId + "DateTo").disabled = true;
	if ($("strSearch" + strProductId + "Categories")){
	$("strSearch" + strProductId + "Categories").value = "";}
	if ($("frmSearch" + strProductId)) {
	var arrCheckBoxList = $("frmSearch" + strProductId).getElementsByTagName("a");
	for (var j = 0; j < arrCheckBoxList.length; j++){
		if (arrCheckBoxList[j].className == "checked"){
			arrCheckBoxList[j].className = "";}}
	}
}
//========================================================================================
//
//	Nom Fonction			: isoDate
//	Entrées					: - aucune
//	Sorties					: - aucune
//
//	Description Fonction	: Effectue toutes les actions au lancement de l'application
//
//	Création				: LAPLANCHE Jérémy - 28/10/2005 11:49
//	Dernière modification	: LAPLANCHE Jérémy - 28/10/2005 11:50
//
//----------------------------------------------------------------------------------------
function isoDate(d)
{
	var s = "";
	if (d.getDate() < 10) {s += "0";}
	s += d.getDate();
	s += "/";
	if (d.getMonth() < 9) {s += "0";}
	s += d.getMonth()+1;
	s += "/";
	s += d.getFullYear();
	return s;
}
//========================================================================================
//
//	Nom Fonction			: ChangeQueryDate
//	Entrées					: - aucune
//	Sorties					: - aucune
//
//	Description Fonction	: Effectue toutes les actions au lancement de l'application
//
//	Création				: LAPLANCHE Jérémy - 28/10/2005 11:49
//	Dernière modification	: LAPLANCHE Jérémy - 28/10/2005 11:50
//
//----------------------------------------------------------------------------------------
function ChangeQueryDate(strProductId)
{
	var i = $("strSearch" + strProductId + "DateInterval").value;
//	$("strSearch" + strProductId + "DateFrom").disabled = (i != '');
//	$("strSearch" + strProductId + "DateTo").disabled = (i != '');
	var d = new Date();
	switch (i)
	{
		case "++":
			$("strSearch" + strProductId + "DateFrom").value = isoDate(d);
			$("strSearch" + strProductId + "DateTo").value = "31/12/2099";
			break;
		case "2007":
			$("strSearch" + strProductId + "DateFrom").value = "01/01/2007";
			$("strSearch" + strProductId + "DateTo").value = "31/12/2007";
			break;
		case "2008":
			$("strSearch" + strProductId + "DateFrom").value = "01/01/2008";
			$("strSearch" + strProductId + "DateTo").value = "31/12/2008";
			break;
		case "2009":
			$("strSearch" + strProductId + "DateFrom").value = "01/01/2009";
			$("strSearch" + strProductId + "DateTo").value = "31/12/2009";
			break;
		case ">365":
			$("strSearch" + strProductId + "DateFrom").value = isoDate(d);
			$("strSearch" + strProductId + "DateTo").value = "31/12/" + d.getFullYear();
			break;
		case "+90":
			d.setMonth(d.getMonth( ) + 1);
			d.setDate(1);
			$("strSearch" + strProductId + "DateFrom").value = isoDate(d);
			d.setDate(31);
			d.setMonth(d.getMonth( ) + 2);
			$("strSearch" + strProductId + "DateTo").value = isoDate(d);
			break;
		case "+31":
			d.setMonth(d.getMonth( ) + 1);
			d.setDate(1);
			$("strSearch" + strProductId + "DateFrom").value = isoDate(d);
			d.setDate(31);
			$("strSearch" + strProductId + "DateTo").value = isoDate(d);
			break;
		case ">30":
			$("strSearch" + strProductId + "DateFrom").value = isoDate(d);
			d.setDate(31);
			$("strSearch" + strProductId + "DateTo").value = isoDate(d);
			break;
		case "+30":
			$("strSearch" + strProductId + "DateFrom").value = isoDate(d);
			d.setMonth(d.getMonth( ) + 1);
			$("strSearch" + strProductId + "DateTo").value = isoDate(d);
			break;
		case "+7":
			if ( d.getDay() == 0)
				d.setDate(d.getDate() + 1);
			else
				d.setDate(d.getDate() - d.getDay( ) + 8);
			$("strSearch" + strProductId + "DateFrom").value = isoDate(d);
			d.setDate(d.getDate( ) + 6);
			$("strSearch" + strProductId + "DateTo").value = isoDate(d);
			break;
		case ">7":
			$("strSearch" + strProductId + "DateFrom").value = isoDate(d);
			if ( d.getDay() != 0)
				d.setDate(d.getDate( ) + 7 - d.getDay( ));
			$("strSearch" + strProductId + "DateTo").value = isoDate(d);
			break;
		case "+2":
			if ( d.getDay() == 0)
				d.setDate(d.getDate() - 1);
			else
				d.setDate(d.getDate() - d.getDay( ) + 6);
			$("strSearch" + strProductId + "DateFrom").value = isoDate(d);
			d.setDate(d.getDate() + 1);
			$("strSearch" + strProductId + "DateTo").value = isoDate(d);
			break;
		case "+5":
			if ( d.getDay() == 0)
				d.setDate(d.getDate() - 6);
			else
				d.setDate(d.getDate() - d.getDay( ) + 1);
			$("strSearch" + strProductId + "DateFrom").value = isoDate(d);
			d.setDate(d.getDate( ) + 6);
			$("strSearch" + strProductId + "DateTo").value = isoDate(d);
			break;
		case "+1":
			d.setDate(d.getDate( ) + 1);
			$("strSearch" + strProductId + "DateFrom").value = isoDate(new Date());
			$("strSearch" + strProductId + "DateTo").value = isoDate(d);
			break;
		case "+0":
			$("strSearch" + strProductId + "DateFrom").value = isoDate(d);
			$("strSearch" + strProductId + "DateTo").value = isoDate(d);
			break;
		case "-0":
			d.setDate(d.getDate( ) - 1);
			$("strSearch" + strProductId + "DateFrom").value = isoDate(d);
			$("strSearch" + strProductId + "DateTo").value = isoDate(d);
			break;
		case "-1":
			d.setDate(d.getDate( ) - 1);
			$("strSearch" + strProductId + "DateFrom").value = isoDate(d);
			$("strSearch" + strProductId + "DateTo").value = isoDate(new Date());
			break;
		case "-3":
			d.setDate(d.getDate( ) - 3);
			$("strSearch" + strProductId + "DateFrom").value = isoDate(d);
			$("strSearch" + strProductId + "DateTo").value = isoDate(new Date());
			break;
		case "-7":
			d.setDate(d.getDate( ) - 7);
			$("strSearch" + strProductId + "DateFrom").value = isoDate(d);
			$("strSearch" + strProductId + "DateTo").value = isoDate(new Date());
			break;
		case "-15":
			d.setDate(d.getDate( ) - 15);
			$("strSearch" + strProductId + "DateFrom").value = isoDate(d);
			$("strSearch" + strProductId + "DateTo").value = isoDate(new Date());
			break;
		case "-30":
			d.setMonth(d.getMonth( ) - 1);
			$("strSearch" + strProductId + "DateFrom").value = isoDate(d);
			$("strSearch" + strProductId + "DateTo").value = isoDate(new Date());
			break;
		case "-60":
			d.setMonth(d.getMonth( ) - 2);
			$("strSearch" + strProductId + "DateFrom").value = isoDate(d);
			$("strSearch" + strProductId + "DateTo").value = isoDate(new Date());
			break;
		case "-90":
			d.setMonth(d.getMonth( ) - 3);
			$("strSearch" + strProductId + "DateFrom").value = isoDate(d);
			$("strSearch" + strProductId + "DateTo").value = isoDate(new Date());
			break;
		case "-180":
			d.setMonth(d.getMonth( ) - 6);
			$("strSearch" + strProductId + "DateFrom").value = isoDate(d);
			$("strSearch" + strProductId + "DateTo").value = isoDate(new Date());
			break;
		case "-365":
			d.setYear(d.getYear( ) - 1);
			$("strSearch" + strProductId + "DateFrom").value = isoDate(d);
			$("strSearch" + strProductId + "DateTo").value = isoDate(new Date());
			break;
		default:
			break;
	}
}
//========================================================================================
//
//	Nom Fonction			: ShowSearchText
//	Entrées					: - aucune
//	Sorties					: - aucune
//
//	Description Fonction	: Effectue toutes les actions au lancement de l'application
//
//	Création				: LAPLANCHE Jérémy - 28/10/2005 11:49
//	Dernière modification	: LAPLANCHE Jérémy - 28/10/2005 11:50
//
//----------------------------------------------------------------------------------------
function ShowSearchText ()
{
	$("SearchText").style.display = "block";
	$("HomeText").style.display = "none";
	$("SearchTextResult").style.display = "block";
}
function ShowSearchDiaporama ()
{
	$("SearchDiaporamat").style.display = "block";
	$("HomeDiaporama").style.display = "none";
	$("SearchDiaporamaResult").style.display = "block";
}
//========================================================================================
//
//	Nom Fonction			: ShowDivUp
//	Entrées					: - aucune
//	Sorties					: - aucune
//
//	Description Fonction	: Effectue toutes les actions au lancement de l'application
//
//	Création				: LAPLANCHE Jérémy - 28/10/2005 11:49
//	Dernière modification	: LAPLANCHE Jérémy - 28/10/2005 11:50
//
//----------------------------------------------------------------------------------------
function ShowDivUp (strDivId)
{
	$("Mask").style.display = "block";
	$(strDivId).style.display = "block";
}
/****************************************************************************************/
/*																						*/
/*				FONCTIONS WINDOW														*/
/*																						*/
/****************************************************************************************/
//======================================================================================
//
//	Nom Fonction			: CreateWindow
//	Entrées					: - strWindowName (string - Nom de la fenetre)
//	Sorties					: - boolean
//
//	Description Fonction	: Creation d'une fenetre en pop-up
//
//	Création				: LAPLANCHE Jérémy - 25/07/2005 11:39
//	Dernière modification	: LAPLANCHE Jérémy - 27/12/2005 12:08
//
//----------------------------------------------------------------------------------------
function CreateWindow(strWindowName, strUrl, intWinHeight, intWinWidth)
{
	if (!intWinHeight){
		intWinHeight = 600;}
	if (!intWinWidth){
		intWinWidth = 900;}
	if (!strUrl){
		strUrl = "about:blank";}
	var intWinTop = 0;
	var intWinLeft = 0;

	var strOption = "left=" + intWinLeft + ",top=" + intWinTop + ", height=" + intWinHeight + ", width=" + intWinWidth;
	var winCreated = window.open(strUrl, strWindowName, strOption + ", scrollbars=no,resizable=yes")
	if (winCreated)
	{
		this.window.focus();
		return (true);
	}
	return (false);
}
//======================================================================================
//
//	Nom Fonction			: ResizePreviewWindow
//	Entrées					: - aucune
//	Sorties					: - aucune
//
//	Description Fonction	: Redimensionne la taille du div de Préview en fonction
//								de la taille de la fenêtre.
//
//	Création				: LAPLANCHE Jérémy - 25/07/2005 11:39
//	Dernière modification	: LAPLANCHE Jérémy - 27/12/2005 12:10
//
//----------------------------------------------------------------------------------------
function ResizePreviewWindow()
{
	var intWinHeight = 600;
	if ((navigator.appName).toLowerCase() == "netscape"){
		intWinHeight = window.innerHeight;}
	else{
		intWinHeight = document.documentElement.clientHeight;}
	if (intWinHeight < 600){
		intWinHeight = 600;}
	$("PreviewWindow").style.height = parseInt(intWinHeight - 465) + "px";
}
/****************************************************************************************/
/*																						*/
/*				FONCTIONS XMLHTTPREQUESTOBJECT											*/
/*																						*/
/****************************************************************************************/
//========================================================================================
//
//	Nom Fonction			: GetXmlHttpRequestObject
//	Entrées					: - aucune
//	Sorties					: - objXmlHttpRequest (XMLHttpRequest - Objet de communication)
//
//	Description Fonction	: Créé et renvoie un objet de communication asynchrone
//
//	Création				: LAPLANCHE Jérémy - 29/06/2005 13:30
//	Dernière modification	: LAPLANCHE Jérémy - 29/06/2005 13:36
//
//----------------------------------------------------------------------------------------
function GetXmlHttpRequestObject()
{
	var objXmlHttpRequest = null;
	if(window.XMLHttpRequest)
		{objXmlHttpRequest = new XMLHttpRequest();}
	else if(window.ActiveXObject)
		{objXmlHttpRequest = new ActiveXObject("Microsoft.XMLHTTP");}
	else
		{alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest...");
		return (null);}
	return (objXmlHttpRequest);
}
//========================================================================================
//
//	Nom Fonction			: LaunchKeywordsSearch
//	Entrées					: - aucune
//	Sorties					: - aucune
//
//	Description Fonction	: Effectue toutes les actions au lancement de l'application
//
//	Création				: LAPLANCHE Jérémy - 28/10/2005 11:49
//	Dernière modification	: LAPLANCHE Jérémy - 28/10/2005 11:50
//
//----------------------------------------------------------------------------------------
function LaunchKeywordsSearch (strCategoryId, strFormName, strProductId, strAction, selectionType)
{
	ResetSearchForm("Text", "", "");
	ResetSearchForm("Diaporama", "", "");
	arrCheckBoxList	= $("CSL_SearchTextRubrics").getElementsByTagName("a");
	for (var j = 0; j < arrCheckBoxList.length; j++){
		if (arrCheckBoxList[j].id == "Text-" + strCategoryId && arrCheckBoxList[j]){
			arrCheckBoxList[j].className = "checked";}}
	$("Search" + strProductId).style.display = "block";
	$("Home" + strProductId).style.display = "none";
	$("Search" + strProductId + "Result").style.display = "block";
	$("strSearch" + strProductId + "Categories").value = strCategoryId;
	ExecuteQuery (strFormName, strProductId, strAction);
}
//========================================================================================
//
//	Nom Fonction			: TraceOnHomeLinkClick
//	Entrées					: - strProductId, strCategoryId
//	Sorties					: - aucune
//
//	Description Fonction	: Enregistre le trace log du lien cliqué en Home
//
//	Création				: LE SAUSSE Jacques - 07/12/2006 15:50
//	Dernière modification	: 
//
//----------------------------------------------------------------------------------------
function TraceOnHomeLinkClick(strCategoryId, strProductId) {
	// Ajout LSJ le 07/12/2006
	var currentDate = new Date();
	var strDay, strMonth, strHours, strMin, strSec;
	strDay = "0"+currentDate.getDate();
	strDay = strDay.substr(strDay.length -2, 2);
	strMonth = "0"+(currentDate.getMonth() +1);
	strMonth = strMonth.substr(strMonth.length -2, 2);
	strHours = "0"+currentDate.getHours();
	strHours = strHours.substr(strHours.length -2, 2);
	strMin = "0"+currentDate.getMinutes();
	strMin = strMin.substr(strMin.length -2, 2);
	strSec = "0"+currentDate.getSeconds();
	strSec = strSec.substr(strSec.length -2, 2);
	strDate = currentDate.getFullYear()+"/"+strMonth+"/"+strDay+" "+strHours+":"+strMin+":"+strSec;
	var strXmlStart = "<?xml version=\"1.0\"?><actionLog SessionId=\"<%=IcmDoc.sessionId%>\" startDate=\"" + strDate + "\">";
	strXmlStart += "<log kind=\"1\" date=\"" + strDate + "\">HomeText</log>";
	strXmlStart += "<log kind=\"8\" date=\"" + strDate + "\">User = <%=OBJ_RMM_CURRENT_USER.Id%></log>";
	strXmlStart += "<log kind=\"8\" date=\"" + strDate + "\">Company = <%=OBJ_RMM_CURRENT_USER.Company%></log>";
	strXmlStart += "<log kind=\"8\" date=\"" + strDate + "\">Category = " + strCategoryId + "</log>";
	strXmlStart += "</actionLog>";
	TraceByHttpRequest(strProductId, "Link_click on HomePage category #" + strCategoryId, 1, strXmlStart); 
}
//========================================================================================
//
//	Nom Fonction			: calendarConsult
//	Entrées					: -
//	Sorties					: -
//
//	Description Fonction	: petit calendrier dans formulaires de recherche
//
//	Création				: MBUL
//	Dernière modification	:
//
//----------------------------------------------------------------------------------------
function calendarConsult(chp1, chp2, chp112, frm)
{
	if (document.getElementById(chp1).disabled || document.getElementById(chp2).disabled)
		return;

	mouse_X = document.getElementById(chp1).offsetLeft +130;
	mouse_Y = document.getElementById(chp1).offsetTop +80;

	var jsdate = document.getElementById(chp1).value;
	var jsdate2 = "";
	if(chp2 != "" && chp2 != "undefined") {jsdate2 = document.getElementById(chp2).value;}
	if(chp2 != "" && chp2 != "undefined" && jsdate2 == "") {
		var urlcalend = "inc/tools/calendar/calendrier.asp?dDate=" +  jsdate + "&frm=" +  frm + "&chp1=" + chp1 + "&chp2=" + chp2 + "&chp112=" + chp112 + "&mult=no";
	} else {
		var urlcalend = "inc/tools/calendar/calendrier.asp?dDate=" +  jsdate + "&frm=" +  frm + "&chp1=" + chp1 + "&chp112=" + chp112 + "&mult=no";
	}
	window.open(urlcalend,'calendrier','width=160,height=125,top='+mouse_Y+',left='+mouse_X);
}

//========================================================================================
//
//	Nom Fonction			: TraceByHttpRequest
//	Entrées					: - strProductId, Titre, Kind, Xml
//	Sorties					: -
//
//	Description Fonction	: enregistrement icmDoc.Trace
//
//	Création					: LE SAUSSE Jacques - 17/08/2006 11:55
//	Dernière modification	:
//
//----------------------------------------------------------------------------------------
function TraceByHttpRequest(strProductId, title, kind, text)
{
	if ($("strCurrentProductId").value == strProductId) {return;}
	var objXmlHttpRequest;
	if (!(objXmlHttpRequest = GetXmlHttpRequestObject())) {return;}

	/*
	var URL = Relaxfil.Application["url_Includes"] + "tools/writeTrace.asp?title=" + title + "&kind=" + kind + "&text=" + text;
	objXmlHttpRequest.open("GET", URL, true);
	objXmlHttpRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	objXmlHttpRequest.setRequestHeader("Charset", "iso-8859-1");
	objXmlHttpRequest.send("");
	*/
}


