﻿var Lang='en';
var bMod=false;
var bReadOnly=false;
ClearItems();
var openerUrl = '';
try
{
  if (window.opener)
  {
    openerUrl = window.opener.top.location.href;
  }
}
catch(e)
{
}

//
// Startup functions
//

function OpenHelpWin(url)
{
  window.open(url,'calhelp','height=768,width=1024,scrollbars=1,menubar=0,location=0,titlebar=0,status=0');
}
var targWidth = 0;
var targHeight = 0;
if (window.width > window.screen.availWidth)
{
  targWidth = window.screen.availWidth;
  targHeight = window.height;
}
if (window.height > window.screen.availHeight)
{
  targHeight = window.screen.availHeight;
  if (targWidth == 0) targWidth = window.width;
}
if (targHeight > 0 || targWidth > 0)
{
  window.moveTo(0, 0);
  window.resizeTo(targWidth, targHeight);
}
function Surface()
{
  window.focus();
}
var minute = 0;
function SessionExpiree()
{
  minute++;
  if (minute > (480))
  {
    window.location.href = '../B/SessionExpiree.aspx';
  }
  window.setTimeout('SessionExpiree()', 60000);
}
window.setTimeout('SessionExpiree()', 60000);
window.setTimeout('Surface()', 500);

//
// Popup menu functions
//

var cancelTimerV = new Array(4);
var cancelTimerH = new Array(4);
cancelTimerV[0] = 0;
cancelTimerV[1] = 0;
cancelTimerV[2] = 0;
cancelTimerV[3] = 0;
cancelTimerH[0] = 0;
cancelTimerH[1] = 0;
cancelTimerH[2] = 0;
cancelTimerH[3] = 0;
var menusUp = new Array(4);
function hideMe(popupvar, ev)
{
  if (!ev) ev = window.event;
  if (NotIE)
  {
    if (ev.target.nodeName != "TD")
    {
      ev.stopPropagation();
      return;
    }
  }

  var myLevel = parseInt(popupvar.getAttribute("level"));
  if (cancelTimerV[myLevel] != 0)
  {
    clearTimeout(cancelTimerV[myLevel]);
    cancelTimerV[myLevel] = 0;
  }
  cancelTimerH[myLevel] = setTimeout("doHideMenu('"+popupvar.id+"')", 200);
  
  if (myLevel > 0)
  {
    if (menusUp[myLevel-1])
    {
      cancelTimerH[myLevel-1] = setTimeout("doHideMenu('"+menusUp[myLevel-1].id+"')", 200);
    }
  }
}

function showMe(popupvar, ev)
{
  var myLevel = parseInt(popupvar["level"]);
  if (cancelTimerH[myLevel] != 0)
  {
    clearTimeout(cancelTimerH[myLevel]);
    cancelTimerH[myLevel] = 0;
  }
  if (myLevel > 0 && cancelTimerH[myLevel-1] != 0)
  {
    clearTimeout(cancelTimerH[myLevel-1]);
    cancelTimerH[myLevel-1] = 0;
  }
  if (myLevel > 1 && cancelTimerH[myLevel-2] != 0)
  {
    clearTimeout(cancelTimerH[myLevel-2]);
    cancelTimerH[myLevel-2] = 0;
  }
}

