﻿// JScript File

function addToLightbox(assetID)
{
    //switch to lightbox if not already (not needed but looks better).
    window.frames.lbox.setLBCTab(0);

    frames['lbox'].addtoLB(assetID);
}

function addToCart(assetID)
{
    //switch to cart if not already (not needed but looks better).
    window.frames.lbox.setLBCTab(1);
    
    frames['lbox'].addtoCart(assetID);
    
}

function highlightCell(cellID)
{
    if (document.getElementById(cellID))
    {
        document.getElementById(cellID).className = "highlightedTD";
    }

}

function normalCell(cellID)
{
    if (document.getElementById(cellID))
    {
        document.getElementById(cellID).className = "standardTD";
    }
}

function cleartextbox(object,defaulttext)
{
    if (object.value == defaulttext){
        object.value = "";
        object.style.color = "#333333";
        }
}

  //string trim function  
  String.prototype.trim = function () {
        return this.replace(/^\s*/, "").replace(/\s*$/, "");
    }  

//TDA067 - start    
function ChangeAllCheckBoxStates(checkState)
  {
      // Toggles through all of the checkboxes defined in the CheckBoxIDs array
      // and updates their value to the checkState input parameter
      if (CheckBoxIDs != null)
      {
         for (var i = 0; i < CheckBoxIDs.length; i++)
            ChangeCheckBoxState(CheckBoxIDs[i], checkState);
        }
}

  function ChangeCheckBoxState(id, checkState)
   {
      var cb = document.getElementById(id);
      if (cb != null)
         cb.checked = checkState;
   }
   
//OnClientClick="javascript:if(!ConfirmDelete()){return false;}"    
//UseSubmitBehavior="false"
function ConfirmDelete(){

    var answer = confirm("Are you sure ?");

    if (answer){
        return true;
    }else{  
        return false;
    }
}   
//TDA067 - end 
    
