/*
   +---------------------------------------------------------------------+
   | phpTournois                                                         |
   +---------------------------------------------------------------------+
   +---------------------------------------------------------------------+
   | phpTournoisG4 ©2004 by Gectou4 <le_gardien_prime@hotmail.com>       |
   +---------------------------------------------------------------------+
         This version is based on phpTournois 3.5 realased by :
   | Copyright(c) 2001-2004 Li0n, RV, Gougou (http://www.phptournois.net)|
   +---------------------------------------------------------------------+
   | This file is part of phpTournois.                                   |
   |                                                                     |
   | phpTournois is free software; you can redistribute it and/or modify |
   | it under the terms of the GNU General Public License as published by|
   | the Free Software Foundation; either version 2 of the License, or   |
   | (at your option) any later version.                                 |
   |                                                                     |
   | phpTournois is distributed in the hope that it will be useful,      |
   | but WITHOUT ANY WARRANTY; without even the implied warranty of      |
   | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the       |
   | GNU General Public License for more details.                        |
   |                                                                     |
   | You should have received a copy of the GNU General Public License   |
   | along with AdminBot; if not, write to the Free Software Foundation, |
   | Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA       |
   |                                                                     |
   +---------------------------------------------------------------------+
   | Authors: Li0n  <li0n@phptournois.net>                               |
   |          RV <rv@phptournois.net>                                    |
   |          Gougou                                                     |
   +---------------------------------------------------------------------+
*/


function pop_it(the_form) {
   my_form = eval(the_form)
   window.open("?page=palmares3&op=rechjmatch3&header=win", "popup", "height=500,width=950,menubar='yes',toolbar='yes',location='yes',status='yes',scrollbars='yes'");
   my_form.target = "popup";
   my_form.submit();
}


