// VARIABLE GLOBALE

  var inclut = new Array();
  var si_array = new Array();


//  MENU JAVA
    var preloadFlag = true;

    nav_home_mo  = newImage("/images/essai_voiture/home_mo.gif");
    nav_home     = newImage("/images/essai_voiture/home_mo.gif");




function SetFocus(TargetFormName) {
  var target = 0;
  if (TargetFormName != "")
    for (i=0; i<document.forms.length; i++) {
      if (document.forms[i].name == TargetFormName) {
        target=i;
        break;
      }
    }

  var TargetForm = document.forms[target];

  for (i=0; i<TargetForm.length; i++) {
    if ( (TargetForm.elements[i].type != "image") &&
         (TargetForm.elements[i].type != "hidden") &&
         (TargetForm.elements[i].type != "reset") &&
         (TargetForm.elements[i].type != "submit") ) {

      TargetForm.elements[i].focus();

      if ( (TargetForm.elements[i].type == "text") ||
           (TargetForm.elements[i].type == "password") )
        TargetForm.elements[i].select();

      break;
    }
  }
}

function RemoveFormatString(TargetElement, FormatString) {
  if (TargetElement.value == FormatString)
    TargetElement.value = "";
    TargetElement.select();
}

function CheckDateRange(from, to) {
  if (Date.parse(from.value) <= Date.parse(to.value))
    return true;
  else
    return false;
}

function IsValidDate(DateToCheck, FormatString) {
  var strDateToCheck;
  var strDateToCheckArray;
  var strFormatArray;
  var strFormatString;
  var strDay;
  var strMonth;
  var strYear;
  var intday;
  var intMonth;
  var intYear;
  var intDateSeparatorIdx = -1;
  var intFormatSeparatorIdx = -1;
  var strSeparatorArray = new Array("-"," ","/",".");
  var strMonthArray = new Array("jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec");
  var intDaysArray = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);

  strDateToCheck = DateToCheck.toLowerCase();
  strFormatString = FormatString.toLowerCase();

  if (strDateToCheck.length != strFormatString.length) {
    return false;
  }

  for (i = 0; i < strSeparatorArray.length; i++) {
    if (strFormatString.indexOf(strSeparatorArray[i]) != -1) {
      intFormatSeparatorIdx = i;
      break;
    }
  }

  for (i = 0; i < strSeparatorArray.length; i++) {
    if (strDateToCheck.indexOf(strSeparatorArray[i]) != -1) {
      intDateSeparatorIdx = i;
      break;
    }
  }

  if (intDateSeparatorIdx != intFormatSeparatorIdx)
    return false;

  if (intDateSeparatorIdx != -1) {
    strFormatArray = strFormatString.split(strSeparatorArray[intFormatSeparatorIdx]);
    if (strFormatArray.length != 3) {
      return false;
    }

    strDateToCheckArray = strDateToCheck.split(strSeparatorArray[intDateSeparatorIdx]);
    if (strDateToCheckArray.length != 3) {
      return false;
    }

    for (i = 0; i < strFormatArray.length; i++) {
      if (strFormatArray[i] == 'mm' || strFormatArray[i] == 'mmm')
        strMonth = strDateToCheckArray[i];
      if (strFormatArray[i] == 'dd')
        strDay = strDateToCheckArray[i];
      if (strFormatArray[i] == 'yyyy')
        strYear = strDateToCheckArray[i];
    }
  }
  else {
    if (FormatString.length>7) {
      if (strFormatString.indexOf('mmm') == -1)
        strMonth = strDateToCheck.substring( strFormatString.indexOf('mm'), 2 );
      else
        strMonth = strDateToCheck.substring( strFormatString.indexOf('mmm'), 3 );
      strDay = strDateToCheck.substring( strFormatString.indexOf('dd'), 2 );
      strYear = strDateToCheck.substring( strFormatString.indexOf('yyyy'), 2 );
    }
    else {
      return false;
    }
  }

  if (strYear.length != 4) {
    return false;
  }
  intday = parseInt(strDay, 10);
  if (isNaN(intday)) {
    return false;
  }
  if (intday < 1) {
    return false;
  }

  intMonth = parseInt(strMonth, 10);
  if (isNaN(intMonth)) {
    for (i = 0;i < strMonthArray.length; i++) {
      if (strMonth == strMonthArray[i]) {
        intMonth = i+1;
        break;
      }
    }
    if (isNaN(intMonth)) {
      return false;
    }
  }
  if (intMonth>12 || intMonth<1) {
    return false;
  }

  intYear = parseInt(strYear, 10);
  if (isNaN(intYear)) {
    return false;
  }
  if (IsLeapYear(intYear) == true) {
    intDaysArray[1] = 29;
  }

  if (intday > intDaysArray[intMonth - 1]) {
    return false;
  }

  return true;
}

