function reloadCaptcha() {
    // loads new freeCap image
    if (document.getElementById) {
        // extract image name from image source (i.e. cut off ?randomness)
        var theImage = document.getElementById("tx_srfreecap_pi2_captcha_image");
        var parts = theImage.src.split("&");
        // add ?(random) to prevent browser/isp caching
        // parts[0] should be id=page_id
        // parts[1] should be L=sys_language_uid
        theImage.src = parts[0] + "&" + parts[1] + "&set=" + Math.round(Math.random() * 100000);
    } else {
        alert("Sorry, cannot autoreload new image\nSubmit the form and a new image will be loaded");
    }
}

///**
//* @author alexander.farkas
//* @version 1.4.1
//*/
//(function ($) {
//    var baseClasses = /ui-checkbox|ui-radio/;
//    $.widget('ui.checkBox', {
//        options: {
//            hideInput: true,
//            addVisualElement: true,
//            addLabel: true,
//            _delegated: false
//        },
//        _create: function () {
//            var that = this,
//                opts = this.options
//            ;

//            if (!this.element.is(':radio,:checkbox')) {
//                if ($.nodeName(this.element[0], 'input')) { return false; }
//                this._addDelegate();
//                this.updateContainer();
//                return false;
//            }
//            this.labels = $([]);

//            this.checkedStatus = false;
//            this.disabledStatus = false;
//            this.hoverStatus = false;

//            this.radio = (this.element.is(':radio'));

//            this.visualElement = $([]);
//            if (opts.hideInput) {
//                this.element
//                    .addClass('ui-helper-hidden-accessible')
//                ;
//                if (opts.addVisualElement) {
//                    this.visualElement = $('<span />')
//                        .addClass(this.radio ? 'ui-radio' : 'ui-checkbox')
//                    ;
//                    this.element.after(this.visualElement[0]);
//                }
//            }

//            if (opts.addLabel) {
//                this.labels = $('label[for=' + this.element.attr('id') + ']')
//                    .addClass(this.radio ? 'ui-radio' : 'ui-checkbox')
//                ;
//            }
//            if (!opts._delegated) {
//                this._addEvents();
//            }
//            this.initialized = true;
//            this.reflectUI({ type: 'initialReflect' });
//            return undefined;
//        },
//        updateContainer: function () {
//            if (!this.element.is(':radio,:checkbox') && !$.nodeName(this.element[0], 'input')) {
//                $('input', this.element[0])
//                    .filter(function () {
//                        return !($.data(this, 'checkBox'));
//                    })
//                    .checkBox($.extend({}, this.options, { _delegated: true }))
//                ;
//            }
//        },
//        _addDelegate: function () {
//            var opts = this.options,

//                toggleHover = function (e, that) {
//                    if (!that) { return; }
//                    that.hover = !!(e.type == 'focus' || e.type == 'mouseenter' || e.type == 'focusin' || e.type == 'mouseover');
//                    that._changeStateClassChain.call(that);
//                    return undefined;
//                }
//            ;


//            this.element
//                .bind('click', function (e) {
//                    if (!$.nodeName(e.target, 'input')) { return; }
//                    var inst = ($.data(e.target) || {}).checkBox;
//                    if (!inst) { return; }
//                    inst.reflectUI.call(inst, e.target, e);
//                })
//                .bind('focusin.checkBox focusout.checkBox', function (e) {
//                    if (!$.nodeName(e.target, 'input')) { return; }
//                    var inst = ($.data(e.target) || {}).checkBox;
//                    toggleHover(e, inst);
//                })
//            ;

//            if (opts.hideInput) {
//                this.element
//                    .bind('usermode', function (e) {
//                        if (!e.enabled) { return; }
//                        $('input', this).each(function () {
//                            var inst = ($.data(this) || {}).checkBox;
//                            (inst && inst.destroy.call(inst, true));
//                        });
//                    })
//                ;
//            }

