
/***********************************************
* Image w/ description tooltip- By Dynamic Web Coding (www.dyn-web.com)
* Copyright 2002-2007 by Sharon Paine
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

/* IMPORTANT: Put script after tooltip div or 
	 put tooltip div just before </BODY>. */

var dom = (document.getElementById) ? true : false;
var ns5 = (!document.all && dom || window.opera) ? true: false;
var ie5 = ((navigator.userAgent.indexOf("MSIE")>-1) && dom) ? true : false;
var ie4 = (document.all && !dom) ? true : false;
var nodyn = (!ns5 && !ie4 && !ie5 && !dom) ? true : false;

var origWidth, origHeight;

// avoid error of passing event object in older browsers
if (nodyn) { event = "nope" }

///////////////////////  CUSTOMIZE HERE   ////////////////////
// settings for tooltip 
// Do you want tip to move when mouse moves over link?
var tipFollowMouse= true;	
// Be sure to set tipWidth wide enough for widest image
var tipWidth= 205;
var offX= 20;	// how far from mouse to show tip
var offY= 12; 
var tipFontFamily= "Verdana, arial, helvetica, sans-serif";
var tipFontSize= "8pt";
// set default text color and background color for tooltip here
// individual tooltips can have their own (set in messages arrays)
// but don't have to
var tipFontColor= "#000000";
var tipBgColor= "#FFFFFF"; 
var tipBorderColor= "#980000";
var tipBorderWidth= 3;
var tipBorderStyle= "ridge";
var tipPadding= 4;

// tooltip content goes here (image, description, optional bgColor, optional textcolor)
var messages = new Array();
// multi-dimensional arrays containing: 
// image and text for tooltip

// to layout image and text, 2-row table, image centered in top cell
// these go in var tip in doTooltip function
// startStr goes before image, midStr goes between image and text
var startStr = '<table width="' + tipWidth + '"><tr><td align="center" width="100%"><img src="../pix/liste/';
var midStr = '.gif" border="0"></td></tr><tr><td valign="top">';
var endStr = '</td></tr></table>';

////////////////////////////////////////////////////////////
//  initTip	- initialization for tooltip.
//		Global variables for tooltip. 
//		Set styles
//		Set up mousemove capture if tipFollowMouse set true.
////////////////////////////////////////////////////////////
var tooltip, tipcss;
function initTip() {
	if (nodyn) return;
	tooltip = (ie4)? document.all['tipDiv']: (ie5||ns5)? document.getElementById('tipDiv'): null;
	tipcss = tooltip.style;
	if (ie4||ie5||ns5) {	// ns4 would lose all this on rewrites
		tipcss.width = tipWidth+"px";
		tipcss.fontFamily = tipFontFamily;
		tipcss.fontSize = tipFontSize;
		tipcss.color = tipFontColor;
		tipcss.backgroundColor = tipBgColor;
		tipcss.borderColor = tipBorderColor;
		tipcss.borderWidth = tipBorderWidth+"px";
		tipcss.padding = tipPadding+"px";
		tipcss.borderStyle = tipBorderStyle;
	}
	if (tooltip&&tipFollowMouse) {
		document.onmousemove = trackMouse;
	}
}

window.onload = initTip;

/////////////////////////////////////////////////
//  doTooltip function
//			Assembles content for tooltip and writes 
//			it to tipDiv
/////////////////////////////////////////////////
var t1,t2;	// for setTimeouts
var tipOn = false;	// check if over tooltip link
function doTooltip(evt,num) {
	if (!tooltip) return;
	if (t1) clearTimeout(t1);	if (t2) clearTimeout(t2);
	tipOn = true;
	if (ie4||ie5||ns5) {
		var tip = startStr + num + midStr + endStr;
	 	tooltip.innerHTML = tip;
	}
	if (!tipFollowMouse) positionTip(evt);
	else t1=setTimeout("tipcss.visibility='visible'",100);
}

var mouseX, mouseY;
function trackMouse(evt) {
	standardbody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body //create reference to common "body" across doctypes
	mouseX = (ns5)? evt.pageX: window.event.clientX + standardbody.scrollLeft;
	mouseY = (ns5)? evt.pageY: window.event.clientY + standardbody.scrollTop;
	if (tipOn) positionTip(evt);
}

