/*Copyright (c) 2007, Caridy Patiņo. All rights reserved.Portions Copyright (c) 2007, Yahoo!, Inc. All rights reserved.Code licensed under the BSD License:http://bubbling.comarq.com/eng/licence*/(function(){var $B=YAHOO.CMS.Bubble,$L=YAHOO.lang,$E=YAHOO.util.Event,$D=YAHOO.util.Dom,$=YAHOO.util.Dom.get;YAHOO.CMS.widget.Tips=function(){var obj={},_areas={},_handle='yui-cms-snap',_className='yui-tt',_loadingClass='loading',_status=false,_ready=false,_timer=null,_backup='',_defConf={zIndex:1000,opacity:0.9,seconds:10},forbbidenAncestors=['yuimenu','yui-nav'];var actionControl=function(layer,args){if(!args[1].decrepitate){var el=$B.getAncestorByTagName(args[1].target,'A');if($L.isObject(el)&&!($L.isObject(obj.element)&&(obj.element===el))){for(var i=0;i<forbbidenAncestors.length;i++)if($L.isObject($B.getAncestorByClassName(el,forbbidenAncestors[i]))){return;}obj.check(args[0],el);}}};$B.bubble.rollover.subscribe(actionControl);var save=function(){_backup={title:obj.element.getAttribute('title')};obj.element.setAttribute('title','');};var restore=function(){if(obj.element&&_backup.title){obj.element.setAttribute('title',_backup.title);}};obj.handleOverlay=null;obj.element=null,obj.body='',obj.onCompile=null;obj.init=function(){if(!_ready){this.handleOverlay=new YAHOO.widget.Overlay(_handle,{visible:false,constraintoviewport:true});this.handleOverlay.cfg.setProperty("zIndex",_defConf.zIndex,false);this.handleOverlay.render(document.body);$D.setStyle(this.handleOverlay.element,'opacity',_defConf.opacity);$D.addClass(this.handleOverlay.element,_className);_ready=true;}};obj.check=function(e,el){this.init();if(this.element){$E.removeListener(this.element,"mouseover",this.show);$E.removeListener(this.element,"mouseout",this.hide);restore();}this.element=el;if(!$L.isFunction(this.onCompile)||!(this.body=this.onCompile.apply(this,[this.element,this.handleOverlay]))){var path=el.getAttribute('href'),access=(el.accessKey?" ["+el.accessKey+"]":""),tip=el.getAttribute('title');tip=(tip?tip+'<br />':'');if(!path||(path.indexOf('/#')===0)||(path.indexOf('#')===0)||(path.indexOf('javascript:')===0)||(path=='/')){path='';}else{path=(path.length>30?path.substring(0,30)+"...":path);}this.body=(tip+access+path!=''?'<strong>'+tip+'</strong>'+'<em>'+access+'</em>'+path:'');}if(this.body!=''){this.handleOverlay.cfg.setProperty('context',this.element);this.handleOverlay.setBody(this.body);$E.addListener(this.element,"mouseover",this.show,this,true);$E.addListener(this.element,"mouseout",this.hide,this,true);save();this.show();try{var childs=el.getElementsByTagName("img");if(childs&&(childs.length>0))for(var i=0;i<childs.length;i++)childs[i].alt='';}catch(e){}}};obj.show=function(){if(this.handleOverlay&&this.element){var elementRegion=$D.getRegion(this.element);this.handleOverlay.moveTo(elementRegion.right-5,elementRegion.bottom-5);this.handleOverlay.render(document.body);this.handleOverlay.show();if($L.isNumber(_defConf.seconds)&&(_defConf.seconds>0)){_timer=setTimeout(function(){obj.hide();},Math.abs(_defConf.seconds)*1000);}}};obj.hide=function(){if(this.handleOverlay){this.handleOverlay.hide();window.clearTimeout(_timer);}};$E.onDOMReady(obj.init,obj,true);return obj;}();})();YAHOO.register("tips",YAHOO.CMS.widget.Tips,{version:"2.2.2",build:"105"});