//            if (opts.addVisualElement) {
//                this.element
//                    .bind('mouseover.checkBox mouseout.checkBox', function (e) {
//                        if (!$.nodeName(e.target, 'span')) { return; }
//                        var inst = ($.data($(e.target).prev()[0]) || {}).checkBox;
//                        toggleHover(e, inst);
//                    })
//                    .bind('click.checkBox', function (e) {
//                        if (!$.nodeName(e.target, 'span') || !baseClasses.test(e.target.className || '')) { return; }
//                        $(e.target).prev()[0].click();
//                        return false;
//                    })
//                ;
//            }
//            if (opts.addLabel) {
//                this.element
//                    .delegate('label.ui-radio, label.ui-checkbox', 'mouseenter.checkBox mouseleave.checkBox', function (e) {
//                        var inst = ($.data(document.getElementById($(this).attr('for'))) || {}).checkBox;
//                        toggleHover(e, inst);
//                    });
//            }

//        },
//        _addEvents: function () {
//            var that = this,

//                opts = this.options,

//                toggleHover = function (e) {
//                    if (that.disabledStatus) {
//                        return false;
//                    }
//                    that.hover = (e.type == 'focus' || e.type == 'mouseenter');
//                    that._changeStateClassChain();
//                    return undefined;
//                }
//            ;

//            this.element
//                .bind('click.checkBox', $.proxy(this, 'reflectUI'))
//                .bind('focus.checkBox blur.checkBox', toggleHover)
//            ;
//            if (opts.hideInput) {
//                this.element
//                    .bind('usermode', function (e) {
//                        (e.enabled &&
//                            that.destroy.call(that, true));
//                    })
//                ;
//            }
//            if (opts.addVisualElement) {
//                this.visualElement
//                        .bind('mouseenter.checkBox mouseleave.checkBox', toggleHover)
//                        .bind('click.checkBox', function (e) {
//                            that.element[0].click();
//                            return false;
//                        })
//                    ;
//            }
//            if (opts.addLabel) {
//                this.labels.bind('mouseenter.checkBox mouseleave.checkBox', toggleHover);
//            }
//        },
//        _changeStateClassChain: function () {
//            var allElements = this.labels.add(this.visualElement),
//                stateClass = '',
//                baseClass = 'ui-' + ((this.radio) ? 'radio' : 'checkbox')
//            ;

//            if (this.checkedStatus) {
//                stateClass += '-checked';
//                allElements.addClass(baseClass + '-checked');
//            } else {
//                allElements.removeClass(baseClass + '-checked');
//            }

//            if (this.disabledStatus) {
//                stateClass += '-disabled';
//                allElements.addClass(baseClass + '-disabled');
//            } else {
//                allElements.removeClass(baseClass + '-disabled');
//            }
//            if (this.hover) {
//                stateClass += '-hover';
//                allElements.addClass(baseClass + '-hover');
//            } else {
//                allElements.removeClass(baseClass + '-hover');
//            }

//            baseClass += '-state';
//            if (stateClass) {
//                stateClass = baseClass + stateClass;
//            }

//            function switchStateClass() {
//                var classes = this.className.split(' '),
//                    found = false;
//                $.each(classes, function (i, classN) {
//                    if (classN.indexOf(baseClass) === 0) {
//                        found = true;
//                        classes[i] = stateClass;
//                        return false;
//                    }
//                    return undefined;
//                });
//                if (!found) {
//                    classes.push(stateClass);
//                }
//                this.className = classes.join(' ');
//            }

//            this.labels.each(switchStateClass);
//            this.visualElement.each(switchStateClass);
//        },
//        destroy: function (onlyCss) {
//            this.element.removeClass('ui-helper-hidden-accessible');
//            this.visualElement.addClass('ui-helper-hidden');
//            if (!onlyCss) {
//                var o = this.options;
//                this.element.unbind('.checkBox');
//                this.visualElement.remove();
//                this.labels
//                    .unbind('.checkBox')
//                    .removeClass('ui-state-hover ui-state-checked ui-state-disabled')
//                ;
//            }
//        },