function placeMenu(menuvar, popupname, ev)
{
  if (!ev) ev = window.event;
  if (!NotIE)
  {
    if (ev.srcElement.nodeName != "SPAN")
    {
      return;
    }
  }
  else
  {
    if (ev.target.nodeName != "SPAN")
    {
      return;
    }
  }
  
  if (popupname == "nonexistent")
  {
    var level = parseInt(menuvar.getAttribute("level"))+1;
    while (level < 4)
    {
      if (menusUp[level])
      {
        menusUp[level].style.visibility = "hidden";
        menusUp[level] = null;
      }
      level = level+1;
    }
  }
  
  popupvar = document.getElementById(popupname);
  
  if (popupvar)
  {
    var myLevel = parseInt(popupvar.getAttribute("level"));
    
    if (cancelTimerH[myLevel] != 0)
    {
      clearTimeout(cancelTimerH[myLevel]);
      cancelTimerH[myLevel] = 0;
    }
    if (myLevel > 0 && cancelTimerH[myLevel-1] != 0)
    {
      clearTimeout(cancelTimerH[myLevel-1]);
      cancelTimerH[myLevel-1] = 0;
    }
    if (myLevel > 1 && cancelTimerH[myLevel-2] != 0)
    {
      clearTimeout(cancelTimerH[myLevel-2]);
      cancelTimerH[myLevel-2] = 0;
    }

    if (!NotIE)
    {
      var totalX = (menuvar.getBoundingClientRect().left+40);
      var totalY = (menuvar.getBoundingClientRect().bottom-4);
      cancelTimerV[myLevel] = setTimeout("doShowMenu('"+menuvar.id+"','"+popupname+"','"+totalX+"px','"+totalY+"px')", 50);  
    }
    else
    {
      try
      {
        var totalX = 0;
        var obj = menuvar;
        while (obj)
        {
          if (!isNaN(obj.offsetLeft)) totalX += obj.offsetLeft;
          obj = obj.offsetParent;
        }
        var totalY = 0;
        var obj = menuvar;
        while (obj)
        {
          if (!isNaN(obj.offsetTop)) totalY += obj.offsetTop;
          obj = obj.offsetParent;
        }
        totalX += 40;
        totalY += 20;
        
        cancelTimerV[myLevel] = setTimeout("doShowMenu('"+menuvar.id+"','"+popupname+"','"+totalX+"px','"+totalY+"px')", 50);  
      }
      catch (ex)
      {
      }
    }
  }
}

function hideMenu(popupname, ev)
{
  popupvar = document.getElementById(popupname);
  
  if (!ev) ev = window.event;
  if (NotIE)
  {
    if (ev.target.nodeName != "TD")
    {
      return;
    }
  }
  else
  {
    if (ev.srcElement.nodeName != "SPAN")
    {
      return;
    }
  }

  var myLevel = parseInt(popupvar.getAttribute("level"));
  if (cancelTimerV[myLevel] != 0)
  {
    clearTimeout(cancelTimerV[myLevel]);
    cancelTimerV[myLevel] = 0;
  }
  cancelTimerH[myLevel] = setTimeout("doHideMenu('"+popupname+"')", 200);
}

function doHideMenu(popupname)
{
  popupvar = document.getElementById(popupname);
  
  if (popupvar != null)
  {
    if (popupvar.style.visibility != "hidden")
    {
      var myLevel = parseInt(popupvar.getAttribute("level"));
      menusUp[myLevel] = null;
      
      if (myLevel < 3 && menusUp[3]) menusUp[3].style.visibility = "hidden";
      if (myLevel < 2 && menusUp[2]) menusUp[2].style.visibility = "hidden";
      if (myLevel < 1 && menusUp[1]) menusUp[1].style.visibility = "hidden";
      
      //document.getElementById("debug").value = currentMenuLevel;
      if (!NotIE) popupvar.style.position = "absolute";
      else popupvar.style.position = "fixed";
      popupvar.style.top = -1000;
      popupvar.style.visibility = "hidden";
    }
    //alert("hidden");
  }
}

function doShowMenu(menuname, popupname, x, y)
{
  menuvar = document.getElementById(menuname);
  if (menuvar != null)
  {
    var level = parseInt(menuvar.getAttribute("level"))+1;
    if (menusUp[level]) menusUp[level].style.visibility = "hidden";
  
    popupvar = document.getElementById(popupname);
    if (popupvar != null)
    {
      if (popupvar.style.visibility != "visible")
      {
        menusUp[level] = popupvar;
        
        if (!NotIE)
        {
          popupvar.style.position = "absolute";
        }
        else
        {
          popupvar.style.position = "fixed";
        }
        popupvar.style.top = y;
        popupvar.style.left = x;
        popupvar.style.visibility = "visible";
      }
    }
  }
}

