window.addEvent('domready', function() {

if ($('ctl00_cpContentBeforeMagnet_pnlMagnetResults') && $$('.sorteerop')){
	$$('.sorteerop').setStyle('display','none');
}

});




jQuery.noConflict();
jQuery(document).ready(function ($) {


    $('.supermenu ul').columnize({
        minHeight: 280,
        height: 280,
        width: 200
    });
    //======================================SUPERSUCKERFISH-MENU============================================
    //uitzetten? verwijder de class 'supermenu' uit de ul van het menu in de master-page
    //in de standaard stylesheet (jquery.css) staan alle .supermenu styles. (Suckerfish styles.)
    supermenu(
		  'supermenu', //1: de class van de navigatie-ul
		  'h', //2: h voor horizontaal menu / v voor verticaal menu
		  '100', //3: breedte van het menu in het geval van een verticaal menu
		  'fade1', //4: fade1 om te faden / anders fade0
		  'slide0', //5: slide1 om te sliden / anders slide0
		  'slow', //6: snelheid van de animatie. Dit kan 'slow','medium','fast' zijn of een getal in milliseconden
		  500, //7: delay. De duur dat het submenu blijft staan wanneer je muis er vanaf is in milliseconden
		  'arrows1', //8: arrows1 om pijltjes bij menuitems met submenu's te laten zien. Anders arrows0
		  8, //9: de minimal breedte van een submenu in em (n.b. de breedte van de sub-ul wordt dynamisch aangepast adhv de tekst in de knoppen)
		  18//10: de maximale breedte van een submenu in em
		  );
    //supermenu
    function supermenu(classofmenu, horver, v_width, fade1, slide1, speed, delay, arrows, ssmin, ssmax) {
        if (horver == 'v') {
            $("ul." + classofmenu).addClass('sf-vertical');
            $(".sf-vertical, .sf-vertical li").css('width', v_width + "px");
            $(".sf-vertical li ul,.sf-vertical li.sfHover ul").css('left', v_width + "px");
        }
        var vspeed = speed;
        var vdelay = delay;
        var vani = 'fadeslide';
        if (fade1 == "fade1" && slide1 == "slide1") { vani = 'fadeslide' } else
            if (fade1 == "fade0" && slide1 == "slide0") { vani = 'none' } else
                if (fade1 == "fade1") { vani = 'fade' } else
                    if (slide1 == "slide1") { vani = 'slide' }
        var varrows = false;
        if (arrows == 'arrows1') { varrows = true }
        $("ul." + classofmenu).supersubs({
            minWidth: ssmin,   // minimum width of sub-menus in em units 
            maxWidth: ssmax,   // maximum width of sub-menus in em units 
            extraWidth: 1     // extra width can ensure lines don't sometimes turn over 
            // due to slight rounding differences and font-family 
        }).superfish({
            delay: vdelay,                            // one second delay on mouseout 
            animation: vani,  							// fade-in and slide-down animation 
            speed: vspeed,                          // faster animation speed 
            autoArrows: varrows,                           // disable generation of arrow mark-up 
            dropShadows: false,                         // disable drop shadows 
            onInit: function () { },     			  // callback function fires once Superfish is initialised – 'this' is the containing ul 
            onBeforeShow: function () { },     			  // callback function fires just before reveal animation begins – 'this' is the ul about to open 
            onShow: function () { },     			  // callback function fires once reveal animation completed – 'this' is the opened ul 
            onHide: function () { }     			 // callback function fires after a sub-menu has closed – 'this' is the ul that just closed     
        }, function () { repos() }); 							  			// call supersubs first, then superfish, so that subs are 
        // not display:none when measuring. Call before initialising 
        // containing tabs for same reason. 
    }


    $('.supermenu ul').each(function () {
        var colW = 0;
        var vCol = $(this);
        if (vCol.find('.column')) {
            vCol.find('.column').each(function () {
                colW = colW + $(this).outerWidth(true);
            });
            vCol.css({ width: colW, marginLeft: -colW / 2 + 50 });
        }
    });


    //z-index fix for IE7
    $(function () {
        if ($.browser.msie) {
            var zIndexNumber = 1000;
            $('div').each(function () {
                $(this).css('zIndex', zIndexNumber);
                zIndexNumber -= 10;
            });
        }
    });
});

