function HintDialog(elementid, msg) {
	try {
		if ($(elementid)) {
			this._obj = $(elementid);
		}else {
			throw "nofind";	
		}
	}catch(e) {
		if (e == "nofind")
			throw new Error("No find by names for" + elementid + "compont");
		else
			throw new Error("unknow function $");
	}
	this._id = "hint_dialog";
	this._msg = (msg.trim())?msg.trim():"Here is wrong!";
	this._offset = 24;
	if (this._msg.length <= 4) 
		this._marginleft = this._msg.length * 6;
	else
		this._marginleft = 40;
	this._virtualpath	 = "./";
	this._leftpicurl   = "images/leftpic.gif";
	this._bgpicurl 		 = "images/bgpic.gif";
	this._rightpicurl  = "images/rightpic.gif";
	this._buttompicurl = "images/buttompic.gif";
	this._textcolor 	 = "#333333";
	
	this.show();
}

HintDialog.prototype.show = function () {
	var leftpic 	= this._virtualpath + this._leftpicurl;
	var bgpic 		= this._virtualpath + this._bgpicurl;
	var rightpic  = this._virtualpath + this._rightpicurl;
	var buttompic = this._virtualpath + this._buttompicurl;
	var _pos = getAbsolutePosition(this._obj);
	var _top 	= _pos[0];
	var _left	= _pos[1];
		
	var _hintdialog = document.createElement("DIV");
	_hintdialog.id  = this._id;
	with (_hintdialog.style) {
		top			 = (_top - this._offset) + "px";
		left  	 = _left + "px";
		position = "absolute";
	}
  var _html  = "<div style=\"height:24px;font-size:12px\">"
		         + "<div style=\"float:left;\"><img src=\"" + leftpic + "\" /></div>"
		         + "<div style=\"float:left;height:24px;background:url(" + bgpic + ");line-height:24px; color:" + this._textcolor + ";\">"
    				 + this._msg.convertSpace()
    				 + "</div>"
    				 + "<div style=\"float:left;\"><img src=\"" + rightpic + "\" /></div>"
    				 + "<div style=\"clear:both;\"></div>"
    				 + "</div>"
    				 + "<div style=\"margin-left:" + this._marginleft + "px;margin-top:-3px;\"><img src=\"" + buttompic + "\" /></div>";
  _hintdialog.innerHTML = _html;
  var scroll_top = Math.max(document.documentElement.scrollTop,document.body.scrollTop);
  if (scroll_top > parseInt(_hintdialog.style.top)) {
  	document.documentElement.scrollTop = Math.max(parseInt(_hintdialog.style.top) - 10, 0);
  	document.body.scrollTop = Math.max(parseInt(_hintdialog.style.top) - 10, 0);
  }
    	
	var selectlist = document.getElementsByTagName("SELECT");
	for (var i=0;i<selectlist.length;i++) {
		_pos = getAbsolutePosition(selectlist[i]);
		var select_top 	= _pos[0];
		var select_left = _pos[1];
		if ((select_top + 25 > _top) && (select_top < _top)) {
			selectlist[i].style.visibility = "hidden";
		}
	}

  document.body.appendChild(_hintdialog);
	this._obj.focus();


	var okd = document.onkeydown;
  var omd = document.onmousedown;

	document.onkeydown = function () {	
		document.body.removeChild(_hintdialog);
		for (var i=0;i<selectlist.length;i++) {
			_pos = getAbsolutePosition(selectlist[i]);
			var select_top 	= _pos[0];
			var select_left = _pos[1];
			if ((select_top + 25 > _top) && (select_top < _top)) {
				selectlist[i].style.visibility = "visible";
			}
		}
		document.onkeydown = okd;
		document.onmousedown = omd;
  }
	
  document.onmousedown = function () {
  	document.body.removeChild(_hintdialog);
  	for (var i=0;i<selectlist.length;i++) {
			_pos = getAbsolutePosition(selectlist[i]);
			var select_top 	= _pos[0];
			var select_left = _pos[1];
			if ((select_top + 25 > _top) && (select_top < _top)) {
				selectlist[i].style.visibility = "visible";
			}
		}
		document.onkeydown = okd;
		document.onmousedown = omd;
  }
}