//        disable: function () {
//            this.element[0].disabled = true;
//            this.reflectUI({ type: 'manuallyDisabled' });
//        },

//        enable: function () {
//            this.element[0].disabled = false;
//            this.reflectUI({ type: 'manuallyenabled' });
//        },

//        toggle: function (e) {
//            this.changeCheckStatus((this.element.is(':checked')) ? false : true, e);
//        },

//        changeCheckStatus: function (status, e) {
//            if (e && e.type == 'click' && this.element[0].disabled) {
//                return false;
//            }
//            this.element.attr({ 'checked': status });
//            this.reflectUI(e || {
//                type: 'changeCheckStatus'
//            });
//            return undefined;
//        },

//        propagate: function (n, e, _noGroupReflect) {
//            if (!e || e.type != 'initialReflect') {
//                if (this.radio && !_noGroupReflect) {
//                    //dynamic
//                    $(document.getElementsByName(this.element.attr('name')))
//                        .checkBox('reflectUI', e, true);
//                }
//                return this._trigger(n, e, {
//                    options: this.options,
//                    checked: this.checkedStatus,
//                    labels: this.labels,
//                    disabled: this.disabledStatus
//                });
//            }
//            return undefined;
//        },

//        reflectUI: function (e) {

//            var oldChecked = this.checkedStatus,
//                oldDisabledStatus = this.disabledStatus
//            ;

//            this.disabledStatus = this.element.is(':disabled');
//            this.checkedStatus = this.element.is(':checked');

//            if (this.disabledStatus != oldDisabledStatus || this.checkedStatus !== oldChecked) {
//                this._changeStateClassChain();

//                (this.disabledStatus != oldDisabledStatus &&
//                    this.propagate('disabledChange', e));

//                (this.checkedStatus !== oldChecked &&
//                    this.propagate('change', e));
//            }

//        }
//    });
//})(jQuery);

function Cufonize() {
    Cufon.set('fontFamily', 'HelveticaNeueLight');
    Cufon.replace('.teaser-content.solid h2,.teaser-content.transparent h2, .gewinnspiel-teaserset-text h2, .text-teaser-professionals strong, .institute-finder-selectors h2, .header-v12 h2, #right-col h2, #mainNavi > ul > li > a, .centerpage-header h2, .doctor-babor-centerpage-header h2, .doctor-babor-sub-header h3, .doctor-babor-sub-header h2, .beratung-centerpage-header h2, .default-header h2, .slider-header h2, .products-overview-sub-header .teaser-content h2, .dates-container h2 span, .teaserset-item h2, .teaserset-item h2, .teaserlist h3');
}

Cufonize();

function resizeBG() {
    img = jQuery('#backgroundImage');

    var vm = jQuery(window).width() / jQuery(window).height();
    var im = jQuery('#backgroundImage').width() / jQuery('#backgroundImage').height();

    if (vm > im) {
        jQuery('#backgroundImage').css('width', '100%');
        jQuery('#backgroundImage').css('height', 'auto');
    }
    if (vm < im) {
        jQuery('#backgroundImage').css('width', 'auto');
        jQuery('#backgroundImage').css('height', '100%');
    }
}

