var $j = jQuery.noConflict();


// +------------------------------------------------------------------------+
// | GLOBALS                                                                |
// +------------------------------------------------------------------------+
try {
    GLOBALS.ie6 == GLOBALS.ie7;
}
catch (eExc)
{
    var GLOBALS = {
        ie6: false,
        ie7: false
    };
}



// +------------------------------------------------------------------------+
// | Page                                                                   |
// +------------------------------------------------------------------------+
var Page = {

    /**
     * @var integer
     */
    iScope : 0,

    /**
     * @var element
     */
    eSection : null,

    /**
     * @var float
     */
    fontIndex : 0,
    
    /**
     * @var integer
     */
		zoom : 100,

    /**
     * Initialize website.
     *
     * @return void
     */
    init : function ()
    {
        GLOBALS = Object.extend(GLOBALS,{path: ''});

        // ~~~~~~~~~~~~~~~~
        // Google analytics
        // ~~~~~~~~~~~~~~~~
        //_uacct = "UA-XXXXXX-X";
        //urchinTracker();

        Behaviour.apply();

        try {
        	 lightwindowInit();
        }
        catch (err) {}
    },

    /**
     * Open external links in a new window.
     *
     * @param object _oEvent Fired event
     * @return void
     */
    externalLinks : function (_oEvent)
    {
        _oEvent.preventDefault();
        _oEvent.stopPropagation();

        window.open($j(this).get(0));
    },

    /**
     *
     * @param string _sOperator
     * @return void
     */
    setFontSize : function (_sOperator)
    {
    	  if (_sOperator == '*')
    	  {
    	  	  this.zoom = 100;
    	  }
    	  else
    	  {
    	      if (_sOperator == '+' && this.zoom < 126)
    	      {
    	  	  		this.zoom = this.zoom + 13;
    	  		}
    	  		else if (_sOperator == '-' && this.zoom > 100)
    	  		{
    	  	  		this.zoom = this.zoom - 13;
    	  	  }
    	  }
    	  
    	  //Anpassungen f�r IE
    	  if (navigator.appName == 'Microsoft Internet Explorer') {
    	  	  if (this.zoom == 100)
    	  	  {
    	  	  	  $j('.sidebar').css('width', '23.3em');
    	  	  	  $j('.noLefthand .sidebar').css('width', '29em');
    	  	  	  $j('.lefthand').css('width', '23.2em');
    	  	  }
    	  	  else
    	  	 	{
    	  	 		  $j('.sidebar').css('width', '23.2em');
    	  	 		  $j('.noLefthand .sidebar').css('width', '28.9em');
    	  	 		  $j('.lefthand').css('width', '23.1em');
    	  	 	}
    	  }
    	  
    	  $j('body').css('font-size', this.zoom + '%');
    }
};


