//------------------------------------------------------------------------------------------------------
//                                        Gestion des langues
//------------------------------------------------------------------------------------------------------
var currentLng //language courant

currentUrl=(document.location+"").toLowerCase() //adresse courante de la page

//recherche _nl _fr _en dans l'adresse
startPosIndexNl=currentUrl.toLowerCase().indexOf("_nl")
startPosIndexFr=currentUrl.toLowerCase().indexOf("_fr")
startPosIndexEn=currentUrl.toLowerCase().indexOf("_en")
  
//trouve la langue courante	
if (startPosIndexNl>0) { currentLng="Nl" }
if (startPosIndexEn>0) { currentLng="En" }
if (startPosIndexFr>0) { currentLng="Fr" }


function swapToLng(f_LngToSwap)
  {
  //génère le string de la nouvelle adresse	
  newUrl=currentUrl.replace("_"+currentLng.toLowerCase(),"_"+f_LngToSwap)

  //Envoie à la nouvelle adresse
  document.location=newUrl
  }

//------------------------------------------------------------------------------------------------------
//                                        Utilitaires
//------------------------------------------------------------------------------------------------------
function w(Param) {document.write(Param)}

IE = document.all?true:false;
IE4  = (document.all && !document.getElementById) ? true : false;
IE5  = (document.all && document.getElementById) ? true : false;
NS4 = (document.layers) ? true : false;
N6   = (document.getElementById && !document.all) ? true : false;

ScrW=screen.width
ScrH=screen.height

function getDocObject(P_Id)
{
if (IE4 || IE5) {return document.all(P_Id)}
if (N6) {return document.getElementById(P_Id)}
}

function findDocObject(P_Id)
{
if (IE4 || IE5) {if (document.all(P_Id)) {return true} else {return false}}
if (N6) {if ( document.getElementById(P_Id)) {return true} else {return false}}
}

//------------------------------------------------------------------------------------------------------
//                                        Gestion des menus
//------------------------------------------------------------------------------------------------------
var MenuLevel1NumCurrentBtn=0 ; //numéro du bouton courant
var MenuRigthCurrentBtn


var MenuLanguagesBtn_Src    = new Array("Fr","Nl")

  var MenuLanguagesBtn_Txt_Fr = new Array("Fr","Nl","En")
  var MenuLanguagesBtn_Txt_Nl = new Array("Fr","Nl","En")
  var MenuLanguagesBtn_Txt_En = new Array("Fr","Nl","En")

  var MenuLanguagesBtn_Url_Fr = new Array("javascript:swapToLng('Fr')","javascript:swapToLng('Nl')","javascript:swapToLng('En')")


var MenuLevel1LeftBtn_Src    = new Array("Home","Presentation","Services","Products","Contacts")

  var MenuLevel1LeftBtn_Txt_Fr = new Array("Accueil","Présentation","Services","Produits","Contacts")
  var MenuLevel1LeftBtn_Txt_Nl = new Array("Onthaal","Voorstelling","Voorstelling","Producten","Contacten")
  var MenuLevel1LeftBtn_Txt_En = new Array("Home","Presentation","Services","Products","Contacts")

  var MenuLevel1LeftBtn_Url_Fr = new Array("Home_Fr.htm","AboutFame_Fr.htm","ServicesTraining_Fr.htm","EFormations_Fr.htm","ContactUs_Fr.htm")
  var MenuLevel1LeftBtn_Url_Nl = new Array("Home_Nl.htm","AboutFame_Nl.htm","ServicesTraining_Nl.htm","EFormations_Nl.htm","ContactUs_Nl.htm")
  var MenuLevel1LeftBtn_Url_En = new Array("Accueil.htm","Presentation.htm","Services.htm","Produits.htm","Contacts.htm")


var MenuLevel2Space = new Array(24,8,64,176,270) // espace d'alignement à gauche pour le menu de niveau 2 en fonction du niveau 1 selectioné


var MenuRightBtn_Src = new Array("LogIn","SiteMap","Fr","Nl")

  var MenuRightBtn_Txt_Fr = new Array("Log In","Site Map","","","")
  var MenuRightBtn_Txt_Nl = new Array("Log In","Site Map","","","")
  var MenuRightBtn_Txt_En = new Array("Log In","Site Map","","","")

