/*
This Code is write by Seachaos.
Welcome mail to ilmsilms@yahoo.com.tw.
Copyrights 2010 Seachaos, all rights reserved.
http://www.airweb.tw
*/
var SMB = new seaMsgBox();
var ev = new Object();
function seaMsgBox(){
	this.showType = "mouse";
	this.seaMessage = "";
	this.box = false;
	this.boxType = "helper";
	this.setShowAutoHide = function(msg,obj){
		if(msg.length>0){
			this.setContent(msg);
			this.show();
			obj.smb = this;
			obj.onmouseout = function(){
				this.smb.hide();
			}
		}
	}
	this.setShow = function(msg){
		if(msg.length>0){
			this.setContent(msg);
			this.show();
		}
	}
	this.setContent = function(msg){
		this.seaMessage = msg;
	}
	this.show = function(){
		wt = document.documentElement.scrollTop;
		if(wt==0)
			wt = parseInt(document.body.scrollTop);
		this.insertBox(this.seaMessage);
		this.box.style.left = (_clientX+10)+"px";
		this.box.style.top = (_clientY+wt+10)+"px";
	}
	this.hide = function(){
		ts = this.seaMB;
		if(!ts)
			ts = this;
		ts.removeBox();
	}
	this.setAutoAction = function(obj){
		obj.seaMessage = this.message;
		obj.seaMB = this;
		obj.onmouseover = this.show;
		obj.onmouseout = this.hide;
	}
	this.insertBox = function(title){
		if(!this.box){
			this.box = document.createElement("div");
			this.box.style.background="#DFC";
			this.box.style.border="1px #DDD solid";
			this.box.style.borderRight="1px #999 solid";
			this.box.style.borderBottom=this.box.style.borderRight;
			this.box.style.color="#000";
			this.box.style.padding="5px";
			this.box.style.fontSize="0.8em";
			this.box.style.position = "absolute";
		}
		switch(this.boxType){
			case "helper": this.box.innerHTML = title; break;
			default: this.box.innerHTML = title; break;
		}
		document.body.appendChild(this.box);
	}
	this.removeBox = function(){
		document.body.removeChild(this.box);
	}
}
