//=====================================================================================
//================================== Personalized tooltip =============================
//=====================================================================================

/**************************************************************************************
 * Author: spe (february 2006)
 * How to use:
 *		1) insert these tags in the body section:
 *			<div id="dhtmltooltip" class="toolTip1" style="position:absolute; visibility:hidden; z-index:100;"></div>
 *			<script language="JavaScript" src="tooltip.js"><!----></script>
 *
 *		2) call the function showtip(...) and hidetip(...) like this:
 *			<div onMouseOver="showtip('It's a tooltip :)','aCssClassName',event,-300,-75)" onMouseOut="hidetip('dhtmltooltip')">Some text ...</div>
 *
 ***************************************************************************************/
var ie=document.all;								//IExplorer
var ns6=document.getElementById && !document.all;	//Netscape
var ns4=document.layers;
var ie5=document.all && !window.opera
var dom = document.getElementById;					//Test if support DHTML
var Vitesse = speed = 10;
var decalage = 5;


/*
 * Process: Display a tooltip
 * Input: [name of the container tag], [the text to display], [the keyword: event], [x offset], [y offset]
 */
function showtip(idElem,text,cssClass,e,x,y)
{
	//--Uncomment to use the title attribute and change the function to pass the reference 'this' of the tag (don't use alt which work only on ie)
	//current.title=text;
	if (dom)
	{
	  var hauteur = document.getElementById(idElem).offsetHeight;
      var largeur = document.getElementById(idElem).offsetWidth;
      
      var xpage = (ie)?e.x + document.body.scrollLeft  : e.pageX; 
      var ypage = (ie)?e.y + document.body.scrollTop : e.pageY; 
      
      var posTop = 0;
      var posLeft = 0;
      
		if (xpage >= 500)
		{
			posLeft = xpage - largeur - x;
		}
		else
		{
			posLeft = x + xpage;
		}
		
		if (ypage >= 300)
		{
			posTop = ypage - hauteur - y;
			if (posTop < 0) {posTop = 10;}
		}
		else
		{
			posTop = y + ypage;
		}
		
		
		if(typeof(document.getElementById(idElem).style.left)=="string") 
		{
			document.getElementById(idElem).style.top = posTop+"px";
			document.getElementById(idElem).style.left = posLeft+"px";
		} 
		else 
		{
			document.getElementById(idElem).style.top = posTop;
			document.getElementById(idElem).style.left = posLeft;
		}
     var content = "<TABLE style='z-index:100' border='0' CELLPADDING='0' CELLSPACING='0'";	
      content += "<TR><TD class='"+cssClass+"'>"+text+"</TD></TR>";	
      content += "</TABLE>";
      
      document.getElementById(idElem).innerHTML = content;
      document.getElementById(idElem).style.visibility = "visible";	
	}
}

/*
 * Process: Hide a displayed tooltip
 * Input: [name of the container tag]
 */

function hidemenu(idElem){
	if (window.document.getElementById(idElem))
	document.getElementById(idElem).style.visibility="hidden"
}

/**************************************************************************************
 * Author: spe (february 2006)
 * How to use:
 *		1) insert these tags in the body section:
 *			<div id="dhtmltooltip" class="toolTip1" style="position:absolute; visibility:hidden; z-index:100;"></div>
 *			<script language="JavaScript" src="tooltip.js"><!----></script>
 *
 *		2) call the function showPopupImage(...) and hidePopupImage(...) like this e.g.:
 *			<div onMouseOver="showPopupImage('imagepath'','aCssClassName',event,-300,-75)" onMouseOut="hidePopupImage('dhtmltooltip')">Some text ...</div>
 *
 ***************************************************************************************/
/*
 * Process: Display a picture larger
 * Input: [name of the container tag], [the text to display], [the keyword: event], [x offset], [y offset]
 */
function showPopupImage(idElem,path,cssClass,e,x,y)
{
	//--Uncomment to use the title attribute and change the function to pass the reference 'this' of the tag (don't use alt which work only on ie)
	//current.title=text;
	
	if (dom)
	{
	  var hauteur = document.getElementById(idElem).offsetHeight;
      var largeur = document.getElementById(idElem).offsetWidth;
      
      var xpage = (ie)?e.x + document.body.scrollLeft  : e.pageX; 
      var ypage = (ie)?e.y + document.body.scrollTop : e.pageY; 
      
      var posTop = 0;
      var posLeft = 0;
      
		if (xpage >= 500)
		{
			posLeft = xpage - largeur - x;
		}
		else
		{
			posLeft = x + xpage;
		}
		
		if (ypage >= 300)
		{
			posTop = ypage - hauteur - y;
			if (posTop < 0) {posTop = 10;}
		}
		else
		{
			posTop = y + ypage;
		}
		
		
		if(typeof(document.getElementById(idElem).style.left)=="string") 
		{
			document.getElementById(idElem).style.top = posTop+"px";
			document.getElementById(idElem).style.left = posLeft+"px";
		} 
		else 
		{
			document.getElementById(idElem).style.top = posTop;
			document.getElementById(idElem).style.left = posLeft;
		}
      var content = "<TABLE style='z-index:10' width='100%' align='center' border='0' CELLPADDING='0' CELLSPACING='0' class='"+cssClass+"'>";	
      content += "<TR><TD width='100%'><img src='"+path+"' /></TD></TR>";	
      content += "</TABLE>";
      
      document.getElementById(idElem).innerHTML = content;
      document.getElementById(idElem).style.visibility = "visible";	
	}
}

