    /* Sliderwindow-0.6.0.js - Copyright Eaktion.com - All right reserved
    * http://www.eaktion.com/sliderwindow/
    * SliderWindowAnimation encapsulates animation that are executed when 
    * a SliderWindow receives a message with sendMessage and other methods.
    * SliderWindow is an extended YUI module built to work together with the sliderWindowAnimation
    * Some methods are ported directly from the YUI Overlay: configClassName configZIndex
    * The rest is done following YUI patterns. 
    * 
    * 
    * Released under BSD licence
    * Redistribution and use in source and binary forms, with or without
    * modification, are permitted provided that the following conditions are met:
    *     * Redistributions of source code must retain the above copyright
    *       notice, this list of conditions and the following disclaimer.
    *     * Redistributions in binary form must reproduce the above copyright
    *       notice, this list of conditions and the following disclaimer in the
    *       documentation and/or other materials provided with the distribution.
    *     * Neither the name of Eaktion.com nor the
    *       names of its contributors may be used to endorse or promote products
    *       derived from this software without specific prior written permission.
    *
    * THIS SOFTWARE IS PROVIDED BY Eaktion ApS ``AS IS'' AND ANY
    * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
    * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
    * DISCLAIMED. IN NO EVENT SHALL Eaktion ApS BE LIABLE FOR ANY
    * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
    * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
    * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
    * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
    * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    */
