/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * 根据日期是不是过去的三天，返回相应的图片代码。
 */
function imgCode(date) {
    var img = new Array("images00/new.gif","images/bullet1.gif");
    var arr = date.split("-");
    var b = new Date(arr[0],arr[1]-1,arr[2]).getTime();
    var a = new Date().getTime();
    if(a-b<=3*1000*3600*24){
        return "<img src='"+img[0]+"'/>";
    }else{
        return "<img src='"+img[1]+"'/>";
    }
}
function drawImage(B,A){
    var _=new Image();
    _.src=B.src;
    var $=_.width,C=_.height;
    if($>C){
        B.style.width=A;
        B.style.height=Math.round(C*A/$);
    }else {
        B.style.height=A;
        B.style.width=Math.round($*A/C);
    }
}
function ColorEffect(id) {
    this.Em = document.getElementById(id);
    if(this.Em == null){
        alert("您要设置的\"" + id + "\"初始化错误\r\n请检查标签ID设置是否正确!");
        return;
    }
    this.colorArray = new Array("#66CCFF","#9999FF","#99CC33","#CC66FF","#D2691E");
    if(arguments[1] instanceof Array){
        this.colorArray = arguments[1];
    }
    this.time = 200;
    if(typeof arguments[2] == "number"){
        this.time = arguments[2];
    }
}
ColorEffect.prototype.Start = function(){
    if(this.Em == null){
        return;
    }
    var em = this.Em;
    var title = em.innerHTML;
    var colorArray = this.colorArray;
    var time = this.time;
    var sum = 0;
    setInterval(function (){
        var i = sum % title.length;
        var j = sum % colorArray.length;
        sum = (i==0 && j==0) ? 0:sum;
        var a = title.substr(0,i);
        var b = "<span style='color:"+colorArray[j]+";'>" + title.substr(i,1) + "</span>";
        var c = title.substr(i+1,title.length);
        em.innerHTML = a+b+c;
        sum++;
    },time);
}