(function($) {
	
	$.alerts = {
		
		// These properties can be read/written by accessing $.alerts.propertyName from your scripts at any time
		
		verticalOffset: -75,                // vertical offset of the dialog from center screen, in pixels
		horizontalOffset: 0,                // horizontal offset of the dialog from center screen, in pixels/
		repositionOnResize: true,           // re-centers the dialog on window resize
		overlayOpacity: .01,                // transparency level of overlay
		overlayColor: '#FFF',               // base color of overlay
		draggable: true,                    // make the dialogs draggable (requires UI Draggables plugin)
		okButton: '&nbsp;OK&nbsp;',         // text for the OK button
		cancelButton: '&nbsp;Cancel&nbsp;', // text for the Cancel button
		dialogClass: null,                  // if specified, this class will be applied to all dialogs
		
		// Public methods
		
		alert: function(message, title, callback) {
			if( title == null ) title = 'Alert';
			$.alerts._show(title, message, null, 'alert', function(result) {
				if( callback ) callback(result);
			});
		},
		
		confirm: function(message, title, callback) {
			if( title == null ) title = 'Confirm';
			$.alerts._show(title, message, null, 'confirm', function(result) {
				if( callback ) callback(result);
			});
		},
			
		prompt: function(message, value, title, callback) {
			if( title == null ) title = 'Prompt';
			$.alerts._show(title, message, value, 'prompt', function(result) {
				if( callback ) callback(result);
			});
		},
		
		// Private methods
		
		_show: function(title, msg, value, type, callback) {
			
			$.alerts._hide();
			$.alerts._overlay('show');
			
			$("BODY").append(
			  '<div id="popup_container">' +
			    '<h1 id="popup_title"></h1>' +
			    '<div id="popup_content">' +
			      '<div id="popup_message"></div>' +
				'</div>' +
			  '</div>');
			
			if( $.alerts.dialogClass ) $("#popup_container").addClass($.alerts.dialogClass);
			
			// IE6 Fix
			var pos = ($.browser.msie && parseInt($.browser.version) <= 6 ) ? 'absolute' : 'fixed'; 
			
			$("#popup_container").css({
				position: pos,
				zIndex: 99999,
				padding: 0,
				margin: 0
			});
			
			$("#popup_title").text(title);
			$("#popup_content").addClass(type);
			$("#popup_message").text(msg);
			$("#popup_message").html( $("#popup_message").text().replace(/\n/g, '<br />') );
			
			$("#popup_container").css({
				minWidth: $("#popup_container").outerWidth(),
				maxWidth: $("#popup_container").outerWidth()
			});
			
			$.alerts._reposition();
			$.alerts._maintainPosition(true);
			
			switch( type ) {
				case 'alert':
					$("#popup_message").after('<div id="popup_panel"><input type="button" value="' + $.alerts.okButton + '" id="popup_ok" /></div>');
					$("#popup_ok").click( function() {
						$.alerts._hide();
						callback(true);
					});
					$("#popup_ok").focus().keypress( function(e) {
						if( e.keyCode == 13 || e.keyCode == 27 ) $("#popup_ok").trigger('click');
					});
				break;
				case 'confirm':
					$("#popup_message").after('<div id="popup_panel"><input type="button" value="' + $.alerts.okButton + '" id="popup_ok" /> <input type="button" value="' + $.alerts.cancelButton + '" id="popup_cancel" /></div>');
					$("#popup_ok").click( function() {
						$.alerts._hide();
						if( callback ) callback(true);
					});
					$("#popup_cancel").click( function() {
						$.alerts._hide();
						if( callback ) callback(false);
					});
					$("#popup_ok").focus();
					$("#popup_ok, #popup_cancel").keypress( function(e) {
						if( e.keyCode == 13 ) $("#popup_ok").trigger('click');
						if( e.keyCode == 27 ) $("#popup_cancel").trigger('click');
					});
				break;
				case 'prompt':
					$("#popup_message").append('<br /><input type="text" size="30" id="popup_prompt" />').after('<div id="popup_panel"><input type="button" value="' + $.alerts.okButton + '" id="popup_ok" /> <input type="button" value="' + $.alerts.cancelButton + '" id="popup_cancel" /></div>');
					$("#popup_prompt").width( $("#popup_message").width() );
					$("#popup_ok").click( function() {
						var val = $("#popup_prompt").val();
						$.alerts._hide();
						if( callback ) callback( val );
					});
					$("#popup_cancel").click( function() {
						$.alerts._hide();
						if( callback ) callback( null );
					});
					$("#popup_prompt, #popup_ok, #popup_cancel").keypress( function(e) {
						if( e.keyCode == 13 ) $("#popup_ok").trigger('click');
						if( e.keyCode == 27 ) $("#popup_cancel").trigger('click');
					});
					if( value ) $("#popup_prompt").val(value);
					$("#popup_prompt").focus().select();
				break;
			}
			
			// Make draggable
			if( $.alerts.draggable ) {
				try {
					$("#popup_container").draggable({ handle: $("#popup_title") });
					$("#popup_title").css({ cursor: 'move' });
				} catch(e) { /* requires jQuery UI draggables */ }
			}
		},
		
		_hide: function() {
			$("#popup_container").remove();
			$.alerts._overlay('hide');
			$.alerts._maintainPosition(false);
		},
		
		_overlay: function(status) {
			switch( status ) {
				case 'show':
					$.alerts._overlay('hide');
					$("BODY").append('<div id="popup_overlay"></div>');
					$("#popup_overlay").css({
						position: 'absolute',
						zIndex: 99998,
						top: '0px',
						left: '0px',
						width: '100%',
						height: $(document).height(),
						background: $.alerts.overlayColor,
						opacity: $.alerts.overlayOpacity
					});
				break;
				case 'hide':
					$("#popup_overlay").remove();
				break;
			}
		},
		
		_reposition: function() {
			var top = (($(window).height() / 2) - ($("#popup_container").outerHeight() / 2)) + $.alerts.verticalOffset;
			var left = (($(window).width() / 2) - ($("#popup_container").outerWidth() / 2)) + $.alerts.horizontalOffset;
			if( top < 0 ) top = 0;
			if( left < 0 ) left = 0;
			
			// IE6 fix
			if( $.browser.msie && parseInt($.browser.version) <= 6 ) top = top + $(window).scrollTop();
			
			$("#popup_container").css({
				top: top + 'px',
				left: left + 'px'
			});
			$("#popup_overlay").height( $(document).height() );
		},
		
		_maintainPosition: function(status) {
			if( $.alerts.repositionOnResize ) {
				switch(status) {
					case true:
						$(window).bind('resize', $.alerts._reposition);
					break;
					case false:
						$(window).unbind('resize', $.alerts._reposition);
					break;
				}
			}
		}
		
	}
	
	// Shortuct functions
	jAlert = function(message, title, callback) {
		$.alerts.alert(message, title, callback);
	}
	
	jConfirm = function(message, title, callback) {
		$.alerts.confirm(message, title, callback);
	};
		
	jPrompt = function(message, value, title, callback) {
		$.alerts.prompt(message, value, title, callback);
	};
	
})(jQuery);

