function RedimImage(inImg, Largeur, Hauteur)
{
 if ((Largeur/Hauteur)>(inImg.width/inImg.height))
 	{
	inImg.style.height = Hauteur + "px";
	tmp = parseInt(inImg.width * Hauteur / inImg.height);
	inImg.style.width = tmp + "px"; 
	inImg.style.marginLeft = parseInt((Largeur-tmp) / 2) + "px";
	}
	else
	{
	inImg.style.width = Largeur + "px";
	tmp = parseInt(inImg.height * Largeur / inImg.width);
	inImg.style.height = tmp + "px";
	inImg.style.marginTop = parseInt((Hauteur-tmp) / 2) + "px";
	}
};


function EcrireCookie(nom, valeur)
{
		var argv=EcrireCookie.arguments;
		var argc=EcrireCookie.arguments.length;
		var expires=(argc > 2) ? argv[2] : null;
		var path=(argc > 3) ? argv[3] : null;
		var domain=(argc > 4) ? argv[4] : null;
		var secure=(argc > 5) ? argv[5] : false;
		document.cookie=nom+"="+escape(valeur)+
		((expires==null) ? "" : ("; expires="+expires.toGMTString()))+
		((path==null) ? "" : ("; path="+path))+
		((domain==null) ? "" : ("; domain="+domain))+
		((secure==true) ? "; secure" : "");
}

function getCookieVal(offset)
{
var endstr=document.cookie.indexOf (";", offset);
if (endstr==-1) endstr=document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}
function LireCookie(nom)
{
var arg=nom+"=";
var alen=arg.length;
var clen=document.cookie.length;
var i=0;
while (i<clen)
{
var j=i+alen;
if (document.cookie.substring(i, j)==arg) return getCookieVal(j);
i=document.cookie.indexOf(" ",i)+1;
if (i==0) break;

}
return null;
}


//top des ventes bulle

function position()
{    
    mouseX = Event.pointerX(e);
	mouseY = Event.pointerY(e);    
}

function showbulle(text)
{                      
	if($(text)){
	bubble = document.getElementById("infobulle2");
	document.getElementById("infobulle2contenu").innerHTML = document.getElementById(text).innerHTML;
	bubble.style.visibility = "visible";
	bubble.style.display = "block";
	bubble.style.left = mouseposx - 165 + 'px';
	bubble.style.top = mouseposy -20 - bubble.offsetHeight + 'px';}
}

function cachebulle()
{
	bubble = document.getElementById("infobulle2");
	bubble.style.visibility = "hidden";
	bubble.style.display = "none";
}
var showimage = '0';
function showbulleImg(text, elmt)
{
    try
    {


        showimage=text;
        oImage = new Image();
        oImage.src= text;       
        oImageLoading = new Image();
        oImageLoading.src= "Image/WEB/loading.gif";
        
        bubble2 = document.getElementById("infobulleOff");               
        bubble2.style.visibility = "visible";
		bubble2.style.display = "block";                  
        var pos=Position.cumulativeOffset(elmt);
        bubble2.style.width = '57px';
        bubble2.style.height = '57px';
	    bubble2.style.left = pos[0] - 1 + 'px';
        bubble2.style.top = pos[1] - 1 + 'px';
        bubble2.style.zIndex = '1201';
                        
        bubble = document.getElementById("infobulle");               
        bubble.style.visibility = "visible";
		bubble.style.display = "block";                  
        document.getElementById("infobulle").innerHTML = '<img style="margin:66px 0 0 66px" src=' + oImageLoading.src + '>'; 
        bubble.style.width = '175px';
        bubble.style.height = '175px';
        bubble.style.background = '#000';
	    bubble.style.left = pos[0] - 66 + 'px';
        bubble.style.top = pos[1] - 66 + 'px';
        bubble.style.zIndex = '1200';	        
        
        bubble2.style.width = '57px';
        bubble2.style.height = '57px';
	    bubble2.style.left = pos[0] - 1 + 'px';
        bubble2.style.top = pos[1] - 1 + 'px';
        bubble2.style.zIndex = '1201';
        bubble2.style.background = "#fff";

            
        if (oImage.complete==false)
        {
            running = setInterval(function() { iscomplete2()},200);
        }
        else
        {
            document.getElementById("infobulle").innerHTML = '<img src="' + oImage.src + '">';              
        }

  
    }
    catch (ex)
    {         
        //window.status = "Erreur : " + ex.Message;
    }
}

function iscomplete2()
{        
    if (oImage.complete)
    {
            document.getElementById("infobulle").innerHTML = '<img src="' + oImage.src + '">';
    }
}

function cachebulleImg()
{
	clearInterval(running);
	bubble = document.getElementById("infobulle");
	bubble.style.visibility = "hidden";
	bubble.style.display = "none";
	bubble = document.getElementById("infobulleOff");
	bubble.style.visibility = "hidden";
	bubble.style.display = "none";
}


function addHover(elm) {
         elm.style.behavior = " ";
         if (document.all && window.print && /MSIE [56]/.test(navigator.userAgent)) {
                 elm.style.behavior = " ";
                 elm.onmouseenter = function() {
                     this.className+=' hover';
					 this.firstChild.className+=' hover';
					 this.lastChild.style.display='block';
                 }
                elm.onmouseleave = function() {
                    this.className = this.className.replace(/\hover\b/,"" );
					 this.firstChild.className = this.firstChild.className.replace(/\hover\b/,"" );
					 this.lastChild.style.display='none';
                 }
         }
}


/*déplacer des contenus dans la page pour structurer et améliorer le referencement*/
function deplacercontenu(numero) {
deplacerDe = document.getElementById("deplacerDe_" + numero);
deplacerVers = document.getElementById("deplacerVers_" + numero);
deplacerVers.innerHTML = deplacerDe.innerHTML;
deplacerDe.innerHTML="";
}

function FlashToJS (valeur){
global.eval(valeur);
}

function verifFormContact(){ 
    try 
    {      
        var bRet = true;      
        if (document.getElementById("ZE_DOSSIER_TEXTE1").value.length < 1)       {document.getElementById("ZE_DOSSIER_TEXTE1").style.borderColor='red'; bRet = false;}
        if (document.getElementById("ZE_DOSSIER_TEXTE2").value.length < 1)       {document.getElementById("ZE_DOSSIER_TEXTE2").style.borderColor='red'; bRet = false;}
        if (document.getElementById("ZE_DOSSIER_COMMENTAIRE").value.length < 1)       {document.getElementById("ZE_DOSSIER_COMMENTAIRE").style.borderColor='red'; bRet = false;}

        if (bRet == false) 
        {
            document.getElementById("ZE_DOSSIER_TextErreur").innerHTML = "<b style='color:#cc0000'>Veuillez renseigner tout le formulaire afin de pouvoir r&eacute;pondre &agrave; votre demande</b>";
        }
        return bRet;   
    }   
	catch (e)   
	{
	}
}