﻿// JScript File
function writeContentFlash(src, width, height, wmode)
{
     document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="' + width + '" height="' + height + '" id="prom1" align="middle" VIEWASTEXT>\n');
     document.write('<param name="allowScriptAccess" value="sameDomain" />\n');
     document.write('<param name="movie" value="' + src + '" />\n');
     document.write('<param name="quality" value="high" />\n');
     document.write('<param name="wmode" value="' + wmode + '" />\n');
     document.write('<param name="bgcolor" value="#ffffff" />\n');
     document.write('<embed src="' + src + '" quality="high" bgcolor="#ffffff" wmode="' + wmode + '" width="' + width + '" height="' + height + '" name="prom1" align="middle" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />\n');
     document.write('</object>');

}



/* AFFICHAGE DES SubLevel DU MENU  ainsi QUE LES ROLLOVER */
function showMenuContent(id, visible, current)
{
    var d = document.getElementById("sub" + id); // sub
    var m = document.getElementById("title" + id); // title

    if(current)
    {
        if (visible)
        {
            d.style.display = "block";
        }
        else
        {
            d.style.display = "none";
        }
    }
    else
    {
        if (visible)
        {
            d.style.display = "block";
            m.style.background = "url(images/menu/fond_ssmenu.gif) left top no-repeat";
            m.style.color = "#ffffff";
        }
        else
        {
            d.style.display = "none";
            m.style.background = "url(images/menu/fond_ssmenu.gif) left top no-repeat"; 
            m.style.color = "#ffffff";
        }
    }
}

function border(visible, id)
{
    id = "ctl00_ContentPlaceHolder1_"+id;
    
    if(visible)
    {
        document.getElementById(id).style.border = "";
    }
    else
    {
        document.getElementById(id).style.border = "";
    }
}

function turnDiv(show, hide)
{   
    var show = document.getElementById(show);
    var hide = document.getElementById(hide);
    
    if(show.style.display == "block")
    {
        show.style.display = "none";
        hide.style.display = "block";
    }
    else
    {
        show.style.display = "none";
        hide.style.display = "block";
    }
}

function blockEnter(e, buttonName)
{ 	
    var characterCode;
	//if(!ie)
	if (navigator.appName != "Microsoft Internet Explorer")
	{
	    e = e;
	    characterCode = e.which;
	}
	else
	{
	    characterCode = e.keyCode;
	}
	
	if(characterCode == 13)
	{
        if (getObj2(buttonName))
        {
	        if (ie)
	            setTimeout("getObj2('" + buttonName + "').click()",100);
	        else
	            setTimeout("getObj2('" + buttonName + "').click()",100);
    		
	        return false;	
        }
        else
	        return false ;	
	}
	else
	{
	    return true;
	}
}

var tooltip = 
{
    id:"tooltip",
    offsetx : 20,
    offsety : 10,
    _x : 0,
    _y : 0,
    _tooltipElement:null,
    _saveonmouseover:null
}

tooltip.show = function (htmlelement)
{
    var text=htmlelement.getAttribute("title");
    htmlelement.setAttribute("title", "");
    htmlelement.setAttribute("title_saved", text);

	if(document.getElementById)
	{
        this._tooltipElement = document.getElementById(this.id);
	}
	else if ( document.all ) 
	{
        this._tooltipElement = document.all[this.id].style;
	}

    this._saveonmouseover = document.onmousemove;
    document.onmousemove = this.mouseMove;

    this._tooltipElement.innerHTML = text;

    this.moveTo(this._x + this.offsetx , this._y + this.offsety);

    if(this._tooltipElement.style)
    {
        this._tooltipElement.style.visibility ="visible";
    }
    else
    {
        this._tooltipElement.visibility = "visible";
    }
   return false;
}

tooltip.hide = function (htmlelement) 
{
    htmlelement.setAttribute("title", htmlelement.getAttribute("title_saved"));
    htmlelement.removeAttribute("title_saved");

    if(this._tooltipElement.style)
    {
        this._tooltipElement.style.visibility ="hidden";
    }
    else
    {
        this._tooltipElement.visibility = "hidden";
    }
    
    document.onmousemove=this._saveonmouseover;
}

tooltip.mouseMove = function (e) 
{
    if(e == undefined)
        e = event;

    if( e.pageX != undefined)
    {
        tooltip._x = e.pageX;
        tooltip._y = e.pageY;
    }
    else if(event != undefined && event.x != undefined && event.clientX == undefined)
    {
        tooltip._x = event.x;
        tooltip._y = event.y;
    }
    else if(e.clientX != undefined )
    {
        if(document.documentElement)
        {
            tooltip._x = e.clientX + ( document.documentElement.scrollLeft || document.body.scrollLeft);
            tooltip._y = e.clientY + ( document.documentElement.scrollTop || document.body.scrollTop);
        }
        else
        {
            tooltip._x = e.clientX + document.body.scrollLeft;
            tooltip._y = e.clientY + document.body.scrollTop;
        }
    }
    else
    {
        tooltip._x = 0;
        tooltip._y = 0;
    }
    
    tooltip.moveTo( tooltip._x +tooltip.offsetx , tooltip._y + tooltip.offsety);
}

tooltip.moveTo = function (xL,yL) 
{
    if(this._tooltipElement.style)
    {
        this._tooltipElement.style.left = xL + "px";
        this._tooltipElement.style.top = yL + "px";
    }
    else
    {
        this._tooltipElement.left = xL;
        this._tooltipElement.top = yL;
    }
}

