<!--
//  Copyright © 2004 Siti Tous droits réservés
function VersionNavigateur(Netscape, Explorer)
{
  if (( (navigator.appVersion.substring(0,3) >= Netscape) && (navigator.appName == 'Netscape')) ||
  ( (navigator.appVersion.substring(0,3) >= Explorer) && (navigator.appName.substring(0,9) == 'Microsoft') ))
      return true;
  else return false;
}


function fenetre(url,name,features)
{
  var smallwindow = window.open(url,name,features);
  smallwindow.focus();
}
function resizescreen()
{
    window.resizeTo(screen.width,screen.height);
}

// confirmer

function ConfirmPopupForm(form,mess)
{
    if (window.confirm(mess))
    {
        form.submit();
    }

}

function ChangeImageBanner(n)
{

    if (document.getElementById)
    {
        document.getElementById(['banner']).src = banner[n];
        document.getElementById(['bannerhref']).href = bannerhref[n];
    }
    else if (document.all)
    {
      document.all['banner'].src = banner[n];
      document.all['bannerhref'].href = bannerhref [n];
    }
    else
    {
      document.layers['banner'].src = banner[n];
      document.layers['bannerhref'].href = bannerhref[n];
    }

}

function changebanner()
{
delay = 10;    // Secondes avant

ChangeImageBanner(i);
timer = setTimeout('changebanner()', delay*1000);
i++;
if (i >= number) i= 0;
};

function imp_image(win,img,w,h,design)
{
    var toth = h + 30 + 40;
    var totw = w + 30;
    var smallwindow = win.open('','_blank',"toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=yes,width="+totw+",height="+toth);
    var doc = smallwindow.document;
    doc.clear();
    doc.write("<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1 \"><title>Coupon</title>");
    doc.write("</head>");
    doc.write("<body background=\"#FFFFFF\" >\n") ;
    doc.write("<div align=\"center\"><center><table border=\"0\" width=\"100%\" cellspacing=\"2\" cellpadding=\"2\" height=\"100%\">");
    doc.write("<tr>");
    doc.write("<td colspan=\"2\" width=\""+w+"\" height=\""+h+"\"><img src=\"");
    doc.write(img);
    doc.write("\" width=\""+w+"\" height=\""+h+"\"></td>");
    doc.write("</tr>");
    doc.write("<tr>");
    doc.write("<td width=\"30%\" height=\"30\">");
    doc.write("<a href=\"javascript:window.close()\"><img name=\"Imgfermer\" align=\"absmiddle\" border=0 src=\""+design+"/bt_quit.png\" width=\"20\" height=\"20\"></a>");
    doc.write("&nbsp;<a href=\"javascript:window.print()\"><IMG src=\""+design+"/imprim.gif\" width=\"59\" height=\"35\" border=\"0\" alt=\"Imprimer\" align=\"absmiddle\"></a>");
    doc.write("</td>");
    doc.write("<td width=\"70%\" height=\"30\">");
    doc.write("<font size=\"2\" face=\"Verdana\">&nbsp;</font>");
    doc.write("</td>");
    doc.write("</tr>");
    doc.write("</table>");
    doc.write("</center></div>");
    doc.write("</body>");
    doc.write("</html>");
    doc.close();
    smallwindow.focus();
}

