/*
  SimpleJsMin From YouYee OpenSource 
  2008 - 2009
*/

org.youyee.controls=org.youyee.controls||{};org.youyee.controls.Tips=function(msg,container){this.styleName={TIPS:'yee_ctrls_tips',TIPS_M:'yee_ctrls_tips_m',TIPS_B:'yee_ctrls_tips_b',TIPS_T:'yee_ctrls_tips_t'};this._dom=null;this.textField=null;this.WIDTH_PER_FONT=13;this._createDom();this._dom.style.display='none';this._dom.style.position='absolute';this.alpha=100;this.TWEEN_TIME=1;this.width=12;this.height=32;container=container||document.body;if(msg){this.setText(msg);}
container.appendChild(this._dom);};org.youyee.controls.Tips.prototype._createDom=function(){this._dom=document.createElement('div');this._dom.className=this.styleName.TIPS;var tips_top=document.createElement('div'),tips_bottom=document.createElement('div'),textField=document.createElement('div');tips_top.className=this.styleName.TIPS_T;tips_bottom.className=this.styleName.TIPS_B;textField.className=this.styleName.TIPS_M;tips_top.appendChild(textField);this._dom.appendChild(tips_top);this._dom.appendChild(tips_bottom);this.textField=textField;};org.youyee.controls.Tips.prototype.setText=function(text){var len=Math.ceil(String(text).replace(/[^\x00-xFF]/g,'**').length/2);var textWidth=len*this.WIDTH_PER_FONT;this.width=12+textWidth;this.height=32;this._dom.style.width=this.width+'px';this.textField.innerHTML=text;};org.youyee.controls.Tips.prototype.getText=function(){return this.textField.innerHTML;};org.youyee.controls.Tips.prototype.setPosition=function(x,y){this.setX(x);this.setY(y);};org.youyee.controls.Tips.prototype.setX=function(value){this._dom.style.left=value+'px';};org.youyee.controls.Tips.prototype.setY=function(value){this._dom.style.top=value+'px';};org.youyee.controls.Tips.prototype.show=function(alpha){if(Tween){if(typeof(alpha)!='number'){alpha=100;}
alpha=Math.floor(alpha);if(alpha<0){alpha=0;}else if(alpha>100){alpha=100;}
var _self=this;if(this._t){this._t.stop();}
this._t=new Tween(this,'alpha',Tween.regularEaseOut,0,alpha,this.TWEEN_TIME);this._t.onMotionChanged=function(){YEE.Display.setOpacity(_self._dom,_self.alpha);};this._t.start();}
this._dom.style.display='';};org.youyee.controls.Tips.prototype.hide=function(){if(Tween){var _self=this;if(this._t){this._t.stop();}
var fAlpha=this.alpha;this._t=new Tween(this,'alpha',Tween.regularEaseOut,parseInt(fAlpha,10),0,this.TWEEN_TIME);this._t.onMotionChanged=function(){YEE.Display.setOpacity(_self._dom,_self.alpha);};this._t.start();}else{this._dom.style.display='none';}};org.youyee.controls.Tips.prototype.setPositionByElement=function(element){if(!element){return;}
var pos=YEE.Display.getPosition(element),w=YEE.Display.getWidth(element),OFFSET_Y=5;this.setPosition(parseInt(pos.x+w/2-this.width/2,10),parseInt(pos.y-this.height-OFFSET_Y,10));};