/*------------------------------------------------------------------------------
 * FILE    : PanelBar.js
 * PURPOSE : Render Panelbar like cross-browser DHTML control.
 * REQUIRES: JavaScript 1.3, IE 6.0, FireFox 1.0
 * AUTHOR  : Khan Information Systems (KIS)
 *------------------------------------------------------------------------------
 * Copyright (c) 2005. Khan Information Systems. All Rights Reserved
 * The contents of this file are subject to the KIS Public License 1.0
 * (the "License"); you may not use this file except in compliance with the 
 * License. You should have received a copy of the KIS Public License along with 
 * this library; if not, please ask your software vendor to provide one.
 * 
 * YOU AGREE THAT THE PROGRAM IS PROVIDED AS-IS, WITHOUT WARRANTY OF ANY KIND
 * (EITHER EXPRESS OR IMPLIED) INCLUDING, WITHOUT LIMITATION, ANY IMPLIED 
 * WARRANTY OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, AND ANY 
 * WARRANTY OF NON INFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR
 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 
 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THE 
 * PROGRAM, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * See the License for the specific language governing rights and limitations 
 * under the License.
 -----------------------------------------------------------------------------*/
TARGET_OTHER = 0;
TARGET_BLANK = 1; 
TARGET_SELF = 2; 
TARGET_PARENT = 3; 
TARGET_TOP = 4; 
BROWSER_IE = 1; 
BROWSER_GECKO = 2; 
BROWSER_OTHER = -1;

var vide = ""; 
var nulle = 0;
var faux = false; 
var format_style = "../css"; 
var feuille_style = "XPBlue.css";
var rep_image = "Images";
var negatif = -1;
var strCtxt = "";


function menu() 
{
	 this.id = 0;
	 this.x1123687333477 = 0;
	 this.x1123687333478 = new Array;
	 this.create_categorie = create_categorie;
	 this.initialisation = x1123687333534;
} 

/*
function menu2() 
{
	 this.id = 0;
	 this.x1123687333477 = 0;
	 this.x1123687333478 = new Array;
	 this.create_separateur = create_separateur;
	 this.initialisation = x1123687333534;
} 
*/


function categorie(categorie_lib, x1123687333483, x1123687333484,separateur) 
{ 
	 this.id = "";
	 this.parentId = 0;
	 this.Libelle = categorie_lib;
	 this.x1123687333487 = x1123687333483;
	 this.x1123687333488 = true;
	 this.x1123687333489 = false;
	 this.sousmenu = new Array;
	 this.smcount = 0;
	 this.x1123687333492 = x1123687333484;
	 
	 this.separateur = separateur;
	 
	 this.create_sousmenu = create_sousmenu;
	 this.initialisation = drawcategorie;
	 
}

function sousmenu(sousmenu_lib, url_cible, x1123687333496, x1123687333483, x1123687333497, x1123687333498)
{ 
	 this.parentId = "";
	 this.Libelle = sousmenu_lib;
	 this.hlink = url_cible;
	 this.linktarget = x1123687333498;
	 this.linkdata = x1123687333496;
	 this.x1123687333487 = x1123687333483;
	 this.x1123687333488 = false;
	 this.x1123687333502 = false;
	 this.iconsrc = x1123687333497;
	 this.initialisation = drawsousmenu;
}

function create_categorie(categorie_lib, x1123687333483, x1123687333484,separateur)
{ 
	 var structure_categorie;
	 structure_categorie = new categorie(categorie_lib, x1123687333483, x1123687333484,separateur);
	 structure_categorie.id = this.x1123687333477;
	 structure_categorie.parentId = this.id;
	 this.x1123687333478[this.x1123687333477] = structure_categorie; this.x1123687333477++;
	 return structure_categorie;
}

function create_sousmenu(sousmenu_lib, url_cible, x1123687333496, x1123687333483, x1123687333497, x1123687333498)
{
	 var structure_sousmenu;
	 structure_sousmenu = new sousmenu(sousmenu_lib, url_cible, x1123687333496, x1123687333483, x1123687333497, x1123687333498);
	 structure_sousmenu.parentId = this.id;
	 this.sousmenu[this.smcount] = structure_sousmenu; this.smcount++;
}