function cloturer_inscriptions1vs1ps3(strCloturerLesInscriptions) {
	reponse = confirm(strCloturerLesInscriptions);
	
	if (reponse)
		location.href = "?page=tournoisnews1vs1ps3&op=cloturer_inscriptions";
}

function cloturer_inscriptions1vs1xbox(strCloturerLesInscriptions) {
	reponse = confirm(strCloturerLesInscriptions);
	
	if (reponse)
		location.href = "?page=tournoisnews1vs1xbox&op=cloturer_inscriptions";
}

function valider_poules1vs1ps3(strValiderLesPoules) {
	reponse = confirm(strValiderLesPoules);
	
	if (reponse)
		location.href = "?page=tournoisnews1vs1ps3&op=valider_poules";
}


function valider_poules1vs1xbox(strValiderLesPoules) {
	reponse = confirm(strValiderLesPoules);
	
	if (reponse)
		location.href = "?page=tournoisnews1vs1xbox&op=valider_poules";
}

function terminer_poules(strTerminerLesPoules) {
	reponse = confirm(strTerminerLesPoules);

	if (reponse)
		location.href = "?page=tournoisnews1vs1ps3&op=terminer_poules";
}

function valider_finales(strValiderLesFinales) {
	reponse = confirm(strValiderLesFinales);
	
	if (reponse)
		location.href = "?page=tournoisnews&op=valider_finales";
}

function terminer_tournois(strTerminerLeTournois) {
	reponse = confirm(strTerminerLeTournois);

	if (reponse)
		location.href = "?page=tournoisnews&op=terminer_tournois";
}
function regisfinal() {
	

	
		location.href = "?page=regisfinal";
}
function show_flash(w, h, swf, color, fvar)
{
    document.write("<object type='application/x-shockwave-flash' data='"+swf+"' width='"+w+"' height='"+h+"'>");
    document.write("<param name='movie' value='"+swf+"' />");
    document.write("<param name='pluginurl' value='http://www.macromedia.com/go/getflashplayer' />");
    document.write("<!-- <param name='wmode' value='transparent' /> -->");
    document.write("<param name='bgcolor' value='"+color+"' />");
    document.write("<param name='menu' value='false' />");
    document.write("<param name='quality' value='best' />"); 
    document.write("<param name='scale' value='exactfit' />"); 
    document.write("<param name='flashvars' value='"+fvar+"' />");
    document.write("</object>");
}
function status_tournois(tournois,status,strChangerStatusTournois) {
		reponse = confirm(strChangerStatusTournois);

	if (reponse) 
		location.href = "?page=tournois&op=status&value=" + status + "&id=" + tournois;
	else
		location.href = "?page=tournois&op=admin";
}
function status_tournoisps3(tournois,status,strChangerStatusTournois) {
		reponse = confirm(strChangerStatusTournois);

	if (reponse) 
		location.href = "?page=admintournoisps3&op=status&value=" + status + "&id=" + tournois;
	else
		location.href = "?page=admintournoisps3&op=admin";
}

