//
//模拟即时聊天工具的消息提示功能！
//
//作者：jidixuelang(雪狼) www.phpchina.com
//
//欢迎转载 望注明出处！谢谢！          +_!

function stepTo(up){
    var d = document.getElementById("sn_dialog");
	if(up){
	    var tf     = parseInt(d.style.top)>=document.documentElement.clientHeight-d.clientHeight;
		var x      = -5;
		var elsedo = "stepToTime = setTimeout('stepTo()',5000)";
	}else{
	    var tf     = parseInt(d.style.top)<=document.documentElement.clientHeight;
		var x      = 5;
		var elsedo = " d.style.display = 'none';clearTimeout(stepToTime);";
	}
	
	if(tf){
		d.style.top  = parseInt(d.style.top)+x+"px";
		stepToTime = setTimeout("stepTo("+up+");",20);
	}else{
		eval(elsedo);
	}
}


var Dialog = new Object();
Dialog.Popable  = function(sHtml){
	this.sHtml  = sHtml  || "没有写入任何内容！";
}
Dialog.Popable.prototype.popup = function(sHtml){
	var _sHtml   = sHtml  || this.sHtml;
	var d        = document.createElement("div");
	d.id         = "sn_dialog";
	d.innerHTML  = _sHtml;
	document.body.appendChild(d);
	with(d.style){
	position =  "absolute";
    zIndex   =  "999";
	width    =  "";
	height   =  "";
	left     =  document.documentElement.clientWidth-d.clientWidth-10+"px";
	top      =  document.documentElement.clientHeight+"px";
	}
	stepToTime = setTimeout("stepTo(1);",100);

}
window.onresize = function(){
	var d = document.getElementById("sn_dialog");
	with(d.style){
	left    =  document.documentElement.clientWidth-d.clientWidth-20+"px";
	top     =  document.documentElement.clientHeight-d.clientHeight+"px";
	}
	
}