function IsLeapYear(intYear) {
  if (intYear % 100 == 0) {
    if (intYear % 400 == 0)
      return true;
  }
  else {
    if ((intYear % 4) == 0)
      return true;
  }

  return false;
}


/******************************************************************
*        Script name: Link fader (http://design64.net/js/linkfader.html)
*        Version: 1.0
*        Date: 12.05.02
*        Usage: Freeware - You may modify this script as you wish,
*                as long as you don't remove this header comment.
*
*        Script by: Fayez Zaheer (viol8r on #webdesign [irc.zanet.org.za])
*        Email: fayez@design64.net
*        Web site: http://design64.net
*         Original idea: http://anarchos.xs.mw/fade.phtml
*       Script featured on JavaScript Kit (http://www.javascriptkit.com)
******************************************************************/

// DELETE COMMENTS THAT START WITH // TO MAKE THE FILE SIZE SMALLER.

// This script will no longer overwrite your current onmouseover and
// onmouseout attributes - it will instead skip those links. If you would
// still like to fade them, add findLink(this.id) to your onmouseover
// and clearFade() to your onmouseout, like so -
// <a href="#" onmouseover="findLink(this.id); yourFunction()"
// onmouseout="clearFade(); yourSecondFunction()">
// Make sure to put it BEFORE any "return" statements otherwise
// the fade will not execute.

// Fade-to colour without the # (6 character value only!)
var fadeTo = "000000";

// Fade in colour increment/decrement by
var fiBy = 6;

// Fade out colour increment/decrement by
var foBy = 10;

// Speed - milliseconds between each colour change in the fade
// Less than 10ms doesn't really make all that much difference, so
// 10 is the minimum effective value.
var speed = 10;

// Class name of links to NOT fade (i.e. ignore)
// var ignoreClass = "somebogusvalue" if you don't want to
// use this feature. Alternatively, add onmouseover="clearFade()"
// to the link you do not wish to fade.
var ignoreClass = "ignore";

// No more changes required (unless you know what you are doing)
// Enjoy... and email me and let me know what site(s) you are using it on :)
var opera, ie, dom, x = 0, oc, fader, ocs = new Array();

if (navigator.userAgent.indexOf("Opera") != -1) opera = true
else if (document.all && !opera) ie = true
else if (!document.all && document.getElementById) dom = true;

function convertRGB(z)
        {
                var newfcS = "", splitter = "";
                splitter = z.split(",");
                splitter[0] = parseInt(splitter[0].substring(4, splitter[0].length));
                splitter[1] = parseInt(splitter[1]);
                splitter[2] = parseInt(splitter[2].substring(0, splitter[2].length-1));
                for (var q = 0; q < 3; q++)
                        {
                                splitter[q] = splitter[q].toString(16);
                                if (splitter[q].length == 1) splitter[q] = "0" + splitter[q];
                                newfcS += splitter[q];
                        }
                return newfcS;
        }

function currentColour(index)
        {
                var temp, cc;
                if (opera) cc = document.links[index].style.color
                else if (ie) cc = document.links[index].currentStyle.color
                else if (dom) cc = document.defaultView.getComputedStyle(document.links[index], '').getPropertyValue("color");
                if (cc.length == 4 && cc.substring(0, 1) == "#")
                        {
                                temp = "";
                                for (var a = 0; a < 3; a++)
                                        temp += cc.substring(a+1, a+2) + cc.substring(a+1, a+2);
                                cc = temp;
                        }
                else if (cc.indexOf("rgb") != -1) cc = convertRGB(cc)
                else if (cc.length == 7) cc = cc.substring(1, 7)
                else cc = fadeTo;
                return cc;
        }


