GMX.pages.add('tech-support',['popups','innerPopups'],function() {

        // hide all fields
        hideFields = function(){
            //hide email
            $('phone-number-fields').hide();
            //hide phone
            $('email-fields').hide();
            //hide fax
            $('fax-number-fields').hide();
        }

        //show email fields
        showEmail = function(){
            hideFields();
            $('email-fields').show();
            
        }
        //show phone fields
        showPhone = function(){
            hideFields();
            $('phone-number-fields').show();
        }
        //show fax fields
        showFax = function(){
            hideFields();
            $('fax-number-fields').show();
        }

        //overwrite select box width
        $$('div.custom-select').each(
            function(el){
                
                el.style.width = '350px'
            }
            );
        //overwrite select box width
        $$('div.custom-select-wrapper').each(
            function(el){
                el.style.width = '350px'
            }
            );


    }
    );

Event.observe(window, 'load', function(){
    GMX.pages.setup('tech-support');
});

function selectContactType(chk){
  
    if(chk.value == 'Email')
    {
        hideContactFields();
        $('email-fields').show();
    }else if(chk.value == 'Phone'){
        hideContactFields();
        $('phone-number-fields').show();
    }
}

function hideContactFields() {
    $('phone-number-fields').hide();
    $('email-fields').hide();
    $('fax-number-fields').hide();
}


var selectedCategoryIndex = 0;
function showOtherCategoryField(){
    var selectMenu = document.getElementById('category');
   
    selectedCategoryIndex=selectMenu.selectedIndex;
    if(selectMenu.options[selectMenu.selectedIndex].value == 'category11') {
        $('other-category-fields').show();
    }else {
        $('other-category-fields').hide();
    }
}

function setOtherCategoryField(selectedCategory){
    var selectMenu = document.getElementById('category');
    if(selectedCategory){
        if(selectedCategory == 'category11') {
        $('other-category-fields').show();
        }
        if(selectedCategory == 'category19') {
            selectMenu.selectedIndex=3;
            return;
        }
    }else {
        $('other-category-fields').hide();
    }
    selectMenu.selectedIndex=selectedCategoryIndex;
}

function showModalPanel(showPanelChk){
    GMX.select.setup();
    if(showPanelChk == 'true') {
        Richfaces.showModalPanel('message');
    }
}

/*Function to hide/show contact type section in contactus/tech support screen based on selected button*/
function selectedContactType(btnName){
    var selType = document.getElementsByName(btnName);
    if(selType[0].checked){ selectContactType(selType[0]); }
    if(selType[1].checked){ selectContactType(selType[1]); }
    if(selType[2]){
        if(selType[2].checked){ selectContactType(selType[2]); }
    }
}

function realignComboPopup(){
    var browserType = navigator.userAgent;
    if(browserType.indexOf('MSIE') > 0 ){
        var listPanel = document.getElementById('tech-supp-categorylistParent');
        listPanel.style.marginLeft = '-250px';
    }
}


function showMessage(popupDiv){
    var mflag=$('error-msg-flag');
    if(mflag && mflag.value == 'true'){
        GMX.popups.launchPopUp(popupDiv);
    }
}