﻿$.extend({
    includePath: '',
    include: function(file) {
        var files = typeof file == "string" ? [file] : file;
        for (var i = 0; i < files.length; i++) {
            var name = files[i].replace(/^\s|\s$/g, "");
            var att = name.split('.');
            var ext = att[att.length - 1].toLowerCase();
            var isCSS = ext == "css";
            var tag = isCSS ? "link" : "script";
            var attr = isCSS ? " type='text/css' rel='stylesheet' " : " language='javascript' type='text/javascript' ";
            var link = (isCSS ? "href" : "src") + "='" + $.includePath + name + "'";
            if ($(tag + "[" + link + "]").length == 0) document.write("<" + tag + attr + link + "></" + tag + ">");
        }
    }
});
$.include("javascript/jquery.cookie.js");
$.fn.extend({
    hoverClass: function(c) {
        return this.each(function() {
            $(this).hover(function() { $(this).addClass(c); },function() { $(this).removeClass(c); });
        });
    }
})

function flash(file,w,h) {
    document.write('<table border="0" padding="0" cellspacing="0"><tr><td><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+w+'" height="'+h+'"> ');
    document.write('<param name="movie" value="' + file + '">');
    document.write('<param name="quality" value="high"> ');
    document.write('<param name="wmode" value="transparent"> ');
    document.write('<param name="menu" value="false"> ');
    document.write('<embed src="' + file + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+w+'" height="'+h+'" wmode="transparent"></embed> ');
    document.write('</object><td></tr></table>');
}


function fullOpen(obj) {
    window.open($(obj).attr("href"), 'detail', 'width=' + window.screen.width + ',height=' + (window.screen.height - 20) + ',toolbar=no,location=no,directories=no,menubar=no,scrollbars=no,resizable=yes,status=no');
    return false;
}

$(function() {

    $("#menu").children().hover(
    function() { $("ul", this).hide().slideDown('fast'); },
    function() { }
    ).last().css("background-image", "none").end().find("ul:empty").remove();


    if (screen.width > 1024) $(document.body).css({ "background-image": "url('images/2010bg.png')" });

    if (document.all) {
        $("#menu li").hoverClass("sfHover");
    }

    $("a[href^='Detail.aspx']").click(function() { fullOpen(this); return false; });

    setInterval(function() {
        var x = new Array('星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六');
        var now = new Date();
        var str = x[now.getDay()] + '<br/>' + now.toLocaleString();
        $("#divTime").html(str);
    }, 1000);

    //校庆打开时自动弹出窗口 一天一次
    if (!$.cookie("xq")) {
        $.cookie("xq", "True", { expires: 1 });
        window.open("xq");
    }
});