/*
* Superfish v1.4.8 - jQuery menu widget
* Copyright (c) 2008 Joel Birch
*
* Dual licensed under the MIT and GPL licenses:
* 	http://www.opensource.org/licenses/mit-license.php
* 	http://www.gnu.org/licenses/gpl.html
*
* CHANGELOG: http://users.tpg.com.au/j_birch/plugins/superfish/changelog.txt
*/
; (function ($) {
    $.fn.superfish = function (op) {

        var sf = $.fn.superfish,
			c = sf.c,
			$arrow = $(['<span class="', c.arrowClass, '"> &#187;</span>'].join('')),
			over = function () {
			    var $$ = $(this), menu = getMenu($$);
                console.log($('#sitemain').offset().left);
                console.log($(this).offset().left);
                console.log($(this).children('ul').width());
			    clearTimeout(menu.sfTimer);
			    $$.showSuperfishUl().siblings().hideSuperfishUl();
			},
			out = function () {
			    var $$ = $(this), menu = getMenu($$), o = sf.op;
			    clearTimeout(menu.sfTimer);
			    menu.sfTimer = setTimeout(function () {
			        o.retainPath = ($.inArray($$[0], o.$path) > -1);
			        $$.hideSuperfishUl();
			        if (o.$path.length && $$.parents(['li.', o.hoverClass].join('')).length < 1) { over.call(o.$path); }
			    }, o.delay);
			},
			getMenu = function ($menu) {
			    var menu = $menu.parents(['ul.', c.menuClass, ':first'].join(''))[0];
			    sf.op = sf.o[menu.serial];
			    return menu;
			},
			addArrow = function ($a) { $a.addClass(c.anchorClass).append($arrow.clone()); };

        return this.each(function () {
            var s = this.serial = sf.o.length;
            var o = $.extend({}, sf.defaults, op);
            o.$path = $('li.' + o.pathClass, this).slice(0, o.pathLevels).each(function () {
                $(this).addClass([o.hoverClass, c.bcClass].join(' '))
					.filter('li:has(ul)').removeClass(o.pathClass);
            });
            sf.o[s] = sf.op = o;

            $('li:has(ul)', this)[($.fn.hoverIntent && !o.disableHI) ? 'hoverIntent' : 'hover'](over, out).each(function () {
                if (o.autoArrows) addArrow($('>a:first-child', this));
            })
			.not('.' + c.bcClass)
				.hideSuperfishUl();

            var $a = $('a', this);
            $a.each(function (i) {
                var $li = $a.eq(i).parents('li');
                $a.eq(i).focus(function () { over.call($li); }).blur(function () { out.call($li); });
            });
            o.onInit.call(this);

        }).each(function () {
            var menuClasses = [c.menuClass];
            if (sf.op.dropShadows && !($.browser.msie && $.browser.version < 7)) menuClasses.push(c.shadowClass);
            $(this).addClass(menuClasses.join(' '));
        });
    };

    var sf = $.fn.superfish;
    sf.o = [];
    sf.op = {};
    sf.IE7fix = function () {
        var o = sf.op;
        if ($.browser.msie && $.browser.version > 6 && o.dropShadows && o.animation.opacity != undefined)
            this.toggleClass(sf.c.shadowClass + '-off');
    };
    sf.c = {
        bcClass: 'sf-breadcrumb',
        menuClass: 'sf-js-enabled',
        anchorClass: 'sf-with-ul',
        arrowClass: 'sf-sub-indicator',
        shadowClass: 'sf-shadow'
    };
    sf.defaults = {
        hoverClass: 'sfHover',
        pathClass: 'overideThisToUse',
        pathLevels: 1,
        delay: 800,
        animation: 'fadeslide',
        speed: 'normal',
        autoArrows: true,
        dropShadows: true,
        disableHI: false, 	// true disables hoverIntent detection
        onInit: function () { }, // callback functions
        onBeforeShow: function () { },
        onShow: function () { },
        onHide: function () { }
    };
    $.fn.extend({
        hideSuperfishUl: function () {
            var o = sf.op,
				not = (o.retainPath === true) ? o.$path : '';
            o.retainPath = false;
            var $ul = $(['li.', o.hoverClass].join(''), this).add(this).not(not).removeClass(o.hoverClass)
					.find('>ul').stop(true, true).hide().css('visibility', 'hidden');
            o.onHide.call($ul);
            return this;
        },
        showSuperfishUl: function () {
            var o = sf.op,
				sh = sf.c.shadowClass + '-off',
				$ul = this.addClass(o.hoverClass)
					.find('>ul:hidden').css('visibility', 'visible');
            sf.IE7fix.call($ul);
            if (o.animation == 'fadeslide') {
                o.animation = { opacity: 'show', height: 'show' };
            } else
                if (o.animation == 'none') {
                    o.animation = { opacity: 'show' };
                    o.speed = 0;
                } else
                    if (o.animation == 'fade') {
                        o.animation = { opacity: 'show' };
                    } else
                        if (o.animation == 'slide') {
                            o.animation = { height: 'show' };
                        }
            o.onBeforeShow.call($ul);

            $ul.animate(o.animation, o.speed, function () { sf.IE7fix.call($ul); o.onShow.call($ul); });
            return this;
        }
    });

})(jQuery);



