    /* Sliderwindow-0.6.0.js - Copyright Eaktion.com - All rights 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) {

        /**
        * The SliderWindow to animate
        * @property overlay
        * @type YAHOO.widget.Overlay
        */
        this.module = module;
    
        /**
        * The animation attributes to use when transitioning into view
        * @property attrOpen
        * @type Object
        */
        this.attrOpen = attrOpen; 
    
        /**
        * The animation attributes to use when transitioning out of view
        * @property attrClose
        * @type Object
        */
        this.attrClose = attrClose;

        
        /**
        * The target element to be animated
        * @property targetElement
        * @type HTMLElement
        */
        this.targetElement = module;
        
        this.AnimClass = YAHOO.util.Anim;
        
    };


    var Dom = YAHOO.util.Dom,
        Easing = YAHOO.util.Easing,
        SliderWindowAnimation = YAHOO.widget.SliderWindowAnimation;


    /**
    * A pre-configured SliderWindowAnimation instance that can be used for opening and closing a sliderWindow.
    * @method SLIDE_WINDOW
    * @static
    * @param {YAHOO.widget.Module} module The Module object to animate
    * @param {Number} dur The duration of the animation
    * @return {YAHOO.widget.SliderWindowAnimation} The configured SliderWindowAnimation object
    */
    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 = {
    
        /**
        * Initializes the animation classes and events.
        * @method init
        */
        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); 
        },
        
 	/**
        * change styles for the window (to please IE6)
        * Set the bg handler image to the left to let it show through the container
        * @method handleCloseWindow
        * 
        * Try moving this handler to sliderwindow instead, and respond to an
        * event triggered in sliderwindowanimation
        * Create an event to be fired inside openwindow and closewindow
        */
        handleCloseWindow: function () {
            var element = document.getElementById('ea_swbd');
            Dom.setStyle(element,'background-position-x','left');
		
        },
        
 	/**
        * change styles for the window (to please IE6).
        * The handler bg image is reset to the right
        * @method handleCloseWindow
        * 
        */
        handleOpenWindow: function () {
            var element = this.targetElement.firstChild.nextSibling;
            Dom.setStyle(element,'background-position-x','right');		
        },
        
        /**
        * Triggers the open animation.
        * @method openWindow
        */
        openWindow: function () {
            //removing the handleCloseWindow from last close if any. It cannot be unsubscribed at onComplete for close because
            //it must fire at that point
            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);
        },
        
        /**
        * Triggers the close animation.
        * @method closeWindow
        */
        closeWindow: function () {
            //handleClose at onComplete to avoid handle bckground to jump on left side
            this.windowClose.onComplete.subscribe(this.handleCloseWindow, this, true);            
	    
            //removing the handleCloseWindow from last close if any.
           var unsub = this.windowClose.onComplete.unsubscribe(this.handleCloseWindow, this, true);
            this.windowClose.animate();  
            
        },

               
        /**
        * Returns a string representation of the object.
        * @method toString
        * @return {String} The string representation of the SliderWindowAnimation
        */
        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;  
		
       
        /**
        * Initialization method
        * @method init
        * @param {String}	el	The element ID representing the MessageWindow <em>OR</em>
        * @param {HTMLElement}	el	The element representing the MessageWindow
        * @param {Object}	userConfig	The configuration object literal containing the configuration that should be set.
        */
        YAHOO.widget.MessageWindow.prototype.init = function(el, userConfig) {
            
        	
            // Note that we don't pass the user config in here yet because we only want it processed once, at the lowest subclass level (by calling this.cfg.applyConfig later on)
            // this also calls this.initEvents
            YAHOO.widget.MessageWindow.superclass.init.call(this, el/*, userConfig*/);
            
            // fire event saying we are about to start the initialisation
            this.fireEvent('beforeInit');     
            
            this.CSS_BODYCONT = 'bdc';
			if (userConfig.body_css!=''){
				this.CSS_BODY_IDC = 'bdc_' + userConfig.body_css;
			}
			
			this.noticeid = userConfig.noticeid;
            
            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);
                       
            // initialise event delegation
            this.initEventListeners();
        
                        //override default if set
            if (userConfig) {
                    this.cfg.applyConfig(userConfig, true);
            }
            
            this.animatedResize = false;
            
            // fire event saying initialisation of the Control is done
            this.fireEvent('init');

        };

	/**
        * Constant representing the MessageWindow's configuration properties
        * @property DEFAULT_CONFIG
        * @private
        * @final
        * @type Object
        */
        var DEFAULT_CONFIG = {

            "WIDTH": { 
                key: "width", 
                suppressEvent: false,
                value: 300
            },
            
            "HEADERCWIDTH": { 
                key: "headercwidth", 
                suppressEvent: false,
                value: (400 - this.SIZE_HEADERHIGHT)
            },

            "HEIGHT": { 
                key: "height", 
                suppressEvent: false,
                value: 75
            }, 

            "ZINDEX": { 
                key: "zIndex", 
                value: 5 
            },
            
            /* direction instantiates anim */
            "DIRECTION": { 
                key: "direction", 
                value: 'right',
                validator: function(value){
                        if(value!='left' && value!='right'){
                               return false;               	 	
                        }
                }
            },
            
            "ADD_RESIZING": {
                key: "addResizing",
                value: false,
                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: 'no'
            },
            
            "UTILMETHODS": { 
                key: "utilmethods", 
                value: 'yes'
            },

			//BEGIN MOD
            "VPOSITION": { 
                key: "vposition", 
                value: 0
            }
			//END MOD
               
        };
            
        /**
        * Apply this config in any case
        *
        **/
        
        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:'',//config for Opera in func
                            credit: DEFAULT_CONFIG.CREDIT.value,
                            zIndex: DEFAULT_CONFIG.ZINDEX.value,
                            addResizing: DEFAULT_CONFIG.ADD_RESIZING.value,
							//BEGIN MOD
                            vposition: DEFAULT_CONFIG.VPOSITION.value
							//END MOD
                    };
                
        
        var UTIL_CONFIG = {

            "MYMETHOD": { 
            	handler: false
            }
        };
        
        /**
        * Initializes the custom events for YAHOO.widget.MessageWindow 
        * This method gets called by YAHOO.widget.Module.prototype.init
        * @method initEvents
        * @see http://yuiblog.com/blog/2007/12/19/custommodules/
        * 
        */
        YAHOO.widget.MessageWindow.prototype.initEvents = function() {

            // call the base class method to make sure inherited custom events get set up
            YAHOO.widget.MessageWindow.superclass.initEvents.call(this);        
     	
        };
        
        /**
        * Initializes the class's configurable properties which can be changed 
        * using the MessageWindow's Config object (cfg).
        * @method initDefaultConfig
        */
        YAHOO.widget.MessageWindow.prototype.initDefaultConfig = function () {

            YAHOO.widget.MessageWindow.superclass.initDefaultConfig.call(this);
            
			            
            /**
            * CSS width of the MessageWindow.
            * @config width
            * @type String
            * @default null
            */
            this.cfg.addProperty(DEFAULT_CONFIG.WIDTH.key, {

                handler: this.configWidth, 
                suppressEvent: DEFAULT_CONFIG.WIDTH.suppressEvent, 
                supercedes: DEFAULT_CONFIG.WIDTH.supercedes

            });
            
            /**
            * CSS width of the headercont.
            * @config headercwidth
            * @type String
            * @default null
            */
            this.cfg.addProperty(DEFAULT_CONFIG.HEADERCWIDTH.key, {

                handler: this.configHeaderCWidth, 
                suppressEvent: DEFAULT_CONFIG.HEADERCWIDTH.suppressEvent, 
                supercedes: DEFAULT_CONFIG.HEADERCWIDTH.supercedes

            });
            
                       
            /**
            * CSS classname of the MessageWindow.
            * @config class-name
            * @type String
            * @default 'eaSliderWindow'
            */
            this.cfg.addProperty(DEFAULT_CONFIG.CLASS.key, {

                handler: this.configClassName, 
                suppressEvent: DEFAULT_CONFIG.CLASS.suppressEvent, 
                supercedes: DEFAULT_CONFIG.CLASS.supercedes

            });

            
            /**
            * CSS height of the MessageWindow.
            * @config height
            * @type String
            * @default null
            */
            this.cfg.addProperty(DEFAULT_CONFIG.HEIGHT.key, {

                handler: this.configHeight, 
                suppressEvent: DEFAULT_CONFIG.HEIGHT.suppressEvent, 
                supercedes: DEFAULT_CONFIG.HEIGHT.supercedes
            
            });
            
            /**
            * CSS z-index of the MessageWindow.
            * @config zIndex
            * @type Number
            * @default 1
            */
            this.cfg.addProperty(DEFAULT_CONFIG.ZINDEX.key, {

                handler: this.configzIndex,
                value: DEFAULT_CONFIG.ZINDEX.value

            });
            
            /**
            * Configuring the direction of opening. Only 'right' is supported yet
            * @config direction
            * @type String
            * @default 'right'
            */
            this.cfg.addProperty(DEFAULT_CONFIG.DIRECTION.key, {
            
                handler: this.configDirection
            
            });
            
            /**
            * Configuring whether to add resizing or not.
            * @config addResizing
            * @type bool
            * @default 'true'
            */
            this.cfg.addProperty(DEFAULT_CONFIG.ADD_RESIZING.key, {
            
                suppressEvent: DEFAULT_CONFIG.ADD_RESIZING.suppressEvent
            
            });
            
            /**
            * CSS width of the MessageWindow.
            * @config width
            * @type String
            * @default null
            */
            this.cfg.addProperty(DEFAULT_CONFIG.HANDLEWIDTH.key, {

            	handler: this.configHandlewidth
            	 
            });
             
            /**
            * Title text in the close icon.
            * @config closetitle
            * @type String
            * @default null
            */
            this.cfg.addProperty(DEFAULT_CONFIG.CLOSETITLE.key, {

            	handler: this.configClosetitle
            	 
            });
            
            /**
            * Whether the credit is to be shown.
            * @config credit
            * @type String
            * @default yes
            */
            this.cfg.addProperty(DEFAULT_CONFIG.CREDIT.key, {

            	 
            });

			//BEGIN MOD
            this.cfg.addProperty(DEFAULT_CONFIG.VPOSITION.key, {});
			//END MOD

            
            /**
            * A set of utility methods are called at this time.
            * @config utilmethods
            * @type string
            * @default yes
            */
            this.cfg.addProperty(DEFAULT_CONFIG.UTILMETHODS.key, {

            	 handler: this.callUtilMethods
            });           
        };
        
        /**
        * The default event handler fired when the "height" property is changed.
        * @method configHeight
        * @param {String} type The CustomEvent type (usually the property name)
        * @param {Object[]} args The CustomEvent arguments. For configuration 
        * handlers, args[0] will equal the newly applied value for the property.
        * @param {Object} obj The scope object. For configuration handlers, 
        * this will usually equal the owner.
        */
        YAHOO.widget.MessageWindow.prototype.configHeight = function (type, args, obj) {

            var height = parseInt(args[0],10),
            el = this.element;
            

             //body is without header and footer
            Dom.setStyle(this.body, 'height',(height-this.SIZE_HEADERHIGHT-this.SIZE_FOOTERHIGHT)+'px');
            Dom.setStyle(el, "height", height+'px');
   
        };
        
        /**
        * The default event handler fired when the "zIndex" property is changed.
        * @method configzIndex
        * @param {String} type The CustomEvent type (usually the property name)
        * @param {Object[]} args The CustomEvent arguments. For configuration 
        * handlers, args[0] will equal the newly applied value for the property.
        * @param {Object} obj The scope object. For configuration handlers, 
        * this will usually equal the owner.
        */
        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);
        };
        /**
        * The default event handler fired when the "classname" property is changed.
        * @method configClassName
        * @param {String} type The CustomEvent type (usually the property name)
        * @param {Object[]} args The CustomEvent arguments. For configuration 
        * handlers, args[0] will equal the newly applied value for the property.
        * @param {Object} obj The scope object. For configuration handlers, 
        * this will usually equal the owner.
        */
        YAHOO.widget.MessageWindow.prototype.configClassName = function (type, args, obj) {

            var classname = args[0],
            el = this.element;
            Dom.addClass(el, classname);
        };
        
        /**
        * The default event handler fired when the "width" property is changed.
        * We set the current width of the slider to the handlewidth, the width is used to configure the openTo width. 
        * See configDirection
        * @method configWidth
        * @param {String} type The CustomEvent type (usually the property name)
        * @param {Object[]} args The CustomEvent arguments. For configuration 
        * handlers, args[0] will equal the newly applied value for the property.
        * @param {Object} obj The scope object. For configuration handlers, 
        * this will usually equal the owner.
        */
        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;//keep space for the close icon
            var contentElement = this.headerContent;
            var el = document.getElementById('ea_swhdc');//contentElement should do but in this case it
            //doesn't touch the correct element,
            //as if this.headerContent is not part of the dom
            Dom.setStyle(contentElement, "width", hdcw+"px");                      
           
        };
        
         /**
        * The default event handler fired when the "title" property of the header is changed.
        * @method configTitleTag
        * @param {String} type The CustomEvent type (usually the property name)
        * @param {Object[]} args The CustomEvent arguments. For configuration 
        * handlers, args[0] will equal the newly applied value for the property.
        * @param {Object} obj The scope object. For configuration handlers, 
        * this will usually equal the owner.
        */
        YAHOO.widget.MessageWindow.prototype.configTitleTag = function (type, args, obj) {

            var text = args[0],
                el = this.element;
            var hd = el.firstChild();
                hd.setAttribute('title',text);
        };
        
        /**
        * configClosetitle sets the close icon on the header. Create a a setCloseTooltip to set the text from the page.
        * Thus  being able to set it to different languages
        *
        */

        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);  //why does this work in FF? Shouldn't it have   nextSibling.nextSibling.?  
            container.appendChild(closeHandle.firstChild);                                  
        };
        
        /**
         * callUtilMethods calls a series of methods used to set up various
         * things that are not user configurable.
         * 
         *
         **/
        YAHOO.widget.MessageWindow.prototype.callUtilMethods = function(type, args, obj){
            
            var utilMethodConfig = UTIL_CONFIG;
            for (privSettings in utilMethodConfig){
            //	if('string' == typeof privSettings)alert(privSettings)
            	
                var fn = utilMethodConfig[privSettings].handler;    
                fn(this);
            }
           
        };
        
                
        /**
        * configHandlewidth sets the canvas with the appropriate right-margin, 
        * sets the 'move to' value and the handler width value to the same value
        * It sets the body to the empty string without publishing this message.
        * The right-margin of the canvas is padding+handlewidth (padding is 0 only for right-padding, 
        * margin is equal the handlewidth to keep bdc invisible when the window is closed)
        */

        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');//styling the bdc
            
            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');
                                       
        };
        
        
       /******* help functions used by configHandlewidth ****************
       *
       *
       *
        * Appends the passed element to the body. If no body is present, one 
        * will be automatically created.
        * @method createBodyContTemplate
        * @param {HTMLElement} element The element to append to the body
        */
        YAHOO.widget.MessageWindow.prototype.createBodyContTemplate = function() {

            var m_oBodyContTemplate = document.createElement("div");
            m_oBodyContTemplate.innerHTML = ("<div id=\"ea_swbdc\" class=\"" + this.CSS_BODYCONT + " " + this.CSS_BODY_IDC + "\"></div>");
            return m_oBodyContTemplate.firstChild;
        };
	 	
	/*
        * Appends the passed element to the header. If no header is present, one 
        * will be automatically created.
        * @method createHeaderContTemplate
        * @param {HTMLElement} element The element to append to the body
        */
        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;
        };
       
	 	
        /*
        * addBodyCont adds the initial content set to body into the special bdc div.
        * Called by configHandlewidth
        * It is no longer used afterwards.
        */
        	
        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;
        };
        
        /*
        * addHeaderCont adds the initial content set to header into the  ea_swhdc div. 
        * It is no longer used afterwards??
        */
        	
        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;
        };
        
        /*
        * addHeaderCont adds the initial content set to header into the special ea_swhdc div. 
        * 
        */
        	
        YAHOO.widget.MessageWindow.prototype.moveToHeaderCont = function () {
            
            if(!this.doneAddHeader){
                return;
            }
            
            var oHeader = this.header;
            var contentElement = this.headerContent;
	    
            //removing any contents from hdc
             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);
        };
        
        /*
        *
        ******** end help functions used by configHandlewidth ****************/
        
        /*
        * moveToCont does the same as the initial content set to body into the special bdc div. 
        * 
        */
        
        YAHOO.widget.MessageWindow.prototype.moveToCont = function () {

            var oBody = this.body;            
            if(!this.doneAddBody) {
                return true;
            }
            var contentElement = this.contentElement;
                        
            //removing any contents from bdc
             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);
        };
        
        /**
        * Default event handler for the "direction" configuration property
        * @param {String} type The CustomEvent type (usually the property name)
        * @param {Object[]} args The CustomEvent arguments. For configuration 
        * handlers, args[0] will equal the newly applied value for the property.
        * @param {Object} obj The scope object. For configuration handlers, 
        * this will usually equal the owner.
        * @method configDirection
        */
	 
        YAHOO.widget.MessageWindow.prototype.configDirection = function(type, args, obj) {
          
            if(args[0]){
                 switch (args[0]){
                      case 'left':
                      /* configuration to be created. The window opens from right to left, 
                      that is the left upper vertex of the module must be shifted left at the same time hat the window is opening 
                      The dom properties of the module must also be edited.
                      
                      Throwing an error won't be shown in FF or MSIE, why?
                      */
                      alert ("Configuration for key 'direction' with value of '"+args[0]+"' is not yet implemented");
                      break;
                      case 'right':

                      /* just apply the animation to the width of the box, using the default dom 
                      el, attributes, duration, method
                      */
                      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, 1,hw,w);
                      
                      this.Slider.windowOpen.onComplete.subscribe(this.handleCloseBehaviour, this, true);
                      break;
                 }
            }
               
        };
        
        /**
        *  Wrapper function for this.Slider.closeWindow
        * 
        */
        YAHOO.widget.MessageWindow.prototype.closeWindow = function (){
                this.repositionSlider();
                this.Slider.closeWindow();
                
                //change overflow for bdc to avoid seeing the scrollbar in MSIE if there is any text in the window
                var element = document.getElementById('ea_swbdc');
                Dom.setStyle(element,'overflow-y','hidden');
        };
 
       /**
        * It opens the slider window taking care to unsubscribe possible close function
        * to ensure that the window stays open  after it has been opened.
        */
       YAHOO.widget.MessageWindow.prototype.openWindow = function (){
               
               var element = document.getElementById('ea_swbdc');
              
               this.repositionSlider();
               
               this.Slider.openWindow();	
               
               Dom.setStyle(element,'overflow-y','auto');
       };
       
       /**
        * @method handlePublishMessageEvent
        * @param {string} action the mode of opening: close after open or stop
        * This handler stes a flag to be used by handleCloseWindow that is constantly subsribed to
        */		
        YAHOO.widget.MessageWindow.prototype.handlePublishMessageEvent = function(action) {
            
            
               //Reposition the widget at the bottom of the page. It might have been scrolled up
       this.repositionSlider();
               
        switch(action){
                case 'close':

                break;
                case 'stop':
                this.stop = true;
 
                break;
                case 'publish':
                this.stop = false;
				//BEGIN MOD
				//set time delay for leaving window open
				this.delay = 1000*5; //milliseconds
				//END MOD
                 
                break;
        }
                
                
        this.openWindow();

        };
        
        YAHOO.widget.MessageWindow.prototype.handleCloseBehaviour = function(action) {
            if(this.stop){
                return;
            }
			
			//BEGIN MOD
			//delay the closing
			var thisObj = this;
            setTimeout(function(){thisObj.closeWindow()},this.delay);
			//END MOD
            
        };
        YAHOO.widget.MessageWindow.prototype.repositionSlider = function() {
            //Reposition the widget at the bottom of the page. It might have been scrolled up
            var offSet = Dom.getDocumentScrollTop(window.document);
           
            var bl = Dom.getViewportHeight(window.document);
           
            var sHeight = this.cfg.getProperty('height');

            var iHeight = parseInt(sHeight,10);

			//BEGIN MOD
			//reposition slider to top of page instead of bottom
			var topPosition = (this.cfg.getProperty('vposition') * (iHeight-10));
            Dom.setY(this.element,topPosition);   
            //Dom.setY(this.element,(bl+offSet-iHeight));   
			//END MOD

        };
        
        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(){
        /* add class below needed for IE */
     //   Dom.addClass(this.resize._handles['t'].id,'ea_sw-resize-ie');
     //   Dom.addClass(this.resize._handles['tr'].id,'ea_sw-resize-ie');
         this.resize.on('endResize',function(args){
            var h = args.height;
            var w = args.width;
            this.setToWidth(w+'px');
            this.resizeHeight(h+'px');
            },this, true);        
         
       };
        /*
        * Moving the position of the background handler image (to please IE6)
        * Otherwise in closed position it is not visible because the width of bd(c) is not 0px.
        */
        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'){//target is close window icon
				 DismissNotice(this.noticeid);
                 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();
                 }                       
            }
        };
        
   
        /*
        * Adding empty header body and footer.
        */
        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');
                    //in Opera it doesn't prevent it to browse back/forth
                    //Opera user will have to ctrl shift - arrow
                    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);
                    
                }
            }               
        };

        /**
        * Setup event delegation
        * @method initDOMEventListeners
        */
        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);
            

        };


        /**
        * Add a new text to the Bodycont element and fire a doPublish event 
        * that triggers the handlePublishMessageEvent
        * @method sendMessage
        * @param {string} txt the text/html to be published
        * @param {string} mode, tobe added, whether the window shal open and close or only open
        */
        YAHOO.widget.MessageWindow.prototype.sendMessage = function (txt,mode) {
        	
            //select the innerHTML of bdc and replace it with this new content
            
            this.setBody(txt);
            
            if(mode){
                switch(mode){
                    case 'publish':
                    this.handlePublishMessageEvent('publish');
                    
                    break;
                    case 'open':
                    this.handlePublishMessageEvent('stop');
                    
                    break;
                }
            }else{
                this.handlePublishMessageEvent('publish');
            }
        };
        
        /**
        * @method resizeWidth
        * @see setToWidth
        * @param {string} the new width in pixels
        */
        YAHOO.widget.MessageWindow.prototype.resizeWidth = function (width) {
            
            this.cfg.setProperty("width",width,true);
            //we don't refire width because this set sthe current width of the slider
            // to the handle width (closed slider). Use setToWidth to resize and set to width
            this.cfg.refireEvent("direction");

            this.cfg.refireEvent("headercwidth");
            
            return true;
        };
        
        /**
        * @method setToWidth
        * @see resizeWidth
        * @param {string} the new width in pixels
        */
        YAHOO.widget.MessageWindow.prototype.setToWidth = function (width) {
            
            this.cfg.setProperty("width",width,true);
            //we don't refire width because this set the current width of the slider
            // to the handle width (closed slider).
            Dom.setStyle(this.element,"width",width);            
            this.cfg.refireEvent("direction");
            this.cfg.refireEvent("headercwidth");
            
            this.handlePublishMessageEvent('stop');
            return true;
        };
        
        /**
        * @method resizeHeight
        * @param {string} the new height in pixels
        */
        YAHOO.widget.MessageWindow.prototype.resizeHeight = function (height) {
            
            var iNewHeight = parseInt(height, 10);            

            //property height takes the full height and calculate itself the difference
            this.cfg.setProperty("height",(Number(iNewHeight))+'px');

          //  this.cfg.refireEvent("height");
            
            this.repositionSlider();
            return true;
        };
        
}());