$(function() {
	//底部调整
	var isChrome = navigator.userAgent.toLowerCase().match(/chrome/) != null;
	if (!isChrome) {
		$(".tpl-page-container .tpl-content-wrapper").addClass("R-wra");
		$(".tpl-page-container .tpl-left-nav").addClass("L-tpl");
	}
    $('#sub').click(function() {
        var hid = $('.hidden');
        var arr = [];
        var url = [];
        var textBtn = $('.btn-menu');
        for (var i = 0; i < textBtn.length; i++) {
            arr[i] = $.trim($(textBtn[i]).text());
            url[i] = $.trim($(textBtn[i]).next().text());
        }
        $(hid).val(arr);
        var strs = arr.join(',');
        $(hid).val(strs);
        var urls = url.join(',');
        $('.url').val(urls);
        $('#myForm').submit();
    })
    $('.search-bar').focus(function() {
        $(this).parent().next('.am-dropdown-content').show();
    });
    // 插入ui版本号
    var uiVersions = $.AMUI.VERSION;
    $('.uiVersion').html(uiVersions);
    //弹出框自定义菜单
    $('body').on('mouseenter', '#menu-box ul li', function() {
        $(this).find('.hd').show();
    })
    $('body').on('mouseleave', '#menu-box ul li', function() {
        $(this).find('.hd').hide();
    })
    //点击按钮删除
    $('body').on('click', '.hd', function() {
        $(this).parent().parent().remove();
    })
    //点击添加按钮添加菜单
    $('.ngin-add-tihuan').click(function() {
        //获取当前下拉框选中的值
        var selected = $('.am-selected-status').html();
        var select_val = $('#indexpage').val();
        //最多只能添加9个菜单
        var len = $('.menu-list').children().length - 1;
        var str = "<li><a class='btn-menu am-btn am-btn-default'>" + selected + "<span class='am-icon-close hd'></span></a><input type='hidden' name='name' value=" + selected + "><input type='hidden' name='page' value=" + select_val + "></li>";
        if (len < 9) {
            $('.menu-list').append($(str));
        } else {
            alert('最多只能添加9个菜单');
        }
    })
    //显示时间
    var today = getTime();
    $('#date').text(today['date'] + ' , ' + today['week']);
    $('#lunar-calendar').text('今日 , ' + today['lCDate'] + ' ' + today['solarTerm']);
    //滚动提示
    new marquee("notice", 0, 1, null, null, 5, 3000, 3000, 22);
});