/*
 * Process: Hide the larger image
 * Input: [name of the container tag]
 */
function hidePopupImage(idElem)
{
   if (dom)
      document.getElementById(idElem).style.visibility = "hidden";
}

function Opacity(start, end) {
	document.getElementById('Visuel').style.filter = "alpha(opacity="+parseInt(start)+")"; 
	start = start + decalage;
	DG = setTimeout("Opacity("+start+", "+end+")", speed);
	if (start >= end) { clearTimeout(DG); }
}

function run_filter(obj){	
	if(obj && obj.filters[0]){
		obj.filters[0].apply();
		obj.visibility="visible";
		obj.filters[0].play();
	}
}

function showInfoBulle()
{
	if (dom)
		{
			var ContentInfoBulle = "<div id='InfoBulleTranslucide' class='InfoBulleTranslucide'></div>";
				ContentInfoBulle += "<div id='InfoBulleTexteOpaque' class='InfoBulleTexteOpaque'>";
				ContentInfoBulle += "<table border='0' cellpadding='0' cellspacing='0' width='650'>";
				ContentInfoBulle += "<tr>";
				ContentInfoBulle += "<td><img src='"+PortalRootPath+"/images/design/InfoBulle_01.gif' width='32' height='27'></td>";
				ContentInfoBulle += "<td class='InfoBulleTop'></td>";
				ContentInfoBulle += "<td><img src='"+PortalRootPath+"/images/design/InfoBulle_03.gif' width='30' height='27'></td>";
				ContentInfoBulle += "</tr>";
				ContentInfoBulle += "<tr>";
				ContentInfoBulle += "<td class='InfoBulleLeft'></td>";
				ContentInfoBulle += "<td class='InfoBulleTxt'>";
				ContentInfoBulle += "<table border='0' cellpadding='0' cellspacing='5'>";
				ContentInfoBulle += "<tr>";
				ContentInfoBulle += "<td><img src='"+PortalRootPath+"/images/design/InfoBulleSmiley.gif'></td>";
				ContentInfoBulle += "<td Class='InfoBulleTexte' id='LblMessage'>"+InfoBulleMessage+"</td>";
				ContentInfoBulle += "</tr>";
				ContentInfoBulle += "</table>";
				ContentInfoBulle += "</td>";
				ContentInfoBulle += "<td class='InfoBulleRight'></td>";
				ContentInfoBulle += "</tr>";
				ContentInfoBulle += "<tr>";
				ContentInfoBulle += "<td class='InfoBulleLeft'></td>";
				ContentInfoBulle += "<td class='InfoBulleTxt'><img src='"+PortalRootPath+"/images/design/InputVioletFormLeft.jpg' align='absmiddle'><a href='Javascript:hideInfoBulle()' id='InfoBulleOk' Class='input'>"+InfoBulleOk+"</a><img src='"+PortalRootPath+"/images/design/InputVioletFormRight.jpg' align='absmiddle'><img src='"+PortalRootPath+"/images/design/InputVioletFormLeft.jpg' align='absmiddle'><a id='InfoBulleCancel' href='"+PortalRootPath+"/Forms/MailContact.aspx' Class='input'>"+InfoBulleCancel+"</a><img src='"+PortalRootPath+"/images/design/InputVioletFormRight.jpg' align='absmiddle'></td>";
				ContentInfoBulle += "<td class='InfoBulleRight'></td>";
				ContentInfoBulle += "</tr>";
				ContentInfoBulle += "<tr>";
				ContentInfoBulle += "<td>";
				ContentInfoBulle += "<img src='"+PortalRootPath+"/images/design/InfoBulle_07.gif' width='32' height='30'></td>";
				ContentInfoBulle += "<td class='InfoBulleBottom'></td>";
				ContentInfoBulle += "<td>";
				ContentInfoBulle += "<img src='"+PortalRootPath+"/images/design/InfoBulle_09.gif' width='30' height='30'></td>";
				ContentInfoBulle += "</tr>";
				ContentInfoBulle += "</table>";
				ContentInfoBulle += "</div>";
			document.getElementById("InfoBulle").innerHTML = ContentInfoBulle;
			document.getElementById("InfoBulle").style.visibility = "visible";
			
			var pageWidth = 0; var pageHeight = 0;
			
			pageWidth =  window.innerWidth;
			pageWidth = (pageWidth)? pageWidth : document.documentElement.clientWidth;
			pageWidth = (pageWidth)? pageWidth: document.body.clientWidth;

			pageHeight =  window.innerHeight;
			pageHeight = (pageHeight)? pageHeight: document.documentElement.clientHeight;
			pageHeight = (pageHeight)? pageHeight: document.body.clientHeight;
			
			var myDiv = document.getElementById('InfoBulleTexteOpaque');
			var posLeft = ((pageWidth/2)-(myDiv.offsetHeight/2))/2;
			myDiv.style.left = (posLeft<0)?0+"px":posLeft+"px";
			var posTop = (pageHeight-myDiv.offsetHeight)/2;
			myDiv.style.top = (posTop<0)?0+"px":posTop+"px";
			
		}

}

function hideInfoBulle()
{
	if (dom) { document.getElementById('InfoBulle').style.visibility = "hidden"; }
}

function initAjax()
{
	if(typeof ActiveXObject == 'undefined') 
    { 
        xmlHttpRequest = new XMLHttpRequest(); 
    } 
    else 
    { 
        xmlHttpRequest = new ActiveXObject("Microsoft.XMLHTTP"); 
    }
}