//  var MenuRightBtn_Url_Fr = new Array("LogIn_Fr.htm","SiteMap_Fr.htm","javascript:swapToLng('fr')","javascript:swapToLng('nl')","javascript:swapToLng('en')")
  var MenuRightBtn_Url_Fr = new Array("LogIn_Fr.htm","SiteMap_Fr.htm","javascript:swapToLng('fr')","javascript:swapToLng('nl')","javascript:swapToLng('en')")
  var MenuRightBtn_Url_Nl = new Array("LogIn_Nl.htm","SiteMap_Nl.htm","javascript:swapToLng('fr')","javascript:swapToLng('nl')","javascript:swapToLng('en')")
  var MenuRightBtn_Url_En = new Array("LogIn_En.htm","SiteMap_En.htm","javascript:swapToLng('fr')","javascript:swapToLng('nl')","javascript:swapToLng('en')")


function drawBtn(SrcBtn,TextBtn,Language,State,Url)
  {
  Language = currentLng //langage courant
  if (State=="Off")
    { w('<td><a href="'+Url+'" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'Btn_'+SrcBtn+'\',\'\',\'Interface/Btn/Btn_'+SrcBtn+'_'+Language+'_On.gif\',1)"><img src="Interface/Btn/Btn_'+SrcBtn+'_'+Language+'_Off.gif" alt="'+TextBtn+'" name="Btn_'+SrcBtn+'" border="0"></a></td>') }
  else
    { w('<td><a href="'+Url+'"><img src="Interface/Btn/Btn_'+SrcBtn+'_'+Language+'_On.gif" alt="'+TextBtn+'" name="Btn_'+SrcBtn+'" border="0"></a></td>') }
  } 


function drawMenuLevel1(F_CurrentBtn,F_Language)
  {
  NumberOfBtn=MenuLevel1LeftBtn_Src.length //Length of the array Btn (Nbr of Btn)

  for (i=0 ; i<NumberOfBtn ; i++ )
    {
//    Language = F_Language
    Language = currentLng //langage courant
    SrcBtn = MenuLevel1LeftBtn_Src[i]
//    TextBtn = eval("MenuLevel1LeftBtn_Txt_"+F_Language+"[i]")
    TextBtn = eval("MenuLevel1LeftBtn_Txt_"+Language+"[i]")
    if (F_CurrentBtn==SrcBtn) {State = "On";MenuLevel1NumCurrentBtn=i} else {State = "Off"}
    Url = eval("MenuLevel1LeftBtn_Url_"+Language+"[i]")

    drawBtn(SrcBtn,TextBtn,Language,State,Url)
    }
  }

//aligne menu level2 en fonction de l'option menu 1 seléctionée
function drawMenuLevel2Space()
  {
  MenuLevel2Space=MenuLevel2Space[MenuLevel1NumCurrentBtn]

  if (MenuRigthCurrentBtn=="LogIn")   {MenuLevel2Space=547}
  if (MenuRigthCurrentBtn=="SiteMap") {MenuLevel2Space=603}

  w('<img src="Interface/Shim.gif" width="'+MenuLevel2Space+'" height="1">')
  }


function drawMenuRight(F_CurrentBtn,F_Language)
  {
  NumberOfBtn=MenuRightBtn_Src.length //Length of the array Btn

  for (i=0 ; i<NumberOfBtn ; i++ )
    {
    Language = currentLng //langage courant
    SrcBtn = MenuRightBtn_Src[i]
    TextBtn = eval("MenuRightBtn_Txt_"+Language+"[i]")

    if (F_CurrentBtn==SrcBtn) {State = "On"} else {State = "Off"} // highlight bouton courant
    if (SrcBtn.toLowerCase()==currentLng.toLowerCase()) {State = "On"} else {State = "Off"} // highlight language courant

    Url = eval("MenuRightBtn_Url_"+Language+"[i]")

    drawBtn(SrcBtn,TextBtn,Language,State,Url)
    }
  MenuRigthCurrentBtn=F_CurrentBtn
  }

//------------------------------------------------------------------------------------------------------
//                                        Création dynamique des feuilles de style
//------------------------------------------------------------------------------------------------------

function CreateCSS()
  {
  w("<STYLE TYPE='text/css'>")

  if (NS4)
    {
    w(".TagParent {position:absolute; visibility:visible}")
    w(".TagChild {position:absolute; visibility:visible}")
    w(".TagReg {position:absolute; visibility:hidden}")
    w(".BoxLanguage {position:absolute; visibility:hidden;z-index:101}")
    }

  if (IE4 || IE5)
    {
    w(".TagChild {display:'none'}")
    w(".BoxLanguage {visibility='hidden';width=1;left: 100; top: 100; position:absolute; z-index:101; ")
    }

  if (N6)
    {
    w(".TagChild {display:'none'}")
    w(".BoxLanguage {position:absolute; display=''; width:0px; z-index:101; left: -1000px; top: -1000px;")
    }

  w("</STYLE>")
  }