// +------------------------------------------------------------------------+
// | PageNavigation                                                         |
// +------------------------------------------------------------------------+
var PageNav = {
       
        /**
         * Array containing pages
         * 
         * @var array
         */
        pages : null,
    
    
        /**
         * Switch to the next page
         *
         * @return void
         */
        next : function ()
        {
          // ~~~~~~~~~~~~~
          // Get all pages
          // ~~~~~~~~~~~~~
          if (this.pages == null)
            this.pages = $j('.pages > div');

            
          // ~~~~~~~~~~~~~~~~~~~~~~~~~
          // Get and hide current page
          // ~~~~~~~~~~~~~~~~~~~~~~~~~
          var iIndex  = 0;
          var iNext   = 0;
          var iLength = this.pages.length;
          var iLimit  = iLength;
            
          while (iLength--)
          {
            var oPage = $j(this.pages[iIndex++]);
            
            if (!oPage.hasClass("hidden"))
            {            
              // Save current page number
              if (iIndex < iLimit)
                iNext = iIndex;
              
              oPage.addClass("hidden");
            }
          }
          
                             
          // ~~~~~~~~~~~~~~
          // Show next page
          // ~~~~~~~~~~~~~~
          $j(this.pages[iNext]).removeClass("hidden");
        },
        
        
        /**
         * Switch to the previous page
         *
         * @return void
         */
        prev : function ()
        {
          // ~~~~~~~~~~~~~
          // Get all pages
          // ~~~~~~~~~~~~~
          if (this.pages == null)
            this.pages = $j('.pages > div');

            
          // ~~~~~~~~~~~~~~~~~~~~~~~~~
          // Get and hide current page
          // ~~~~~~~~~~~~~~~~~~~~~~~~~
          var iIndex  = 0;
          var iLength = this.pages.length;
          var iLimit  = iLength;
          var iPrev   = iLimit - 1;
            
          while (iLength--)
          {
            var oPage = $j(this.pages[iIndex]);
            
            if (!oPage.hasClass("hidden"))
            {            
              // Save current page number
              if ((iIndex - 1) >= 0)
                iPrev = (iIndex - 1);
              
              oPage.addClass("hidden");
            }
            
            iIndex++;
          }
          
                             
          // ~~~~~~~~~~~~~~~~~~
          // Show previous page
          // ~~~~~~~~~~~~~~~~~~
          $j(this.pages[iPrev]).removeClass("hidden");
        },
        
        
        /**
         * Switch to the given page number
         *
         * @param  integer _iPage
         * @return void
         */
        _switch : function (_iPage)
        {
          // ~~~~~~~~~~~~~
          // Get all pages
          // ~~~~~~~~~~~~~
          if (this.pages == null)
            this.pages = $j('.pages > div');

            
          // ~~~~~~~~~~~~~~~~~
          // Hide current page
          // ~~~~~~~~~~~~~~~~~
          $j('.pages > div:not(.hidden)').addClass("hidden");
                            
                            
          // ~~~~~~~~~~~~~~~
          // Show given page
          // ~~~~~~~~~~~~~~~
          $j(this.pages[_iPage]).removeClass("hidden");
        }
        
}