function imp_plan(win,fic,w,h,design)
{
    var toth = h + 30 + 40;
    var totw = w + 30;
    var smallwindow = win.open('','_blank',"toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=yes,width="+totw+",height="+toth);
    var doc = smallwindow.document;
    doc.clear();
    doc.write("<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1 \"><title>Coupon</title>");
    doc.write("</head>");
    doc.write("<body background=\"#FFFFFF\" >\n") ;
    doc.write("<div align=\"center\"><center><table border=\"0\" width=\"100%\" cellspacing=\"2\" cellpadding=\"2\" height=\"100%\">");
    doc.write("<tr>");
    doc.write("<td colspan=\"2\" width=\""+w+"\" height=\""+h+"\">");
    doc.write("<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0\" width=\"" +w + "\" height=\""+ h + "\" id=\"plan\" align=\"middle\">");
    doc.write("<param name=\"allowScriptAccess\" value=\"sameDomain\" />");
    doc.write("<param name=\"movie\" value=\""+ fic + "\" />");
    doc.write("<param name=\"quality\" value=\"high\" />");
    doc.write("<param name=\"wmode\" value=\"transparent\" />");
    doc.write("<param name=\"bgcolor\" value=\"#ffffff\" />");
    doc.write("<embed src=\""+ fic + "\" quality=\"high\" wmode=\"transparent\" bgcolor=\"#ffffff\" width=\""+w+"\" height=\""+h+"\" name=\"plan\" align=\"middle\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" /></object>");
    doc.write("</td>");
    doc.write("</tr>");
    doc.write("<tr>");
    doc.write("<td width=\"30%\" height=\"30\">");
    doc.write("<a href=\"javascript:window.close()\"><img name=\"Imgfermer\" align=\"absmiddle\" border=0 OnMouseOver=\"Imgfermer.src='"+design+"/bt_quit_on.png'\" OnMouseOut=\"Imgfermer.src='"+design+"/bt_quit_off.png'\" src=\""+design+"/bt_quit_off.png\" OnLoad=\"tempImg=new Image(0,0); tempImg.src='"+design+"/bt_quit_off.png'\"></a>");
    doc.write("</td>");
    doc.write("<td width=\"70%\" height=\"30\">");
    doc.write("&nbsp;");
    doc.write("</td>");
    doc.write("</tr>");
    doc.write("</table>");
    doc.write("</center></div>");
    doc.write("</body>");
    doc.write("</html>");
    doc.close();
    smallwindow.focus();
}
function imp_popup(url)
{
    var smallwindow = window.open(url,'_blank',"toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=500,height=400");
    smallwindow.focus();
}

function Select_Insert_Item(theList,itemNo,text,value)
{
    len = theList.options.length;
    index = -1;
    if ((itemNo>=0) && (itemNo<len))
    {
      nouv= new Option(text,value);

      for (i=len;i>itemNo;i--)
      {
            theList.options[i] = new Option(theList.options[i-1].text,theList.options[i-1].value);
      }
      theList.options[itemNo] = nouv;
      index = itemNo;

    }else{
      index = len;
      theList.options[index] = new Option(text,value);
      theList.options[index].value = value;
    }
    return index;
 }
function Select_Delete_Item(theList,itemNo)
{
    theList.options[itemNo]=null
}
function Select_Modify_Item(theList,itemNo,text,value)
{
    len = theList.options.length;
    index = -1;
    if ((itemNo>=0) && (itemNo<len))
    {
      theList.options[itemNo] = new Option(text,value);
    }
    return index;
 }

function hidelayer(lay) {// incompatbile ns7 si c'est hidden par defaut

if (document.all) {document.all[lay].style.visibility = "hidden";}
else if (document.getElementById) {document.getElementById([lay]).style.display = "none";}
else if (document.layers) {document.layers[lay].visibility = "hide";}
else {document.layers[lay].visibility = "hide";}
}
function showlayer(lay) {// incompatbile ns7 si c'est hidden par defaut

if (document.all) {document.all[lay].style.visibility = "visible";}
else if (document.getElementById) {document.getElementById([lay]).style.display = "block";}
else if (document.layers) {document.layers[lay].visibility = "show";}
else {document.layers[lay].visibility = "show";}
}

var marked_row = new Array;

function setPointer(theRow, theRowNum, theAction, theDefaultColor, thePointerColor, theMarkColor)
{
    var theCells = null;

    // 1. Pointer and mark feature are disabled or the browser can't get the
    //    row -> exits
    if ((thePointerColor == '' && theMarkColor == '')
        || typeof(theRow.style) == 'undefined') {
        return false;
    }

    // 2. Gets the current row and exits if the browser can't get it
    if (typeof(document.getElementsByTagName) != 'undefined') {
        theCells = theRow.getElementsByTagName('td');
    }
    else if (typeof(theRow.cells) != 'undefined') {
        theCells = theRow.cells;
    }
    else {
        return false;
    }

    // 3. Gets the current color...
    var rowCellsCnt  = theCells.length;
    var domDetect    = null;
    var currentColor = null;
    var newColor     = null;
    // 3.1 ... with DOM compatible browsers except Opera that does not return
    //         valid values with "getAttribute"
    if (typeof(window.opera) == 'undefined'
        && typeof(theCells[0].getAttribute) != 'undefined') {
        currentColor = theCells[0].getAttribute('bgcolor');
        domDetect    = true;
    }
    // 3.2 ... with other browsers
    else {
        currentColor = theCells[0].style.backgroundColor;
        domDetect    = false;
    } // end 3

    // 3.3 ... Opera changes colors set via HTML to rgb(r,g,b) format so fix it
    if (currentColor.indexOf("rgb") >= 0)
    {
        var rgbStr = currentColor.slice(currentColor.indexOf('(') + 1,
                                     currentColor.indexOf(')'));
        var rgbValues = rgbStr.split(",");
        currentColor = "#";
        var hexChars = "0123456789ABCDEF";
        for (var i = 0; i < 3; i++)
        {
            var v = rgbValues[i].valueOf();
            currentColor += hexChars.charAt(v/16) + hexChars.charAt(v%16);
        }
    }

    // 4. Defines the new color
    // 4.1 Current color is the default one
    if (currentColor == ''
        || currentColor.toLowerCase() == theDefaultColor.toLowerCase()) {
        if (theAction == 'over' && thePointerColor != '') {
            newColor              = thePointerColor;
        }
        else if (theAction == 'click' && theMarkColor != '') {
            newColor              = theMarkColor;
            marked_row[theRowNum] = true;
            // Garvin: deactivated onclick marking of the checkbox because it's also executed
            // when an action (like edit/delete) on a single item is performed. Then the checkbox
            // would get deactived, even though we need it activated. Maybe there is a way
            // to detect if the row was clicked, and not an item therein...
            // document.getElementById('id_rows_to_delete' + theRowNum).checked = true;
        }
    }
    // 4.1.2 Current color is the pointer one
    else if (currentColor.toLowerCase() == thePointerColor.toLowerCase()
             && (typeof(marked_row[theRowNum]) == 'undefined' || !marked_row[theRowNum])) {
        if (theAction == 'out') {
            newColor              = theDefaultColor;
        }
        else if (theAction == 'click' && theMarkColor != '') {
            newColor              = theMarkColor;
            marked_row[theRowNum] = true;
            // document.getElementById('id_rows_to_delete' + theRowNum).checked = true;
        }
    }
    // 4.1.3 Current color is the marker one
    else if (currentColor.toLowerCase() == theMarkColor.toLowerCase()) {
        if (theAction == 'click') {
            newColor              = (thePointerColor != '')
                                  ? thePointerColor
                                  : theDefaultColor;
            marked_row[theRowNum] = (typeof(marked_row[theRowNum]) == 'undefined' || !marked_row[theRowNum])
                                  ? true
                                  : null;
            // document.getElementById('id_rows_to_delete' + theRowNum).checked = false;
        }
    } // end 4

    // 5. Sets the new color...

    if (newColor) {
        var c = null;
        // 5.1 ... with DOM compatible browsers except Opera
        if (domDetect) {
            for (c = 0; c < rowCellsCnt; c++) {
                theCells[c].setAttribute('bgcolor', newColor, 0);

            } // end for

        }
        // 5.2 ... with other browsers
        else {
            for (c = 0; c < rowCellsCnt; c++) {
                theCells[c].style.backgroundColor = newColor;
            }
        }
    } // end 5

    return true;
} // end of the 'setPointer()' function
//-->

function RunFlash(swf, hauteur, largeur, couleur, wmode, nom) {
document.write("<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" width=\""+hauteur+"\" height=\""+largeur+"\" id=\""+nom+"\" align=\"middle\">\n");
document.write("<param name=\"allowScriptAccess\" value=\"sameDomain\" />\n");
if ((wmode == "transparent") || (wmode == "opaque"))
    document.write("<param name=\"wmode\" value=\""+wmode+"\" />\n");
document.write("<param name=\"bgcolor\" value=\""+couleur+"\" />\n");

document.write("<param name=\"movie\" value=\""+swf+"\" /><param name=\"quality\" value=\"high\" /><embed src=\""+swf+"\" quality=\"high\" ");
if ((wmode == "transparent") || (wmode == "opaque"))
    document.write("wmode=\""+wmode+"\" ");
document.write("bgcolor=\""+couleur+"\" width=\""+hauteur+"\" height=\""+largeur+"\" name=\""+nom+"\" align=\"middle\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />\n");
document.write("</object>\n");
}