//--------------------------------------Capture de la pos de la souris-----------------------------------------------------

if (!IE) {document.captureEvents(Event.MOUSEMOVE)}
document.onmousemove = getMouseXY
var MouseX = 0
var MouseY = 0
function getMouseXY(e)
  {
  if (IE) // grab the x-y pos.s if browser is IE
    {
	MouseX = event.clientX + document.body.scrollLeft
	MouseY = event.clientY + document.body.scrollTop
	}
	else  // grab the x-y pos.s if browser is NS
	{
	MouseX = e.pageX
	MouseY = e.pageY
	}  
  }	
                             
//--------------------------------------Fonction pour afficher une WinBox--------------------------------------------------
function OpenNote (Param) {  ShowWinBox("Note_"+Param)}

function ShowWinBox(P_WinName)
	{
	WinBoxPad = 8 //Espace minimum entre la WinBox et le bord de la fenetre du browser

	if (IE4 || IE5 || N6)
		{                       
		WinBox=getDocObject(P_WinName)
		//if (WinBox.style.display=="block") {alert("ejecté de ShowWinBox !!!");return}
		BrowserWidth = (IE5 || IE4)  ? document.body.clientWidth  : window.innerWidth ;//Taille du browser
		BrowserHeight = (IE5 || IE4) ? document.body.clientHeight+document.body.scrollTop : window.innerHeight+document.body.scrollTop ;

		WinBoxWidth = (IE5 || IE4)  ? WinBox.clientWidth : document.getElementById(P_WinName+"Table").width ;//Taille de la WinBox à afficher
		WinBoxHeight = (IE5 || IE4)  ? WinBox.clientHeight : 100 ;

		if ( BrowserWidth < (MouseX+(WinBoxWidth/2)+WinBoxPad) ) {MouseX=BrowserWidth-( WinBoxWidth/2)-WinBoxPad}
		if ( (MouseX-(WinBoxWidth/2)+WinBoxPad) < WinBoxPad ) {MouseX=WinBoxPad+(WinBoxWidth/2)}
		if ( !N6 && BrowserHeight < (MouseY+WinBoxHeight+WinBoxPad) ) {MouseY=BrowserHeight-WinBoxHeight-WinBoxPad}

		WinBox.style.left=MouseX-(WinBoxWidth/2)
		WinBox.style.top=MouseY+4
    
  	if (IE4 || IE5)
  		{
  		WinBox.style.visibility="visible"
  		}
    else
	    {
		WinBox.style.display="block"
		}
	}

	if (NS4)
		{
		WinBox=document.layers[P_WinName]
		if (WinBox.visibility=="show") {return}

		BrowserHeight = window.innerHeight //Taille du browser
		BrowserWidth = window.innerWidth

		WinBoxWidth = WinBox.document.width  //Taille de la WinBox à afficher
		WinBoxHeight= WinBox.document.height

		if ( BrowserWidth < (MouseX+(WinBoxWidth/2)+WinBoxPad) ) {MouseX=BrowserWidth-( WinBoxWidth/2)-WinBoxPad}
		if ( (MouseX-(WinBoxWidth/2)+WinBoxPad) < WinBoxPad ) {MouseX=WinBoxPad+(WinBoxWidth/2)}
		if ( BrowserHeight < (MouseY+WinBoxHeight+WinBoxPad) ) {MouseY=BrowserHeight-WinBoxHeight-WinBoxPad}

		WinBox.left=MouseX-(WinBoxWidth/2)
		WinBox.top=MouseY+4
		WinBox.visibility="show"
		}
	}

function HideWinBox(P_WinName)
	{
	if (IE4 || IE5) {getDocObject(P_WinName).style.visibility='hidden'}
	if (N6) {getDocObject(P_WinName).style.display='none'}
	if (NS4) {document.layers[P_WinName].visibility="hidden"}
	}

//--------------------------------------Hide or show Div----------------------------------------------------------------

function showDiv (param)  {  getDocObject(param).className="DivShown"  }
function hideDiv (param)   {  getDocObject(param).className="DivHidden"  }

//----------------------------------------Ouvre où ferme un tag-------------------------
function OpenCloseTag(Param)
	{
		if (getDocObject(Param).style.display=="block") 
    {
      getDocObject(Param).style.display="none";
      getDocObject(Param+"Img").src=getDocObject(Param+"Img").srcPlay;
    }
		else
		{
      getDocObject(Param).style.display="block";
      getDocObject(Param+"Img").src=getDocObject(Param+"Img").srcPlayOpen;
  	  var i, st
	  	if (document.body.clientHeight - event.clientY<100)
      {
   		  st = document.body.scrollTop
    		for (i=1;i<event.clientY-document.body.clientHeight/2;i+=20)
       		document.body.scrollTop = st + i;
      }
    }
	}