function addslashes(str) {
    str = str.replace(/\\/g, '\\\\');
    str = str.replace(/\'/g, '\\\'');
    str = str.replace(/\"/g, '\\"');
    str = str.replace(/\0/g, '\\0');
    return str;
}




//(function (jQuery) {

//    jQuery.fn.replaceSelect = function (fn) {
//        jQuery(this).each(function (index, el) {
//            var self = this;
//            this.element = jQuery(el);
//            this.callback = fn || jQuery.noop;
//            this.prepare = function () {
//                var opt = this.element.find('option');
//                var inp = '<div class="select-container">';
//                // aw
//                inp += '<input type="hidden" name="' + this.element.attr('name') + '" value="' + this.element.val() + '" />';
//                inp += '<div class="dropdown-container clearfix">';
//                inp += '<div class="dropdown-select">';
//                inp += '<a class="selector" href="#">' + opt.filter(':selected').text() + '</a>';
//                inp += '</div>';
//                inp += '<ul class="dropdown-options hide">';
//                opt.each(function (i, o) {
//                    var c = '';
//                    if (i == 0) c += ' first';
//                    if (i == opt.length - 1) c += ' last';
//                    inp += '<li class="' + c + '"><a href="javascript: void(0);" rel="' + jQuery(o).val() + '">' + jQuery(o).text() + '&#160;</a></li>';
//                });
//                inp += '</ul>';
//                inp += '</div>';
//                inp += '</div>';
//                return jQuery(inp);
//            }
//            this.element = this.prepare().replaceAll(this.element).dropdown();
//            this.element.find('li a').click(function () {
//                self.element.find('input:hidden').val(jQuery(this).attr('rel'));
//                //eval(onch); // aw
//                self.element.find('a.selector').text(jQuery(this).text());
//                jQuery(this).parents('.dropdown-options').hide();

//                self.callback(self);
//            });
//        });
//    }



//    // !jQuery.fn.dropdown
//    jQuery.fn.dropdown = function (opts) {
//        jQuery(this).each(function (index, el) {
//            var self = this;
//            this.timeout = false;
//            this.element = jQuery(el);
//            this.options = jQuery.extend({
//                'select': '.dropdown-select .selector',
//                'options': '.dropdown-options',
//                'timeout': 1250,
//                'duration': 250
//            }, opts || {});

//            this.element.find(this.options.select).click(function (ev) {
//                ev.preventDefault();
//                self.element.find(self.options.options).toggle();
//            });

//            // aw 11.10.
//            /*
//            this.element.find(this.options.select).mouseleave(function(ev2){
//            ev2.preventDefault();
//            self.timeout = window.setTimeout(function() {
//            self.element.find(self.options.options).fadeOut(self.options.duration);
//            }, self.options.timeout);           
//            });
//            */
//            // /

//            // aw 19.10.
//            this.element.find(this.options.select).hover(
//                function () {
//                    if (self.timeout)
//                        window.clearTimeout(self.timeout);
//                },
//                function () {
//                    self.timeout = window.setTimeout(function () {
//                        self.element.find(self.options.options).fadeOut(self.options.duration);
//                    }, self.options.timeout);
//                }
//            );
//            // /            

//            this.element.find(this.options.options).hover(
//                function () {
//                    if (self.timeout)
//                        window.clearTimeout(self.timeout);
//                },
//                function () {
//                    self.timeout = window.setTimeout(function () {
//                        self.element.find(self.options.options).fadeOut(self.options.duration);
//                    }, self.options.timeout);
//                }
//            );
//        });

//        return this;
//    }

//    // !jQuery.fn.slider
//    jQuery.fn.slider = function (opts) {
//        jQuery(this).each(function (index, el) {
//            var self = this;
//            this.idle = false;
//            this.current = 0;
//            this.element = jQuery(el);
//            this.options = jQuery.extend({
//                'container': '.slider-inner',
//                'item': '.item',
//                'next': '.next',
//                'prev': '.prev',
//                'nums': '.number',
//                'offset': 1,
//                'onstart': function () { },
//                'onstop': function () { }
//            }, opts || {});
//            this.items = this.element.find(self.options.container + ' ' + this.options.item).each(function (i, el) {
//                jQuery(el).addClass('item-' + i);
//            });

//            this.activateRelated = function () {
//                this.element.find(this.options.nums).removeClass('active').eq(self.current).addClass('active');
//            }
//            this.scrollTo = function (offset) {
//                if (!self.idle) {
//                    self.idle = true;
//                    self.options.onstart(self);
//                    self.activateRelated();
//                    self.element.find(self.options.container).animate({ 'scrollLeft': offset }, self.options.duration, function () {
//                        self.idle = false;
//                        self.options.onstop(self);
//                    });
//                }
//            }
//            this.getOffset = function (index) {
//                return self.element.find(self.options.container).scrollLeft() + jQuery(self.items[index ? index : self.current]).position().left
//            }
//            this.scrollNext = function () {
//                self.current = (self.current + self.options.offset >= self.items.size()) ? 0 : self.current + self.options.offset;
//                self.scrollTo(self.getOffset());
//            }
//            this.scrollPrev = function () {
//                self.current = (self.current - self.options.offset < 0) ? self.items.size() - self.options.offset : self.current - self.options.offset;
//                self.scrollTo(self.getOffset());
//            }

//            this.element.find(this.options.next).click(function (ev) {
//                ev.preventDefault();
//                self.scrollNext();
//            });
//            this.element.find(this.options.prev).click(function (ev) {
//                ev.preventDefault();
//                self.scrollPrev();
//            });
//            this.element.find(this.options.nums).each(function (index, el) {
//                jQuery(el).addClass('number-' + index).removeClass('active').click(function (ev) {
//                    ev.preventDefault();
//                    self.current = index;
//                    self.scrollTo(self.getOffset());
//                })
//            });
//            this.activateRelated();
//        });

//        return this;
//    }

//    // !jQuery.fn.tabs
//    jQuery.fn.tabs = function (opts) {
//        jQuery(this).each(function (index, el) {
//            var self = this;
//            this.current = 0;
//            this.element = jQuery(el);
//            this.options = jQuery.extend({
//                'handlers': '.tab-list li',
//                'contents': '.tab-content',
//                'active': 'active',
//                'direction': false,
//                'leftside': 'left-border',
//                'rightside': 'right-border',
//                'leftsideactive': 'left-active',
//                'rightsideactive': 'right-active',
//                'current': false,
//                'ajax': false,
//                'callback': function () { }
//            }, opts || {});

//            this.setDirections = function () {
//                self.handlers.removeClass(self.options.leftside + ' ' + self.options.rightside + ' ' + self.options.leftsideactive + ' ' + self.options.rightsideactive);
//                self.handlers.filter(':lt(' + self.current + ')').addClass(self.options.leftside);
//                self.handlers.filter(':gt(' + self.current + ')').addClass(self.options.rightside);
//                switch (self.options.direction) {
//                    case 'ltr':
//                        if (self.current == 0)
//                            self.handlers.eq(self.current).addClass(self.options.leftsideactive);
//                        else self.handlers.eq(self.current).addClass(self.options.rightsideactive);
//                        break;
//                    case 'rtl':
//                        if (self.current == self.handlers.length - 1)
//                            self.handlers.eq(self.current).addClass(self.options.rightsideactive);
//                        else self.handlers.eq(self.current).addClass(self.options.leftsideactive);
//                        break;
//                    default: return;
//                }
//            }
//            this.load = function (num) {
//                var num = num || self.current;
//                var url = self.handlers.eq(num).is('a') ? self.handlers.eq(num).attr('href') : self.handlers.eq(num).find('a:first').attr('href');
//                self.contents.eq(num).addClass('loading').load(
//                    'js.tabs.php',
//                    { 'tab': url },
//                    function (res) {
//                        self.contents.eq(num).removeClass('loading');
//                        self.options.callback(self);
//                    }
//                );
//            }
//            this.activate = function (num) {
//                self.handlers.removeClass(self.options.active);
//                self.handlers.eq(num).addClass(self.options.active);
//                self.contents.hide();
//                self.contents.eq(num).show();
//                self.current = num;
//                if (self.options.direction)
//                    self.setDirections();
//                if (self.options.ajax)
//                    self.load(num);
//                else self.options.callback(self);
//            }
//            this.activateHandler = function (ev) {
//                ev.preventDefault();
//                self.activate(jQuery(this).data('num'));
//            }

//            this.handlers = this.element.find(this.options.handlers).each(function (index) { jQuery(this).addClass('num-' + index).data({ 'num': index }); }).click(this.activateHandler);
//            this.contents = this.element.find(this.options.contents).each(function (index) { jQuery(this).addClass('num-' + index).data({ 'num': index }); });
//            this.current = this.contents.index(this.contents.filter(':visible'));
//            this.activate(this.options.current ? this.options.current : this.current);
//        });

//        return this;
//    }
//    // !jQuery.fn.menuHoverDelay
//    jQuery.fn.menuHoverDelay = function (opts) {
//        var self = this;
//        this.options = jQuery.extend({
//            'speed': 250,
//            'delayIn': 250,
//            'delayOut': 500,
//            'holder': '> div',
//            'property': 'opacity',
//            'from': function () { return 0; },
//            'to': function () { return 100; }
//        }, opts || {});
//        this.elements = jQuery(this);

//        this.elements.each(function (i, el) {
//            var wrapper = jQuery(el).find(self.options.holder);
//            var objFrom = {};
//            objFrom[self.options.property] = self.options.from(jQuery(el), wrapper, self);
//            var objTo = {};
//            objTo[self.options.property] = self.options.to(jQuery(el), wrapper, self);
//            //              wrapper.data('hover' + self.options.property, wrapper.css(self.options.property));
//            wrapper.css(objFrom);

//            this.over = function (ev) {
//                ev.preventDefault();
//                jQuery(this).addClass('hover');
//                var active = self.elements.filter('.idle').not(jQuery(this)).find(self.options.holder);
//                if (active.length)
//                    active.stop(false, true).delay(100).dequeue('fx').clearQueue('fx');
//                wrapper.stop(true, true);
//                //              wrapper.css(objFrom);
//                wrapper.css('overflow', 'hidden');
//                wrapper.delay(active.length ? self.options.speed + self.options.delayIn : self.options.delayIn);
//                wrapper.animate(objTo, {
//                    'duration': self.options.speed,
//                    'complete': function () {
//                        wrapper.css('overflow', 'visible');
//                    }
//                }).css('overflow', 'hidden');
//            }
//            this.out = function (ev) {
//                ev.preventDefault();
//                el = jQuery(this).addClass('idle').removeClass('hover');
//                if (wrapper.length) {
//                    wrapper.stop(true, true);
//                    //                  wrapper.css('overflow', 'visible');
//                    //                  if (parseInt(wrapper.css(self.options.property).replace(/px|%|em|pt/g, '')) > 0)
//                    wrapper.delay(self.options.delayOut).animate(objFrom, {
//                        'duration': self.options.speed,
//                        'complete': function () {
//                            wrapper.css('overflow', 'hidden');
//                            el.removeClass('idle');
//                        }
//                    });
//                } else el.removeClass('idle');
//            }

//            jQuery(el).mouseenter(this.over).mouseleave(this.out);
//        });

//        return this
//    }
//})(jQuery);






jQuery.noConflict();
jQuery(document).ready(function () {


//    jQuery('.gewinnspiel-teaserset-text input').checkBox({ addLabel: false });
//    jQuery('.doCheckbox').checkBox();



//    jQuery('.tab-container').tabs({
//        'handlers': '.tabs li',
//        'contents': '.tabs-target-container',
//        'active': 'active-tab'
//    });


//    jQuery('.slider-header').slider({
//        'container': '.slider-visuals-container',
//        'duration': 1000
//    });

//    jQuery('.dropdown-container:not(#footerServiceNavi .dropdown-container)').dropdown();

    resizeBG();
    jQuery(window).resize(function () {
        resizeBG();
    });

    jQuery(".dropdown-select").click(function () {
        jQuery(this).siblings(".dropdown-options").toggle(50);
       
    });

    jQuery(".moreinfo").click(function () {
        jQuery(".product-info ul li.hide").toggle(50);
        jQuery(".moreinfo").toggleClass("moreinfo-active");
    });
    jQuery('.accordion').accordion({
        active: 0,
        header: '.selector',
        collapsible: true,
        animated: 'easeslide',
        autoHeight: false
    });

    /*
    jQuery('.institute-finder-selectors select').each(function(i, el){
    var oc = jQuery(el).attr('rel');
    jQuery(el).replaceSelect(function (obj) {
    var oci = oc.split(',');
    IFC.handleStep(el, oci[0], oci[1]);
    }); 
    });
    */

    /*
    var oc = jQuery('.institute-finder-selectors select').attr('rel');
    jQuery('.institute-finder-selectors select').replaceSelect(function (obj) {
    alert(oc);
    });
    */

//    jQuery('#searchInShop').addClass('selected');
//    jQuery('#searchInWebsite').hide();
//    jQuery('#searchInShop').click(function () {
//        jQuery('#searchInShop').addClass('selected');
//        jQuery('#searchInWebsite').removeClass('selected');
//        jQuery('.searchInSelector:not(.selected)').hide();
//    });
//    jQuery('#searchInWebsite').click(function () {
//        jQuery('#searchInWebsite').addClass('selected');
//        jQuery('#searchInShop').removeClass('selected');
//        jQuery('.searchInSelector:not(.selected)').hide();
//    });
//    jQuery('.searchInSelectorHolderInner').hover(
//            function () { jQuery('.searchInSelector:not(.selected)').show() },
//            function () { jQuery('.searchInSelector:not(.selected)').hide() }
//        );


    // Refine mee, select replacement......begin
    // maybe add real hash or blaa...
    creategewinnselectDD();

    jQuery(".gewinnselectDD dt").click(function () {
        jQuery(".gewinnselectDD dd ul").animate({ opacity: 'toggle', height: 'toggle' }, 300);
    });


    jQuery(".gewinnselectDD dd ul li").click(function () {
        var text = jQuery(this).html();
        jQuery(".gewinnselectDD dt").html(text);
        jQuery(".gewinnselectDD dd ul").animate({ opacity: 'toggle', height: 'toggle' }, 300);

        var gewinnselectSelect = jQuery("#gewinnselectSelect");
        gewinnselectSelect.val(jQuery(this).find("span.value").html())
    });

    function creategewinnselectDD() {
        var gewinnselectSelect = jQuery("#gewinnselectSelect");
        var selected = jQuery(gewinnselectSelect).find("option:selected");
        var options = jQuery("option", gewinnselectSelect);
        jQuery(gewinnselectSelect).hide();
        jQuery("#gewinnselectSelectReplacement").append('<dl id="gewinnselectDD" class="gewinnselectDD"></dl>')
        jQuery("#gewinnselectDD").append('<dt>' + selected.text() +
                    '<span class="value">' + selected.val() +
                    '</span></dt>')
        jQuery("#gewinnselectDD").append('<dd><ul></ul></dd>')
        options.each(function () {
            jQuery("#gewinnselectDD dd ul").append('<li>' +
                    jQuery(this).text() + '<span class="value">' +
                    jQuery(this).val() + '</span></li>');
        });
    }
    // End of Refine mee

});

jQuery().ready(function () {
    jQuery("img.gfxToggle").each(function () {
        var img = jQuery(this);
        var path = img.attr('src').match(/^(.*)\/([^\/]+)$/)[1];
        var paths = {
            out: path + '/' + img.attr('out'),
            over: path + '/' + img.attr('over'),
            down: path + '/' + img.attr('down')
        }
        var toggle = function (e) { e.data.img.attr({ src: e.data.path }); }

        img.bind('mouseout', { img: img, path: paths.out }, toggle);
        img.bind('mouseenter', { img: img, path: paths.over }, toggle);
        img.bind('mousedown', { img: img, path: paths.down }, toggle);
        img.bind('mouseup', { img: img, path: paths.over }, toggle);
        img.bind('click', { img: img, path: paths.over }, toggle);
    });
});


function initializeCategorySelector() {

    var selectors = jQuery(".products-filter div.dropdown-container");
    jQuery.each(selectors, function () {
        if (jQuery(this).find("ul.dropdown-options li").length == 0) {
            jQuery(this).hide();
        }  });

    jQuery(".bottom-products-filter-wrapper div.dropdown-container").addClass("dropdown-container-top");

}
