//############### DELETE RECORD(S) CONFIMATION ################

function deleter(d) {
//  if (confirm("Are you sure you want to permanently delete this record?"+ (d != '' ? "\n\n" + d : ''))) {
  if (confirm("Are you sure you want to permanently delete this record(s)?")) {     return true;
  }
  else
  {
     return false;
  }
}

//  MULTI-DELETER SETTINGS -----------------------------------------

var state = true
function selectAll(state, formn) {
   if (!document.getElementById('multid')) return;
   for (i=0;i<document.forms[formn].elements['selectedItems[]'].length;i++) {
      document.forms[formn].elements['selectedItems[]'][i].checked = state;
   }
   return !state 
}

//################################################

function checkform1(f) {
  var errMSG = ""; 

  

  if (f.elements['FileName'].value == "") 
         errMSG += "File Name\n";

  if (f.elements['FilePath'].value == "") 
         errMSG += "File\n";
       
  if ("" != errMSG) {
        alert("Required Fields:\n\n" + errMSG);
      return false;
  }

  return true;
}

//################################################

function checkform2(f) {
  var errMSG = ""; 

  

  if (f.elements['FileName'].value == "") 
         errMSG += "File Name\n";

  
 
       
  if ("" != errMSG) {
        alert("Required Fields:\n\n" + errMSG);
      return false;
  }

  return true;
}
//################################################
function checkform3(f) {
  var errMSG = ""; 

  

  if (f.elements['GroupTitle'].value == "") 
         errMSG += "Title\n";
if (f.elements['Position'].value == "") 
         errMSG += "Position\n";
  
 
       
  if ("" != errMSG) {
        alert("Required Fields:\n\n" + errMSG);
      return false;
  }

  return true;
}

//################################################

function checkform4(f) {
  var errMSG = "";   

  if (f.elements['Title'].value == "") 
         errMSG += "Title\n";
       
  if (f.elements['Alias'].value == "") 
         errMSG += "Alias\n";
       
  if (f.elements['Position'].value == "") 
         errMSG += "Position\n";
       
  if ("" != errMSG) {
        alert("Required Fields:\n\n" + errMSG);
      return false;
  }

  return true;
}
//################################################

function setPointer(theRow, theAction, theDefaultColor, thePointerColor, theMarkColor)
{
    var theCells = null;

    if ((thePointerColor == '' && theMarkColor == '')
        || typeof(theRow.style) == 'undefined') {
        return false;
    }

    if (typeof(document.getElementsByTagName) != 'undefined') {
        theCells = theRow.getElementsByTagName('td');
    }
    else if (typeof(theRow.cells) != 'undefined') {
        theCells = theRow.cells;
    }
    else {
        return false;
    }

    var rowCellsCnt  = theCells.length;
    var domDetect    = null;
    var currentColor = null;
    var newColor     = null;
    if (typeof(window.opera) == 'undefined'
        && typeof(theCells[0].getAttribute) != 'undefined') {
        currentColor = theCells[0].getAttribute('bgcolor');
        domDetect    = true;
    }
    else {
        currentColor = theCells[0].style.backgroundColor;
        domDetect    = false;
    } // end 3

    if (currentColor == ''
        || currentColor.toLowerCase() == theDefaultColor.toLowerCase()) {
        if (theAction == 'over' && thePointerColor != '') {
            newColor = thePointerColor;
        }
        else if (theAction == 'click' && theMarkColor != '') {
            newColor = theMarkColor;
        }
    }
    else if (currentColor.toLowerCase() == thePointerColor.toLowerCase()) {
        if (theAction == 'out') {
            newColor = theDefaultColor;
        }
        else if (theAction == 'click' && theMarkColor != '') {
            newColor = theMarkColor;
        }
    }
    else if (currentColor.toLowerCase() == theMarkColor.toLowerCase()) {
        if (theAction == 'click') {
            newColor = (thePointerColor != '')
                     ? thePointerColor
                     : theDefaultColor;
        }
    } // end 4

    if (newColor) {
        var c = null;
        if (domDetect) {
            for (c = 0; c < rowCellsCnt; c++) {
                theCells[c].setAttribute('bgcolor', newColor, 0);
            } // end for
        }
        else {
            for (c = 0; c < rowCellsCnt; c++) {
                theCells[c].style.backgroundColor = newColor;
            }
        }
    } // end 5

    return true;
}

//################################################

function setfocus() {
  if (document.forms[0] != null ) {
    for (f=0; f<document.forms[0].length; f++) {
      if (document.forms[0].elements[f].type == 'text') {
         document.forms[0].elements[f].focus();
         break;
      }
    }
  }
}