//---------------------------------------Ouvre des fenêtres------------------------------------------------
function OpenNewWindow(href, w, h)
{
  if (!w)
    w=(ScrW*80)/100;
  if (!h)
    h=(ScrH*80)/100;
  x=(ScrW-w)/2;
  y=(ScrH-h)/4;
  pos = "left="+x+",top="+y+",width="+w+",height="+h;
  open(href, "_blank","toolbar=no,location=no,status=no,directories=no,resizable=yes,scrollbars=yes,"+pos);
}

function OpenTitlePdf()
  {
  OpenNewWindow("Titres_"+currentLng+".pdf", 550, 550)
  }

function OpenDemoSecuritiesHandling()
  {
  OpenNewWindow("http://www.learningcenter.be/demo/titres/start.htm", 750, 550)
  }

function OpenDemoFCDP()
  {
//  OpenNewWindow("OnLineSoon_"+currentLng+".htm", 500, 200)
  OpenNewWindow("http://www.learningcenter.be/Demo/FCDP/Start.htm", 500, 350)
  }



function OrderOnline()
  {
  OpenNewWindow("EFormationsInscription2_"+currentLng+".htm", 550, 550)
  }

function OrderOnlineMagellan()
  {
  OpenNewWindow("http://www.net800.co.uk/netstart/magellanon-linelearning/cgi-bin/search.pl", 760, 550)
  }

function OpenMagellan()
  {
  OpenNewWindow("http://www.chisholmroth.com/01/magellan/index.htm", 760, 550)
  }

function logIn()
  {
  window.location="LogIn_"+currentLng+".htm"
  }


// Example:
// onMouseOver="toolTip('tool tip text here')";
// onMouseOut="toolTip()";
// -or-
// onMouseOver="toolTip('more good stuff', '#FFFF00', 'orange')";
// onMouseOut="toolTip()"; 
/*
MOVE this to the <body>:

<script language="JavaScript"><!--
initToolTips(); //--></script>
*/
var ns4 = document.layers;
var ns6 = document.getElementById && !document.all;
var ie4 = document.all;
offsetX = 0;
offsetY = 20;
var toolTipSTYLE="";
function initToolTips()
{
  if(ns4||ns6||ie4)
  {
    if(ns4) toolTipSTYLE = document.toolTipLayer;
    else if(ns6) toolTipSTYLE = document.getElementById("toolTipLayer").style;
    else if(ie4) toolTipSTYLE = document.all.toolTipLayer.style;
    if(ns4) document.captureEvents(Event.MOUSEMOVE);
    else
    {
      toolTipSTYLE.visibility = "visible";
      toolTipSTYLE.display = "none";
    }
    document.onmousemove = moveToMouseLoc;
  }
}
function toolTip(msg, fg, bg, tp)
{
  if(toolTip.arguments.length < 1) // hide
  {
    if(ns4) toolTipSTYLE.visibility = "hidden";
    else toolTipSTYLE.display = "none";
  }
  else // show
  {
    if(!fg) fg = "#055A49"; //Cadre
    if(!bg) bg = "#92CC28"; //Fond
    if(!tp) tp = "#FFFFFF"; //Color type
    var content =
    '<table border="0" cellspacing="0" cellpadding="1" bgcolor="' + fg + '"><td>' +
    '<table border="0" cellspacing="0" cellpadding="4" bgcolor="' + bg + 
    '"><td align="left"><font face="sans-serif" color="' + tp +
    '" size="-2">' + msg +
    '&nbsp\;</font></td></table></td></table>';
    if(ns4)
    {
      toolTipSTYLE.document.write(content);
      toolTipSTYLE.document.close();
      toolTipSTYLE.visibility = "visible";
    }
    if(ns6)
    {
      document.getElementById("toolTipLayer").innerHTML = content;
      toolTipSTYLE.display='block'
    }
    if(ie4)
    {
      document.all("toolTipLayer").innerHTML=content;
      toolTipSTYLE.display='block'
    }
  }
}
function moveToMouseLoc(e)
{
  if(ns4||ns6)
  {
    x = e.pageX;
    y = e.pageY;
  }
  else
  {
    x = event.x + document.body.scrollLeft;
    y = event.y + document.body.scrollTop;
  }
  toolTipSTYLE.left = x + offsetX;
  toolTipSTYLE.top = y + offsetY;
  return true;
}