//
// End Popup menu functions
//

function ScrollWith(source)
{
  var destC = document.getElementById(source.id.replace("R_", "CH_"));
  var destR = document.getElementById(source.id.replace("R_", "RH_"));
  if (destC != null) destC.scrollLeft = source.scrollLeft;
  if (destR != null) destR.scrollTop  = source.scrollTop;
}

function AddToCart(sId)
{
  var oSelect = document.getElementById("sel"+sId);
  var oQty    = document.getElementById("txt"+sId);
  
  if (oSelect.value.length == 0)
  {
    if (Lang=='fr')
    {
      alert("SVP choisissez une option.");
    }
    else
    {
      alert("Please select one option.");
    }
    return;
  }
  if (oQty.value.length == 0)
  {
    if (Lang=='fr')
    {
      alert("Vous n'avez pas entré de quantité pour cet item. Avant de l'ajouter à votre panier, SVP choisissez le produit spécifique que vous désirez dans la liste de sélection puis indiquez une quantité dans le champ QTÉ à droite du bouton 'Ajouter au panier'.");
    }
    else
    {
      alert("You have not entered a quantity for this item. Before adding an item to your shopping cart, please select the specific product you desire from the drop-down list and indicate a quantity in the QTY box just right of the 'Add to cart' button.");
    }
    return;
  }
  if (isNaN(oQty.value))
  {
    if (Lang=='fr')
    {
      alert("Vous avez entré des caractères non-numériques dans le champ QTÉ. SVP entrez uniquement des chiffres dans ce champ.");
    }
    else
    {
      alert("You have entered non-numeric characters in the QTY field. Please use digits only.");
    }
    return;
  }
  window.open("AddToCart.aspx?V="+oSelect.value+"&N="+oQty.value, "AddToCart", "height=250,width=400,scrollbars=0,menubar=0,location=0,titlebar=0,status=0" );
  oQty.value = '';
}

function TriggerCurrencyConversion()
{
  var sFactor = "";

  if (Lang=='fr')
  {
    sFactor = window.prompt("Facteur multiplicateur",sFactor);
  }
  else
  {
    sFactor = window.prompt("Multiplying factor",sFactor);
  }
  
  if (sFactor == null) return;
  else if (sFactor.length == 0)
  {
    if (Lang=='fr')
    {
      alert("SVP entrez un facteur multiplicateur.");
    }
    else
    {
      alert("Please enter a multiplying factor.");
    }
    return;
  }
  else if (isNaN(sFactor))
  {
    if (Lang=='fr')
    {
      alert("Vous avez entré des caractères non-numériques.");
    }
    else
    {
      alert("You have entered non-numeric characters.");
    }
    return;
  }
  
  var oFactor = document.getElementById("child_txtFactor");
  oFactor.value = sFactor;
  __doPostBack('child$btnEDuplicate','');
}

function Mod()
{
  bMod = true;
}

// This is for the delete column of DigLists
function DeleteItem(item)
{
  if (bReadOnly)
  {
    if (Lang=='fr') alert("La page est en lecture seulement. Impossible d'effacer.");
    if (Lang=='en') alert("Page is in read-only mode. Cannot delete.");
    if (Lang=='es') alert("(Espanol)");
  }
  else
  {
    ClearItemChecks();
    var box = document.getElementById("Item" + item);
    if (box)
    {
      box.checked = true;
    }
    window.items = item;
    SingleItemCommand('child$btnLDelete', 'delete', 'effacer', 'es', true, false);
  }
}

function ProcessSelection(button, action, safe, validated)
{
  MultipleItemCommand(button, action, action, action, safe, validated);
}
function MultipleItemCommand(button, actionEn, actionFr, actionEs)
{
  MultipleItemCommand(button, actionEn, actionFr, actionEs, false, false);
}

