$(document).ready(function(){

    // Selector en menu y destacado home
    var selector = $(".selector");
    selector.customStyle();
    var falso_selector_nav = $('#nav .customStyleSelectBox');
    var falso_selector_destac = $('#destacado .customStyleSelectBox');
    var body_id = $('body').attr('id');
    var option_set = $('#nav option');
    var option_class = '.' + body_id;
    
    $('#nav_selector, #nav .customStyleSelectBox').hover(
        function () {
            falso_selector_nav.addClass('changed');
            if ( $(option_class).length > 0 ){
                falso_selector_nav.addClass('changed');
            }
        }, 
        function () {
            falso_selector_nav.removeClass('changed');
            if ( $(option_class).length > 0 ){
                falso_selector_nav.addClass('changed');
            }
        }
    );
    
    $('#destacado_selector, #home #destacado_selector').hover(
        function () {
            falso_selector_destac.addClass('changed');
            if ( $(option_class).length > 0 ){
                falso_selector_nav.addClass('changed');
            }
        }, 
        function () {
            falso_selector_destac.removeClass('changed');
            if ( $(option_class).length > 0 ){
                falso_selector_nav.addClass('changed');
            }
        }
    );
    
    selector.change(function(){
        var url = $(this).find('option:selected').attr('value');
        if( url != '' ){
            window.location.href = url;
        }     
    });
    
    if ( $(option_class).length > 0 ){
        falso_selector_nav.addClass('changed');
    }
    
});