// +------------------------------------------------------------------------+
// | LinkList                                                               |
// +------------------------------------------------------------------------+
var LinkList = Class.create(
    {
        /**
         * Animated link list identifier.
         *
         * @var string
         */
        identifier : '',

        /**
         * Number of items in animated link list.
         *
         * @var integer
         */
        size : 0,

        /**
         * Index of currently highlighted animated link list item.
         *
         * @var integer
         */
        index : 0,

        /**
         * Content list.
         *
         * @var element
         */
        content : null,

        /**
         * Menu list.
         *
         * @var element
         */
        menu : null,

        /**
         * Link list animation timeout.
         *
         * @var element
         */
        timeout : null,

        /**
         * Initialize animted link list.
         *
         * @param object _oList
         * @return void
         */
        initialize : function (_oList)
        {
            this.identifier = _oList.attr('id');

            this.buildMenu(_oList.find('dt'));

            var oList = _oList.parent(),
                fHeight = (33 * this.size - 2);

            if (GLOBALS.ie6 || GLOBALS.ie7)
                fHeight -= this.size - 1;

            fHeight /= 10;

            oList.attr('rel', this.identifier);

            this.buildContent(_oList.find('dd'), (fHeight - 1.4));

            oList.css('height', (fHeight+0.2)+'em');
            this.content.css('height', fHeight+'em');

            oList.bind('mouseover', LinkListEvent.pause);
            oList.bind('mouseout', LinkListEvent.continueLoop);

            this.highlight(this.index);

            _oList.remove();

            oList.append(this.content);
            oList.append(this.menu);

            this.setTimeout();
        },

        /**
         * Transform link elements to link list menu.
         *
         * @param object _oList
         * @return void
         */
        buildMenu : function (_oList)
        {
            this.size = _oList.length;
            this.menu = $j('<ul>');
            this.menu.attr('class', 'links');

            var iLength = this.size,
                iIndex = 0;

            while (iLength--)
            {
                var oElement = $j(_oList.get(iIndex++)),
                    oItem = $j('<li>');

                oItem.html(oElement.html());

                var oLink = $j(oItem.find('a').get(0));
                oLink.attr('rel', this.identifier+ '[' +(iIndex-1)+ ']');
                oLink.bind('mouseover', LinkListEvent.focus);

                this.menu.append(oItem);
            }
        },

        /**
         * Transform text elements to list contents.
         *
         * @param object _oList
         * @param float _fHeight
         * @return void
         */
        buildContent : function (_oList, _fHeight)
        {
            this.content = $j('<ul>');
            this.content.attr('class', 'text');

            var iLength = _oList.length,
                iIndex = 0;

            while (iLength--)
            {
                var oElement = $j(_oList.get(iIndex++)),
                    oItem = $j('<li>');

                oItem.html(oElement.html());
                oItem.addClass(oElement.attr('class'));
                oItem.addClass('hidden');
                oItem.css('height', _fHeight+'em');

                this.content.append(oItem);
            }
        },

        /**
         * Highlight list item by given index.
         *
         * @param integer _iIndex
         * @return element
         */
        highlight : function (_iIndex)
        {
            this.index = _iIndex;

            var oMenu = this.menu.find('a'),
                oContent = this.content.find('li'),
                iLength = this.size,
                iIndex = 0;

            while (iLength--)
            {
                if (_iIndex == iIndex)
                {
                    $j(oMenu.get(iIndex)).addClass('active');
                    $j(oContent.get(iIndex)).removeClass('hidden');
                }
                else
                {
                    $j(oMenu.get(iIndex)).removeClass('active');
                    $j(oContent.get(iIndex)).addClass('hidden');
                }

                iIndex++;
            }
        },

        /**
         * Highlight next list item.
         *
         * @return element
         */
        highlightNext : function ()
        {
            this.index++;

            if (this.index >= this.size)
                this.index = 0;

            this.highlight(this.index);

            this.setTimeout();
        },

        /**
         * Set animation timeout
         *
         * @return void
         */
        setTimeout : function ()
        {
            this.timeout = window.setTimeout(
                "LinkListFactory.highlightNext('" +this.identifier+ "')",
                4000
            );
        }
    }
);

var LinkListFactory = {

    /**
     * Array of registered LinkLists
     *
     * @var LinkList[]
     */
    instance : {},

    /**
     * Register LinkList.
     *
     * @param object _oList
     * @return void
     */
    register : function (_oList)
    {
        LinkListFactory.instance[_oList.attr('id')] = new LinkList(_oList);
    },

    /**
     * Get registered LinkList by identifier.
     *
     * @param string _sIdentifier
     * @return LinkList|false
     */
    getList : function (_sIdentifier)
    {
        try
        {
            return LinkListFactory.instance[_sIdentifier];
        }
        catch (eExc) {}

        return false;
    },

    /**
     * Highlight next item of given link list.
     *
     * @param string _sIdentifier
     * @return void
     */
    highlightNext : function (_sIdentifier)
    {
        this.instance[_sIdentifier].highlightNext()
    }
};

var LinkListEvent = {

    /**
     * Register LinkList.
     *
     * @param object _oEvent
     * @return void
     */
    focus : function (_oEvent)
    {
        var eTarget = Event.findElement(_oEvent, 'a')
            sIdentifier = eTarget.getAttribute('rel');

        if (!sIdentifier.match(/^([a-z]+[0-9]+)\[([0-9])\]$/i))
            return;

        var oList = LinkListFactory.getList(RegExp.$1);

        if (false == oList)
            return;

        oList.highlight(RegExp.$2);
    },

    /**
     * Pause LinkList animation.
     *
     * @param object _oEvent
     * @return void
     */
    pause : function (_oEvent)
    {
        var eTarget = Event.findElement(_oEvent, 'div')
            sIdentifier = eTarget.getAttribute('rel');

        window.clearTimeout(LinkListFactory.instance[sIdentifier].timeout);
    },

    /**
     * Continue LinkList animation.
     *
     * @param object _oEvent
     * @return void
     */
    continueLoop : function (_oEvent)
    {
        var eTarget = Event.findElement(_oEvent, 'div')
            sIdentifier = eTarget.getAttribute('rel');

        LinkListFactory.instance[sIdentifier].setTimeout();
    }
};