function convert2Dec(hex)
        {
                var rgb = new Array();
                for (var u = 0; u < 3; u++)
                        rgb[u] = parseInt(hex.substring(u*2, u*2+2), 16);
                return rgb;
        }

function newRGB(f, n, d)
        {
                var change;
                if (d == 1) change = fiBy
                else change = foBy;
                for (var g = 0; g < 3; g++)
                        {
                                if (n[g] > f[g] && n[g] - change >= 0) n[g] -= change;
                                if (n[g] < f[g] && n[g] + change <= 255) n[g] += change;
                        }
                return n;
        }

function fade(index, d)
        {
                var fc, nc, temp = new Array(), finished = false;
                nc = convert2Dec(currentColour(index));
                if (d == 1) fc = convert2Dec(fadeTo)
                else fc = convert2Dec(ocs[x]);
                temp = convert2Dec(currentColour(index));
                nc = newRGB(fc, nc, d);
                if ((nc[0] == temp[0]) && (nc[1] == temp[1]) && (nc[2] == temp[2]))
                        finished = true;
                if (!finished) document.links[x].style.color = "rgb(" + nc[0] + "," + nc[1] + "," + nc[2] + ")"
                else clearInterval(fader);
        }

function findLink(over)
        {
                if (document.layers) return;
                if (fader)
                        {
                                clearInterval(fader);
                                document.links[x].style.color = "#" + ocs[x];
                        }
                if (over && !this.id) this.id = over;
                x = 0;
                while (!(this.id == document.links[x].id) && (x < document.links.length))
                        x++;
                if (this.id == document.links[x].id)
                        {
                                oc = currentColour(x);
                                fader = setInterval("fade(" + x  + ", 1)", speed);
                        }
        }

function clearFade()
        {
                if (document.layers) return;
                if (fader) clearInterval(fader);
                fader = setInterval("fade(" + x + ", 0)", speed);
        }

function init()
        {
                for (var i = 0; i < document.links.length; i++)
                        {
                                ocs[i] = currentColour(i);
                                var currentOver = document.links[i].onmouseover;
                                var currentOut = document.links[i].onmouseout;
                                var ignoreIt = document.links[i].className == ignoreClass;
                                if (!ignoreIt) document.links[i].id = "link" + i;
                                if (!currentOver && !currentOut && !ignoreIt)
                                        {
                                                document.links[i].onmouseover = findLink;
                                                document.links[i].onmouseout = clearFade;
                                        }
                        }
}

if (opera || ie || dom) window.onload = init;




/*  Preload IMAGE ROLL OVER   */

