/* PUBLIC */
/* Javascript files used for public sites. */


/* POPUP WINDOW */
//  EMM Public site new pop-up window for footer information
function popUp(location) {
    newWindow = window.open(location, "name", "status=yes, toolbar=no, menubar=no, location=no, scrollbars=yes, resizable=yes, width=500, height=300");
    if (window.focus) {
        newWindow.focus();
    }
}
/****************************/


/* DYNAMIC CHECKBOX AND RADIOBUTTON for SELECTION */
// Last modified: 03-15-06 by Tito;
// This function is used on the registration page of the public site.
// It allows a disabled select menu to become enabled when its corresponded radio button is checked.
    function enableSelect() { // function used for the price tiering
        radioChecked = document.forms[0].EVT_STD_PRICE;
        selection = document.forms[0].EVENT_REG_QTY;

        for (var i = 0; i < radioChecked.length; i++) {
            if (radioChecked[i].checked == true) {
                for (var j = 0; j < selection.length; j++) {
                    if (radioChecked[i].getAttribute("id") == selection[j].getAttribute("id")) {
                        selection[j].disabled = false;
                        selection[j].style.backgroundColor = "#fff";
                    }
                    else {
                        selection[j].disabled = true;
                        selection[j].style.backgroundColor = "#ccc";
                    }
                }
            }
        }
    }

    function checkSubEvents(which) { // function used for the checking subevents
        var regForm = document.forms[0];
        var subEventId = which.getAttribute("name").substring(7);

        for (var k = 0; k < regForm.elements.length; k++) {
            var field = regForm.elements[k];
            var quantityId = field.getAttribute("name").substring(4);

            if (field.type == "select-one" && quantityId == subEventId) {
                if (which.checked) {                
                    field.disabled = false;
                    field.style.backgroundColor = "#fff";
                }
                else {
                    field.disabled = true;
                    field.style.backgroundColor = "#ccc";
                }
            }
        }
    }  
/****************************/