// +------------------------------------------------------------------------+
// | ImageMap                                                               |
// +------------------------------------------------------------------------+
var ImageMap = Class.create(
    {
        /**
         * Animated link list identifier.
         *
         * @var string
         */
        identifier : '',

        /**
         * Number of items in animated link list.
         *
         * @var integer
         */
        size : 0,

        /**
         * ImageMap items.
         *
         * @var object
         */
        item : 0,

        /**
         * Index of currently highlighted animated link list item.
         *
         * @var integer
         */
        index : 0,

        /**
         * Link list animation timeout.
         *
         * @var element
         */
        timeout : null,

        /**
         * Initialize animted link list.
         *
         * @param object _oList
         * @return void
         */
        initialize : function (_oList)
        {
            this.identifier = _oList.attr('id');
            this.item = _oList.find('div.box');
            this.size = this.item.length;

            if (this.size == 1)
                return;

            var iLength = this.size,
                iIndex = 0;

            while (iLength--)
            {
                var oItem = $j(this.item.get(iIndex++));

                oItem.attr('rel', this.identifier);

                if (iIndex > 1)
                    oItem.addClass('hidden');
            }

            this.item.bind('mouseover', ImageMapEvent.pause);
            this.item.bind('mouseout', ImageMapEvent.continueLoop);
            this.setTimeout();
        },

        /**
         * Highlight list item by given index.
         *
         * @param integer _iIndex
         * @return element
         */
        showItem : function (_iIndex)
        {
            this.index = _iIndex;

            var iLength = this.size,
                iIndex = 0;

            while (iLength--)
            {
                if (_iIndex == iIndex)
                    $j(this.item.get(iIndex)).removeClass('hidden');
                else
                    $j(this.item.get(iIndex)).addClass('hidden');

                iIndex++;
            }
        },

        /**
         * Highlight next list item.
         *
         * @return element
         */
        nextItem : function ()
        {
            this.index++;

            if (this.index >= this.size)
                this.index = 0;

            this.showItem(this.index);

            this.setTimeout();
        },

        /**
         * Set animation timeout
         *
         * @return void
         */
        setTimeout : function ()
        {
            this.timeout = window.setTimeout(
                "ImageMapFactory.nextItem('" +this.identifier+ "')",
                4000
            );
        }
    }
);

var ImageMapFactory = {

    /**
     * Array of registered ImageMaps
     *
     * @var ImageMap[]
     */
    instance : {},

    /**
     * Register ImageMap.
     *
     * @param object _oList
     * @return void
     */
    register : function (_oList)
    {
        ImageMapFactory.instance[_oList.attr('id')] = new ImageMap(_oList);
    },

    /**
     * Get registered ImageMap by identifier.
     *
     * @param string _sIdentifier
     * @return ImageMap|boolean
     */
    getList : function (_sIdentifier)
    {
        try
        {
            return ImageMapFactory.instance[_sIdentifier];
        }
        catch (eExc) {}

        return false;
    },

    /**
     * Highlight next item of given ImageMap.
     *
     * @param string _sIdentifier
     * @return void
     */
    nextItem : function (_sIdentifier)
    {
        this.instance[_sIdentifier].nextItem()
    }
};

