PINT.vs = { 
menus : [{'title':'Desktop Monitors ', 'href':'/nl/products/desktop-monitors/', items: [{'title':'Size', 'href':'/nl/products/desktop-monitors/search-results.php?&', items: [{'title':'39cm-43cm (15-17&quot;)', 'href':'/nl/products/desktop-monitors/search-results.php?&x=43&y=5&y=14', items: [{'title':'VA703b ', 'href':'/nl/products/desktop-monitors/lcd/value-series/va703b.htm? '}]},{'title':'48cm-51cm (19-20&quot;)', 'href':'/nl/products/desktop-monitors/search-results.php?&x=31&y=15', items: [{'title':'VA916', 'href':'/nl/products/desktop-monitors/lcd/value-series/va916.htm'},{'title':'	VG930m ', 'href':'/nl/products/desktop-monitors/lcd/graphic-series/vg930m.htm? '},{'title':'VA926', 'href':'/nl/products/desktop-monitors/lcd/value-series/va926.htm? '},{'title':'VA2013wm', 'href':'/nl/products/desktop-monitors/lcd/value-series/va2013wm.htm'},{'title':'VA2013w', 'href':'/nl/products/desktop-monitors/lcd/value-series/va2013w.htm'},{'title':'VA1913wm', 'href':'/nl/products/desktop-monitors/lcd/value-series/va1913wm.htm'},{'title':'VX1932wm-LED', 'href':'/nl/products/desktop-monitors/lcd/x-series/vx1932wmled.htm'},{'title':'VA1913w', 'href':'/nl/products/desktop-monitors/lcd/value-series/va1913w.htm'},{'title':'VA1916w', 'href':'/nl/products/desktop-monitors/lcd/value-series/va1916w.htm'},{'title':'VA1926w', 'href':'/nl/products/desktop-monitors/va1926w.htm? '},{'title':'VX1940w-3', 'href':'/nl/products/desktop-monitors/lcd/x-series/vx1940w-3.htm'},{'title':'VX1940w-4', 'href':'/nl/products/desktop-monitors/lcd/x-series/vx1940w.htm'}]},{'title':'56cm (22&quot;)', 'href':'/nl/products/desktop-monitors/search-results.php?&x=28&y=13', items: [{'title':'VG2230wm', 'href':'/nl/products/desktop-monitors/lcd/graphic-series/vg2230wm.htm? '},{'title':'VX2262wm', 'href':'/nl/products/desktop-monitors/lcd/x-series/vx2262wm.htm? '},{'title':'VA2216w', 'href':'/nl/products/desktop-monitors/lcd/value-series/va2216w.htm'},{'title':'VA2213w', 'href':'/nl/products/desktop-monitors/lcd/value-series/va2213w.htm'},{'title':'VA2226w', 'href':'/nl/products/desktop-monitors/lcd/value-series/va2226w.htm? '},{'title':'VX2268wm', 'href':'/nl/products/desktop-monitors/lcd/x-series/vx2268wm.htm'},{'title':'VG2227wm', 'href':'/nl/products/desktop-monitors/lcd/graphic-series/vg2227wm.htm'}]},{'title':'58cm (23&quot;)', 'href':'#', items: [{'title':'VP2365wb', 'href':'/nl/products/desktop-monitors/lcd/pro-series/vp2365wb.htm'}]},{'title':'61cm (24&quot;) -up', 'href':'#', items: [{'title':'VA2413wm', 'href':'/nl/products/desktop-monitors/lcd/value-series/va2413wm.htm'},{'title':'VX2433wm', 'href':'/nl/products/desktop-monitors/lcd/x-series/vx2433wm.htm'},{'title':'VG2427wm', 'href':'/nl/products/desktop-monitors/lcd/graphic-series/vg2427wm.htm'}]}]},{'title':'Application', 'href':'#', items: [{'title':'Home &amp; Office', 'href':'/nl/home-office/desktop-monitors/'},{'title':'Entertainment', 'href':'/nl/entertainment/desktop-monitors/'},{'title':'Business', 'href':'/nl/business/desktop-monitors/'}]},{'title':'Technology', 'href':'#', items: [{'title':'LED', 'href':'/nl/products/desktop-monitors/lcd/led-lcd/', items: [{'title':'VX1932wm-LED', 'href':'/nl/products/desktop-monitors/lcd/x-series/vx1932wmled.htm'}]},{'title':'LCD', 'href':'/nl/products/desktop-monitors/lcd/', items: [{'title':'VA1926w ', 'href':'/nl/products/desktop-monitors/lcd/value-series/va1926w.htm? '},{'title':'VA2226w ', 'href':'/nl/products/desktop-monitors/lcd/value-series/va2226w.htm? '},{'title':'VA703b ', 'href':'/nl/products/desktop-monitors/lcd/value-series/va703b.htm? '},{'title':'VA926 ', 'href':'/nl/products/desktop-monitors/lcd/value-series/va926.htm? '},{'title':'VG2230wm ', 'href':'/nl/products/desktop-monitors/lcd/graphic-series/vg2230wm.htm? '},{'title':'VG930m ', 'href':'/nl/products/desktop-monitors/lcd/graphic-series/vg930m.htm? '},{'title':'VA1916w', 'href':'/nl/products/desktop-monitors/lcd/value-series/va1916w.htm'},{'title':'VA2216w', 'href':'/nl/products/desktop-monitors/lcd/value-series/va2216w.htm'},{'title':'VA916', 'href':'/nl/products/desktop-monitors/lcd/value-series/va916.htm'},{'title':'VA2213w', 'href':'/nl/products/desktop-monitors/lcd/value-series/va2213w.htm'},{'title':'VA2413wm', 'href':'/nl/products/desktop-monitors/lcd/value-series/va2413wm.htm'},{'title':'VX2433wm', 'href':'/nl/products/desktop-monitors/lcd/x-series/vx2433wm.htm'},{'title':'VA2013wm', 'href':'/nl/products/desktop-monitors/lcd/value-series/va2013wm.htm'},{'title':'VX2268wm', 'href':'/nl/products/desktop-monitors/lcd/x-series/vx2268wm.htm'},{'title':'VA2013w', 'href':'/nl/products/desktop-monitors/lcd/value-series/va2013w.htm'},{'title':'VA1913wm', 'href':'/nl/products/desktop-monitors/lcd/value-series/va1913wm.htm'},{'title':'VP2365wb', 'href':'/nl/products/desktop-monitors/lcd/pro-series/vp2365wb.htm'},{'title':'VG2227wm', 'href':'/nl/products/desktop-monitors/lcd/graphic-series/vg2227wm.htm'},{'title':'VA1913w', 'href':'/nl/products/desktop-monitors/lcd/value-series/va1913w.htm'},{'title':'VG2427wm', 'href':'/nl/products/desktop-monitors/lcd/graphic-series/vg2427wm.htm'},{'title':'VX2260wm', 'href':'/nl/products/desktop-monitors/lcd/x-series/vx2260wm.htm'},{'title':'VX1940w-3', 'href':'/nl/products/desktop-monitors/lcd/x-series/vx1940w-3.htm'},{'title':'VX1940w-4', 'href':'/nl/products/desktop-monitors/lcd/x-series/vx1940w.htm'}]}]},{'title':'Series', 'href':'/nl/products/desktop-monitors/', items: [{'title':'X Series', 'href':'/nl/products/desktop-monitors/lcd/x-series/', items: [{'title':'VX2260wm', 'href':'/nl/products/desktop-monitors/lcd/x-series/vx2260wm.htm'},{'title':'VX2433wm', 'href':'/nl/products/desktop-monitors/lcd/x-series/vx2433wm.htm'},{'title':'VX2268wm', 'href':'/nl/products/desktop-monitors/lcd/x-series/vx2268wm.htm'},{'title':'VX1932wm-LED', 'href':'/nl/products/desktop-monitors/lcd/x-series/vx1932wmled.htm'},{'title':'VX1940w-3', 'href':'/nl/products/desktop-monitors/lcd/x-series/vx1940w-3.htm'},{'title':'VX1940w-4', 'href':'/nl/products/desktop-monitors/lcd/x-series/vx1940w.htm?V'}]},{'title':'Pro Series', 'href':'/nl/products/desktop-monitors/lcd/pro-series/', items: [{'title':'VP2365wb', 'href':'/nl/products/desktop-monitors/lcd/pro-series/vp2365wb.htm'}]},{'title':'Graphic Series', 'href':'/nl/products/desktop-monitors/lcd/graphic-series/', items: [{'title':'VG930m', 'href':'#'},{'title':'VG2230wm', 'href':'/nl/products/desktop-monitors/lcd/graphic-series/vg2230wm.htm'},{'title':'VG2227wm', 'href':'/nl/products/desktop-monitors/lcd/graphic-series/vg2227wm.htm'},{'title':'VG2427wm', 'href':'/nl/products/desktop-monitors/lcd/graphic-series/vg2427wm.htm'}]},{'title':'Value Series', 'href':'/nl/products/desktop-monitors/lcd/value-series/', items: [{'title':'VA703b ', 'href':'/nl/products/desktop-monitors/va703b.htm? '},{'title':'VA1926w ', 'href':'/nl/products/desktop-monitors/va1926w.htm? '},{'title':'VA2226w ', 'href':'/nl/products/desktop-monitors/va2226w.htm? '},{'title':'VA926 ', 'href':'/nl/products/desktop-monitors/va926.htm? '},{'title':'VA1916w', 'href':'/nl/products/desktop-monitors/lcd/value-series/va1916w.htm'},{'title':'VA2216w', 'href':'/nl/products/desktop-monitors/lcd/value-series/va2216w.htm'},{'title':'VA916', 'href':'/nl/products/desktop-monitors/lcd/value-series/va916.htm'},{'title':'VA2213w', 'href':'/nl/products/desktop-monitors/lcd/value-series/va2213w.htm'},{'title':'VA2413wm', 'href':'/nl/products/desktop-monitors/lcd/value-series/va2413wm.htm'},{'title':'VA2013wm', 'href':'/nl/products/desktop-monitors/lcd/value-series/va2013wm.htm'},{'title':'VA2013w', 'href':'/nl/products/desktop-monitors/lcd/value-series/va2013w.htm'},{'title':'VA1913wm', 'href':'/nl/products/desktop-monitors/lcd/value-series/va1913wm.htm'},{'title':'VA1913w', 'href':'/nl/products/desktop-monitors/lcd/value-series/va1913w.htm'}]}]}]},{'title':'Projectors', 'href':'/nl/products/projectors/', items: [{'title':'Application', 'href':'/nl/entertainment/', items: [{'title':'Home &amp; Office', 'href':'/nl/home-office/projectors/'},{'title':'Entertainment', 'href':'/nl/entertainment/projectors/'},{'title':'Business', 'href':'/nl/business/projectors/'}]},{'title':'Technology', 'href':'#', items: [{'title':'DLP', 'href':'#', items: [{'title':'PJ258D ', 'href':'/nl/products/projectors/pj258d.htm? '},{'title':'PJ260D ', 'href':'/nl/products/projectors/pj260d.htm? '},{'title':'PJ513D', 'href':'/nl/products/projectors/pj513d.htm'},{'title':'PJ559D ', 'href':'/nl/products/projectors/pj559d.htm? '},{'title':'PJ560D ', 'href':'/nl/products/projectors/pj560d.htm? '},{'title':'PJD6210-WH', 'href':'/nl/products/pjd6210wh.htm'},{'title':'PJ551D', 'href':'/nl/products/projectors/pj551d.htm? '},{'title':'PJ568D', 'href':'/nl/products/projectors/pj588d44128.htm'},{'title':'PJ588D', 'href':'/nl/products/projectors/pj588d.htm'},{'title':'PJD6211', 'href':'/nl/products/projectors/pjd6211.htm'},{'title':'PJD6221', 'href':'/nl/products/projectors/pjd6221.htm'},{'title':'PJD6241', 'href':'/nl/products/projectors/pjd6241.htm'},{'title':'PJD6381', 'href':'/nl/products/projectors/pjd6381.htm'},{'title':'PJD6251', 'href':'/nl/products/projectors/pjd6251.htm'},{'title':'PJD5111', 'href':'/nl/products/projectors/pjd5111.htm'}]},{'title':'LCD', 'href':'#', items: [{'title':'PJ1158 ', 'href':'/nl/products/projectors/pj1158.htm? '},{'title':'PJ1173 ', 'href':'/nl/products/projectors/pj1173.htm? '},{'title':'PJ358 ', 'href':'/nl/products/projectors/pj358.htm? '},{'title':'PJ359w ', 'href':'/nl/products/projectors/pj359w.htm? '},{'title':'PJ759 ', 'href':'/nl/products/projectors/pj759.htm? '},{'title':'PJ760', 'href':'/nl/products/projectors/pj760.htm'},{'title':'PJL7201', 'href':'/nl/products/pjl7201.htm'},{'title':'PJ758', 'href':'/nl/products/projectors/pj758.htm'},{'title':'PJL3211', 'href':'/nl/products/projectors/pjl3211.htm'}]}]},{'title':'Wireless Presentation Gateway ', 'href':'/nl/products/projectors/wireless-presentation-gateway/', items: [{'title':'WPG-350', 'href':'/nl/products/projectors/wireless-presentation-gateway/wpg350.htm'},{'title':'WPG-150', 'href':'/nl/products/projectors/wireless-presentation-gateway/wireless-presentation-gateways-wpg150.htm'}]}]},{'title':'Digital Signage', 'href':'/nl/products/digital-signage/', items: [{'title':'Type', 'href':'#', items: [{'title':'Commercial Display', 'href':'/nl/products/digital-signage/commercial-display/', items: [{'title':'ND4210w', 'href':'/nl/products/digital-signage/commercial-display/nd4210w.htm'},{'title':'CD3200', 'href':'/nl/products/digital-signage/commercial-display/cd3200.htm'},{'title':'CD4620', 'href':'/nl/products/digital-signage/commercial-display/cd4620.htm'},{'title':'CD4220', 'href':'/nl/products/digital-signage/commercial-display/cd4220.htm'}]},{'title':'Media Players', 'href':'/nl/products/digital-signage/media-players/', items: [{'title':'NMP-530', 'href':'/nl/products/digital-signage/media-players/nmp530.htm'}]}]},{'title':'Application', 'href':'#', items: [{'title':'Business', 'href':'/nl/business/digital-signage/'}]}]},{'title':'Digital Photo Frames', 'href':'/nl/products/digital-photo-frames/', items: [{'title':'Application', 'href':'#', items: [{'title':'Home &amp; Office', 'href':'/nl/home-office/digital-photo-frames/'},{'title':'Business', 'href':'/nl/business/digital-photo-frames/'}]}]},{'title':'Computer', 'href':'/nl/products/pcs/', items: [{'title':'PC mini', 'href':'/nl/products/pcs/pc-mini/', items: [{'title':'PC mini 120', 'href':'/nl/products/pcs/pc-mini/vot120.htm'}]}]}],
_createMenu : function (items, level, genealogy) {

	// Create the menu element
	var div = document.createElement('div');
	
	// Add the genealogy ID and set the level className
	div.setAttribute('id', 'menu_' + genealogy.join('_'));
	div.className = 'level_'+level;
	
	// Begin the links inside our menu
	var html = '<div id="submenu_' + genealogy.join('_') + '" class="scroll"><ul>';
	for (var i=0; i<items.length; i++) {
		// If there are children inside the current list item
		var isParent = (items[i].items && items[i].items.length) ? true : false;
		html = html + '<li';
		if (i==items.length-1) html = html + ' class="last"';
		html = html + '><a href="'+items[i].href+'" class="link_'+(i+1);
		if (isParent) html = html + ' parent';
		html = html + '">'+items[i].title+'</a>';
		
		if (isParent) {
		
			// Increase the genealogy for the children
			genealogy[level]++;
			
			// Reset genealogy if we are on a top level item or a first level item 
			if (level == 0) genealogy = [genealogy[0]++,0,0];
			else if (level == 1) genealogy = [genealogy[0], genealogy[1], 0];

			// Recursion: create the child menu and increase the level by 1
			PINT.vs._createMenu(items[i].items, level+1, genealogy);
		}
	}
	html = html + '</ul></div>';
	div.innerHTML = html;
	
	// Add the menu to the document
	PINT.vs.menuContainer.appendChild(div);
	
	// Make the last div scrollable and then hide it (quirkiness of flexcroll)
	if (level == 3 && items.length > 6) { 
		
		// Creates the scroller and hides it (it has to be shown at first to get calculations right)
		CSBfleXcroll('submenu_' + genealogy.join('_'));
		div.style.display = 'none'; 
	}
	// Add listeners to the A tags
	YAHOO.util.Event.on(div.getElementsByTagName('a'), 'mouseover', PINT.vs._prepareMenu);
},
_prepareMenu : function(e) {
	var isLast = false;

	// Get the menu containing the link that was moused over.
	var menu = this.parentNode.parentNode.parentNode.parentNode;
	
	// Remove any previous selections
	YAHOO.util.Dom.removeClass(menu.getElementsByTagName('a'), 'selected');
	
	// Build out the genealogy of the current menu
	var genealogy = menu.id.split('_');
		genealogy = genealogy.slice(1,4);
		
	// Find the current menu level
	var level = menu.className.split('_')[1];
	
	// Find the level of the link (when added into the genealogy, we can figure out the menu to be shown)
	var nextLevel =  this.className.split(' ')[0].split('_')[1];
	if (genealogy[0] == 0) genealogy[0] = nextLevel;
	else if (genealogy[1] == 0) genealogy[1] = nextLevel;
	else if (genealogy[2] == 0) genealogy[2] = nextLevel;
	else isLast = true;
	
	if (!isLast) {
		// Select the link if it is a parent
		if (YAHOO.util.Dom.hasClass(this, 'parent')) YAHOO.util.Dom.addClass(this, 'selected');
		
		var genealogyId = 'menu_' + genealogy.join('_');
		
		// Hide previous divs by checking to see if they are a higher level than our current level AND making sure the next divToShow is not already showing
		var checkLevel = function(el) {
			return (el.className.split(' ')[0].split('_')[1] > level && el.id != genealogyId);
		}
		var divsToHide = YAHOO.util.Dom.getElementsBy(checkLevel, 'div', 'menu');
		YAHOO.util.Dom.setStyle(divsToHide, 'display', 'none');
		

		// Check to see if the next menu exists and that it's not currently showing
		var divToShow = YAHOO.util.Dom.get(genealogyId);
		
		// If it does, we show it
		if (divToShow && divToShow.style.display != 'block') PINT.vs._showMenu(divToShow, level);
	}
},
_showMenu : function(menu, level) {
	// by/from value default
	var position = [0,0];
	
	// Hardcoded by/from values
	if (level == 0) position = [162, 10];
	else if (level == 1) position = [182, 172];
	else if (level == 2) position = [182, 354];
	
	var slide = new YAHOO.util.Anim(menu, { 
	    left: { by : position[0], from : position[1] }  
	}, .25, YAHOO.util.Easing.easeOut); 
	slide.onStart.subscribe(function() { menu.style.left = position[1] + 'px'; menu.style.display = 'block'; });
	slide.animate();
	
	// Remove any pre-selections
	YAHOO.util.Dom.removeClass(menu.getElementsByTagName('a'), 'selected');
},
init : function() {
	PINT.vs.menuContainer = YAHOO.util.Dom.get('menu');	
    PINT.vs._createMenu(PINT.vs.menus, 0, [0,0,0]);
	PINT.vs.menuContainer.style.display = 'none';
	
	PINT.vs.menu = new PINT.MenuCreator({
        menus: [
			{ id: 'menu', trigger: 'productsMenuLink' },
			{ id: 'menu_shop', trigger: 'shopMenuLink' },
			{ id: 'menu_support', trigger: 'supportMenuLink' },
			{ id: 'menu_company', trigger: 'companyMenuLink' }

		],
        show:function(trigger,menu) {
			if (trigger.parentNode.className.substr(trigger.parentNode.className.length-6) !== '_hover') { 
                    trigger.parentNode.className += '_hover';
            }
			YAHOO.util.Dom.setStyle(menu, 'display', 'block');
			YAHOO.util.Dom.removeClass(menu.getElementsByTagName('a'), 'selected');
        },
        hide:function(trigger,menu) {
            if (trigger.parentNode.className.substr(trigger.parentNode.className.length-6) === '_hover') { 
                trigger.parentNode.className = trigger.parentNode.className.substr(0, trigger.parentNode.className.length-6);
            }
            if (menu.id == 'menu') YAHOO.util.Dom.setStyle(menu.childNodes, 'display', 'none');
           	YAHOO.util.Dom.setStyle(menu, 'display', 'none');
        }
	});

	// Removes the IE6 flicker during animation
	if (PINT.util.browser.bIe6) try { document.execCommand("BackgroundImageCache", false, true); } catch(err) {}
}
};