function poules_tournois(tournois,poules,strChangerPoules) {
	reponse = confirm(strChangerPoules);
	
	if (reponse) 
		location.href = "?page=tournois&op=poules&value=" + poules + "&id=" + tournois;
}
function poules_tournoisps3(tournois,poules,strChangerPoules) {
	reponse = confirm(strChangerPoules);
	
	if (reponse) 
		location.href = "?page=admintournoisps3&op=poules&value=" + poules + "&id=" + tournois;
}
function alerter(lien,strText) {
	reponse = confirm(strText);
	
	if (reponse) 
		location.href = lien;
}

function finales_winner(tournois,finales,strChangerFinales) {
	reponse = confirm(strChangerFinales);

	if (reponse) 
		location.href = "?page=tournoisnews&op=winner&value=" + finales + "&id=" + tournois;
}

function finales_looser(tournois,finales,strChangerLooser) {
	reponse = confirm(strChangerLooser);

	if (reponse) {
		location.href = "?page=tournoisnews&op=looser&value=" + finales + "&id=" + tournois;
	}
}

function finales_elimination(tournois,finales_type,strChangerElimination) {
	reponse = confirm(strChangerElimination);

	if (reponse) {
		location.href = "?page=tournoisnews&op=elimination&value=" + finales_type + "&id=" + tournois;
	}
}

function status_participe(equipe, status, strChangerStatusParticipe) {
	reponse = confirm(strChangerStatusParticipe);

	if (reponse)
		location.href = "?page=inscriptionsnews1vs1ps3&op=status&value=" + status + "&id=" + equipe;
}

function status_joueur(joueur, status, strChangerStatusJoueur) {
	reponse = confirm(strChangerStatusJoueur);

	if (reponse)
		location.href = "?page=joueurs&op=status&value=" + status + "&id=" + joueur;
}
function status_joueurps3(joueur, status, strChangerStatusJoueur) {
	reponse = confirm(strChangerStatusJoueur);

	if (reponse)
		location.href = "?page=joueursnewsps3&op=status&value=" + status + "&id=" + joueur;
}
function status_equipe(equipe, status, strChangerStatusEquipe) {
	reponse = confirm(strChangerStatusEquipe);

	if (reponse)
		location.href = "?page=equipes&op=status&value=" + status + "&id=" + equipe;
}

function valider_match() {	
	var str = this.opener.location;
	this.opener.location = str;
	this.close();
	
}

function select_map(map,form,input) {
	var tmpform=eval("this.opener.document."+form);	
	len = tmpform.elements.length;

	for (i = 0 ; i < len ; i++) {
		if(tmpform.elements[i].name == input) {
			break
		}
	}

	tmpform.elements[i].value = map;
	this.close();
}

function select_serveur(serveur,form,input) {
	var tmpform=eval("this.opener.document."+form);	
	len = tmpform.elements.length;

	for (i = 0 ; i < len ; i++) {
		if(tmpform.elements[i].name == input) {
			break
		}
	}

	tmpform.elements[i].value = serveur;
	this.close();
}


function select_avatar_cat(cat,url) {
	location.href = "?page=avatars&op=galerie&cat=" + cat + url + "&header=win";
}


function ouvrir_fenetre(addr,nom,height,width) {

	var top=(screen.height-height)/2;
	var left=(screen.width-width)/2;

	var windowops = eval("'status=yes,scrollbars=yes,top=" + top + ",left=" + left + ",height=" + height + ",width=" + width + "'");
	this.open(addr,nom,windowops);
}

function fermer_fenetre() {
	this.close();
}

function back() {
	history.go(-1);
}