/////////////////////////////////////////////////////////////
//  positionTip function
//		If tipFollowMouse set false, so trackMouse function
//		not being used, get position of mouseover event.
//		Calculations use mouseover event position, 
//		offset amounts and tooltip width to position
//		tooltip within window.
/////////////////////////////////////////////////////////////
function positionTip(evt) {
	if (!tipFollowMouse) {
		standardbody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body
		mouseX = (ns5)? evt.pageX: window.event.clientX + standardbody.scrollLeft;
		mouseY = (ns5)? evt.pageY: window.event.clientY + standardbody.scrollTop;
	}
	// tooltip width and height
	var tpWd = (ie4||ie5)? tooltip.clientWidth: tooltip.offsetWidth;
	var tpHt = (ie4||ie5)? tooltip.clientHeight: tooltip.offsetHeight;
	// document area in view (subtract scrollbar width for ns)
	var winWd = (ns5)? window.innerWidth-20+window.pageXOffset: standardbody.clientWidth+standardbody.scrollLeft;
	var winHt = (ns5)? window.innerHeight-20+window.pageYOffset: standardbody.clientHeight+standardbody.scrollTop;
	// check mouse position against tip and window dimensions
	// and position the tooltip 
	if ((mouseX+offX+tpWd)>winWd) 
		tipcss.left = mouseX-(tpWd+offX)+"px";
	else tipcss.left = mouseX+offX+"px";
	if ((mouseY+offY+tpHt)>winHt) 
		tipcss.top = winHt-(tpHt+offY)+"px";
	else tipcss.top = mouseY+offY+"px";
	if (!tipFollowMouse) t1=setTimeout("tipcss.visibility='visible'",100);
}

function hideTip() {
	if (!tooltip) return;
	t2=setTimeout("tipcss.visibility='hidden'",100);
	tipOn = false;
}

document.write('<div id="tipDiv" style="position:absolute; visibility:hidden; z-index:100"></div>')

// ----------------------------------------------------------------------------
// FRACTAL POPUP SCRIPT
// Thomas Hautesserres (VKV) email: thomas@hautesserres.com
// Version 1.001 (2003/10/25, 16:00)
// ----------------------------------------------------------------------------

// ----------------------------------------------------------------------------
// PUBLIC CONSTANTS
//

// Minimum displayed icons count. Can be 0.
var fract_minCompIcon = 5;

// Icon file name prefix and suffix. The "type" parameter is inserted in between
// to generate the file name. If a inactive icon must to displayed, the empty
// suffix is added to the type name.
//
// Final image name is: <prefix><type>[<title>|<brick>][<empty>]<suffix>

var fract_compIconPrefix = "../../pix/ico_";
var fract_compIconTitle  = "_titre";
var fract_compIconEmpty  = "_vide"; //"_vide";
var fract_compIconBrick  = "_brique";
var fract_compIconSuffix = ".gif";

// Parameters
// type: Icon type, appended to fract_compIconPrefix.

function fract_compIco_Rag (type, barCount, brickCount, altText)
{
  var imgStart    = "<IMG class=\"carac\" SRC=\"";
  var imgEnd      = "\" TITLE=\"" + altText + "\" alt=\"" + altText + "\">";
  
  var title       = imgStart +
                    fract_compIconPrefix + type + fract_compIconTitle + fract_compIconSuffix +
                    imgEnd;

  var full        = imgStart +
                    fract_compIconPrefix + type + fract_compIconSuffix+
                    imgEnd;

  var empty       = imgStart +
                    fract_compIconPrefix + fract_compIconEmpty + fract_compIconSuffix+
                    imgEnd;

  var full_brick  = imgStart +
                    fract_compIconPrefix + type + fract_compIconBrick + fract_compIconSuffix+
                    imgEnd;

  var empty_brick = imgStart +
                    fract_compIconPrefix + type + fract_compIconBrick + fract_compIconEmpty  + fract_compIconSuffix+
                    imgEnd;

  document.write("<TD class=\"ico\" valign=\"center\" colspan=\"2\" width=\"50%\">" + 
                 "<A href=\"popup_legende.php?type=" + type + "\" target=\"prime\">");
  document.write(title);

  // Insert icons
  for (i = 0; i < barCount; i++)
  {
    if (i < brickCount)
    {
        document.write (full_brick);
    } else {
        document.write (full);
    }
  }
  for (i = barCount; i < fract_minCompIcon; i++)
  {
    if (i < brickCount)
    {
        document.write (empty_brick);
    }  else {
        document.write (empty);
    }
  }
  
  // End table cell.
  document.write("</A></TD>");
}


// ----------------------------------------------------------------------------
// TAB PAGES DRAWING SCRIPT
// Thomas Hautesserres (VKV) email: thomas@hautesserres.com
// ----------------------------------------------------------------------------

// ----------------------------------------------------------------------------
// CONSTANTS
//

var tab_backgrdColorNormal = "transparent"; // Tab pages' background color or 'transparent'
var tab_backgrdColorActive = "#F0EDD4";     // Background color of tab titles under mouse pointer.

var tab_foregrdColorNormal = "#888888"; // Foreground color of not currently selected tab title.
var tab_foregrdColorActive = "black";   // Foreground color of currently selected tab title.

// ----------------------------------------------------------------------------
// PUBLIC FUNCTION
//

function tab_startHeaders(width, align)
{
  // Reset variables
  g_tabTotalCount = 0;
  g_tabCurrent    = 0;

  // Insert HTML element.
  var element = "<TABLE width=\"" + width + "\" align=\"" + align + "\" border=0 cellpadding=0 cellspacing=0><TR>";

  document.writeln(element);
}


