// 首页顶部宣传条脚本
var showTopBar = false; //显示开关
var pageBg = "/images/newbg.png"; //页面背景图片
var pageBgColor = ""; //页面背景色
var pageBgRepeat = "no-repeat"//背景图片重复
var topBarWidth = 1000;
var topBarHeight = 50; //宣传条高度
var topBarBg = ""; //宣传条背景图片
var topBarImage = "/images/2011.jpg"; //宣传条图片
var topBarLink = ""; //链接地址
var topBarClose1 = "/images/btnclose.gif"; //关闭按钮图片
var topBarClose2 = "/images/btnclose2.gif"; //关闭按钮图片片


//页面起始
$(document).ready(function() {
    //检测是否显示
    if (showTopBar == true) {
        var htmlstr = "<style type='text/css'>\nbody{text-align:center;}\n#topBar{position:relative;height:0px;overflow:visible;margin-left:auto;margin-right:auto;text-align:center;}\n#topBarImg{position: relative;width:auto;height:auto;margin:0 auto;}\n#topBarClose{position:relative;top:-50px;left:950px;width:0;height:0;overflow: visible;}\n</style>\n";
        htmlstr += "<div id='topBar'><div id='topBarImg'></div><div id='topBarClose'><img src='" + topBarClose1 + "' /></div></div>";
        $("body").prepend(htmlstr);
        pageBgColor = $("body").css("background-color");
        //设置页面背景
        $("body").css("background", pageBgColor + " url(" + pageBg + ") " + pageBgRepeat + " center top");
        //
        $("#topBar").width(1000).height(topBarHeight);
        //设置图片
        if (topBarImage != "") {
            if (topBarLink == "") {
                $("#topBarImg").html("<img src='" + topBarImage + "' />");
            } else {
                $("#topBarImg").html("<a href='" + topBarLink + "' target='_blank'><img src='" + topBarImage + "' /></a>");
            }
        }
        //设置关闭按钮
        $("#topBarClose")[0].onclick = function() {
            $("body").css("background", pageBgColor);
            $("#topBar").hide();
            $("#topBarTable").hide();
        }
        $("#topBarClose img").hover(function() { $(this).attr("src", topBarClose2); }, function() { $(this).attr("src", topBarClose1); });
    }
});