function drawcategorie() 
{ 
	 var i = 0;
	 var objcategorie;
	 var strId, strLbl;
	 
	 if (this.separateur !=null)
	 {
	 	document.write("<div class=\"menuSeparateurCollapsed\" >");
	 }
	else
		{
	 document.write("<div class=\"menuHeaderCollapsed\" id=\"mnu_" + this.parentId + "_" + this.id + "\"" + " onmouseover=\"mouseover(this)\"" + " onmouseout=\"mouseout(this)\"" + "onclick=\"toggle(this)\">");
	}
	 document.write("<table border=\"0\" cellspacing=\"0\"" + " cellpadding=\"4\" width=\"100%\">");
	 document.write("<tr><td style=\"vertical-align: center;\">" + this.Libelle + "</td></tr>");
	 document.write("</table></div>");
	 document.write("<div style=\"display: none;visibility: hidden;\"" + " class=\"menuitems\" id=\"mnu_" + this.parentId + "_" + this.id + "_child" + "\">");
	 if (this.x1123687333492 != null) 
	 {
	 		document.write("<table border=\"0\" cellspacing=\"2\"" + " cellpadding=\"4\" width=\"100%\" style=\"" + "background-image: url('" + rep_image + "/" + this.x1123687333492 + "');\">");
	 }
	 else document.write("<table border=\"0\" cellspacing=\"2\"" + " cellpadding=\"4\" width=\"100%\">");
	 			for (i = 0; i < this.smcount; i++)
	 			{ 
	 				this.sousmenu[i].initialisation();
	 			} document.write("</table></div>");
	
	// saute une ligne entre les categories
	// document.write ("<span style=\"DISPLAY: block\">&nbsp;</span>");
}

/*
function drawseparateur() 
{ 
	 var i = 0;
	 var objseparateur;
	 var strId, strLbl;
	 
	 document.write("<div class=\"menuHeaderCollapsed\" id=\"mnu_" + this.parentId + "_" + this.id + "\"" + " onmouseover=\"mouseover(this)\"" + " onmouseout=\"mouseout(this)\"" + "onclick=\"toggle(this)\">");
	 document.write("<table border=\"0\" cellspacing=\"0\"" + " cellpadding=\"4\" width=\"100%\">");
	 document.write("<tr><td style=\"vertical-align: center;\">" + this.Libelle + "</td></tr>");
	 document.write("</table></div>");
	 document.write("<div style=\"display: none;visibility: hidden;\"" + " class=\"menuitems\" id=\"mnu_" + this.parentId + "_" + this.id + "_child" + "\">");
	 if (this.x1123687333492 != null) 
	 {
	 		document.write("<table border=\"0\" cellspacing=\"2\"" + " cellpadding=\"4\" width=\"100%\" style=\"" + "background-image: url('" + rep_image + "/" + this.x1123687333492 + "');\">");
	 }
	 else document.write("<table border=\"0\" cellspacing=\"2\"" + " cellpadding=\"4\" width=\"100%\">");
	 			for (i = 0; i < this.smcount; i++)
	 			{ 
	 				this.sousmenu[i].initialisation();
	 			} document.write("</table></div>");
	
	// saute une ligne entre les categories
	// document.write ("<span style=\"DISPLAY: block\">&nbsp;</span>");
}
*/


function drawsousmenu() 
{ 
	var strimg = "";
	document.write("<tr><td>");
	if (this.iconsrc) strimg = "<img src=\"" + strCtxt + rep_image + "/" + this.iconsrc + "\" border=\"0\"\">&nbsp;";
	document.write("<a href=" + getlink(this.linktarget, (strCtxt + this.hlink), this.linkdata) + "\">");
	document.write(strimg); document.write(this.Libelle);
	document.write("</a>");
	document.write("</td></tr>");
}

function getlink(x1123687333514, url_cible, x1123687333496) 
{ 
	var x1123687333515 = "";
	var x1123687333516; x1123687333516 = url_cible;
	
	if (x1123687333496 != null) x1123687333516 = x1123687333496 + "\" TARGET=\"contenu" + "\"";
	if (x1123687333514 == TARGET_BLANK) x1123687333515 = "\"" + x1123687333516 + "\" TARGET=\"_blank\"";
	else if (x1123687333514 == TARGET_SELF) x1123687333515 = "\"" + x1123687333516 + "\" TARGET=\"_self\"";
		else if (x1123687333514 == TARGET_PARENT) x1123687333515 = "\"" + x1123687333516 + "\" TARGET=\"_parent\"";
			else if (x1123687333514 == TARGET_TOP) x1123687333515 = "\"" + x1123687333516 + "\" TARGET=\"_top\"";
				else if (x1123687333514 != null) x1123687333515 = "\"" + x1123687333516 + "\" TARGET=\"" + x1123687333514 + "\"";
					else x1123687333515 = "\"" + x1123687333516 + "\"";
						return x1123687333515;
}