var ImageMapEvent = {

    /**
     * Register ImageMap.
     *
     * @param object _oEvent
     * @return void
     */
    focus : function (_oEvent)
    {
        var eTarget = Event.findElement(_oEvent, 'a')
            sIdentifier = eTarget.getAttribute('rel');

        if (!sIdentifier.match(/^([a-z]+[0-9]+)\[([0-9])\]$/i))
            return;

        var oList = ImageMapFactory.getList(RegExp.$1);

        if (false == oList)
            return;

        oList.nextItem(RegExp.$2);
    },

    /**
     * Pause ImageMap animation.
     *
     * @param object _oEvent
     * @return void
     */
    pause : function (_oEvent)
    {
        var eTarget = Event.findElement(_oEvent, 'div')
            sIdentifier = eTarget.getAttribute('rel');

        window.clearTimeout(ImageMapFactory.instance[sIdentifier].timeout);
    },

    /**
     * Continue ImageMap animation.
     *
     * @param object _oEvent
     * @return void
     */
    continueLoop : function (_oEvent)
    {
        var eTarget = Event.findElement(_oEvent, 'div')
            sIdentifier = eTarget.getAttribute('rel');

        ImageMapFactory.instance[sIdentifier].setTimeout();
    }
};



// +------------------------------------------------------------------------+
// | OnlineCatalogue                                                        |
// +------------------------------------------------------------------------+
var OnlineCatalogue = {

    /**
     * Initialize online catalogue.
     *
     * @param object _oElement
     * @return void
     */
    init : function (_oCatalogue)
    {
        var oSpacer = _oCatalogue.find('div.spacer'),
            oTeaser = _oCatalogue.find('div.teaserList'),
            oList = $j(oTeaser.find('ul').get(0));

        oTeaser.attr('id', 'catalogueItems');
        TeaserSliderFactory.register(oTeaser);

        oSpacer.removeClass('hidden');

        var iHeight = parseInt($j(oTeaser.find('li').get(0)).css('height'));

        oList.css(
            {
                height: (iHeight / 10)+'em',
                overflow: 'hidden'
            }
        );

        var sLeft = '<a href="javascript:void(0);" class="backward">'
                  + '<img src="' +GLOBALS.path+ '/media/resources/gfx/arrow/leftScrollGrey.gif" />'
                  + '<img src="' +GLOBALS.path+ '/media/resources/gfx/arrow/leftScrollGrey.gif" />'
                  + '</a>';

        var sRight = '<a href="javascript:void(0);" class="forward">'
                   + '<img src="' +GLOBALS.path+ '/media/resources/gfx/arrow/rightScrollGrey.gif" />'
                   + '<img src="' +GLOBALS.path+ '/media/resources/gfx/arrow/rightScrollGrey.gif" />'
                   + '</a>';

        //oList.append($j(sLeft));
        //oList.append($j(sRight));
    }
};



// +------------------------------------------------------------------------+
// | Slider                                                                  |
// +------------------------------------------------------------------------+
var TeaserSlider = Class.create(
    {
        /**
         * Register TeaserSlider
         *
         * @param object _oTeaser
         * @return void
         */
        initialize : function (_oTeaser)
        {
            var oList = _oTeaser.find('li'),
                iLength = oList.length - 1,
                iIndex = 0;

            if (iLength <= 0)
                return;

            while (iLength--)
            {
                var oItem = $j(oList.get(iIndex++));

                oItem.css('float', 'none');
            }

            $j(oList.get(iIndex)).remove();
        }
    }
);

var TeaserSliderFactory = {

    /**
     * Array of registered TeaserSlider
     *
     * @var TeaserSlider[]
     */
    instance : {},

    /**
     * Register LinkList.
     *
     * @param element _eList
     * @return void
     */
    register : function (_eList)
    {
        TeaserSliderFactory.instance[_eList.id] = new TeaserSlider(_eList);
    },

    /**
     * Get registered TeaserSlider by identifier.
     *
     * @param string _sIdentifier
     * @return TeaserSlider|false
     */
    getSlider : function (_sIdentifier)
    {
        try
        {
            return TeaserSliderFactory.instance[_sIdentifier];
        }
        catch (eExc) {}

        return false;
    }
};