function MultipleItemCommand(button, actionEn, actionFr, actionEs, safe, validated)
{
  if (window.items == '')
  {
    if (Lang=='fr') alert("Vous devez sélectionner un ou plusieurs items avant d'utiliser ce bouton.");
    if (Lang=='en') alert("Please select one or more items before using this button.");
    if (Lang=='es') alert("(Espanol)");
    return;
  }
  var plur = false
  if (window.items.substr(1).indexOf(",") > -1) plur = true;
  if (plur && safe && bMod)
  {
    var Msg = "";
    if (Lang=='fr') Msg = "Vous avez des modifications non-enregistrées. Voulez-vous vraiment " + actionFr + " les items sélectionnés et perdre vos modifications?";
    if (Lang=='en') Msg = "You have unsaved changes. Do you really wish to " + actionEn + " selected items and loose the changes?";
    if (Lang=='es') Msg = "(Espanol)";
    if (!window.confirm(Msg)) return;
  }
  else if (plur && safe)
  {
    var Msg = "";
    if (Lang=='fr') Msg = "Voulez-vous vraiment " + actionFr + " les items sélectionnés?";
    if (Lang=='en') Msg = "Do you really wish to " + actionEn + " selected items?";
    if (Lang=='es') Msg = "(Espanol)";
    if (!window.confirm(Msg)) return;
  }
  else if (safe && bMod)
  {
    var Msg = "";
    if (Lang=='fr') Msg = "Vous avez des modifications non-enregistrées. Voulez-vous vraiment " + actionFr + " l'item sélectionné et perdre vos modifications?";
    if (Lang=='en') Msg = "You have unsaved changes. Do you really wish to " + actionEn + " the selected item and loose the changes?";
    if (Lang=='es') Msg = "(Espanol)";
    if (!window.confirm(Msg)) return;
  }

  else if (safe)
  {
    var Msg = " ";
    if (Lang=="fr") Msg = "Voulez-vous vraiment " + actionFr + " cet item?";
    if (Lang=="en") Msg = "Do you really wish to " + actionEn + " the selected item?";
    if (Lang=="es") Msg = "(Espanol)";
    if (!window.confirm(Msg)) return;
  }
  
  SilentSelectionCommand(button, validated);
}

function ProcessItem(button, action, safe, validated)
{
  SingleItemCommand(button, action, action, action, safe, validated);
}
function SingleItemCommand(button, actionEn, actionFr, actionEs)
{
  SingleItemCommand(button, actionEn, actionFr, actionEs, false, false);
}

function SingleItemCommand(button, actionEn, actionFr, actionEs, safe, validated)
{
  if (window.items == '')
  {
    if (Lang=='fr') alert("Vous devez sélectionner un item avant d'utiliser ce bouton.");
    if (Lang=='en') alert("Please select one item before using this button.");
    if (Lang=='es') alert("(Espanol)");
    return;
  }
  if (window.items.indexOf(',') != window.items.lastIndexOf(','))
  {
    if (Lang=='fr') alert("Vous devez sélectionner un seul item avant d'utiliser ce bouton.");
    if (Lang=='en') alert("Please select only one item before using this button.");
    if (Lang=='es') alert("(Espanol)");
    return;
  }
  if (safe && bMod)
  {
    var Msg = "";
    if (Lang=='fr') Msg = "Vous avez des modifications non-enregistrées. Voulez-vous vraiment " + actionFr + " l'item sélectionné et perdre vos modifications?";
    if (Lang=='en') Msg = "You have unsaved changes. Do you really wish to " + actionEn + " the selected item and loose the changes?";
    if (Lang=='es') Msg = "(Espanol)";
    if (!window.confirm(Msg)) return;
  }
  else if (safe)
  {
    if (bReadOnly && button.IndexOf("Del") > -1)
    {
      if (Lang=='fr') alert("La page est en lecture seulement. Impossible d'effacer.");
      if (Lang=='en') alert("Page is in read-only mode. Cannot delete.");
      if (Lang=='es') alert("(Espanol)");
      return;
    }

    var Msg = "";
    if (Lang=='fr') Msg = "Voulez-vous vraiment " + actionFr + " cet item?";
    if (Lang=='en') Msg = "Do you really wish to " + actionEn + " the selected item?";
    if (Lang=='es') Msg = "(Espanol)";
    if (!window.confirm(Msg)) return;
  }
  SilentSelectionCommand(button, validated);
}

