function OpenWin(URL,width,height,nom)
  {
	window.open(URL,nom,"toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,width=" + width + ",height=" + height + ",resizable=no");
  }

function OpenWin2(URL,width,height,nom)
  {
	window.open(URL,nom,"toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,width=" + width + ",height=" + height + ",resizable=yes");
  }

function AfficheMaxi(URL,nom_jv,CSS)
  {
  i1 = new Image();
  i1.src = URL;
  nom = stripslashes(nom_jv);

    html = '<html><head><title>Zoom</title><script language="javascript">function Min (a, b){if (a < b) {return a;} else {return b;}}function autoSize(){self.resizeTo(Min((document.images[0].width+40), screen.width-10),Min((document.images[0].height+130), screen.height-25));}</script></head><body bgcolor="#FED61B" leftMargin="0" topMargin="0" rightMargin="0" bottomMargin="0" MARGINHEIGHT="0" MARGINWIDTH="0" onLoad="javascript:autoSize();"><link REL="stylesheet" type="text/css" href="'+CSS+'"> <center><table width="100%" cellpadding="0" cellspacing="0" align="center"><tr><td  bgcolor="black"><font class="jauneik">&nbsp;&nbsp;&nbsp;&nbsp;<b>'+nom+'</b></font></td></tr><tr><td align="center"><font class="jauneik"><br></font><img src="'+URL+'"</td></tr><tr><td height="5"><font class="jauneik">&nbsp;</font></td></tr><tr><td align="center"><a href="javascript:close()"><img SRC="/images/b_fermer.gif" BORDER="0"></a></td></tr></table></center></body></html>';

  popupImage = window.open('','_blank','toolbar=0,location=0,directories=0,menuBar=0,scrollbars=0,resizable=0, width=300, height=30, left=180, top=50');
  popupImage.document.open();
  popupImage.document.write(html);
  popupImage.document.close()
  }

function expandingWindow(website, id_author)
    {
    var id_auth = id_author;
    var sizer = window.open('','_blank','toolbar=0,location=0,directories=0,menuBar=0,scrollbars=1,resizable=1, width=400, height=350, left=70, top=50');
    sizer.location = website + "?id_auth=" + id_auth;
    }

function stripslashes(ch)
    {
    return ch.replace(/(\\)([\\\'\"])/g,"$2")
    }
    
var ns6=document.getElementById && !document.all

function restrictinput(maxlength,e,placeholder){
    if (window.event&&event.srcElement.value.length>=maxlength)
        return false
    else if (e.target&&e.target==eval(placeholder)&&e.target.value.length>=maxlength){
        var pressedkey=/[a-zA-Z0-9\.\,\/]/ 
        if (pressedkey.test(String.fromCharCode(e.which)))
        e.stopPropagation()
    }
}

function countlimit(maxlength,e,placeholder){
    var theform=eval(placeholder)
    var lengthleft=maxlength-theform.value.length
    var placeholderobj=document.all? document.all[placeholder] : document.getElementById(placeholder)
    if (window.event||e.target&&e.target==eval(placeholder)){
    if (lengthleft<0)
    theform.value=theform.value.substring(0,maxlength)
    placeholderobj.innerHTML=lengthleft
    }
}

function displaylimit(thename, theid, thelimit){
    var theform=theid!=""? document.getElementById(theid) : thename
    var limit_text='<b><span id="'+theform.toString()+'">'+thelimit+'</span></b> charactères restants.'
    if (document.all||ns6) document.write(limit_text)
    if (document.all){
        eval(theform).onkeypress=function(){ return restrictinput(thelimit,event,theform)}
        eval(theform).onkeyup=function(){ countlimit(thelimit,event,theform)}
    }
    else if (ns6){
        document.body.addEventListener('keypress', function(event) { restrictinput(thelimit,event,theform) }, true); 
        document.body.addEventListener('keyup', function(event) { countlimit(thelimit,event,theform) }, true); 
    }
}

function divswitch(checkboxId, baliseId) {
    if (document.getElementById && document.getElementById(checkboxId) != null) {
        if (document.getElementById(baliseId) != null) {
            if (document.getElementById(checkboxId).checked == true) {
                document.getElementById(baliseId).style.visibility='visible';
                document.getElementById(baliseId).style.display='block';
            }
            else
            {
                document.getElementById(baliseId).style.visibility='hidden';
                document.getElementById(baliseId).style.display='none';
            }
        }
    }
}

function rb_divswitch(radioId, baliseId) {
    if (document.getElementById && document.getElementById(radioId) != null) {
        if (document.getElementById(baliseId) != null) {
            if (document.entryform.paiement[1].checked == true) {
                document.getElementById(baliseId).style.visibility='visible';
                document.getElementById(baliseId).style.display='block';
            }
            else
            {
                document.getElementById(baliseId).style.visibility='hidden';
                document.getElementById(baliseId).style.display='none';
            }
        }
    }
}

function get_total(totalId, nbline) {
    var thetotal=0
    var q=0
    var p=0
    var tot=0
    for (cnt = 1; cnt < nbline+1; cnt++){
        q = document.getElementById("qte"+cnt).value;
        p = document.getElementById("prix"+cnt).value;
        tot = q * p;
        thetotal += tot;
    }
    document.getElementById(totalId).innerHTML = thetotal;
}
