
function I2(n) { return (n<10) ? "0" + n : n; }

function TimeString() { 
	var d = new Date();
	var t_y = d.getFullYear();
	var t_m = I2(d.getMonth()+1);
	var t_d = I2(d.getDate());
	var t_h = I2(d.getHours());
	var t_n = I2(d.getMinutes());
	var t_s = I2(d.getSeconds());
	//$("#timer").html(t_h + ":" + t_n); 
	return t_y + "-" + t_m + "-" + t_d + " " + t_h + ":" + t_n + ":" + t_s;
}

var vobj = document.getElementById("divMain");

// 键盘上下翻页键的事件
function keyUp(e) {
	var currKey=0,e=e||event;
	currKey=e.keyCode||e.which||e.charCode;
	var keyName = String.fromCharCode(currKey);
	if(currKey==40) { vobj.scrollTop += 60; }
	if(currKey==38) { vobj.scrollTop -= 60; }
}
document.onkeyup = keyUp;

// 注册鼠标滚轮事件 

var scrollFunc=function(e){ 
    var direct=0; 
    e=e || window.event; 
    if(e.wheelDelta){//IE/Opera/Chrome 
		vobj.scrollTop += (e.wheelDelta>0) ? -60 : 60; 
    }else if(e.detail){//Firefox 
		vobj.scrollTop += (e.detail>0) ? 60 : -60; 
    } 
} 

if(document.addEventListener){ 
    document.addEventListener('DOMMouseScroll',scrollFunc,false); 
} //W3C 
window.onmousewheel=document.onmousewheel=scrollFunc; //IE/Opera/Chrome 