function PopupCentrer(page,largeur,hauteur,options) {
  var top=(screen.height-hauteur)/2;
  var left=(screen.width-largeur)/2;
  window.open(page,"","top="+top+",left="+left+",width="+largeur+",height="+hauteur+","+options);
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function calc_price(link, sender, price, prefix)
{
  var total = arrondi(document.cart_quantity.products_price_base.value, 0);
  var message = '', message_exclut = '', message_exige = '', message_inclut = '', message_exige_ou = '';
  var price;
  var is_inclut,et, ou, si, pos, posbase, separator, first, checked1 = false;
  var temp_array = new Array();

  if (link != '' && link != 0) {
     var link = link.split("|");
     for (var i = 0; i < link.length; i=i+2) {
        var type = link[i];
        var option_array = link[i+1];

        pos = 1;
        first = false;
      while (pos) {
        if (pos!= 1 || first) posbase = pos+1; else posbase = 0;
        et = option_array.indexOf('&', posbase);
        ou = option_array.indexOf(',', posbase);
        si = option_array.indexOf(';', posbase);
        first = true;

        if (  (ou != -1 ? et < ou : true)  && ( si != -1 ? et < si : true) && et != -1 ) {separator = 'et'; pos = et;}
        if (  (et != -1 ? ou < et : true)  && ( si != -1 ? ou < si : true) && ou != -1 ) {separator = 'ou'; pos = ou;}
        if (  (ou != -1 ? si < ou : true)  && ( et != -1 ? si < et : true) && si != -1 ) {separator = 'si'; pos = si;}
        if (et == -1 && ou == -1  && si == -1) {separator = ''; pos = false;}
        if (pos) {
           var id = option_array.substr(posbase, pos-posbase);
        } else {
           var id = option_array.substr(posbase, option_array.length);
        }

//        option_array = option_array.split("&");
        if (type == 'exclut' ) {
           if (separator == 'et' || !pos) {
               if (document.cart_quantity.elements['id['+sender+']'].checked) { // ON VIENT DE COCHER
                  message_exclut += document.cart_quantity.elements['option_value_name_'+id].value + "\n" + separator + '\n';
                  if (document.cart_quantity.elements['id['+id+']'].checked) { // LINK OK
                     document.cart_quantity.elements['id['+id+']'].checked = false;
                     document.cart_quantity.elements['id['+id+']'].disabled = true;
                  } else {
                     document.cart_quantity.elements['id['+id+']'].disabled = true;
                  }
               } else {  // ON VIENT DE DECOCHER
                  document.cart_quantity.elements['id['+id+']'].disabled = false;
               }
           }
           if (separator == 'si') {
               if (document.cart_quantity.elements['id['+sender+']'].checked) { // ON VIENT DE COCHER
                  message_exclut += document.cart_quantity.elements['option_value_name_'+id].value + "\n" + separator + '\n';
                  if (document.cart_quantity.elements['id['+id+']'].checked) { // LINK OK
                     document.cart_quantity.elements['id['+id+']'].checked = false;
                     document.cart_quantity.elements['id['+id+']'].disabled = true;
                  } else {
                     document.cart_quantity.elements['id['+id+']'].disabled = true;
                  }
                  // ON VA VOIR L'OPTION LIE AU SI
                  posbase = pos+1;
                  et = option_array.indexOf('&', posbase);
                  ou = option_array.indexOf(',', posbase);
                  si = option_array.indexOf(';', posbase);

                  if (  (ou != -1 ? et < ou : true)  && ( si != -1 ? et < si : true) && et != -1 ) {separator = 'et'; pos = et;}
                  if (  (et != -1 ? ou < et : true)  && ( si != -1 ? ou < si : true) && ou != -1 ) {separator = 'ou'; pos = ou;}
                  if (  (ou != -1 ? si < ou : true)  && ( et != -1 ? si < et : true) && si != -1 ) {separator = 'si'; pos = si;}
                  if (et == -1 && ou == -1  && si == -1) {separator = ''; pos = false;}
                  if (pos) {
                     var code = option_array.substr(posbase, pos-posbase);
                     var si_id = code.substr(0, code.indexOf('('));
                     var new_price = code.substr(code.indexOf('(')+1, code.indexOf(')')-3);
                  } else {
                     var code = option_array.substr(posbase, option_array.length);
                     var si_id = code.substr(0, code.indexOf('('));
                     var new_price = code.substr(code.indexOf('(')+1, code.indexOf(')')-3);
                  }

                  message_exclut += document.cart_quantity.elements['option_value_name_'+si_id].value + "\n" + separator + '\n';


                  if (document.cart_quantity.elements['id['+si_id+']'].checked) { // LINK OK
                     document.cart_quantity.elements['id['+si_id+']'].disabled = true;
                     si_array.push(si_id+'|'+sender+'|'+document.cart_quantity.elements['id['+sender+']'].value+'|'+new_price);
                    // alert(document.cart_quantity.elements['id['+sender+']'].value);
                  }
               } else {  // ON VIENT DE DECOCHER
                  document.cart_quantity.elements['id['+id+']'].disabled = false;
                  // ON VA VOIR L'OPTION LIE AU SI
                  posbase = pos+1;
                  et = option_array.indexOf('&', posbase);
                  ou = option_array.indexOf(',', posbase);
                  si = option_array.indexOf(';', posbase);

                  if (  (ou != -1 ? et < ou : true)  && ( si != -1 ? et < si : true) && et != -1 ) {separator = 'et'; pos = et;}
                  if (  (et != -1 ? ou < et : true)  && ( si != -1 ? ou < si : true) && ou != -1 ) {separator = 'ou'; pos = ou;}
                  if (  (ou != -1 ? si < ou : true)  && ( et != -1 ? si < et : true) && si != -1 ) {separator = 'si'; pos = si;}
                  if (et == -1 && ou == -1  && si == -1) {separator = ''; pos = false;}
                  if (pos) {
                     var code = option_array.substr(posbase, pos-posbase);
                     var si_id = code.substr(0, code.indexOf('('));
                     var new_price = code.substr(code.indexOf('(')+1, code.indexOf(')')-3);
                  } else {
                     var code = option_array.substr(posbase, option_array.length);
                     var si_id = code.substr(0, code.indexOf('('));
                     var new_price = code.substr(code.indexOf('(')+1, code.indexOf(')')-3);
                  }
                  document.cart_quantity.elements['id['+si_id+']'].disabled = false;
                  // CLEAN SI_ARRAY
                  temp_array = '';
                  for (var k=0; k< si_array.length; k++) {
                     var temp_si_array = si_array[k].split("|");
                     if (sender != temp_si_array[1]) {
                        //VERIF SI OPTION LIE CHECKE
                        temp_array.push(temp_si_array);
                     }
                  }
                  si_array = temp_array;
               }
           }
//        if (message != '') alert('ATTENTION : exclut\n' + message);
        }
        if (type == 'exige' ) {
           if (separator == 'et' || separator == '') {
               if (document.cart_quantity.elements['id['+sender+']'].checked) { // ON VIENT DE COCHER
                  message_exige += document.cart_quantity.elements['option_value_name_'+id].value + "\n" + separator + '\n';
                  if (document.cart_quantity.elements['id['+id+']'].checked) { // LINK OK
                     document.cart_quantity.elements['id['+id+']'].disabled = true;
                  } else {
                     document.cart_quantity.elements['id['+id+']'].checked = true;
                  calc_price(document.cart_quantity.elements['id['+id+']'].getAttribute("link_js"), id, document.cart_quantity.elements['id['+id+']'].value, '+');
                     document.cart_quantity.elements['id['+id+']'].disabled = true;
                  }
               } else {  // ON VIENT DE DECOCHER
                  document.cart_quantity.elements['id['+id+']'].checked = false;
                  calc_price(document.cart_quantity.elements['id['+id+']'].getAttribute("link_js"), id, document.cart_quantity.elements['id['+id+']'].value, '+');
                  document.cart_quantity.elements['id['+id+']'].disabled = false;
               }
           }
           if (separator == 'ou') {
               if (document.cart_quantity.elements['id['+sender+']'].checked) { // ON VIENT DE COCHER
                  // ON RECUPERE TOUTES LES OPTIONS LIE ET ON CHECKE SI UNE EST CHECKE
                  message_exige_ou += document.cart_quantity.elements['option_value_name_'+id].value + "\n" + separator + '\n';
                  if (document.cart_quantity.elements['id['+id+']'].checked) checked1 =true;
                  document.cart_quantity.elements['id['+id+']'].disabled = true;

                  while (pos) {
                     posbase = pos+1;
                     ou = option_array.indexOf(',', posbase);

                     separator = 'ou';
                     pos = ou;
                     if (ou == -1) {separator = ''; pos = false;}
                     if (pos) {
                        var id = option_array.substr(posbase, pos-posbase);
                     } else {
                        var id = option_array.substr(posbase, option_array.length);
                     }
                     message_exige_ou += document.cart_quantity.elements['option_value_name_'+id].value + "\n" + separator + '\n';
                     document.cart_quantity.elements['id['+id+']'].disabled = true;
                     // OPTIONS CHECKE ????
                     if (document.cart_quantity.elements['id['+id+']'].checked) checked1 =true;
                  }
                  if (!checked1) {
                        alert('ATTENTION : VOUS DEVEZ CHOISIR UNE DE SES OPTIONS POUR POUVOIR SELECTIONNER CETTE OPTION :\n' + message_exige_ou);
                        document.cart_quantity.elements['id['+sender+']'].checked = false;
                        calc_price(document.cart_quantity.elements['id['+sender+']'].getAttribute("link_js"), sender, document.cart_quantity.elements['id['+sender+']'].value, '+');
                        message_exige_ou = '';
                        message_exige = '';
                        message_exclut = '';
                        message_inclut = '';
                  }
                  message_exige += message_exige_ou;

               } else {  // ON VIENT DE DECOCHER
                  document.cart_quantity.elements['id['+id+']'].disabled = false;
                  calc_price(document.cart_quantity.elements['id['+id+']'].getAttribute("link_js"), id, document.cart_quantity.elements['id['+id+']'].value, '+');
               }
           }
//        if (message != '') alert('ATTENTION : exige\n' + message);
        }
        if (type == 'inclut' ) {
//           for (var j = 0; j < option_array.length; j++) {
               if (document.cart_quantity.elements['id['+sender+']'].checked) { // ON VIENT DE COCHER
                  message_inclut += document.cart_quantity.elements['option_value_name_'+id].value + "\n" + separator + '\n';
                  inclut.push(id+'|'+sender+'|'+document.cart_quantity.elements['id['+id+']'].value);
//                  inclut.push(id+'|'+sender);
                  document.cart_quantity.elements['id['+id+']'].value = 0;
                  if (document.cart_quantity.elements['id['+id+']'].checked) { // LINK OK
                     document.cart_quantity.elements['id['+id+']'].disabled = true;
                  } else {
                     document.cart_quantity.elements['id['+id+']'].checked = true;
                     document.cart_quantity.elements['id['+id+']'].disabled = true;
                  }
               } else {  // ON VIENT DE DECOCHER
                  // CLEAN INCLUT ARRAY
                  temp_array = '';
                  for (var k=0; k< inclut.length; k++) {
                     var temp_inclut = inclut[k].split("|");
                     if (sender != temp_inclut[1]) {
                        //VERIF SI OPTION LIE CHECKE
                        temp_array.push(inclut[k]);
                     } else {
                        document.cart_quantity.elements['id['+temp_inclut[0]+']'].value = temp_inclut[2];
                     }
                  }
                  inclut = temp_array;

                  document.cart_quantity.elements['id['+id+']'].checked = false;
                  document.cart_quantity.elements['id['+id+']'].disabled = false;
               }
//           }
//        if (message != '') alert('ATTENTION : inclut\n' + message);
        }
      }
     }
  }

  if (message_exclut != '') message += 'ATTENTION : exclut\n' + message_exclut;
  if (message_exige != '') message += 'ATTENTION : exige\n' + message_exige;
  if (message_inclut != '') message += 'ATTENTION : inclut\n' + message_inclut;
  if (message != '') alert(message);


  for (var j=0; j<document.cart_quantity.length; j++) {
      if ( (document.cart_quantity.elements[j].type == 'checkbox' ||  document.cart_quantity.elements[j].type == 'radio') && document.cart_quantity.elements[j].checked) {
         if (document.cart_quantity.elements[j].value == -1) {
             price = 0;
         } else {
             price = document.cart_quantity.elements[j].value;
         }
         // GESTION DES INCLUSIONS
         is_inclut = false;
         for (var k=0; k< inclut.length; k++) {
             if (document.cart_quantity.elements[j].name == 'id['+inclut[k]+']')
             is_inclut = true;
         }
         // GESTION DES SI + NEW PRICE
         for (var k=0; k< si_array.length; k++) {
             var temp_si_array = si_array[k].split("|");
             if (document.cart_quantity.elements[j].name == 'id['+temp_si_array[1]+']') {
                //VERIF SI OPTION LIE CHECKE
                if (document.getElementsByName("id["+temp_si_array[1]+"]")[0].checked) price = temp_si_array[3];
             }
         }

         if (prefix == '+') {
            //alert(document.cart_quantity.elements[i].value);
            if (!is_inclut) total = total + parseInt(price, 10);
         } else {
            total = total - parseInt(price, 10);
         }
      }
  }
//  if (document.cart_quantity.elements[i].value2 != 0) {
       textBlink(total,'price',2000,350);
//  }
  return total;
}

function do_submit()
{
  for (var j=0; j<document.cart_quantity.length; j++) {
      if ( (document.cart_quantity.elements[j].type == 'checkbox' ||  document.cart_quantity.elements[j].type == 'radio') && document.cart_quantity.elements[j].checked) {
         document.cart_quantity.elements[j].disabled = false;
      }
  }
}

function clear_checkbox()
{
  for (var j=0; j<document.cart_quantity.length; j++) {
      if ( (document.cart_quantity.elements[j].type == 'checkbox' ||  document.cart_quantity.elements[j].type == 'radio')) {
         if (document.cart_quantity.elements[j].normal == true) {
            document.cart_quantity.elements[j].checked = false;
            document.cart_quantity.elements[j].disabled = false;
         }
      }
  }
}

function textBlink(txt,id,max,speed)
{
  if (!document.getElementById) return;
  el = document.getElementById(id);
  el.blink = false;
  el.max = max;
  el.txt = txt;
  el.speed = speed;
  goBlink(id)
}

function goBlink(id)
{
  el = document.getElementById(id);
  el.innerHTML = el.blink?" ":el.txt;
  el.max = el.max - el.speed;
  if (el.max<0 && !el.blink) return;
  el.blink = !el.blink;
  setTimeout("goBlink('"+id+"')",el.speed);
}

function clear_field(options_id) {
  for (i=0; i<document.cart_quantity.length; i++) {
      if ( document.cart_quantity.elements[i].type == 'checkbox' ||  document.cart_quantity.elements[i].type == 'radio' ) {
         if ( (document.cart_quantity.elements[i].name == 'id['+options_id+']') || (document.cart_quantity.elements[i].name == 'id['+options_id+'][]') ) {
            document.cart_quantity.elements[i].checked = false;
         }
      }
  }
  var total = calc_price();
}

function arrondi(nombre, precision)
{
   var num_arrondi = Math.round(nombre * Math.pow(10, precision)) / (Math.pow(10, precision));
   return num_arrondi;
}


function hideLayer(layer){
        if(layer != 'cancel'){
                timeID = setTimeout("resetNavigation('"+layer+"')",500);
                //timeID = setTimeout("MM_showHideLayers('" + layer + "','','hide')",500);
                //timeID = setTimeout("clearImage()",500);
        }else{
                clearTimeout(timeID);
        }
}
        var currentImage = null;
        var swapImage;
        var editedParam;
        function setImage(a,b) {
//            alert ( "A = " + a + " current = " + currentImage );
//                if (currentImage != a) {
                        if (currentImage != null  )
                        {
                                clearImage();
                        }
                        currentImage = a;
//                        swapImage = document[currentImage].src;
                        swapImage = currentImage.src;
//                    alert ( "2 A = " + a + " current = " + currentImage );
                        changeImages(a,b);
//                swapImage = b +".gif";
//                editedParam = b+"_mo.gif";
//                changeImages(a,editedParam);
//                }
        }

        function resetNavigation(layer){
                MM_showHideLayers(layer,'','hide');
                clearImage();
        }

function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}

        function clearImage () {
                if (currentImage != null ) {
                        changeImages(currentImage,swapImage);
                        currentImage = null;
                }
        }

        function changeImages() {
                if (document.images && (preloadFlag == true)) {
                        for (var i=0; i<changeImages.arguments.length; i+=2) {
                           // alert ( changeImages.arguments[i+1] );
                                document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
                        }
                }
        }

        function newImage(arg) {
                if (document.images) {
                        rslt = new Image();
                        rslt.src = arg;
                        return rslt;
                }
        }









