$(document).ready(function() {

    //search1
    var search_value = $('.search1_input1').attr('value');
    $('.search1_input1').focus(function() {
        if ($(this).attr('value') == search_value) {
            $(this).attr('value', '');
        }
    });
    $('.search1_radio').click(function() {
        $('.search1_radio').removeClass('search1_radio_on');
        $(this).addClass('search1_radio_on');
        $('.search1_radio input').attr('checked', false);
        $(this).children('input').attr('checked', true);
    });

    //filter select 
    $(".content_filter4_table select").change(function() {
        $(".content_filter_find_disable").hide();
        $(".content_filter_update_disable").hide();
    });

    $('.content_filter4_disable,.content_filter_update_disable,.content_filter_find_disable').animate({ 'opacity': '0.7' });

    $("#content_filter1_select2").change(function() {
        $('.content_filter4_disable').hide();
    });

    $("#content_filter1_select3").change(function() {
        $('.content_filter4_disable').hide();
    });
    $('#content_filter4_table select').change(function() {
        $('.content_filter_update_disable,.content_filter_find_disable').hide();
    });
    $("#content_filter1_select4").change(function() {
        $('.content_filter_update_disable,.content_filter_find_disable').hide();
    });

    //for select2
    
    var forms1_input = $('.content_filter1_forms li input');
    forms1_input.click(function() {
        $('#content_filter1_checkall').parent().removeClass('filter_checked');
        if ($(this).attr('checked') == true) {
            $(this).parent().addClass('filter_checked');
        } else {
            $(this).parent().removeClass('filter_checked');
        }
        $('#content_filter1_checkall').attr('checked', false);
        var checked_count = 0;
        forms1_input.each(function(i) {
            if ($(forms1_input[i]).attr('checked') == true) {
                checked_count++;
            }
        });
        if (checked_count == 1) {
            $("#content_filter1_select2").attr('disabled', false);
        } else {
            $("#content_filter1_select2").attr('disabled', true);
        }
        if ($(this).attr('id') == 'content_filter1_checkall') {
            forms1_input.attr('checked', false);
            $('.content_filter1_forms li').removeClass('filter_checked');
            $('#content_filter1_checkall').attr('checked', true);
            $('#content_filter1_checkall').parent().addClass('filter_checked');
            $('#content_filter1_select2').attr('disabled', true);
        }
    });



    //email input
    $('.content_meta_email').focus(function() {
        $(this).attr('value', '');
    });

    //content_help
    $('.content_help_popup0,.content_help_popup1,.content_help_popup2,.content_help_popup3,.content_help_popup4,.content_help_popup5,.content_help_popup6,.content_help_popup7,.content_help_popup8,.content_help_popup9').hover(function() {
        $(this).show();
    }, function() {
        $(this).hide();
    });
    $('.content_help0').click(function() {
        $(".content_help_popup0").toggle();
        return false;
    });
    $('.content_help1').click(function() {
        $(".content_help_popup1").toggle();
        return false;
    });
    $('.content_help2').click(function() {
        $(".content_help_popup2").toggle();
        return false;
    });
    $('.content_help3').click(function() {
        $(".content_help_popup3").toggle();
        return false;
    });
    $('.content_help4').click(function() {
        $(".content_help_popup4").toggle();
        return false;
    });
    $('.content_help5').click(function() {
        $(".content_help_popup5").toggle();
        return false;
    });
    $('.content_help6').click(function() {
        $(".content_help_popup6").toggle();
        return false;
    });
    $('.content_help7').click(function() {
        $(".content_help_popup7").toggle();
        return false;
    });
    $('.content_help8').click(function() {
        $(".content_help_popup8").toggle();
        return false;
    });
    $('.content_help9').click(function() {
        $(".content_help_popup9").toggle();
        return false;
    });

    //wrapper
    $('#wrapper').animate({ 'opacity': '0.5' });
    $('#wrapper').height($('body')[0].clientHeight);

    $('#wrapper').click(function() {
        $('#wrapper,.alert_box').hide();
    });

    $('.content_bestdeal_btn').click(function() {
        $('#wrapper,.alert_box').show();
    });

    //$(".product_finance_table tr").hover(function(){
    //        $(this).addClass('product_finance_table_payment');
    //    },function(){
    //        $(this).removeClass('product_finance_table_payment');
    //    }
    //);





});

function redirect(url) {
    window.location = url;
}

