﻿/// <reference path="jquery-1.4.1-vsdoc.js" />
$(function() {
    jQuery('ul.sf-menu').superfish();

    var serchBtn = $(".btnSerch")
    serchBtn.click(function(event) {
        if (ISSerchEmpty()) {
            alert("请输入要查询的关键字！");
            $(".serchBox").focus();
            return false;
        }
    });

    $(".serchBox").keydown(function(event) {
        if (event.keyCode == 13) {
            if (ISSerchEmpty()) {
                alert("请输入要查询的关键字！");
                $(".serchBox").focus();
                return false;
            } else {
                serchBtn.click();
                return false;
            }
        }
    });

    var leftmenu = $(".LeftMenuItem a");
    var pos = $(".postion");
    var listPos = $(".list_postion");

    leftmenu.each(function(i, dom) {
        var menuName = $.trim($(dom).text());
        var posStr = $.trim(pos.text());
        var list_posStr = $.trim(listPos.text());

        if (posStr.indexOf(menuName) > -1) {
            $(dom).prepend(">").css({ "color": "white", "font-weight": "bold" });
        }
        if (list_posStr.indexOf(menuName) > -1) {
            $(dom).prepend(">").css({ "color": "white", "font-weight": "bold" });
        }
    });

});

function ISSerchEmpty() {
    var txtSerchContent = $.trim($(".serchBox").val());
    if (txtSerchContent == "") {
        return true;
    }
    return false;
}