function select_all(form) {
	var tmpform=eval("document."+form);
	len = tmpform.elements.length;
	for (i = 0 ; i < len ; i++) {		
		if((tmpform.elements[i].name.indexOf('m4prolongation')==-1) && (tmpform.elements[i].name.indexOf('m4autostart')==-1) && (tmpform.elements[i].name.indexOf('abprolongation')==-1) && (tmpform.elements[i].name.indexOf('abautostart')==-1) && (tmpform.elements[i].name.indexOf('autorecup')==-1)) {
			tmpform.elements[i].checked = true;
		}
	}
}

function unselect_all(form) {
	var tmpform=eval("document."+form);
	len = tmpform.elements.length;
	for (i = 0 ; i < len ; i++) {
		if((tmpform.elements[i].name.indexOf('m4prolongation')==-1) && (tmpform.elements[i].name.indexOf('m4autostart')==-1) && (tmpform.elements[i].name.indexOf('abprolongation')==-1) && (tmpform.elements[i].name.indexOf('abautostart')==-1) && (tmpform.elements[i].name.indexOf('autorecup')==-1)) {
			tmpform.elements[i].checked = false;
		}
	}
}

function alerter(lien,strText) {
reponse = confirm(strText);

if (reponse)
 location.href = lien;
}

/*******************************/
/***** refresh retroproj *******/
/** thx to adminbot code **/

var max_time = 30;
var compteur = 0;

function init_timer()
{
	if(document.forms[0].timer.value == 'checked')
	{
		document.getElementById("timer_status").innerHTML = 'On';
		document.getElementById("timer_status").style.color = '00FF00';
	}
}
function swap_timer()
{
	if(document.forms[0].timer.value == 'checked')
	{
		document.getElementById("timer_status").innerHTML = 'Off';
		document.getElementById("timer_status").style.color = 'CCCCCC';
		document.forms[0].timer.value = '';
		document.getElementById("time_value").innerHTML = '';
	}

	else if(document.forms[0].timer.value == '')
	{
		document.getElementById("timer_status").innerHTML = 'On';
		document.getElementById("timer_status").style.color = '00FF00';
		document.forms[0].timer.value = 'checked';
		compteur = 0;
		document.getElementById("time_value").innerHTML = max_time+'s';
	}
}

function refresh_timer()
{
	var url = '';
	compteur = compteur+1;

	if((document.forms[0].timer.value == 'checked') && (compteur >= max_time))
	{
		url = window.location.href;

		if(url.substring(url.length - 19,url.length) == 'autorefresh=checked') {
				url = url.substring(0,url.length - 20);
		}

		if(url.substring(url.length - 18,url.length) == 'autoscroll=checked') {
				url = url.substring(0,url.length - 19);
		}

		if(url.substring(url.length - 16,url.length) == 'hidemenu=checked') {
				url = url.substring(0,url.length - 17);
		}

		if(url.indexOf("?",0) > 0) {
			if((document.forms[0].menu.value == 'checked') && (document.forms[0].scroll.value == 'checked'))
				window.location.href = url + "&hidemenu=checked&autoscroll=checked&autorefresh=checked";
			else if(document.forms[0].scroll.value == 'checked')
				window.location.href = url + "&autoscroll=checked&autorefresh=checked";
			else if(document.forms[0].menu.value == 'checked')
				window.location.href = url + "&hidemenu=checked&autorefresh=checked";
			else
				window.location.href = url + "&autorefresh=checked";
		}
		else {
			if((document.forms[0].menu.value == 'checked') && (document.forms[0].scroll.value == 'checked'))
				window.location.href = url + "?hidemenu=checked&autoscroll=checked&autorefresh=checked";
			else if(document.forms[0].scroll.value == 'checked')
				window.location.href = url + "?autoscroll=checked&autorefresh=checked";
			else if(document.forms[0].menu.value == 'checked')
				window.location.href = url + "?hidemenu=checked&autorefresh=checked";
			else
				window.location.href = url + "?autorefresh=checked";
		}
			
	}
	else if(document.forms[0].timer.value == 'checked') {
		document.getElementById("time_value").innerHTML = max_time-compteur +'s';
	}
	setTimeout("refresh_timer()",1000);
}


