//clears "None of the Above" if other options are checked		
function ClearChecked(val) {
    document.forms[0].item(val).checked = false;
}

function clearNone(checkbox1) {
    checkbox1.checked = false;
}

function clearAll(noneVal, opVal) {
    opValArray = opVal.split("|");
    for (x = 0; x < opValArray.length; x++) {
        eval("document.forms[0]." + opValArray[x] + ".checked = false");
    }
}

var bSubmit;
bSubmit = false;

function cancelClick() {
    return bSubmit;
}

function setSubmit(aValue) {
    bSubmit = aValue;
    if (aValue == true) {
        document.getElementById('Form1').submit();
    }
}

function clearCheckBoxFromText(checkName) {
    var inputPath = eval('document.forms[0].' + checkName);
    if (inputPath.checked == true) {
        inputPath.checked = false;
    }
}

// Deselect a radiobuttonlist 
function ClearRadioList(question) {
    var itemCount = eval("document.forms[0]." + question + ".length");
    var n;
    for (n = 0; n < itemCount; n++) {
        eval("document.forms[0]." + question + "_" + n + ".checked = false");
    }
}

// Deselect dropdownlists 
function ClearDropLists(questions) {
    var list;
    var questionArray = questions.split("|");

    for (x = 0; x < questionArray.length; x++) {
        list = eval("document.forms[0]." + questionArray[x]);
        list.selectedIndex = 0;
    }
}

// This is used as an alternative to links in order to optimize search engine hits
function goToPage(path) {
    window.location.href = path;
}

// This is for use on the left navigation of the long form - when the users hits any
// links on the left, we want to make sure that the current page that they are in saves
// all of it's data
function submitToPage(path) {
    window.document.forms[0].action = path;
    window.document.forms[0].submit();
}

function Policy_Popup(page) {
    window.open(page, '', 'width=640,height=400,toolbar=1,status=1,menuBar=1,scrollBars=1,resizable=1');
}

function validateCheckBoxGroup(sender, args) {
    args.IsValid = false;
    var div = document.getElementById(sender.id.replace("cuv", ""));
    var checkBoxes = div.getElementsByTagName('input');
    for (i = 0; i < checkBoxes.length; i++) {
        if (checkBoxes[i].type == "checkbox" && checkBoxes[i].checked) {
            args.IsValid = true;
        }
    }
}

function CheckNumeric(e) {
    if (window.event) // IE   
    {
        if ((e.keyCode < 48 || e.keyCode > 57) && e.keyCode != 9) { // NO NUMERIC KEY
            event.returnValue = false;
            return false;
        }
    }
    else {

        if ((e.which < 48 || e.which > 57) && e.keyCode != 9 && e.which != 8 && e.keyCode != 46) {
            return false;
        }
    }
}

