﻿window.onerror = function () { return true; }
//jquery 对联广告
/*
$("body").append("<div id='img1' style='z-index: 100; left: 2px; position: absolute; top: 43px; height: 61px;visibility: visible;'><a href='#' target='_blank'><img src='images/ad.jpg' border='0'></a></div>");
*/
try {
    (function ($) {
        $.fn.adFloat = function (options) {
            return new AdFloat(this, options);
        };
        var AdFloat = function (element, options) {
            this.element = $(element);
            this.options = $.extend({
                width: 100,         //广告容器的宽度
                height: 100,        //广告容器的高度
                top: 0,            //起始top位置
                left: 0,            //超始left位置
                delay: 30,          //延迟
                step: 1             //每次移多少
            }, options || {});
            this.interval = null;
            this.xPos = this.options.left;
            this.yPos = this.options.top;
            this.yon = 0;
            this.xon = 0;
            this.isPause = false;

            this.init();
        };
        AdFloat.prototype = {
            init: function () {
                var me = this;

                me.element.css("display", "block");
                me.element.css({ position: "absolute", left: me.options.left + "px", top: me.options.top + "px", width: me.options.width + "px", height: me.options.height + "px", overflow: "hidden" });
                me.element.hover(
                    function () { clearInterval(me.interval) },
                    function () { me.interval = setInterval(function () { me.changePos(); }, me.options.delay); }
            );
                $(document).ready(function () { me.start(); });
            },
            changePos: function () {
                var me = this;
                var clientWidth = document.documentElement.clientWidth;
                var clientHeight = document.documentElement.clientHeight;
                var Hoffset = me.element.attr("offsetHeight");
                var Woffset = me.element.attr("offsetWidth");
                me.element.css({ left: me.xPos + document.documentElement.scrollLeft, top: me.yPos + document.documentElement.scrollTop });
                if (me.yon)
                    me.yPos = me.yPos + me.options.step;
                else
                    me.yPos = me.yPos - me.options.step;
                if (me.yPos < 0) {
                    me.yon = 1; me.yPos = 0;
                }
                if (me.yPos >= (clientHeight - Hoffset)) {
                    me.yon = 0; me.yPos = (clientHeight - Hoffset);
                }
                if (me.xon)
                    me.xPos = me.xPos + me.options.step;
                else
                    me.xPos = me.xPos - me.options.step;
                if (me.xPos < 0) {
                    me.xon = 1; me.xPos = 0;
                }
                if (me.xPos >= (clientWidth - Woffset)) {
                    me.xon = 0; me.xPos = (clientWidth - Woffset);
                }
            },
            start: function () {
                var me = this;
                me.element.css("top", me.yPos);
                me.interval = setInterval(function () { me.changePos(); }, me.options.delay);
            }
        };
    })(jQuery);
}
catch (e) { }
/* 超作 Cookie  */
function addCookie(name, value, expires, path, domain) {
    var str = name + "=" + escape(value);
    if (expires != "") {
        var date = new Date();
        date.setTime(date.getTime() + expires * 24 * 3600 * 1000); //expires单位为天
        str += ";expires=" + date.toGMTString();
    }
    if (path != "") {
        str += ";path=" + path; //指定可访问cookie的目录
    }
    if (domain != "") {
        str += ";domain=" + domain; //指定可访问cookie的域
    }
    document.cookie = str;
}
function getCookie(name) {
    var str = document.cookie.split(";")
    for (var i = 0; i < str.length; i++) {
        var str2 = str[i].split("=");
        if ($.trim(str2[0]) == name) {
            return unescape(str2[1]);
        }
    }
    return null;
}
/* 超作 Cookie End */


//设置下属子公司导航
$(document).ready(function () {
    if ($("#nav_wrap").length > 0) {
        $(".nav li").mousemove(function () {
            $(this).find('ul').slideDown();
        });
        $(".nav li").mouseleave(function () {
            $(this).find('ul').slideUp();
        });
    }
    $("img").each(function () { $(this).attr("href") == "" })
    $("body").append("<div id='img1' style='z-index:100;visibility:visible;'><a href='news.aspx?id=18'><img src='images/ad.jpg' border='0'></a><div><a href='javascript:void(0)' onclick='img1_close()'><img border='0' src='/images/close.jpg'/></a></div></div>");
    $("#img1").adFloat({ width: 228, height: 88, top: 500, left: 600 });
    if (getCookie("ads") != null) {
        var ads = getCookie("ads");
        if (ads == "1") {
            $("#img1").hide();
        }
    }
});
function img1_close() {
    addCookie("ads", "1", "", "", "");
    $("#img1").hide();
}
$(document).ready(function () {
    $("#div_news ul").eq(0).show();
    $("#ul_news li a").bind("mouseover", function () {
        var i = $(this).attr("alt");
        $("#div_news ul").hide();
        $("#ul_news li a").removeClass("a_bg_red");
        $(this).eq(0).addClass("a_bg_red");
        switch (i) {
            case "0":
                $("#div_news ul").eq(0).show();
                $("#new_more").attr("href", "news.aspx?id=17");
                break;
            case "1":
                $("#div_news ul").eq(1).show();
                $("#new_more").attr("href", "news.aspx?id=19");
                break;
            case "2":
                $("#div_news ul").eq(2).show();
                $("#new_more").attr("href", "news.aspx?id=18");
                break;
            default:
                break;
        }
    });
    $("a").each(function () {
        var href = $(this).attr("href");
        if (href == "" || href == "#") {
            $(this).attr("href", "javascript:void(0)");
        }
    });
    if ($("select.open_link").length > 0) {
        $("select.open_link").bind("change", function () {
            if ($(this).val() != "") {
                window.open($(this).val());
                //location.href = ;
            }
        });
    }
    if ($(".comment_form").length > 0) {
        $(".comment_form").validate(function () {
            //出错时添加的标签
            errorElement: "span"
        });
    }
});
var time_li = null;
function fun_time_li() { $("#index_img li").click(); }
try {
    new Marquee("index_img", 0, 1, 330, 187, 50, 0, 0, 73, 0)
}
catch (e) { }

