/* Modified for Binary Bit LAN Binary Bit Templates
*   http://BinaryBit.com/
*   Admin@BinaryBit.com
*   Last Update: 19-Jan-2009 13:26
*   Version 1.0.1
*
*   Copyright (c) 2007, Caridy Patino. All rights reserved.
*   Portions Copyright (c) 2007, Yahoo!, Inc. All rights reserved.
*   Code licensed under the BSD License: http://www.bubbling-library.com/eng/licence
*   version: 1.5.0
* 
*   Change Log: http://www.binarybit.com
*   When Combining ToolTIps and Bubbling; Bubbling file has to be at the Top.
*   Updated code to pass JS Lint Test
*
*
*/
YAHOO.namespace("plugin","behavior");(function(){var yuiDom=YAHOO.util.Dom,yuiEvent=YAHOO.util.Event,yuiLang=YAHOO.lang,yuiDomGet=YAHOO.util.Dom.get,YuiCustomEvent=YAHOO.util.CustomEvent;YAHOO.Bubbling=function(){var obj={},ua=navigator.userAgent.toLowerCase(),isOpera=(ua.indexOf("opera")>-1);var navRelExternal=function(layer,args){var el=args[1].anchor;if(!(args[1].flagged||args[1].decrepitate)&&el){var r=el.getAttribute("rel"),t=el.getAttribute("target");if((!t||(t===""))&&(r=="external")){el.setAttribute("target","blank")}}};var defaultActionsControl=function(layer,args){obj.processingAction(layer,args,obj.defaultActions)};var _searchYUIButton=function(t){var el=obj.getOwnerByClassName(t,"yui-button"),bt=null,id=null;if(yuiLang.isObject(el)&&YAHOO.widget.Button){bt=YAHOO.widget.Button.getButton(el.id)}return bt};obj._attributeSeprator="|";obj.isContent=false;obj.isEmptyNull=function(theValue){if(typeof theValue===undefined||typeof theValue==="undefined"||theValue===null||theValue===""){return true}return false};obj.setIt=function(name,theValue,contentAttributes){if(!this.isEmptyNull(theValue)){contentAttributes[name]=theValue}};obj.getIt=function(name,contentAttributes){if(contentAttributes[name]){return contentAttributes[name]}return false};obj.isExist=function(name,contentAttributes){if(contentAttributes[name]){return true}return false};obj.remove=function(name,contentAttributes){var tmp=[],i=null;for(i in contentAttributes){if(i!==name){tmp[i]=contentAttributes[i]}}return tmp};obj.toString=function(contentAttributes){var i=0,result="";for(i in contentAttributes){if(contentAttributes.hasOwnProperty(i)){result+=i+":"+contentAttributes[i]+this._attributeSeprator}}return result.substring(0,result.length-1)};obj.setContent=function(el,trackId){var contentAttributes=this.loadAll(this.getContent(el));if(!contentAttributes[trackId]){contentAttributes[trackId]="1";this.save(el,contentAttributes)}return contentAttributes};obj.save=function(el,contentAttributes){el.setAttribute("bbl",this.toString(contentAttributes))};obj.loadAll=function(theContent){if(theContent===null||theContent===""){return{}}var listArray=theContent.split(this._attributeSeprator),i=0,contentAttributes={};for(i=0;i<listArray.length;i++){contentAttributes[listArray[i].substring(0,listArray[i].indexOf(":"))]=listArray[i].substring(listArray[i].indexOf(":")+1)}return contentAttributes};obj.getContent=function(el){var bbl=el.getAttribute("bbl"),contentStyle="";if(el.style.content){if(el.style.content===""){this.isContent=false;contentStyle=""}else{this.isContent=true;contentStyle=el.style.content}}else{this.isContent=false;contentStyle=""}if(bbl===null){if(contentStyle===""){return""}else{contentStyle=contentStyle.substring(1,contentStyle.length-1);el.setAttribute("bbl",contentStyle);try{if(el.style.removeAttribute){el.style.removeAttribute("content")}else{el.style.content=""}}catch(e){}return contentStyle}}else{return bbl}};obj.ready=false;obj.force2alfa=false;obj.bubble={};obj.onReady=new YuiCustomEvent("bubblingOnReady",obj,true);obj.getOwnerByClassName=function(node,className){return(yuiDom.hasClass(node,className)?node:yuiDom.getAncestorByClassName(node,className))};obj.getOwnerByTagName=function(node,tagName){node=yuiDomGet(node);if(!node){return null}return(node.tagName&&node.tagName.toUpperCase()==tagName.toUpperCase()?node:yuiDom.getAncestorByTagName(node,tagName))};obj.getAncestorByClassName=obj.getOwnerByClassName;obj.getAncestorByTagName=obj.getOwnerByTagName;obj.onKeyPressedTrigger=function(args,e,m){var b="key";e=e||yuiEvent.getEvent();m=m||{};m.action=b;m.target=args.target||(e?yuiEvent.getTarget(e):null);m.flagged=false;m.decrepitate=false;m.event=e;m.stop=false;m.type=args.type;m.keyCode=args.keyCode;m.charCode=args.charCode;m.ctrlKey=args.ctrlKey;m.shiftKey=args.shiftKey;m.altKey=args.altKey;this.bubble.key.fire(e,m);if(m.stop){yuiEvent.stopEvent(e)}return m.stop};obj.onEventTrigger=function(b,e,m){e=e||yuiEvent.getEvent();m=m||{};m.action=b;m.target=(e?yuiEvent.getTarget(e):null);m.flagged=false;m.decrepitate=false;m.event=e;m.stop=false;this.bubble[b].fire(e,m);if(m.stop){yuiEvent.stopEvent(e)}return m.stop};obj.onNavigate=function(e){var conf={anchor:this.getOwnerByTagName(yuiEvent.getTarget(e),"A"),button:_searchYUIButton(yuiEvent.getTarget(e))};if(!conf.anchor&&!conf.button){conf.input=this.getOwnerByTagName(yuiEvent.getTarget(e),"INPUT")}if(conf.button){conf.value=conf.button.get("value")}else{if(conf.input){conf.value=conf.input.getAttribute("value")}}if(!this.onEventTrigger("navigate",e,conf)){this.onEventTrigger("god",e,conf)}};obj.onProperty=function(e){this.onEventTrigger("property",e,{anchor:this.getOwnerByTagName(yuiEvent.getTarget(e),"A"),button:_searchYUIButton(yuiEvent.getTarget(e))})};obj._timeoutId=0;obj.onRepaint=function(e){clearTimeout(obj._timeoutId);obj._timeoutId=setTimeout(function(){var b="repaint",e={target:document.body},m={action:b,target:null,event:e,flagged:false,decrepitate:false,stop:false};obj.bubble[b].fire(e,m);if(m.stop){yuiEvent.stopEvent(e)}},150)};obj.onRollOver=function(e){this.onEventTrigger("rollover",e,{anchor:this.getOwnerByTagName(yuiEvent.getTarget(e),"A")})};obj.onRollOut=function(e){this.onEventTrigger("rollout",e,{anchor:this.getOwnerByTagName(yuiEvent.getTarget(e),"A")})};obj.onKeyPressed=function(args){this.onKeyPressedTrigger(args)};obj.getActionName=function(el,depot){depot=depot||{};var b=null,r=null,f=(yuiDom.inDocument(el)?function(b){return yuiDom.hasClass(el,b)}:function(b){return el.hasClass(b)});if(el&&(yuiLang.isObject(el)||(el=yuiDomGet(el)))){try{r=el.getAttribute("rel")}catch(e){}for(b in depot){if(depot.hasOwnProperty(b)&&(f(b)||(b===r))){return b}}}return null};obj.getFirstChildByTagName=function(el,t){if(el&&(yuiLang.isObject(el)||(el=yuiDomGet(el)))&&t){var l=el.getElementsByTagName(t);if(l.length>0){return l[0]}}return null};obj.virtualTarget=function(e,el){if(el&&(yuiLang.isObject(el)||(el=yuiDomGet(el)))&&yuiLang.isObject(e)){var t=yuiEvent.getRelatedTarget(e);if(yuiLang.isObject(t)){while(t.parentNode&&yuiLang.isObject(t.parentNode)&&(t.parentNode.tagName!=="BODY")){if(t.parentNode===el){return true}t=t.parentNode}}}return false};obj.addLayer=function(layers,scope){var result=false;layers=(yuiLang.isArray(layers)?layers:[layers]);scope=scope||window;for(var i=0;i<layers.length;++i){if(layers[i]&&!this.bubble.hasOwnProperty(layers[i])){this.bubble[layers[i]]=new YuiCustomEvent(layers[i],scope,true);result=true}}return result};obj.subscribe=function(layer,bh,scope){var first=this.addLayer(layer);if(layer){if(yuiLang.isObject(scope)){this.bubble[layer].subscribe(bh,scope,true)}else{this.bubble[layer].subscribe(bh)}}return first};obj.on=obj.subscribe;obj.fire=function(layer,obj){obj=obj||{};obj.action=layer;obj.flagged=false;obj.decrepitate=false;obj.stop=false;if(this.bubble.hasOwnProperty(layer)){this.bubble[layer].fire(null,obj)}return obj.stop};obj.processingAction=function(layer,args,actions,force){var behavior=null,t;if(!(args[1].flagged||args[1].decrepitate)||force){t=args[1].anchor||args[1].input||args[1].button;if(t){behavior=this.getActionName(t,actions);args[1].el=t}if(behavior&&actions[behavior].apply(args[1],[layer,args])){yuiEvent.stopEvent(args[0]);args[1].flagged=true;args[1].decrepitate=true;args[1].stop=true}}};obj.defaultActions={};obj.addDefaultAction=function(n,f,force){if(n&&f&&(!this.defaultActions.hasOwnProperty(n)||force)){this.defaultActions[n]=f}};yuiEvent.addListener(window,"resize",obj.onRepaint,obj,true);obj.on("navigate",navRelExternal);obj.on("navigate",defaultActionsControl);obj.initMonitors=function(config){var fMonitors=function(){var oMonitors=new YAHOO.widget.Module("yui-cms-font-monitor",{monitorresize:true,visible:false});oMonitors.render(document.body);YAHOO.widget.Module.textResizeEvent.subscribe(obj.onRepaint,obj,true);YAHOO.widget.Overlay.windowScrollEvent.subscribe(obj.onRepaint,obj,true)};if(yuiLang.isFunction(YAHOO.widget.Module)){yuiEvent.onDOMReady(fMonitors,obj,true)}};obj.init=function(){if(!this.ready){var el=document.body;yuiEvent.addListener(el,"click",obj.onNavigate,obj,true);yuiEvent.addListener(el,(isOpera?"mousedown":"contextmenu"),obj.onProperty,obj,true);if(isOpera){yuiEvent.addListener(el,"click",obj.onProperty,obj,true)}yuiEvent.addListener(el,"mouseover",obj.onRollOver,obj,true);yuiEvent.addListener(el,"mouseout",obj.onRollOut,obj,true);yuiEvent.addListener(document,"keyup",obj.onKeyPressed,obj,true);yuiEvent.addListener(document,"keydown",obj.onKeyPressed,obj,true);this.ready=true;obj.onReady.fire()}};yuiEvent.onDOMReady(obj.init,obj,true);obj.addLayer(["navigate","god","property","key","repaint","rollover","rollout"]);return obj}()})();YAHOO.register("bubbling",YAHOO.Bubbling,{version:"1.5.0",build:"223"});