function refresh_recup()
{
	compteur = compteur+1;

	if(compteur >= max_time)
	{
		window.location=window.location;
	}
	document.getElementById("time_value").innerHTML = max_time-compteur +'s'
	setTimeout("refresh_recup()",1000);
}


/*******************************/
/********* scrolling ***********/
var timeout;
var y = 0;
var step = 1;
var sens = 1;

function init_scroll()
{
	if(document.forms[0].scroll.value == 'checked')	{
		document.getElementById("scroll_status").innerHTML = 'On';
		document.getElementById("scroll_status").style.color = '00FF00';
		start_scroll();
	}
}

function swap_scroll() {

	if(document.forms[0].scroll.value == 'checked')	{
		document.getElementById("scroll_status").innerHTML = 'Off';
		document.getElementById("scroll_status").style.color = 'CCCCCC';
		document.forms[0].scroll.value = '';
		stop_scroll();
	}

	else if(document.forms[0].scroll.value == '') {
		document.getElementById("scroll_status").innerHTML = 'On';
		document.getElementById("scroll_status").style.color = '00FF00';
		document.forms[0].scroll.value = 'checked';
		start_scroll();
	}
}

function start_scroll() {
			
	if (document.body.scrollTop == 0) {
		sens = 1;			
	}		
	else if (document.body.scrollTop == document.body.scrollHeight - document.body.clientHeight ) {
		sens = 0;
	}	
		
	if (sens == 1) {
		doScrollDown();
	}
	else {
		doScrollUp();
	}
	
	timeout=setTimeout("start_scroll()",100);
}

function stop_scroll() {
	clearTimeout(timeout);
}

function doScrollUp() {
	y = document.body.scrollTop - step;
	self.scroll(0,y);
}

function doScrollDown() {
	y = document.body.scrollTop + step;
	self.scroll(0,y);
	
}

/*******************************/
/******* show hide menu ********/

function init_menu()
{
	if(document.forms[0].menu.value == 'checked')	{
		document.getElementById("menu_status").innerHTML = 'On';
		document.getElementById("menu_status").style.color = '00FF00';
		hideMenu("menudiv");
		hideMenu("menudiv_d");
	}
}

function swap_menu() {

	if(document.forms[0].menu.value == 'checked')	{
		document.getElementById("menu_status").innerHTML = 'Off';
		document.getElementById("menu_status").style.color = 'CCCCCC';
		document.forms[0].menu.value = '';
		showMenu("menudiv");
		showMenu("menudiv_d");
	}

	else if(document.forms[0].menu.value == '') {
		document.getElementById("menu_status").innerHTML = 'On';
		document.getElementById("menu_status").style.color = '00FF00';
		document.forms[0].menu.value = 'checked';
		hideMenu("menudiv");
		hideMenu("menudiv_d");
	}
}

function showMenu(element){
	document.getElementById(element).style.display="block";
}

function hideMenu(element){
	document.getElementById(element).style.display="none";
}

//var showImg = new Image();showImg.src = "images/show.gif";
//var hideImg = new Image();hideImg.src = "images/hide.gif";

function swapshow(element,img){
	var objDiv = document.getElementById(element).style;	
	var	objImg = document.getElementById(img);
	
	if(objDiv.display=="block") {
		hideMenu(element);
		objImg.src = hideImg.src;
	}
	else {
		showMenu(element);
		objImg.src = showImg.src;
		
	}
}