/*
* Supersubs v0.2b - jQuery plugin
* Copyright (c) 2008 Joel Birch
*
* Dual licensed under the MIT and GPL licenses:
* 	http://www.opensource.org/licenses/mit-license.php
* 	http://www.gnu.org/licenses/gpl.html
*
*
* This plugin automatically adjusts submenu widths of suckerfish-style menus to that of
* their longest list item children. If you use this, please expect bugs and report them
* to the jQuery Google Group with the word 'Superfish' in the subject line.
*
*/

; (function ($) { // $ will refer to jQuery within this closure

    $.fn.supersubs = function (options) {
        var opts = $.extend({}, $.fn.supersubs.defaults, options);
        // return original object to support chaining
        return this.each(function () {
            // cache selections
            var $$ = $(this);
            // support metadata
            var o = $.meta ? $.extend({}, opts, $$.data()) : opts;
            // get the font size of menu.
            // .css('fontSize') returns various results cross-browser, so measure an em dash instead
            var fontsize = $('<li id="menu-fontsize">&#8212;</li>').css({
                'padding': 0,
                'position': 'absolute',
                'top': '-999em',
                'width': 'auto'
            }).appendTo($$).width(); //clientWidth is faster, but was incorrect here
            // remove em dash
            $('#menu-fontsize').remove();
            // cache all ul elements
            $ULs = $$.find('ul');
            // loop through each ul in menu
            $ULs.each(function (i) {
                // cache this ul
                var $ul = $ULs.eq(i);
                // get all (li) children of this ul
                var $LIs = $ul.children();
                // get all anchor grand-children
                var $As = $LIs.children('a');
                // force content to one line and save current float property
                var liFloat = $LIs.css('white-space', 'nowrap').css('float');
                // remove width restrictions and floats so elements remain vertically stacked
                var emWidth = $ul.add($LIs).add($As).css({
                    'float': 'none',
                    'width': 'auto'
                })
                // this ul will now be shrink-wrapped to longest li due to position:absolute
                // so save its width as ems. Clientwidth is 2 times faster than .width() - thanks Dan Switzer
				.end().end()[0].clientWidth / fontsize;
                // add more width to ensure lines don't turn over at certain sizes in various browsers
                emWidth += o.extraWidth;
                // restrict to at least minWidth and at most maxWidth
                if (emWidth > o.maxWidth) { emWidth = o.maxWidth; }
                else if (emWidth < o.minWidth) { emWidth = o.minWidth; }
                emWidth += 'em';
                // set ul to width in ems
                $ul.css('width', emWidth);
                // restore li floats to avoid IE bugs
                // set li width to full width of this ul
                // revert white-space to normal
                $LIs.css({
                    'float': liFloat,
                    'width': '200px',
                    'white-space': 'normal'
                })
                // update offset position of descendant ul to reflect new width of parent
				.each(function () {
				    var $childUl = $('>ul', this);
				    var offsetDirection = $childUl.css('left') !== undefined ? 'left' : 'right';
				    $childUl.css(offsetDirection, emWidth);
				});
            });

        });
    };
    // expose defaults
    $.fn.supersubs.defaults = {
        minWidth: 9, 	// requires em unit.
        maxWidth: 25, 	// requires em unit.
        extraWidth: 0			// extra width can ensure lines don't sometimes turn over due to slight browser differences in how they round-off values
    };



})(jQuery); // plugin code ends


