function OpenNewWindow(link, width, height)
{
 /* this function is no longer needed.  
    we use the GWC_WindowDotOpen function below.  */
    window.open(link, '', "'statusbar=yes, width=" + width + ", height=" + height + "'");
}
function GWC_WindowDotOpen(link, title, parameters)
{ /* this function is prefered over the default javascript windows.open().  This function takes the same input parameters but it works better because it is cross browser robust and prevents popups from getting lost under the current window. see bug 2765 for more info*/
    var w=window.open(link, title, parameters);
    w.blur();/* this line is chrome and safari fix. . .  from http://code.google.com/p/chromium/issues/detail?id=1674 */
    w.focus();/* this line prevents the window from getting lost under the current browser window */
    return false;/* for some of our code this line is redundant because 'return false' may be hardcoded into the onclick event. */
}


function ConfirmDeleteInGrid(gridName, strNoItemSelected, strConfirm)
{
    if (!HasItemSelect(gridName))
    {
        alert(strNoItemSelected);
        return false;
    }
    
    return ConfirmDelete(strConfirm);
}

function ConfirmDelete(strConfirm)
{
    return confirm(strConfirm);
}

function check_uncheck(Val, gridName)
{
  var ValChecked = Val.checked;
  var ValId = Val.id;
  var frm = document.forms[0];
  // Loop through all elements
  for (i = 0; i < frm.length; i++)
  {
    // Look for Header Template's Checkbox
    //As we have not other control other than checkbox we just check following statement
    if (this != null)
    {
      if (ValId.indexOf('CheckAll') !=  - 1)
      {
        // Check if main checkbox is checked,
        // then select or deselect datagrid checkboxes
        //if (ValChecked)
        if (frm.elements[i].id.indexOf(gridName)!=-1)
          frm.elements[i].checked = ValChecked;
        //else
        //  frm.elements[i].checked = false;
      }
      else if (ValId.indexOf('deleteRec') !=  - 1)
      {
        // Check if any of the checkboxes are not checked, and then uncheck top select all checkbox
        if (frm.elements[i].checked == false)
          frm.elements[1].checked = false;
      }
    } // if
  } // for
} // function

///Check item seleted in gridview
///Return false if no item selectd, else return true
function HasItemSelect(gridName)
{
    var frm = document.forms[0];
    for (i = 0; i < frm.length; i++)
    {
          if (frm.elements[i].id.indexOf(gridName)!=-1)
          {
              if (frm.elements[i].checked)
                return true;
          }
    } // for
  
  return false;
}

//Change Picture
function ChangePicture(simg, supload) 
{
    //document.getElementById(simg).src =document.getElementById(supload).value;
    simg.src = supload.value;
}

function goLite(BTN)
{
    BTN.style.color = "#ce6e19";
    BTN.style.backgroundColor = "#F1ECCF";   
}

function goDim(BTN)
{
    BTN.style.color = "#40403F";
    BTN.style.backgroundColor = "#F1ECCF"; 
}