// This function creates a show/hide relationship between a trigger and menu object.
PINT.MenuCreator = function(obj) {
	PINT.checkMouseEvent = new YAHOO.util.CustomEvent();
	for (var oMenu in obj.menus) {
		(function(index, total) {
			var trigger = (obj.menus[index].trigger) ? YAHOO.util.Dom.get(obj.menus[index].trigger) : YAHOO.util.Dom.get(obj.menus[index]);
			var menu = (obj.menus[index].id) ? YAHOO.util.Dom.get(obj.menus[index].id) : YAHOO.util.Dom.get(obj.menus[index]).lastChild;

			if (!trigger || !menu || !obj.show || !obj.hide) return;

			function enterLink(e) {
				clearMenus();
				obj.show(trigger,menu);
				YAHOO.util.Event.stopEvent(e);
				YAHOO.util.Event.on(document.body, 'mouseout', exitField);
			}

			function exitLink(e) {
				if (!e) var e = window.event;
				if (e.stopPropagation) e.stopPropagation();
				else e.cancelBubble = true;
				var relTarg = e.relatedTarget || e.toElement;
				if (relTarg && relTarg != menu && relTarg.parentNode != menu && relTarg.parentNode.parentNode != menu) {
					obj.hide(trigger, menu);
                    YAHOO.util.Event.removeListener(document.body, 'mouseout', exitField);
					return false;
				}
				YAHOO.util.Event.stopEvent(e);
			}

			function exitField(e) {
				if (!e) var e = window.event;
				var tg = (window.event) ? e.srcElement : e.target;
				if (e.stopPropagation) e.stopPropagation();
				else e.cancelBubble = true;
				//if (tg.nodeName != 'DIV' && tg.nodeName != 'UL') return;
				var reltg = (e.relatedTarget) ? e.relatedTarget : e.toElement;
				while (reltg != tg && reltg.nodeName != 'BODY' && reltg.nodeName != 'HTML') {
					if (reltg == this) return;
					reltg = reltg.parentNode
				}
				if (reltg == tg) return;
				obj.hide(trigger, menu);
				YAHOO.util.Event.removeListener(document.body, 'mouseout', exitField);
				YAHOO.util.Event.stopEvent(e);
			}
			
			function clearMenus() {
				for (var i=0; i<total; i++) {
					obj.hide(YAHOO.util.Dom.get(obj.menus[i].trigger), YAHOO.util.Dom.get(obj.menus[i].id));
				}
			}
			YAHOO.util.Event.on(trigger, 'mouseover', enterLink);
			YAHOO.util.Event.on(trigger, 'mouseout', exitLink);
			YAHOO.util.Event.on(menu, 'mouseout', exitField);
		}(oMenu, obj.menus.length));
	}
};
if (!PINT.isEditing) YAHOO.util.Event.onAvailable('menu', PINT.vs.init);