// JavaScript Document
function formSubmit(id) {
    $(id).submit();
}

$(function() {
    $("#logo").click(function() {
        window.open("/", "_self");
    });
    $("a").bind("focus",
    function() {
        if (this.blur) {
            this.blur();
        }
    });
    if ($("#menu").html()) {
        if (typeof(current_page) != "undefined") {
            $(".menu2 ul li:eq(" + current_page + ")").addClass("afterbg");
        }
        var obj_li = $(".menu ul li")
        obj_li.hover(function() {
            $(this).find("div").show();
        },
        function() {
            $(this).find("div").hide();
        });
    }
//    if ($("#left").html()) {
//        var rightH = $("#right").get(0).offsetHeight;
//        var leftH = $("#left").get(0).offsetHeight;
//        
//    	var leftInH=($("l_inleft") && $("l_inleft").get(0).offsetHeight) ? $("l_inleft").get(0).offsetHeight : "0";
//    	alert("leftInH=" + leftInH + ",leftH=" + leftH + ",rightH=" + rightH);
//    	if(leftH < leftInH)
//    		leftH = leftInH;
//
//    	if (rightH < leftH) {
//            $("#right").height(leftH);
//        }
//        else {
//            $("#left").height(rightH);
//        }
//    }
    if ($(".menu_list").html()) {
        $(".menu_list li").click(function() {
            if ($(this).find("dl").html()) {
                $(this).siblings().find("dl").hide();
                $(this).find("dl").show();
                $(this).siblings().removeClass("menu_current");
                $(this).addClass("menu_current");
            }
        });

        if (typeof(current_txt1) != "undefined") {
            $(".menu_list li").each(function() {
                if ($(this).find("a:eq(0)").html() == current_txt1) {
                    current_left = $(this).index();
                }
            });

            if (typeof(current_txt2) != "undefined") {
                $(".menu_list li:eq(" + current_left + ") dl dd").each(function() {
                    if ($(this).text() == current_txt2) {
                        //current_dd = $(this).index();
						current_dd = $(".menu_list li:eq(" + current_left + ") dl dd").index($(this));
						//alert(current_dd);
                    }
                })
                current_dd = current_dd + 1;
            }
            current_left = current_left + 1;
        }
        if (typeof(current_left) != "undefined") {
            current_left = current_left - 1;
            $(".menu_list li:eq(" + current_left + ")").find("dl").show();
            $(".menu_list li:eq(" + current_left + ")").addClass("menu_current");
            if (typeof(current_dd) != "undefined") {
                current_dd = current_dd - 1;
                $(".menu_list li:eq(" + current_left + ")").find("dl dd:eq(" + current_dd + ")").addClass("current");
            }
        }
    }

    /*三级栏目导航样式设置    兰海滨2010-7-5添加*/

    if (typeof(current_txt3) != "undefined") {
        $("#right_title").find("h1:eq(0)").html(current_txt2);
        $("#right_title").find("h2:eq(0)").html(current_txt3);
        $("#right_menu a").each(function() {
            if ($(this).html() == current_txt3) {
                $(this).addClass("current");
            }
        })

    } else if (typeof(current_txt1) != "undefined" && typeof(current_txt2) != "undefined") {
        $("#right_title").find("h1:eq(0)").html(current_txt1);
        $("#right_title").find("h2:eq(0)").html(current_txt2);
        $("#right_menu a").each(function() {
            if ($(this).html() == current_txt2) {
                $(this).addClass("current");
            }
        })
    }

    /*三级栏目导航样式设置结束*/

    if ($(".stock_li").html()) {
        $(".stock_li ul li:first").addClass("stock_active");
        $(".stock_li ul li").click(function() {
            $(this).addClass("stock_active");
            $(this).siblings().removeClass("stock_active");
            $(".stock_li div").hide();
            $(".stock_li div:eq(" + (($(this).index()) + 1) + ")").show();
        });
    }
    if ($(".tab_bg").html) {
        $(".tab_bg ul li").each(function() {
            if ($(this).find("a:eq(0)").html() == current_tab) {
                $(this).addClass("selected");
            }
        });
        $(".tab_bg ul li").hover(function() {
            $(this).addClass("select");
        },
        function() {
            $(this).removeClass("select");
        })
        $(".tab_bg ul li").click(function() {
            $(this).addClass("selected");
            $(this).siblings().removeClass("selected");
        });
    }

    if ($(".c_table1").html) {
        $(".c_table1 tbody tr:odd").addClass("odd");
        $(".c_table1 tbody tr:even").addClass("even");
        $(".c_table1 tbody td table tr").removeClass();
    }
    if ($(".q_con table").html()) {
        $(".q_con table tr:odd").addClass("odd");
        $(".q_con table tr:even").addClass("even")
    }
    if ($(".q_con1 div").html()) {
        $(".q_con1 div:odd").addClass("odd");
        $(".q_con1 div:even").addClass("even")
    }
    if ($(".cont_table2").html) {
        $(".cont_table2 tbody tr:odd").addClass("odd");
        $(".cont_table2 tbody tr:even").addClass("even");
        $(".cont_table2 tbody td table tr").removeClass();
    }


	
});