/*
Columnize Plugin for jQuery
Version: v0.10

Copyright (C) 2008-2010 by Lutz Issler

Systemantics GmbH
Am Lavenstein 3
52064 Aachen
GERMANY

Web:    www.systemantics.net
Email:  hello@systemantics.net

This plugin is distributed under the terms of the
GNU Lesser General Public license. The license can be obtained
from http://www.gnu.org/licenses/lgpl.html.

*/

(function () {
    var cloneEls = new Object();
    var numColsById = new Object();
    var uniqueId = 0;

    function _layoutElement(elDOM, settings, balance) {
        // Some semi-global variables
        var colHeight;
        var colWidth;
        var col;
        var currentColEl;
        var cols = new Array();
        var colNum = 0;
        var colSet = 0;

        var el = jQuery(elDOM);

        // Save numCols property for this element
        // (needed for pagination)
        numColsById[elDOM.id] = settings.columns;

        // Remove child nodes
        el.empty();

        // Macro function (with side effects)
        function _newColumn() {
            colNum++;

            // Add a new column
            col = document.createElement("DIV");
            col.className = settings.column;
            el.append(col);
            currentColEl = col;
            colWidth = jQuery(col).width();
            cols.push(col);

            // Add the same subnode nesting to the new column
            // as there was in the old column
            for (var j = 0; j < subnodes.length; j++) {
                newEl = subnodes[j].cloneNode(false);
                if (j == 0 || innerContinued) {
                    jQuery(newEl).addClass(settings.continued);
                }
                currentColEl.appendChild(newEl);
                currentColEl = newEl;
            }
        }

        // Returns the margin-bottom CSS property of a certain node
        function _getMarginBottom(currentColEl) {
            var marginBottom = parseInt(jQuery(currentColEl).css("marginBottom"));
            if (marginBottom.toString() == 'NaN') {
                marginBottom = 0;
            }
            var currentColElParents = jQuery(currentColEl).parents();
            for (var j = 0; j < currentColElParents.length; j++) {
                if (currentColElParents[j] == elDOM) {
                    break;
                }
                var curMarginBottom = parseInt(jQuery(currentColElParents[j]).css("marginBottom"));
                if (curMarginBottom.toString() != 'NaN') {
                    marginBottom = Math.max(marginBottom, curMarginBottom);
                }
            }
            return marginBottom;
        }

        // Advance to next sibling on el or a parent level
        function _skipToNextNode() {
            while (currentEl && currentColEl && !currentEl.nextSibling) {
                currentEl = currentEl.parentNode;
                currentColEl = currentColEl.parentNode;
                var node = subnodes.pop();
                // Hack: delete the previously saved HREF
                if (node == "A") {
                    href = null;
                }
            }
            if (currentEl) {
                currentEl = currentEl.nextSibling;
            }
        }

        // Take the height from the element to be layouted
        var maxHeight = settings.height
			? settings.height
			: parseInt(el.css("maxHeight"));
        if (balance || isNaN(maxHeight) || maxHeight == 0) {
            // We are asked to balance the col lengths
            // or cannot get the column length from the container,
            // so chose a height that will produce >numCols< columns
            col = document.createElement("DIV");
            col.className = settings.column;
            jQuery(col).append(jQuery(cloneEls[elDOM.id]).html());
            el.append(col);
            var lineHeight = parseInt(el.css("lineHeight"));
            if (!lineHeight) {
                // Assume a line height of 120%
                lineHeight = Math.ceil(parseInt(el.css("fontSize")) * 1.2);
            }
            colHeight = Math.ceil(jQuery(col).height() / settings.columns);
            if (colHeight % lineHeight > 0) {
                colHeight += lineHeight;
            }
            elDOM.removeChild(col);
            if (maxHeight > 0 && colHeight > maxHeight) {
                // Balance only to max-height
                colHeight = maxHeight;
            }
        } else {
            colHeight = maxHeight;
        }

        // Take the minimum height into account
        var minHeight = settings.minHeight
			? settings.minHeight
			: parseInt(el.css("minHeight"));
        if (minHeight) {
            colHeight = Math.max(colHeight, minHeight);
        }

        // Start with first child of the initial node
        var currentEl = cloneEls[elDOM.id].children(":first")[0];
        var subnodes = new Array();
        var href = null;
        var lastNodeType = 0;
        _newColumn();
        if (colHeight == 0 || colWidth == 0) {
            // We cannot continue with zero height or width
            return false;
        }
        while (currentEl) {
            if (currentEl.nodeType == 1) {
                // An element node
                var newEl;
                var $currentEl = jQuery(currentEl);
                if ($currentEl.hasClass("dontSplit")
					|| $currentEl.is(settings.dontsplit)) {
                    // Don't split this node. Instead, clone it completely
                    var newEl = currentEl.cloneNode(true);
                    currentColEl.appendChild(newEl);
                    if (col.offsetHeight > colHeight) {
                        // The column gets too long, start a new colum
                        _newColumn();
                    }
                    _skipToNextNode();
                } else {
                    // Clone the node and append it to the current column
                    var newEl = currentEl.cloneNode(false);
                    currentColEl.appendChild(newEl);
                    if (col.offsetHeight - _getMarginBottom(currentColEl) > colHeight) {
                        // The column gets too long, start a new colum
                        currentColEl.removeChild(newEl);
                        var toBeInsertedEl = newEl;
                        _newColumn();
                        currentColEl.appendChild(toBeInsertedEl);
                        newEl = toBeInsertedEl;
                    }
                    if (currentEl.firstChild) {
                        subnodes.push(currentEl.cloneNode(false));
                        currentColEl = newEl;
                        currentEl = currentEl.firstChild;
                    } else {
                        _skipToNextNode();
                    }
                }
                lastNodeType = 1;
            } else if (currentEl.nodeType == 3) {
                // A text node
                var newEl = document.createTextNode("");
                currentColEl.appendChild(newEl);
                // Determine the current bottom margin
                var marginBottom = _getMarginBottom(currentColEl);
                // Append word by word
                var words = currentEl.data.split(" ");
                for (var i = 0; i < words.length; i++) {
                    if (lastNodeType == 3) {
                        newEl.appendData(" ");
                    }
                    newEl.appendData(words[i]);
                    currentColEl.removeChild(newEl);
                    currentColEl.appendChild(newEl);
                    if (col.offsetHeight - marginBottom > colHeight) {
                        // el column is full
                        // Remove the last word
                        newEl.data = newEl.data.substr(0, newEl.data.length - words[i].length - 1);

                        // Remove the last node if empty
                        var innerContinued;
                        if (jQuery(currentColEl).text() == "") {
                            jQuery(currentColEl).remove();
                            innerContinued = false;
                        } else {
                            innerContinued = true;
                        }

                        // Start a new column
                        _newColumn();

                        // Add a text node at the bottom level
                        // in order to continue the column
                        newEl = document.createTextNode(words[i]);
                        currentColEl.appendChild(newEl);
                    }
                    lastNodeType = 3;
                }
                _skipToNextNode();
                lastNodeType = 0;
            } else {
                // Any other node (comments, for instance)
                _skipToNextNode();
                lastNodeType = currentEl.nodeType;
            }
        }
        return cols;
    };

    jQuery.fn.columnize = function (settings) {
        settings = jQuery.extend({
            column: "column",
            continued: "continued",
            columns: 2,
            balance: true,
            height: false,
            minHeight: false,
            cache: true,
            dontsplit: ""
        }, settings);
        this.each(function () {
            var jthis = jQuery(this);

            var id = this.id;
            if (!id) {
                // Get a new id
                id = "jcols_" + uniqueId;
                this.id = id;
                uniqueId++;
            }

            if (!cloneEls[this.id] || !settings.cache) {
                cloneEls[this.id] = jthis.clone(true);
            }

            // Layout the columns
            var cols = _layoutElement(this, settings, settings.balance);
            if (!cols) {
                // Layout failed, restore the object's contents
                jthis.append(cloneEls[this.id].children().clone(true));
            }
        });
        return this;
    }
})();

