function initMenu() {
    $('.additionalInfo').hide();
    $(".cMore").hide();
    $(".addOpen").hide();
    $(".addFull").show();
    $(".Close").show();




 
    //For Employers
    if (GetUncheckedCheckBoxValuesForEmp() == 0) {
        $(".empRsltsNarrowed").hide();
        $(".empNarrowResults").show();
        $(".empHideFilts").hide();
        $(".empRsltsNarrHideFilts").hide();

        //hide the box while loading the error light box
        $(".empFilterDisclaimerBox").hide();

    }

    else {

        $(".empNarrowResults").hide();
        $(".empHideFilts").hide();
        $(".empRsltsNarrHideFilts").hide();
        $(".empRsltsNarrowed").show();
   
    }

    $(".ShowNarrowSearch").hide();
    $(".popupMoreIndustries").hide();
    //For Employers:
    $(".empNarrowResults").click(function() {
    $(".ShowNarrowSearch").show();
    $(".ShowNarrowSearch").slideDown('slow');
       SetValue('1');

        if (GetCheckBoxValuesForEmp() == 0) {
            $(".empNarrowResults").hide();
            $(".empRsltsNarrHideFilts").show();

        }
        else {

            $(".empNarrowResults").hide();
            $(".empHideFilts").show();
           
        }

    });

    $(".empHideFilts").click(function() {
        $(".ShowNarrowSearch").hide();
        SetValue('0');

        if (GetCheckBoxValuesForEmp() == 0) {
            $(".empHideFilts").hide();
            $(".empRsltsNarrHideFilts").show();
        }
        else {
            $(".empHideFilts").hide();
            $(".empNarrowResults").show();
        }
    });
    $(".empRsltsNarrowed").click(function() {

        $(".ShowNarrowSearch").show();
        SetValue('1');

        if (GetCheckBoxValuesForEmp() == 0) {
            $(".empNarrowResults").hide();
            $(".empHideFilts").show();
        }
        else {
            $(".empRsltsNarrHideFilts").show();
            $(".empRsltsNarrowed").hide();
        }
    });
    $(".empRsltsNarrHideFilts").click(function() {

        $(".ShowNarrowSearch").hide();
        SetValue('0');

        if (GetCheckBoxValuesForEmp() == 0) {
            $(".empRsltsNarrHideFilts").hide();
            $(".empNarrowResults").show();

        }
        else {
            $(".empRsltsNarrHideFilts").hide();
            $(".empRsltsNarrowed").show();
        }
    });

    // disclaimer close

       $(".empDisclaimerClose").click(
       function() {
      $(this).hide('600');
        $(this).prev().slideUp('slow');
        $(".empFilterDisclaimerBox").hide();
        
       });

    
    
    
    $(".disclaimerClose").click(
    function() {
    
    if (GetCheckBoxValuesForEmp() == 0)
        {
            $(".empDisclaimerBox").hide();
            $(".empFilterDisclaimerBox").hide();
        }
     else {
         $(".empDisclaimerBox").hide();

        



         
        }
    });



    
    // Filter close
    $(".filterClose").click(function() 
    {
        $(".ShowNarrowSearch").hide();
        SetValue('0');
        if (GetUncheckedCheckBoxValuesForEmp() == 0) 
        {
            $(".empHideFilts").hide();
            $(".empNarrowResults").show();
        }
        else 
        {
            $(".empRsltsNarrHideFilts").hide();
            $(".empRsltsNarrowed").show();
        }
    });
    // Show results open/close
//    $(".OpenResults").click(
//    function() {
//        $("#divRefineSearch").removeClass("DefaultDisplay");
//        $('.narrowSearchBoxTop').css('display', 'block');
//        $('.narrowSearchBoxBottom').css('display', 'block');
//        $(".ShowNarrowSearch").show();
//        $(".CloseResults").show();
//        $(".OpenResults").hide();
//        SetValue('1');
//    }
//    );
//    $(".CloseResults").click(
//    function() {
//    $(".ShowNarrowSearch").hide();
//        $(".CloseResults").hide();
//        $(".OpenResults").show();
//        SetValue('0');
//    }
//    );
    // Show results open/close
    //End :For Employers
    
    $(".sMore").click(
    function() {
        $(this).hide('600');
        $(this).next().slideDown('slow');
        $(".prefix").hide();
        $(".cMore").show('600');
        $(".addOpen").show();
        $(".addFull").hide();
    }
    );
    $(".cMore").click(
    function() {
        $(this).prev().slideUp('slow');
        $(".sMore").show('600')
        $(".cMore").hide('600');
        $(".prefix").hide();
        $(".addOpen").hide();
        $(".addFull").show();
    }
    );
}
//For Employers

function GetCheckBoxValuesForEmp() {

    var names = [];

   $('#empIndChecks input:checked,#empSizeChecks input:checked').each(function() {
    names.push(this.id);
    });
    return names.length;


}