// +------------------------------------------------------------------------+
// | Product                                                                |
// +------------------------------------------------------------------------+
var Product = {

    /** 
     *
     * @var object
     */
    dialog : null,

    /**
     *
     *
     */
    createInfoBox : function ()
    {
        Product.dialog = $j('<div id="prodInfo"></div>');

        $j('body').append(Product.dialog);
    },

    /**
     *
     *
     */
    showInfoBox : function (_oEvent)
    {
        _oEvent.preventDefault();
        _oEvent.stopPropagation();
        
        var oTarget = $j(this);

        var oProperty = {
            top: ((oTarget.offset().top + oTarget.height())/10 + 'em'),
            left:((oTarget.offset().left / 10 - 0.1) + 'em'),
            display: 'block'
        };

        Product.dialog.html('<p>' +oTarget.attr('rel')+ '</p>')
                      .css(oProperty);

        $j(document).one('mouseout', Product.hideInfoBox);
    },

    /**
     *
     *
     */
    hideInfoBox : function (_oEvent)
    {
        if (Product.dialog.css('display') == 'block')
            Product.dialog.css('display', 'none');
    }
};


/// +------------------------------------------------------------------------+
// | PriceSAP                                                               |
// +------------------------------------------------------------------------+
var PriceSAP = {
    getPrices : function ()
    {
        if (jQuery.browser.msie) {
            nodes = this.parentNode.previousSibling.getElementsByTagName("tr");
        }
	else{
	    nodes = this.parentNode.previousSibling.previousSibling.getElementsByTagName("tr");
	}
	var art = '';
	
	for (var i = 2; i < nodes.length ; i++)
	{
  	    art = art + nodes[i].getElementsByTagName("td")[0].getElementsByTagName("input")[1].value;
	    if (i+1 < nodes.length)
	    {
		art = art + ","
	    }
	}
	
	$j.ajax({
	    type: "GET",
  	    url: '/media/php/action/shop/ajaxprice.php?art=' + art,
	    dataType: 'html',
	    global: 'false',
	    success: function(html){
		$j("#ajaxpricebox").html(html);
		pos = $j(document).scrollTop() - $j("#ajaxpricebox").height() + 500;
		$j("#ajaxpricebox").attr("style", "top:"+ pos +"px;");
		$j("#ajaxpricebox").show();
	    }
	});
    }
		
};