function SilentSelectionCommand(button, validated)
{
  document.getElementById("child_txtItems").value = window.items;
  Command(button, validated)
}

function Command(button, validated)
{
  if (validated) ValidatedCommand(button);
  else DirectCommand(button);
}
function ValidatedCommand(button)
{
  if (typeof(Page_Validators) != 'object' || typeof(Page_ClientValidate) != 'function' ||  Page_ClientValidate()) __doPostBack(button,'');
  else
  {
    var Msg = "";
    if (Lang=='fr') Msg = "SVP vérifiez les champs marqués d'un symbol * (requis) ou ! (invalide). Placez votre pointeur de souris sur le ? rouge pour plus de détails.";
    if (Lang=='en') Msg = "Please check fields maked with a red * (required) or ! (invalid). Place your mouse pointer on the red ? for details.";
    if (Lang=='es') Msg = "(Espanol)";
    alert(Msg);
    return;
  }
}
function DirectCommand(button)
{
  __doPostBack(button,'');
}

function SafeCommand(button, actionEn, actionFr, actionEs, safe, validated)
{
  if (bMod)
  {
    var Msg = "";
    if (Lang=='fr') Msg = "Vous avez des modifications non-enregistrées. Voulez-vous vraiment " + actionFr + " et perdre les modifications?";
    if (Lang=='en') Msg = "You have unsaved changes. Do you really wish to " + actionEn + " and loose the changes?";
    if (Lang=='es') Msg = "(Espanol)";
    if (!window.confirm(Msg)) return;
  }
  else if (safe)
  {
    var Msg = "";
    if (Lang=='fr') Msg = "Voulez-vous " + actionFr + "?";
    if (Lang=='en') Msg = "Do you wish to " + actionEn + "?";
    if (Lang=='es') Msg = "(Espanol)";
    if (!window.confirm(Msg)) return;
  }
  Command(button, validated);
}

function SafeBack()
{
  if (bMod)
  {
    var Msg = "";
    if (Lang=='fr') Msg = "Vous avez des modifications non-enregistrées. Voulez-vous vraiment revenir à la page précédente et perdre les modifications?";
    if (Lang=='en') Msg = "You have unsaved changes. Do you really wish to go back to the previous page and loose the changes?";
    if (Lang=='es') Msg = "(Espanol)";
    if (!window.confirm(Msg)) return;
  }
  window.history.back();
}

function SafeReset()
{ 
  DirectCommand("child$btnEReset");
}

function SafeRefresh()
{ 
  if (bMod)
  {
    var Msg = "";
    if (Lang=='fr') Msg = "Vous avez des changements non enregistrés. Voulez-vous vraiment actualier la page et perdre les changements en cours?";
    if (Lang=='en') Msg = "You have unsaved changes. Do you really want to refresh the page and loose current changes?";
    if (Lang=='es') Msg = "(Espanol)";
    if (!window.confirm(Msg)) return;
  }
  top.location.href = top.location.href;
}

function NavigByPostBack(dest)
{
  document.getElementById("child_adrPostBackNavig").value = dest;
  __doPostBack("btnDummy", '');
}

function ClearNavigByPostBack()
{
  document.getElementById("child_adrPostBackNavig").value = "";
}

function NavigDirect(dest)
{ 
  window.top.location=dest;
}

function SafeNavigByPostBack(address, nameen, namefr, namees)
{ 
  SafeNavig(address, nameen, namefr, namees, true);
}
function SafeNavigDirect(address, nameen, namefr, namees)
{
  SafeNavig(address, nameen, namefr, namees, false);
}
function SafeOpen(address, name)
{
  SafeNavig(address, name, name, name, false);
}
function SafeNavig(address, nameen, namefr, namees, postback)
{ 
  if (bMod)
  {
    var Msg = "";
    if (Lang=='fr') Msg = "Vous avez des changements non enregistrés. Voulez-vous vraiment aller à "+namefr+" et perdre les changements en cours?";
    if (Lang=='en') Msg = "You have unsaved changes. Do you really want to go to "+nameen+" and loose current changes?";
    if (Lang=='es') Msg = "(Espanol)";
    if (!window.confirm(Msg)) return;
  }
  if (postback) NavigByPostBack(address);
  else NavigDirect(address);
}

