function isIE()
{
 return (navigator.appName.indexOf("Microsoft") != -1);
}

function swapPic (imgObject, url)
{
 imgObject.src = url;
}

function openStandardPopup(theURL,winName) 
{ 
    MM_openBrWindow (theURL, winName, 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=700,height=550');
}


function MM_openBrWindow(theURL,winName,features) 
{ 
    window.open(theURL,winName,features);
}

function getCookie (name)
{
    var arg = name + "=";
    var alen = arg.length;
    var clen = document.cookie.length;
    var i = 0;
    while (i < clen)
    {
        var j = i + alen;
        if (document.cookie.substring (i, j) == arg)
        {
            return getCookieVal (j);
        }

        i = document.cookie.indexOf (" ", i) + 1;
        if (i == 0)
        {
            break;
        }
    }
    return null;
}

function setCookie(name, value)
{
    document.cookie = name + "=" + escape (value);
}

function getCookieVal(offset)
{
    var endstr = document.cookie.indexOf(";", offset);
    if (endstr == -1)
    {
        endstr = document.cookie.length;
    }
    
    return unescape(document.cookie.substring (offset, endstr));
}

function setDisplay(theDIV, toValue)
{
   if (toValue == "false" || toValue == false) // Hack to get around boo boo
   {
      theDIV.style.display = "none";
   } else
   {
      theDIV.style.display = "";
   }
}

// Toggles an array of slave checkboxes to have the same checked status
// as a master checkbox.  Should be called from the onClick of the master
// checkbox.  (Ignores non-checkbox controls as well as disabled checkboxes
// in the slave array.)
function toggleCheckboxes(masterCheckbox, slaveCheckboxes) {
    if (slaveCheckboxes != null) {
        if (slaveCheckboxes.type == "checkbox") {
            slaveCheckboxes.checked = masterCheckbox.checked;
        }
        else {
            for (var i = 0; i < slaveCheckboxes.length; i++) {
                if (slaveCheckboxes[i].type == "checkbox" && slaveCheckboxes[i].disabled == false) {
                    slaveCheckboxes[i].checked = masterCheckbox.checked;
                }
            }
        }
    }
}

// Toggles a master checkbox to represent whether or not all of an array of
// slave checkboxes are checked.  Should be called from the onClick of each
// of the slave checkboxes.  (Ignores non-checkbox controls as well as
// disabled checkboxes in the slave array.)
function setMasterCheckbox(masterCheckbox, slaveCheckboxes) {
    var slaveCheckboxesChecked = true;
    var slaveCheckboxesDisabled = true;
    if (slaveCheckboxes.type == "checkbox") {
        masterCheckbox.checked = slaveCheckboxes.checked;
    }
    else {
        for (var i = 0; i < slaveCheckboxes.length; i++) {
            if (slaveCheckboxes[i].type == "checkbox" && slaveCheckboxes[i].disabled == false) {
            	slaveCheckboxesDisabled = false;
                if (slaveCheckboxes[i].checked == false) {
                    slaveCheckboxesChecked = false;
                    break;
                }
            }
        }
    }
    // Only set the master if there is actually at least one enabled slave
    if (slaveCheckboxesDisabled == false) {
        masterCheckbox.checked = slaveCheckboxesChecked;
    }
}