/*******************************/
/*********** horloge ***********/
// Original:  Ramandeep Singh (ramandeepji@yahoo.com) -- Web Site:  http://hard-drive.hypermart.net
var Digital;
c1 = new Image(); c1.src = "images/clock/1.gif";
c2 = new Image(); c2.src = "images/clock/2.gif";
c3 = new Image(); c3.src = "images/clock/3.gif";
c4 = new Image(); c4.src = "images/clock/4.gif";
c5 = new Image(); c5.src = "images/clock/5.gif";
c6 = new Image(); c6.src = "images/clock/6.gif";
c7 = new Image(); c7.src = "images/clock/7.gif";
c8 = new Image(); c8.src = "images/clock/8.gif";
c9 = new Image(); c9.src = "images/clock/9.gif";
c0 = new Image(); c0.src = "images/clock/0.gif";
cb = new Image(); cb.src = "images/clock/b.gif";
ct = new Image(); cb.src = "images/clock/t.gif";

function extract(h,m,s) {
	if (!document.images.a) return;

	if (h <= 9) {
		document.images.a.src = c0.src;
		document.images.b.src = eval("c"+h+".src");
	}
	else {
		document.images.a.src = eval("c"+Math.floor(h/10)+".src");
		document.images.b.src = eval("c"+(h%10)+".src");
	}
	if (m <= 9) {
		document.images.d.src = c0.src;
		document.images.e.src = eval("c"+m+".src");
	}
	else {
		document.images.d.src = eval("c"+Math.floor(m/10)+".src");
		document.images.e.src = eval("c"+(m%10)+".src");
	}
	if (s <= 9) {
		document.g.src = c0.src;
		document.images.h.src = eval("c"+s+".src");
	}
	else {
		document.images.g.src = eval("c"+Math.floor(s/10)+".src");
		document.images.h.src = eval("c"+(s%10)+".src");
	}
}

function show(datephp) {
	if(!document.images.a) return;
		
	if (datephp) Digital = new Date(datephp);

	var hours = Digital.getHours();
	var minutes = Digital.getMinutes();
	var seconds = Digital.getSeconds();
	Digital.setSeconds( seconds+1 );

	extract(hours, minutes, seconds);

	setTimeout("show()", 1000);
}

function lien_msg(msg,url)
{
	temp = prompt( msg, url );
	return false;
}

//***INFO BULLE***//

var IB=new Object;
var posX=0;posY=0;
var xOffset=10;yOffset=10;
function AffBulle(texte) {
  contenu="<TABLE border=0 cellspacing=0 cellpadding=0 class=\"bordure1\"><TR><TD><TABLE border=0 cellpadding=2 cellspacing=1><TR><TD class=\"text\">"+texte+"</TD></TR></TABLE></TD></TR></TABLE>&nbsp;";
  var finalPosX=posX-xOffset;
  if (finalPosX<0) finalPosX=0;
  if (document.layers) {
    document.layers["bulle"].document.write(contenu);
    document.layers["bulle"].document.close();
    document.layers["bulle"].top=posY+yOffset;
    document.layers["bulle"].left=finalPosX;
    document.layers["bulle"].visibility="show";}
  if (document.all) {
    //var f=window.event;
    //doc=document.body.scrollTop;
    bulle.innerHTML=contenu;
    document.all["bulle"].style.top=posY+yOffset;
    document.all["bulle"].style.left=finalPosX;//f.x-xOffset;
    document.all["bulle"].style.visibility="visible";
  }
  //modif CL 09/2001 - NS6 : celui-ci ne supporte plus document.layers mais document.getElementById
  else if (document.getElementById) {
    document.getElementById("bulle").innerHTML=contenu;
    document.getElementById("bulle").style.top=posY+yOffset;
    document.getElementById("bulle").style.left=finalPosX;
    document.getElementById("bulle").style.visibility="visible";
  }
}
function getMousePos(e) {
  if (document.all) {
  posX=event.x+document.body.scrollLeft; //modifs CL 09/2001 - IE : regrouper l'&eacute;vènement
  posY=event.y+document.body.scrollTop;
  }
  else {
  posX=e.pageX; //modifs CL 09/2001 - NS6 : celui-ci ne supporte pas e.x et e.y
  posY=e.pageY; 
  }
}
function HideBulle() {
	if (document.layers) {document.layers["bulle"].visibility="hide";}
	if (document.all) {document.all["bulle"].style.visibility="hidden";}
	else if (document.getElementById){document.getElementById("bulle").style.visibility="hidden";}
}