function mouseover(x1123687333518) 
{ 
	var x1123687333519 = x1123687333518.className;
	
	if (x1123687333519 == "menuHeaderExpanded") x1123687333518.className = "menuHeaderExpandedOver";
	else x1123687333518.className = "menuHeaderCollapsedOver";
}

function mouseout(x1123687333518) 
{ 
	var x1123687333519 = x1123687333518.className;
	
	if (x1123687333519 == "menuHeaderExpandedOver") x1123687333518.className = "menuHeaderExpanded";
	else x1123687333518.className = "menuHeaderCollapsed";
}

function toggle(x1123687333518) 
{ 
	var x1123687333519 = x1123687333518.className;
	var strId = x1123687333518.id;
	var structure_sousmenu, x1123687333522;
	
	if (x1123687333518.id != vide) structure_sousmenu = document.getElementById(vide);
	if (structure_sousmenu) 
	{ 
		structure_sousmenu.className = "menuHeaderCollapsed";
		x1123687333522 = document.getElementById(vide + "_child");
		x1123687333522.style.visibility = "hidden";
		x1123687333522.style.display = "none";
	}
	x1123687333522 = document.getElementById(strId + "_child");
	if (x1123687333522.style.visibility == "hidden") 
	{ 
		x1123687333518.className = "menuHeaderExpandedOver";
		x1123687333522.style.visibility = "visible";
		x1123687333522.style.display = "block";
  } 
  else 
  	{ 
  		x1123687333518.className = "menuHeaderCollapsedOver";
  		x1123687333522.style.visibility = "hidden"; x1123687333522.style.display = "none";
  	} 
  vide = x1123687333518.id;
}

function x1123687333523() 
{ 
	switch(navigator.family) 
	{ 
		case 'ie4': negatif = BROWSER_IE; break;
		case 'gecko': negatif = BROWSER_GECKO; break;
		default: negatif = BROWSER_OTHER; break;
	} 
} 

function x1123687333524() 
{ 
	var x1123687333525, x1123687333526, x1123687333527; var x1123687333528, x1123687333529, x1123687333530;
	var x1123687333531;
	var x1123687333532, x1123687333533;
	
	x1123687333525 = window.location.protocol;
	if (x1123687333525.indexOf("http") != -1) 
	{ 
		x1123687333526 = window.location.hostname;
		x1123687333527 = window.location.pathname;
		x1123687333528 = window.location.port;
		x1123687333529 = window.location.href;
		x1123687333530 = x1123687333525 + "/" + "/" + x1123687333526 + ":" + x1123687333528;
		x1123687333532 = x1123687333530.length;
		x1123687333531 = x1123687333529.substr(x1123687333532 + 1);
		x1123687333533 = x1123687333531.indexOf("/");
		strCtxt = x1123687333531.substr(0, x1123687333533);
		if (strCtxt.length > 0) strCtxt = "/" + strCtxt + "/"; 
	} 
}

function x1123687333534(largeur) 
{ 
	var i = 0;
	var x1123687333536 = "\x4B\x68\x61\x6E\x20\x49\x6E\x66\x6F\x72";
	var x1123687333537 = "\x6D\x61\x74\x69\x6F\x6E\x20\x53\x79\x73\x74\x65\x6D\x73";
	
	for (i = 0; i < this.x1123687333477; i++) 
	{ 
		document.write("<div id=\"panelBar\" style=\"width: " + largeur + "\">");
		this.x1123687333478[i].initialisation();
		document.write("</div></center>");
	} 
} 

function create_menu() 
{ 
	var structure_menu; 
	
	structure_menu = new menu();
	structure_menu.id = nulle;
	nulle++;
	return structure_menu;
}

/*
function create_menu2() 
{ 
	var structure_menu2; 
	
	structure_menu2 = new menu2();
	structure_menu2.id = nulle;
	nulle++;
	return structure_menu2;
}
*/


function applique_style(style_nom, style_rep, style_image_rep) 
{ 
	if (style_nom != null) feuille_style = style_nom;
	if (style_rep != null) format_style = style_rep;
	if (style_image_rep != null) rep_image = style_image_rep;
	if (!faux) 
	{ 
		document.write("<link href=\"" + format_style + "/" + feuille_style + "\"" + " rel=\"stylesheet\" type=\"text/css\">");
		_themSet = true;
	}
}