function tab_addHeader(headerTitle)
{
  // Increment table count
  g_tabTotalCount++;

  // Insert HTML element
  var element = "<TD><DIV " +
                  "ID=\"tab_header" + g_tabTotalCount + "\" " +
                  "class=\"tab_header\" " +
                  "onClick=\"return tab_showTab(" + g_tabTotalCount + ");\" " +
                  "onMouseOut=\"this.style.background='" + tab_backgrdColorNormal + "';\" " +
                  "onMouseOver=\"this.style.background='" + tab_backgrdColorActive + "';\" "+
                ">" + headerTitle + "</DIV></TD>";

  document.writeln(element);
}


function tab_closeHeaders()
{
  var element = "</TR>";
  document.writeln(element);

}





function tab_startAllTabs()
{
  var element = "<TR><TD colspan=\"" + g_tabTotalCount + "\">";

  document.writeln(element);
}

function tab_startTab()
{
  // Increment current tab ID
  g_tabCurrent++;

  if (g_tabCurrent > g_tabTotalCount)
  {
    alert ("Too many tabs added!");
    return;
  }

  // Insert HTML element

  var element = "<DIV " +
                  "ID=\"tab_page" + g_tabCurrent + "\"" +
                  "class=\"tab_page\"" +
                ">";

  document.writeln(element);

}

function tab_closeTab()
{
  // Insert HTML element
  var element = "</DIV>";

  document.writeln(element);

}



function tab_closeAllTabs()

{

  if (g_tabCurrent < g_tabTotalCount)

  {

    alert ("Not enough tabs added!");

  }

  

  g_tabCurrent = 1;

  tab_showTab(1);



  var element = "</TD></TR></TABLE>";



  document.writeln(element);

}



// ----------------------------------------------------------------------------
//                    END OF PUBLIC PART
// ----------------------------------------------------------------------------

// ----------------------------------------------------------------------------
// PRIVATE VARIABLES
// Should not be accessed outside this file.

// Total number of tab headers, reset by tab_startHeaders() and 
// incremented by tab_addHeader().

var g_tabTotalCount = 0;



// Current tab. Used by tab_addTab(). Valid tab number range from 1 to g_tabTotalCount.

var g_tabCurrent;



// True if Internet Explorer, else false.

var g_tabIE = (navigator.appName == "Microsoft Internet Explorer");



// ----------------------------------------------------------------------------

// PRIVATE FUNCTIONS



function tab_showTab (tabNumber)
{
  var headStyle;
  var tabStyle;

  // Hide current tab
  tabStyle = tab_getTabStyle(g_tabCurrent);
  tabStyle.display = "none";

  // Change border of currently selected header
  headStyle = tab_getHeaderStyle (g_tabCurrent);
  headStyle.borderBottomWidth = 1;
  headStyle.borderBottomColor = headStyle.borderTopColor;
  headStyle.borderBottomStyle = "solid";
  headStyle.color             = tab_foregrdColorNormal;
  headStyle.fontWeight        = "normal";

  // Show selected tab
  g_tabCurrent = tabNumber;

  tabStyle = tab_getTabStyle(g_tabCurrent);
  tabStyle.display = "block";

  // Change border of new selected header
  headStyle = tab_getHeaderStyle (g_tabCurrent);
  headStyle.borderBottomWidth = 0;
  headStyle.borderBottomColor = headStyle.background;
  headStyle.borderBottomStyle = "none";
  headStyle.color             = tab_foregrdColorActive;
  headStyle.fontWeight        = "bold";

}



function tab_getHeaderStyle(headerNumber)

{

  return tab_getStyle("tab_header" + headerNumber);

}



function tab_getTabStyle(tabNumber)

{

  return tab_getStyle("tab_page" + tabNumber);

}





function tab_getStyle (elementName)

{

  if (g_tabIE)

  {

    return document.all[elementName].style;

  }

  else

  {

    return document.getElementById(elementName).style;

  }

}



function getXhr(){
                                var xhr = null; 
				if(window.XMLHttpRequest) // Firefox et autres
				   xhr = new XMLHttpRequest(); 
				else if(window.ActiveXObject){ // Internet Explorer 
				   try {
			                xhr = new ActiveXObject("Msxml2.XMLHTTP");
			            } catch (e) {
			                xhr = new ActiveXObject("Microsoft.XMLHTTP");
			            }
				}
				else { // XMLHttpRequest non supporté par le navigateur 
				   alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest..."); 
				   xhr = false; 
				} 
                                return xhr
			}
			
			/**
			* Faire un signe de la main
			*/
			function salut(cazid,caztyp){
				var xhr = getXhr()
				document.getElementById('coucou').style.display = "none";;
				xhr.open("GET","../public/salut.php?cazid="+cazid+"&caztyp="+caztyp,true);
				xhr.send(null);
			}
