﻿//分页索引
var pageIndex = 1;
var url;
var div;

$(function() {
    if (typeof document.compatMode != 'undefined' && document.compatMode != 'BackCompat') {
        scrollPos = document.documentElement;
    }
    else if (typeof document.body != 'undefined') {
        scrollPos = document.body;
    }

});

 function AddFL(fl, ww, hh, target) {
    var param = { menu: 'false', allowfullscreen: 'true', wmode: 'transparent' };
    swfobject.embedSWF(fl, target, ww, hh, '9.0.0', '/Scripts/expressInstall.swf', false, param, false);
}

//取得ＨＴＭＬ内容
function GetList() {
    var url2 = url + pageIndex + "/" + Math.random();
    // alert(url2);
    $.get(url2, function(data) {
        $("#" + div).html(data);
    });
}
function GetContent(currentUrl, currentDiv) {
    $.get(currentUrl, function(data) {
        $("#" + currentDiv).html(data);
    });
}
function Pager(index) {
    pageIndex = index;
    GetList();
}

function SetFontSize(id, size) {
    $("#" + id).css("font-size", size + "px");
}

function ValidateEmail(email) {
    var regEmail = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
    if (!regEmail.exec(email)) return false;
    return true;
}

function ValidatePhone(num) {
    var regNum = /^(\d{11})|^((\d{7,8})|(\d{4}|\d{3})-(\d{7,8})|(\d{4}|\d{3})-(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1})|(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1}))$/;
    if (!regNum.exec(num)) return false;
    return true;
}

(function($) {
    $.fn.extend({
        Scroll: function(opt, scrollHeight, callback) {
            //参数初始化
            if (!opt) var opt = {};
            var _this = this.eq(0).find("ul:first");
            var lineH = scrollHeight; // _this.find("li:first").height(), //获取行高
            line = opt.line ? parseInt(opt.line, 10) : parseInt(this.height() / lineH, 10), //每次滚动的行数，默认为一屏，即父容器高度
                        speed = opt.speed ? parseInt(opt.speed, 10) : 500, //卷动速度，数值越大，速度越慢（毫秒）
                        timer = opt.timer ? parseInt(opt.timer, 10) : 3000; //滚动的时间间隔（毫秒）
            if (line == 0) line = 1;
            var upHeight = 0 - line * lineH;
            //滚动函数
            scrollUp = function() {
                _this.animate({
                    marginTop: upHeight
                }, speed, function() {
                    for (i = 1; i <= line; i++) {
                        _this.find("li:first").appendTo(_this);
                    }
                    _this.css({ marginTop: 0 });
                });
            }
            //鼠标事件绑定
            _this.hover(function() {
                clearInterval(timerID);
            }, function() {
                timerID = setInterval("scrollUp()", timer);
            }).mouseout();
        }
    })
})(jQuery);

function initArray() {
    this.length = initArray.arguments.length
    for (var i = 0; i < this.length; i++)
        this[i + 1] = initArray.arguments[i]
}
function tick() {
    var hours, minutes, seconds, xfile;
    var intHours, intMinutes, intSeconds;
    var today, theday;
    today = new Date();

    var d = new initArray("星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六");

    theday = "今天是" + today.getYear() + "年" + [today.getMonth() + 1] + "月" + today.getDate() + "日&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + d[today.getDay() + 1] + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
    intHours = today.getHours();
    intMinutes = today.getMinutes();
    intSeconds = today.getSeconds();
    if (intHours == 0) {
        hours = "12:";
        xfile = "午夜";
    } else if (intHours < 12) {
        hours = intHours + ":";
        xfile = "上午";
    } else if (intHours == 12) {
        hours = "12:";
        xfile = "正午";
    } else {
        intHours = intHours - 12
        hours = intHours + ":";
        xfile = "下午";
    }
    if (intMinutes < 10) {
        minutes = "0" + intMinutes + ":";
    } else {
        minutes = intMinutes + ":";
    }
    if (intSeconds < 10) {
        seconds = "0" + intSeconds + " ";
    } else {
        seconds = intSeconds + " ";
    }
    timeString = theday + " " + xfile + " " + hours + minutes + seconds;
    $("#Clock").html(timeString);
    window.setTimeout("tick();", 100);
}
