/* 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();
    }
}
/****************************/


/****************************/
// MARKETING SITE: Pop-up broser window for main content area
// Last modified: 06-09-06 by Tito;
    function popUpMain(location) {
        newWindow = window.open(location, "name", "status=yes, toolbar=no, menubar=no, location=no, scrollbars=yes, resizable=yes, width=600, height=450");
        if (window.focus) {
            newWindow.focus();
        }
    }

/****************************/
// MARKETING SITE: EQ feature pop-up display on Solutions page
// Last modified: 06-09-06 by Tito;
    function displayFeature(id) {
        if(document.getElementById) {
            var featureDiv = document.getElementById(id);
            var features = document.getElementById("featuresDisplay").getElementsByTagName("div");
            if(featureDiv.style.display != "block") {
                for (var i = 0; i < features.length; i++) {
                    features[i].style.display = "none";
                    document.getElementById("feat00").style.display = "none";
                }
                featureDiv.style.display = "block";
                document.getElementById("feat00").style.display = "none";
            }
            else {
                featureDiv.style.display = "none";
                document.getElementById("feat00").style.display = "block";
            }
        }
    }


/****************************/
/* 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";
                }
            }
        }
    }  
/****************************/