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

document.onmousemove = position;
function position(evt)
{    
    if (!evt) 
    {
        evt = window.event;
    }
    
    if( document.documentElement && document.documentElement.clientWidth)
    {
        DocRef = document.documentElement;
    }
    else
    {
        DocRef = document.body;
    }
    mouseposx = evt.clientX + DocRef.scrollLeft;
    mouseposy = evt.clientY + DocRef.scrollTop;     
}

function showbulle(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";
}

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="";
}

/*form demand de ctlg par courrier*/
function verifFormDemandCatalogue(){ 
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_TEXTE3").value.length < 1)       {document.getElementById("ZE_DOSSIER_TEXTE3").style.borderColor='red'; bRet = false;}
if (document.getElementById("ZE_DOSSIER_TEXTE5").value.length < 1)       {document.getElementById("ZE_DOSSIER_TEXTE5").style.borderColor='red'; bRet = false;}
if (document.getElementById("ZE_DOSSIER_TEXTE6").value.length < 1)       {document.getElementById("ZE_DOSSIER_TEXTE6").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)   
	{
	
	}
}

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";
        bubble.style.textalign = "center";
        document.getElementById("infobulle").innerHTML = '<img style="margin:25px 0 0 0" src=' + oImageLoading.src + '>';
        bubble.style.width = '158px';
        bubble.style.height = '105px';
        bubble.style.background = 'none';
        bubble.style.border = "none";
        var larg =  elmt.width / 2   
        bubble.style.left = pos[0] - 79 +  larg + 'px';
        bubble.style.top = pos[1] - 25 + '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";
}