function ClearItems()
{
  window.items = '';
  if (document.body)
  {
    ClearItemChecks();
  }
}

function ClearItemChecks()
{
  var aItems = document.body.getElementsByTagName("INPUT");
  for (var i=0; i<aItems.length; i++)
  {
    if (aItems[i].name.substring(0,4) == "Item")
    {   
      aItems[i].checked = false;
    }
  }
}

function AppendItem(item)
{
  window.items = window.items + ',' + item.toString();
  document.getElementById("child_txtItems").value = window.items;  
}
function RemoveItem(item)
{
  window.items = window.items.replace(','+item.toString(), '');
  document.getElementById("child_txtItems").value = window.items;  
}
function CheckListItem(ob, item)
{
  if (typeof(CheckListItemAlternate) == "function")
  {
    CheckListItemAlternate(ob, item);
  }
  else
  {
    if (ob.checked) AppendItem(item);
    else RemoveItem(item);
  }
}

function OpenEditWin(url)
{
  window.open(url,'edit','height=500,width=600,scrollbars=1,menubar=0,location=0,titlebar=0,status=1');
}

function RefreshOpener()
{
  window.setTimeout('RefreshOpener2()', 120);
}

function RefreshOpener2()
{
  if (window.opener) 
  {
    try
    {
      if (window.opener.top.location.href != openerUrl)
      {
        window.open(openerUrl, '_blank');
      }
      else
      {
        if (window.opener.__doPostBack)
        {
          window.opener.execScript("__doPostBack(\"child$dummy\");");
        }
        else if (window.opener.parent.__doPostBack) 
        {
          window.opener.parent.execScript("__doPostBack(\"child$dummy\");");
        }
      }
      window.close();
    }
    catch (e)
    {
    }
  }
}

function DelayedRefresh()
{
  setTimeout("__doPostBack('child$dummy','')", 200);
}

function ReturnToOpener()
{
  if (bMod)
  {
    var Msg = "Vous avez des changements non enregistrés. Voulez-vous vraiment fermer et perdre les changements en cours?";
    if (Lang=='en') Msg = "You have unsaved changes. Do you really want to close and loose current changes?";
    if (Lang=='es') Msg = "(Espanol)";
    if (!window.confirm(Msg)) return;
  }

  if (window.opener) 
  {
    try
    {
      window.opener.focus();
      window.opener.execScript("DelayedRefresh()");
    }
    catch (e)
    {
    }
  }
  window.close();
}

function GotoShop()
{
  ReturnToOpener();
}

function GotoCart()
{
  if (window.opener) 
  {
    try
    {
      window.opener.location = "Cart.aspx";
    }
    catch (e)
    {
    }
  }
  ReturnToOpener();
}

function SetScrollPos(top)
{
  var memPos = window.document.getElementById("child_txtScrollPosition");
  memPos.value = top;
}

function OnOffRows(name)
{
  var rowColl = document.getElementsByName("row" + name);
  for (i = 0; i < rowColl.length; i++)
  {
    var obj = rowColl[i];
    if (obj.style.display == 'none') obj.style.display = 'block';
    else obj.style.display = 'none';
  }
}

function OnOff(div, status)
{
  var oDiv = document.getElementById(div);
  if (status == null)
  {
    if (oDiv.style.display=='none')
    {
      oDiv.style.display='block';
    }
    else
    {
      oDiv.style.display='none';
    }
  }
  else if (status == 'On')
  {
    oDiv.style.display='block';
  }
  else
  {
    oDiv.style.display='none';
  }
}