// +------------------------------------------------------------------------+
// | RuleSet                                                                |
// +------------------------------------------------------------------------+
var RuleSet = {

    /**
     * Grab all link with class ext to be opened in a new window.
     *
     * @param object _oList
     * @return void
     */
    'a.ext' : function (_oList)
    {
        _oList.bind(
            'click',
            Page.externalLinks
        );
    },


    /**
     * Grab all link with class ajaxprice.
     *
     * @param object _oList
     * @return void
     */
    'button.ajaxprice' : function (_oList)
    {
         _oList.bind(
             'click',
             PriceSAP.getPrices
         );
    },
    
    'div#ajaxpricebox' : function (_oList)
    {
        _oList.bind(
            'click',
            function (_oEvent)
            {
                $j("#ajaxpricebox").hide();
            }
        );
    },

    /**
     * Grab all input field with wildcards.
     *
     * @param object _oList
     * @return void
     */
    'input.wildcard' : function (_oList)
    {
        if (!_oList.length)
            return;

        _oList.bind(
            'focus',
            function (_oEvent)
            {
                var oTarget = $j(this),
                    aInput = new Array(),
                    iLength,
                    iIndex;

                aInput.push(oTarget);

                if (oTarget.attr('class').match(/rel\[([a-z0-9,_-]+)\]$/i))
                {
                    var aIdentifier = RegExp.$1.split(',');
                    iLength = aIdentifier.length;
                    iIndex = 0;

                    while (iLength--)
                        aInput.push($j('#'+aIdentifier[iIndex++]));
                }

                iLength = aInput.length;
                iIndex = 0;

                while (iLength--)
                    aInput[iIndex++].attr('value', '');
            }
        );
    },

    /**
     * Grab all animted link list elements and initialize them.
     *
     * @param object _oList
     * @return void
     */
    'dl.linkList' : function (_oList)
    {
        var iLength = _oList.length,
            iIndex = 0;

        while (iLength--)
            LinkListFactory.register($j(_oList.get(iIndex++)));
    },

    /**
     * Grab all animted image maps initialize them.
     *
     * @param object _oList
     * @return void
     */
    'div.imageMap' : function (_oList)
    {
        var iLength = _oList.length,
            iIndex = 0;

        while (iLength--)
            ImageMapFactory.register($j(_oList.get(iIndex++)));
    },

    /**
     * Grab all dropdowns that aim to redirect to another page.
     *
     * @param object _oList
     * @return void
     */
    'select.redirect' : function (_oList)
    {
        if (!_oList.length)
            return;

        _oList.bind(
            'change',
            function (_oEvent)
            {
/* rather handle it the same way as without js (i.e. submit the form)
                _oEvent.preventDefault();
                _oEvent.stopPropagation();

                document.location.href = GLOBALS.path + $j(this).val();
*/
							$j(this).parents('form').submit();
            }
        );
    },

    /**
     * Grab all animted link list elements and initialize them.
     *
     * @param object _oElement
     * @return void
     */
    '#onlineCatalogue' : function (_oElement)
    {
        if (!_oElement.length)
            return;

        OnlineCatalogue.init(_oElement);
    },

    /**
     * Apply onchange handler on quicknavigation.
     *
     * @param object _oElement
     * @return void
     */
    '#quickNavigation select' : function (_oList)
    {
        if (!_oList.length)
            return;

        _oList.bind(
            'change',
            function (_oEvent)
            {
                $j('#quickNavigation').get(0).submit();
            }
        );
    },
    
    '#productNaviList select' : function (_oList)
    {
        if (!_oList.length)
            return;

        _oList.bind(
            'change',
            function (_oEvent)
            {
                $j('#productNaviList').get(0).submit();
            }
        );
    },

    '.quicknavigation' : function (_oList)
    {
        if (!_oList.length)
            return;

        var oSelect = _oList.find('select');

        oSelect.bind(
            'change',
            function (_oEvent)
            {
                var oTarget = $j(this);

                do
                {
                    oTarget = oTarget.parent();
                }
                while (oTarget.get(0).nodeName.toLowerCase() != 'form');

                oTarget.submit();
            }
        );
    },

    /**
     * Apply onclick handler on "info-button" in Product-List
     *
     * @param object _oList
     * @return void
     */
    'li.info a' : function (_oList)
    {
        if (!_oList.length)
            return;

        Product.createInfoBox();

        _oList.attr('rel', _oList.attr('title'))
              .attr('title', '')
              .bind('mouseover', Product.showInfoBox);
    },
    /**
            * If the quantity is changed, check the according checkbox
            *
            * @param object _oList
            * @return void
            */
    'td.quantity input' : function (_oList)
    {
        if(!_oList.length)
            return;
        
        _oList.bind(
            'change',
            function (_oEvent)
            {
                oTarget = $j(this);
                oCheckbox = oTarget.parent().parent().find('td.checkbox').find('input');
                oCheckbox.attr('checked','checked');
                
                $j('td.selected select').find('option').each(
                    function() {
                        if ($j(this).attr('value') == 'update')
                            $j(this).attr('selected','selected');
                        else
                            $j(this).attr('selected','');
                    }
                );
            }
        );
    },
    
    '#fieldsetVia input' : function (_oList)
    {
        if(!_oList.length)
            return;
        
        _oList.bind(
            'click',
            function (_oEvent)
            {
                $j('#fieldsetVia input:checked').each ( function () {
                  if ($j(this).val() == 'form')
                    $j('#fieldsetInfos').show();
                  else
                    $j('#fieldsetInfos').hide();
                });
                
            }
        );
    },
    
    '#dEquals' : function (_oList)
    {
        if(!_oList.length)
            return;
            
        _oList.bind(
            'click',
            function (_oEvent)
            {
                $j('fieldset.deliveryAddress').toggle();
            }
        );
    }
};

Behaviour.register(RuleSet);



// +------------------------------------------------------------------------+
// | Page initialization                                                    |
// +------------------------------------------------------------------------+
$j(document).ready(Page.init);