(function(){YAHOO.widget.SliderWindowAnimation=function(module,attrOpen,attrClose){this.module=module;this.attrOpen=attrOpen;this.attrClose=attrClose;this.targetElement=module;this.AnimClass=YAHOO.util.Anim;};var Dom=YAHOO.util.Dom,Easing=YAHOO.util.Easing,SliderWindowAnimation=YAHOO.widget.SliderWindowAnimation;YAHOO.widget.SliderWindowAnimation.SLIDE_WINDOW=function(module,dur,handlewidth,windowwidth){var closeTo=handlewidth||5;var openTo=windowwidth||400;var SlideWindow=new SliderWindowAnimation(module,{attributes:{width:{to:openTo}},duration:dur,method:Easing.easeOut},{attributes:{width:{to:closeTo}},duration:dur,method:Easing.easeIn});SlideWindow.init();return SlideWindow;};YAHOO.widget.SliderWindowAnimation.prototype={init:function(){this.windowOpen=new this.AnimClass(this.targetElement,this.attrOpen.attributes,this.attrOpen.duration,this.attrOpen.method);this.windowClose=new this.AnimClass(this.targetElement,this.attrClose.attributes,this.attrClose.duration,this.attrClose.method);},handleCloseWindow:function(){var element=document.getElementById('ea_swbd');Dom.setStyle(element,'background-position-x','left');},handleOpenWindow:function(){var element=this.targetElement.firstChild.nextSibling;Dom.setStyle(element,'background-position-x','right');},openWindow:function(){var unsub=this.windowClose.onComplete.unsubscribe(this.handleCloseWindow,this,true);this.windowOpen.onStart.subscribe(this.handleOpenWindow,this,true);this.windowOpen.animate();var unsub=this.windowOpen.onStart.unsubscribe(this.handleOpenWindow,this,true);},closeWindow:function(){this.windowClose.onComplete.subscribe(this.handleCloseWindow,this,true);var unsub=this.windowClose.onComplete.unsubscribe(this.handleCloseWindow,this,true);this.windowClose.animate();},toString:function(){var output="SliderWindowAnimation";if(this.module){output+=" ["+this.module.toString()+"]";}
return output;}};YAHOO.lang.augmentProto(SliderWindowAnimation,YAHOO.util.EventProvider);})();(function(){YAHOO.widget.MessageWindow=function(el,userConfig){YAHOO.widget.MessageWindow.superclass.constructor.call(this,el,userConfig);};YAHOO.lang.extend(YAHOO.widget.MessageWindow,YAHOO.widget.Module);YAHOO.lang.augmentProto(YAHOO.widget.MessageWindow,YAHOO.util.EventProvider);var Lang=YAHOO.lang,Event=YAHOO.util.Event,Dom=YAHOO.util.Dom,Y=YAHOO,SliderWindowAnimation=YAHOO.widget.SliderWindowAnimation;YAHOO.widget.MessageWindow.prototype.init=function(el,userConfig){YAHOO.widget.MessageWindow.superclass.init.call(this,el);this.fireEvent('beforeInit');this.CSS_BODYCONT='bdc';this.CSS_HEADERCONT='hdc';this.SIZE_HEADERHIGHT=21;this.SIZE_FOOTERHIGHT=12;this.contentElement=this.createBodyContTemplate();this.headerContent=this.createHeaderContTemplate();this.cfg.applyConfig(defaultConfig,true);this.initEventListeners();if(userConfig){this.cfg.applyConfig(userConfig,true);}
this.animatedResize=false;this.fireEvent('init');};var DEFAULT_CONFIG={"WIDTH":{key:"width",suppressEvent:false,value:400},"HEADERCWIDTH":{key:"headercwidth",suppressEvent:false,value:(400-this.SIZE_HEADERHIGHT)},"HEIGHT":{key:"height",suppressEvent:false,value:287},"ZINDEX":{key:"zIndex",value:5},"DIRECTION":{key:"direction",value:'right',validator:function(value){if(value!='left'&&value!='right'){return false;}}},"ADD_RESIZING":{key:"addResizing",value:true,suppressEvent:true},"CLOSETITLE":{key:"closetitle",value:"Click to close/open or ctrl-left/right arrow to close/open"},"HANDLEWIDTH":{key:"handlewidth",value:5},"CLASS":{key:"classname",value:'eaSliderWindow'},"CREDIT":{key:"credit",value:'yes'},"UTILMETHODS":{key:"utilmethods",value:'yes'}};var defaultConfig={visible:true,height:DEFAULT_CONFIG.HEIGHT.value+"px",width:DEFAULT_CONFIG.WIDTH.value+"px",headercwidth:DEFAULT_CONFIG.HEADERCWIDTH.value+"px",direction:DEFAULT_CONFIG.DIRECTION.value,handlewidth:DEFAULT_CONFIG.HANDLEWIDTH.value+"px",classname:"eaSliderWindow",closetitle:'',credit:DEFAULT_CONFIG.CREDIT.value,zIndex:DEFAULT_CONFIG.ZINDEX.value,addResizing:DEFAULT_CONFIG.ADD_RESIZING.value};var UTIL_CONFIG={"MYMETHOD":{handler:false}};YAHOO.widget.MessageWindow.prototype.initEvents=function(){YAHOO.widget.MessageWindow.superclass.initEvents.call(this);};YAHOO.widget.MessageWindow.prototype.initDefaultConfig=function(){YAHOO.widget.MessageWindow.superclass.initDefaultConfig.call(this);this.cfg.addProperty(DEFAULT_CONFIG.WIDTH.key,{handler:this.configWidth,suppressEvent:DEFAULT_CONFIG.WIDTH.suppressEvent,supercedes:DEFAULT_CONFIG.WIDTH.supercedes});this.cfg.addProperty(DEFAULT_CONFIG.HEADERCWIDTH.key,{handler:this.configHeaderCWidth,suppressEvent:DEFAULT_CONFIG.HEADERCWIDTH.suppressEvent,supercedes:DEFAULT_CONFIG.HEADERCWIDTH.supercedes});this.cfg.addProperty(DEFAULT_CONFIG.CLASS.key,{handler:this.configClassName,suppressEvent:DEFAULT_CONFIG.CLASS.suppressEvent,supercedes:DEFAULT_CONFIG.CLASS.supercedes});this.cfg.addProperty(DEFAULT_CONFIG.HEIGHT.key,{handler:this.configHeight,suppressEvent:DEFAULT_CONFIG.HEIGHT.suppressEvent,supercedes:DEFAULT_CONFIG.HEIGHT.supercedes});this.cfg.addProperty(DEFAULT_CONFIG.ZINDEX.key,{handler:this.configzIndex,value:DEFAULT_CONFIG.ZINDEX.value});this.cfg.addProperty(DEFAULT_CONFIG.DIRECTION.key,{handler:this.configDirection});this.cfg.addProperty(DEFAULT_CONFIG.ADD_RESIZING.key,{suppressEvent:DEFAULT_CONFIG.ADD_RESIZING.suppressEvent});this.cfg.addProperty(DEFAULT_CONFIG.HANDLEWIDTH.key,{handler:this.configHandlewidth});this.cfg.addProperty(DEFAULT_CONFIG.CLOSETITLE.key,{handler:this.configClosetitle});this.cfg.addProperty(DEFAULT_CONFIG.CREDIT.key,{});this.cfg.addProperty(DEFAULT_CONFIG.UTILMETHODS.key,{handler:this.callUtilMethods});};YAHOO.widget.MessageWindow.prototype.configHeight=function(type,args,obj){var height=parseInt(args[0],10),el=this.element;Dom.setStyle(this.body,'height',(height-this.SIZE_HEADERHIGHT-this.SIZE_FOOTERHIGHT)+'px');Dom.setStyle(el,"height",height+'px');};YAHOO.widget.MessageWindow.prototype.configzIndex=function(type,args,obj){var zIndex=args[0],el=this.element;if(!zIndex){zIndex=Dom.getStyle(el,"zIndex");if(!zIndex||isNaN(zIndex)){zIndex=0;}}
Dom.setStyle(el,"zIndex",zIndex);};YAHOO.widget.MessageWindow.prototype.configClassName=function(type,args,obj){var classname=args[0],el=this.element;Dom.addClass(el,classname);};YAHOO.widget.MessageWindow.prototype.configWidth=function(type,args,obj){var hw=this.cfg.getProperty('handlewidth');var i_width=parseInt(args[0],10);var el=this.element;Dom.setStyle(el,"width",hw);};YAHOO.widget.MessageWindow.prototype.configHeaderCWidth=function(type,args,obj){var hdcw=parseInt(this.cfg.getProperty('width'),10)-this.SIZE_HEADERHIGHT;var contentElement=this.headerContent;var el=document.getElementById('ea_swhdc');Dom.setStyle(contentElement,"width",hdcw+"px");};YAHOO.widget.MessageWindow.prototype.configTitleTag=function(type,args,obj){var text=args[0],el=this.element;var hd=el.firstChild();hd.setAttribute('title',text);};YAHOO.widget.MessageWindow.prototype.configClosetitle=function(type,args,obj){var container=this.element;var i_height=parseInt(this.cfg.getProperty('height'),10);var title=args[0]||(YAHOO.env.ua.opera>0?"Click to close/open or hit ctrl+shift-left/right arrow to close/open":DEFAULT_CONFIG.CLOSETITLE.value);var closeHandle=document.createElement('div');closeHandle.innerHTML='<div class="container-close" title="'+title+'"></div><div id ="ea_swht" style="height:'+(i_height-this.SIZE_HEADERHIGHT-this.SIZE_FOOTERHIGHT)+'px;top:'+this.SIZE_HEADERHIGHT+'px;" class="handle-target" title=""></div>';container.appendChild(closeHandle.firstChild.nextSibling);container.appendChild(closeHandle.firstChild);};YAHOO.widget.MessageWindow.prototype.callUtilMethods=function(type,args,obj){var utilMethodConfig=UTIL_CONFIG;for(privSettings in utilMethodConfig){var fn=utilMethodConfig[privSettings].handler;fn(this);}};YAHOO.widget.MessageWindow.prototype.configHandlewidth=function(type,args,obj){var tpl=this.contentElement;var hw=args[0]||DEFAULT_CONFIG.HANDLEWIDTH.value+'px';hw=parseInt(hw,10);this.addBodyCont(tpl);this.addHeaderCont(this.headerContent);var el2style=document.getElementById('ea_swbdc');Dom.setStyle(el2style,'paddingLeft','5px');Dom.setStyle(el2style,'paddingTop','0px');Dom.setStyle(el2style,'paddingBotton','5px');Dom.setStyle(el2style,'marginRight',hw+'px');Dom.setStyle(el2style,'paddingRight','5px');};YAHOO.widget.MessageWindow.prototype.createBodyContTemplate=function(){var m_oBodyContTemplate=document.createElement("div");m_oBodyContTemplate.innerHTML=("<div id=\"ea_swbdc\" class=\""+this.CSS_BODYCONT+"\"></div>");return m_oBodyContTemplate.firstChild;};YAHOO.widget.MessageWindow.prototype.createHeaderContTemplate=function(){var m_oHeaderContTemplate=document.createElement("div");m_oHeaderContTemplate.innerHTML=("<div id=\"ea_swhdc\" class=\""+this.CSS_HEADERCONT+"\"></div>");return m_oHeaderContTemplate.firstChild;};YAHOO.widget.MessageWindow.prototype.addBodyCont=function(contentElement){var oBody=this.body||(this.body=this.createBody());this.body.id="ea_swbd";while(oBody.hasChildNodes()){var contChild=oBody.firstChild.cloneNode(true);if(oBody.removeChild(oBody.firstChild)){contentElement.appendChild(contChild);}}
oBody.appendChild(contentElement);this.doneAddBody=true;};YAHOO.widget.MessageWindow.prototype.addHeaderCont=function(headerContent){var oHeader=this.header||(this.header=this.createHeader());this.header.id="ea_swhd";while(oHeader.hasChildNodes()){var contChild=oHeader.firstChild.cloneNode(true);if(oHeader.removeChild(oHeader.firstChild)){headerContent.appendChild(contChild);}}
oHeader.appendChild(headerContent);this.doneAddHeader=true;};YAHOO.widget.MessageWindow.prototype.moveToHeaderCont=function(){if(!this.doneAddHeader){return;}
var oHeader=this.header;var contentElement=this.headerContent;while(contentElement.hasChildNodes()){contentElement.removeChild(contentElement.firstChild);}
while(oHeader.hasChildNodes()){var contChild=oHeader.firstChild.cloneNode(true);if(oHeader.removeChild(oHeader.firstChild)){contentElement.appendChild(contChild);}}
oHeader.appendChild(contentElement);};YAHOO.widget.MessageWindow.prototype.moveToCont=function(){var oBody=this.body;if(!this.doneAddBody){return true;}
var contentElement=this.contentElement;while(contentElement.hasChildNodes()){contentElement.removeChild(contentElement.firstChild);}
while(oBody.hasChildNodes()){var contChild=oBody.firstChild.cloneNode(true);if(oBody.removeChild(oBody.firstChild)){contentElement.appendChild(contChild);}}
oBody.appendChild(contentElement);};YAHOO.widget.MessageWindow.prototype.configDirection=function(type,args,obj){if(args[0]){switch(args[0]){case'left':alert("Configuration for key 'direction' with value of '"+args[0]+"' is not yet implemented");break;case'right':var hw,w;if(hw=this.cfg.getProperty('handlewidth')){hw=parseInt(hw,10);}else{hw=DEFAULT_CONFIG.HANDLEWIDTH.value;}
if(w=this.cfg.getProperty('width')){w=parseInt(w,10)||DEFAULT_CONFIG.WIDTH.value;}
var el=this.element;this.Slider=SliderWindowAnimation.SLIDE_WINDOW(el,0.5,hw,w);this.Slider.windowOpen.onComplete.subscribe(this.handleCloseBehaviour,this,true);break;}}};YAHOO.widget.MessageWindow.prototype.closeWindow=function(){this.repositionSlider();this.Slider.closeWindow();var element=document.getElementById('ea_swbdc');Dom.setStyle(element,'overflow-y','hidden');};YAHOO.widget.MessageWindow.prototype.openWindow=function(){var element=document.getElementById('ea_swbdc');this.repositionSlider();this.Slider.openWindow();Dom.setStyle(element,'overflow-y','auto');};YAHOO.widget.MessageWindow.prototype.handlePublishMessageEvent=function(action){this.repositionSlider();switch(action){case'close':break;case'stop':this.stop=true;break;case'publish':this.stop=false;break;}
this.openWindow();};YAHOO.widget.MessageWindow.prototype.handleCloseBehaviour=function(action){if(this.stop){return;}
this.closeWindow();};YAHOO.widget.MessageWindow.prototype.repositionSlider=function(){var offSet=Dom.getDocumentScrollTop(window.document);var bl=Dom.getViewportHeight(window.document);var sHeight=this.cfg.getProperty('height');var iHeight=parseInt(sHeight,10);Dom.setY(this.element,(bl+offSet-iHeight));};YAHOO.widget.MessageWindow.prototype.addResizing=function(userConfig){var config=userConfig||{proxy:true,status:false,handles:['t','tr'],hover:true,maxWidth:700,maxHeight:500,ghost:true,setSize:false};if(this.cfg.getProperty('addResizing')){this.resize=new YAHOO.util.Resize(this.id,config);this.configResize();}};YAHOO.widget.MessageWindow.prototype.configResize=function(){this.resize.on('endResize',function(args){var h=args.height;var w=args.width;this.setToWidth(w+'px');this.resizeHeight(h+'px');},this,true);};YAHOO.widget.MessageWindow.prototype.handleRender=function(){var element=document.getElementById('ea_swbd');Dom.setStyle(element,'background-position-x','left');Dom.setStyle(this.id,'position','absolute');this.addResizing();};YAHOO.widget.MessageWindow.prototype.handleClick=function(ev){var target=Event.getTarget(ev);if(target.className=='container-close'){this.closeWindow();}else if(target.className=='handle-target'){var sw=this.cfg.getProperty('width');sw=parseInt(sw,10);if(parseInt(this.element.style.width,10)<sw){this.handlePublishMessageEvent('stop');}else{this.closeWindow();}}};YAHOO.widget.MessageWindow.prototype.handleBeforeRender=function(){var credit='';var userCredit=this.cfg.getProperty('credit');var setCredit=true===userCredit||'yes'===userCredit;if(setCredit){credit='<div style="padding-left:'+this.SIZE_HEADERHIGHT+'px;overflow-x:hidden;overflow-y:hidden;width:50%;top:0px;text-align:left;line-height: '+this.SIZE_FOOTERHIGHT+'px;font-size: 0.6em;"><a href="http://www.eaktion.com/sliderwindow/" target="_BLANK" id="sliderwindow_lnk">SliderWindow</a></div>';}
this.setHeader('');this.setBody('');this.setFooter(credit);};YAHOO.widget.MessageWindow.prototype.handleArrow=function(ev){if(ev.ctrlKey){var isCtrl=true;}
if(isCtrl){if(ev.shiftKey&&!YAHOO.env.ua.opera){return;}
if(39==YAHOO.util.Event.getCharCode(ev)){this.handlePublishMessageEvent('stop');YAHOO.util.Event.preventDefault(ev);YAHOO.util.Event.stopEvent(ev);}
if(37==YAHOO.util.Event.getCharCode(ev)){this.closeWindow();YAHOO.util.Event.preventDefault(ev);YAHOO.util.Event.stopEvent(ev);}}};YAHOO.widget.MessageWindow.prototype.initEventListeners=function(){Event.addListener(this.element,'click',this.handleClick,this,true);Event.addListener(this.element,'mousedown',this.handleMouseDown,this,true);Event.addListener(this.element,'mouseup',this.handleMouseUp,this,true);Event.addListener(document,'keydown',this.handleArrow,this,true);this.beforeRenderEvent.subscribe(this.handleBeforeRender,this,false);this.renderEvent.subscribe(this.repositionSlider,this,false);this.renderEvent.subscribe(this.handleRender,this,false);this.changeHeaderEvent.subscribe(this.moveToHeaderCont,this,false);this.changeBodyEvent.subscribe(this.moveToCont,this,false);};YAHOO.widget.MessageWindow.prototype.sendMessage=function(txt,mode){this.setBody(txt);if(mode){switch(mode){case'publish':this.handlePublishMessageEvent('publish');break;case'open':this.handlePublishMessageEvent('stop');break;}}else{this.handlePublishMessageEvent('publish');}};YAHOO.widget.MessageWindow.prototype.resizeWidth=function(width){this.cfg.setProperty("width",width,true);this.cfg.refireEvent("direction");this.cfg.refireEvent("headercwidth");return true;};YAHOO.widget.MessageWindow.prototype.setToWidth=function(width){this.cfg.setProperty("width",width,true);Dom.setStyle(this.element,"width",width);this.cfg.refireEvent("direction");this.cfg.refireEvent("headercwidth");this.handlePublishMessageEvent('stop');return true;};YAHOO.widget.MessageWindow.prototype.resizeHeight=function(height){var iNewHeight=parseInt(height,10);this.cfg.setProperty("height",(Number(iNewHeight))+'px');this.repositionSlider();return true;};}());