function OnOff2(div, status)
{
  var oDiv = document.getElementById(div);
  var oDivAlt = document.getElementById(div+"Alt");
  
  if (status == null)
  {
    if (oDiv != null && oDiv.style.display=='none')
    {
      oDiv.style.display='block';
      if (oDivAlt != null) oDivAlt.style.display='none';
    }
    else
    {
      if (oDiv != null) oDiv.style.display='none';
      if (oDivAlt != null) oDivAlt.style.display='block';
    }
  }
  else if (status == 'On')
  {
    if (oDiv != null) oDiv.style.display='block';
    if (oDivAlt != null) oDivAlt.style.display='none';
  }
  else
  {
    if (oDiv != null) oDiv.style.display='none';
    if (oDivAlt != null) oDivAlt.style.display='block';
  }
}

function Fermer(bouton)
{
  if (bMod)
  {
    var Msg = "Vous avez des changements non enregistrés. Voulez-vous vraiment fermer et perdre les changements en cours?";
    if (Lang=='en') Msg = "You have unsaved changes. Do you really want to close and loose current changes?";
    if (Lang=='es') Msg = "(Espanol)";
    if (!window.confirm(Msg)) return;
  }
  __doPostBack(bouton,'');
}

function ActionSelectionSil(bouton)
{
  if (window.items == '')
  {
    alert("Vous devez sélectionner un ou plusieurs items avant d'utiliser ce bouton.");
    if (Lang=='en') alert("Please select one or more items before using this button.");
    if (Lang=='es') alert("(Espanol)");
    return;
  }
  document.getElementById("child_txtItems").value = window.items;
  __doPostBack(bouton,'');
}

function ApplyAuditTrail()
{
  var Msg = "Les changements aux poinçons affecteront la paye de l'employé et seront enregistrés dans le registre des modifications. Voulez-vous vraiment appliquer la solution sélectionnée?";
  if (Lang=='en') Msg = "Changes to punches will impact the employee's pay and will be recorded in the audit trail. Do you really want to apply the selected solution?";
  if (Lang=='es') Msg = "(Espanol)";
  if (!window.confirm(Msg)) return;
  __doPostBack('child$btnApply','');
}

function MarkProcessed(id)
{
  if (bReadOnly)
  {
    if (Lang=='fr') alert("La page est en lecture seulement. Impossible d'effacer.");
    if (Lang=='en') alert("Page is in read-only mode. Cannot delete.");
    if (Lang=='es') alert("(Espanol)");
  }
  else
  {
    window.items = id;
    SingleItemCommand('child$btnResolve', 'mark Processed for', 'indiquer Traité pour', 'es', true, false);
  }
}

function Ignore(id)
{
  if (bReadOnly)
  {
    if (Lang=='fr') alert("La page est en lecture seulement. Impossible d'ignorer.");
    if (Lang=='en') alert("Page is in read-only mode. Cannot ignore.");
    if (Lang=='es') alert("(Espanol)");
  }
  else
  {
    window.items = id;
    SingleItemCommand('child$btnRemove', 'ignore', 'ignorer', 'es', true, false);
  }
}

function AddPunches()
{
  if (window.items == '')
  {
    if (Lang=='fr') alert("Vous devez sélectionner un ou plusieurs items avant d'utiliser ce bouton.");
    if (Lang=='en') alert("Please select one or more items before using this button.");
    if (Lang=='es') alert("(Espanol)");
    return;
  }

  top.location.href = 'Punch.aspx?AddPunchFor='+window.items;
}

function checkForAddItem(ddl)
{
  if (ddl.value == "DigAddItem")
  {
    var newVal = window.prompt("Entrez la nouvelle valeur à ajouter", "");
    
    if (newVal != "")
    {
      var oOption = document.createElement("OPTION");

      
      var coll = ddl.options;
      var i = coll.length-1;
      var oOption2 = coll.item(i);
      coll.remove(i);

      coll.add(oOption);
      oOption.innerText = newVal;
      oOption.value = newVal;

      coll.add(oOption2);
      ddl.selectedIndex = i;
    }
  }
}