function GetUncheckedCheckBoxValuesForEmp() {
    var namesUnchecked = [];
    $('#empIndChecks input:not(:checked),#empSizeChecks input:not(:checked)').each(function() {
       
       namesUnchecked.push(this.id);
    });
    return namesUnchecked.length;
}

function validateCBLs() {
    var $lists = $('#empIndChecks');
    var test = "0";
    $lists.each(function(i, item) {
        if ($(item).find(':checked').length < 1) {

            test = "1";
        }
    }); 
    
} 

      
    
// set the hiddenFilterControl value
function SetValue(theVal) { $('input[name=ctl00$ContentPlaceHolder1$hdnShowNarrowFilter]').val(theVal); }



function initMenu_2() {
    $('.additionalInfo2').hide();
    $(".cMore2").hide();
    $(".addOpen2").hide();
    $(".addFull2").show();

    $(".sMore2").click(
    function() {
        $(this).hide('600');
        $(this).next().slideDown('slow');
        $(".prefix2").hide();
        $(".cMore2").show('600');
        $(".addOpen2").show();
        $('.additionalInfo2').children().css('position', 'relative');
        $(".addFull2").hide();
    }
    );
    $(".cMore2").click(
    function() {
        $(this).prev().slideUp('slow');
        $(".sMore2").show('600')
        $(".cMore2").hide('600');
        $(".prefix2").hide();
        $(".addOpen2").hide();
        $(".addFull2").show();
    }
    );
}
$(document).ready(function() {
    initMenu();
    initMenu_2();

    //    $(".MoreIndustries").click(function() {

    //        loadPopup();
    //    })




    $(".MoreIndustries").click(function() {
        loadPopup();
        
        //loadErrorLightBoxPopup();
    })

    $(".ErrorLink").click(function() {
       
        loadErrorLightBoxPopup();
    })

    //Click the x event!
    $("#popupMoreIndustriesClose").click(function() {
        disablePopup();
    });
    //Click the error light box x event!
    $("#popupErrorLightBoxClose").click(function() {
        disableErrorLightBoxPopup();
    });
});






var popupStatus = 0;

function loadPopup() {
    //loads popup only if it is disabled

    if (popupStatus == 0) {
        $("#backgroundPopup").css({
            "opacity": "0.7"
        });
        //$("#backgroundPopup").fadeIn();
        //$("#popupMoreIndustries").fadeIn();
        $("#backgroundPopup").show();
        $("#popupMoreIndustries").show();
        popupStatus = 1;
    }

}

/*jQuery.fn.center = function() {
    this.css("position", "absolute");
    this.css("top", ($(window).height() - this.height()) / 2 + $(window).scrollTop() + "px");
    this.css("left", ($(window).width() - this.width()) / 2 + $(window).scrollLeft() + "px");
    return this;
}*/-





//error light box pop up
function loadErrorLightBoxPopup() {
    //loads popup only if it is disabled

    if (popupStatus == 0) {
        $("#backgroundErrorPopup").css({
            "opacity": "0.7"
        });
        $("#backgroundErrorPopup").fadeIn();       
        //$("#popupErrorLightBox").center();
        $("#popupErrorLightBox").fadeIn();
        popupStatus = 1;
    }

}

function disablePopup() {
    //disables popup only if it is enabled
    if (popupStatus == 1) {
        //$("#backgroundPopup").fadeOut();
       // $("#popupMoreIndustries").fadeOut();
        $("#backgroundPopup").hide();
        $("#popupMoreIndustries").hide();
        popupStatus = 0;
    }
}

//error lightbox disable popup
function disableErrorLightBoxPopup() {
    //disables popup only if it is enabled
    if (popupStatus == 1) {
        $("#backgroundErrorPopup").fadeOut();
        $("#popupErrorLightBox").fadeOut();
        popupStatus = 0;
    }
}

$(document).ready(function() {
    $('.MoreIndustriesLink').click(function() {
    $('.dropDownIndustryMatch').hide();
    $('.dropDownIndustryMatch').css('left', '-10px');
    $('.dropDownIndustryMatch').toggle(130);
        return false;

    });

    /*added focus and blur event handlers to display drop down when

    using tab to jump between links */

    $('.dropDownIndustryMatch a').focus(function() {

    $('.dropDownIndustryMatch').css('left', '-10px');

        return false;

    });

    $('.dropDownIndustryMatch a').blur(function() {

    $('.dropDownIndustryMatch').css('left', '');

        return false;

    });

    $('.dropDownIndustryMatch').click(function() {

    $('.dropDownIndustryMatch').hide(130, function() {

            ;

            $('.dropDownIndustryMatch').css('left', '-10000px');

            $('.dropDownIndustryMatch').css('display', 'block');

        })

        return false;

    });

    $('.dropDownIndustryMatch').css('left', '-10000px');

    $('.dropDownIndustryMatch').css('display', 'block');
    });