function InitBulle(ColTexte,ColFond,ColContour,NbPixel) {
	IB.ColTexte=ColTexte;IB.ColFond=ColFond;IB.ColContour=ColContour;IB.NbPixel=NbPixel;
	if (document.layers) {
		window.captureEvents(Event.MOUSEMOVE);window.onMouseMove=getMousePos;
		document.write("<LAYER name='bulle' top=0 left=0 visibility='hide'></LAYER>");
	}
	if (document.all) {
		document.write("<DIV id='bulle' style='position:absolute;top:0;left:0;visibility:hidden'></DIV>");
		document.onmousemove=getMousePos;
	}
	//modif CL 09/2001 - NS6 : celui-ci ne supporte plus document.layers mais document.getElementById
	else if (document.getElementById) {
	        document.onmousemove=getMousePos;
	        document.write("<DIV id='bulle' style='position:absolute;top:0;left:0;visibility:hidden'></DIV>");
	}

}
function menu(id) {
  if(id == 1) {
    if(document.getElementById('menu1').style.display == 'none') {
      document.getElementById('menu1').style.display = 'block';
    }
    document.getElementById('menu2').style.display = 'none';
    document.getElementById('menu3').style.display = 'none';
	document.getElementById('menu4').style.display = 'none';
	document.getElementById('menu5').style.display = 'none';
	document.getElementById('menu6').style.display = 'none';
  } else if(id == 2) {
    if(document.getElementById('menu2').style.display == 'none') {
      document.getElementById('menu2').style.display = 'block';
    }
	document.getElementById('menu6').style.display = 'none';
	document.getElementById('menu5').style.display = 'none';
	document.getElementById('menu4').style.display = 'none';
    document.getElementById('menu3').style.display = 'none';
    document.getElementById('menu1').style.display = 'none';
  } else if(id == 3) {
    if(document.getElementById('menu3').style.display == 'none') {
      document.getElementById('menu3').style.display = 'block';
    }
    document.getElementById('menu1').style.display = 'none';
    document.getElementById('menu2').style.display = 'none';
	document.getElementById('menu4').style.display = 'none';
	document.getElementById('menu5').style.display = 'none';
	document.getElementById('menu6').style.display = 'none';
  } else if(id == 4) {
    if(document.getElementById('menu4').style.display == 'none') {
      document.getElementById('menu4').style.display = 'block';
    }
    document.getElementById('menu1').style.display = 'none';
    document.getElementById('menu2').style.display = 'none';
	document.getElementById('menu3').style.display = 'none';
	document.getElementById('menu5').style.display = 'none';
	document.getElementById('menu6').style.display = 'none';
  } else if(id == 5) {
    if(document.getElementById('menu5').style.display == 'none') {
      document.getElementById('menu5').style.display = 'block';
    }
	document.getElementById('menu6').style.display = 'none';
	document.getElementById('menu4').style.display = 'none';
    document.getElementById('menu3').style.display = 'none';
    document.getElementById('menu2').style.display = 'none';
    document.getElementById('menu1').style.display = 'none';
  } else if(id == 6) {
    if(document.getElementById('menu6').style.display == 'none') {
      document.getElementById('menu6').style.display = 'block';
    }
    document.getElementById('menu1').style.display = 'none';
    document.getElementById('menu2').style.display = 'none';
	document.getElementById('menu3').style.display = 'none';
	document.getElementById('menu4').style.display = 'none';
	document.getElementById('menu5').style.display = 'none';
 }
}
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
InitBulle("navy","#FFCC66","orange",1);
