<!--
var VBS = {};

VBS.delayCloseMenu = 500; 

VBS.init = function () {
    //add overlay
    $("Main").parentNode.insertBefore(new Element("div", {id: "Overlay2"}), $("Main"));  //used for delete from cart
    
    VBS.addKeyWord();
    VBS.addNewsLetterValidation();
	VBS.addNavigationFoldOut();
	VBS.addPopularSlider();
	VBS.addNewsRollover();
	VBS.addCartRollover();
	VBS.addSpotlightRightRollover();
	VBS.addExternalLink();
}


VBS.addNavigationFoldOut = function () {
    if(!$("MainNavigation")) { return; } 
    
    //add overlay
    var overlayDiv = new Element("div", {id: "Overlay"});
   
    $("Content").insertBefore(overlayDiv, $("Content").childNodes[0]); 
    if(Lib.IE6) {
        var overlayIFrame = new Element("iframe", {id: "OverlayIFrame"});
        $("Content").insertBefore(overlayIFrame, $("Content").childNodes[0]);
    } 
   
	// previous menu item
	//this.time; // this will be the amount of time the menu stays visible
	var closetime = null; // allows us to clear the timer function
	var overlayClosetime = null; // allows us to clear the timer function
	   
    var listItems = $$("#MainNavigation li.submenu");
    
    var hideAll = function () {
       for(var i=0; i<listItems.length; i++) {
            listItems[i].className = "submenu";
       }
    }
    
    var show = function (el) {
        el.listItem.className = "submenu active";
		el.foldOut.style.marginTop = "-" + el.hyperlink.offsetHeight + "px";
		
		clearTimeout(overlayClosetime);
		overlayDiv.style.height = $("Content").offsetHeight + "px"; 
		overlayDiv.style.display = "block";
		if(Lib.IE6) { 
		    overlayIFrame.style.height = $("Content").offsetHeight + "px"; 
		    overlayIFrame.style.display = "block"; 
	    }
		
    }
    
     var hide = function (listItem) {
        listItem.className = "submenu";                
        overlayClosetime = setTimeout(function() { overlayDiv.style.display = "none"; if(Lib.IE6) { overlayIFrame.style.display = "none";}}, 400); 	
    }
        
    for(var i=0; i<listItems.length; i++) {
        var hyperlink = listItems[i].getFirst();
        var foldout = listItems[i].getChildren()[1];
        foldout.listItem = hyperlink.listItem = listItems[i];   
		foldout.foldOut = hyperlink.foldOut = foldout;   
		foldout.hyperlink = hyperlink.hyperlink = hyperlink;     
          
        hyperlink.addEvents({
		    "mouseover": function() { clearTimeout(closetime); hideAll (); show(this); },
		    "mouseout": function() { hide(this.listItem); } 		     
	    });
	    
	    foldout.addEvents({
		   "mouseover": function() { clearTimeout(closetime);  show(this); },
		   "mouseout": function() {  
		      	var me = this.listItem; 
				closetime = setTimeout(function() { hide(me); }, 600); 	
		    }	   
	    });
    }
}

VBS.addPopularSlider = function () {
	if(!$("PopularLink")) { return; }	
	
	var mySlide = new VBS.SlidePopularMenu("PopularLinkList");
	
	if(Lib.getCookie("statuspopular") && Lib.getCookie("statuspopular") == "closed") {
		mySlide.hide();			
	}
	
	$("PopularLink").addEvent('click', function(e) {
		e = new Event(e);
		mySlide.toggle();
		e.stop();				
	});
}

//e-mail validation
VBS.addNewsLetterValidation = function () {
    if(!$("VbsNewsLetter_NewsLetterButton")) { return; }
    
    $("VbsNewsLetter_NewsLetterButton").addEvent("click", function(e) { 
        e = new Event(e);
        var email = $("VbsNewsLetter_Email").value;
        if(email.lenght ==0 || !Lib.Validation.isEmail(email)) {
            $("NewsLetterValidation").className = "active-validation";
            Lib.highlight("NewsLetterValidation");   
            e.stop();
        }
            
    });
}


VBS.addCartRollover = function () {
	if(!$("VbsCart_CartButton")) { return ; }
	
	$("VbsCart_CartButton").addEvents({
		"mouseover": function() { this.getParent().className = "cart-bottom rollover";  },
		"mouseout": function() { this.getParent().className = "cart-bottom";  } 			
	});
}


VBS.addNewsRollover = function () {
	if(!$("VbsNews1_NewsLink")) { return; } 
	
	$("VbsNews1_NewsLink").addEvents({
		"mouseover": function() { this.getParent().className = "news1-bottom rollover";  },
		"mouseout": function() { this.getParent().className = "news1-bottom";  } 
	});
}

//Region slider ===============================================================
VBS.SlidePopularMenu = Fx.Base.extend({

	options: {
		mode: 'vertical'
	},

	initialize: function(el, options){
		this.element = $(el);
		this.wrapper = new Element('div', {'styles': $extend(this.element.getStyles('margin'), {'overflow': 'hidden'})}).injectAfter(this.element).adopt(this.element);
		this.element.setStyle('margin', 0);
		this.setOptions(options);
		this.now = [];
		this.parent(this.options);
		this.open = true;
		this.addEvent('onComplete', function(){
			this.open = (this.now[0] === 0);
			setTimeout("VBS.setPopularSliderStatus()", 500);
		});
		if (window.webkit419) this.addEvent('onComplete', function(){
			if (this.open) this.element.remove().inject(this.wrapper);
		});
	},

	setNow: function(){
		for (var i = 0; i < 2; i++) this.now[i] = this.compute(this.from[i], this.to[i]);
	},

	vertical: function(){
		this.margin = 'margin-top';
		this.layout = 'height';
		this.offset = this.element.offsetHeight;
	},
/*
	horizontal: function(){
		this.margin = 'margin-left';
		this.layout = 'width';
		this.offset = this.element.offsetWidth;
	},

	
	Property: slideIn
		Slides the elements in view horizontally or vertically.

	Arguments:
		mode - (optional, string) 'horizontal' or 'vertical'; defaults to options.mode.
	*/

	slideIn: function(mode){
		this[mode || this.options.mode]();
		return this.start([this.element.getStyle(this.margin).toInt(), this.wrapper.getStyle(this.layout).toInt()], [0, this.offset]);
	},

	/*
	Property: slideOut
		Sides the elements out of view horizontally or vertically.

	Arguments:
		mode - (optional, string) 'horizontal' or 'vertical'; defaults to options.mode.
	*/

	slideOut: function(mode){
		this[mode || this.options.mode]();
		return this.start([this.element.getStyle(this.margin).toInt(), this.wrapper.getStyle(this.layout).toInt()], [-this.offset, 0]);
	},

	/*
	Property: hide
		Hides the element without a transition.

	Arguments:
		mode - (optional, string) 'horizontal' or 'vertical'; defaults to options.mode.
	*/

	hide: function(mode){
		this[mode || this.options.mode]();
		this.open = false;
		VBS.setPopularSliderStatus(true);
		return this.set([-this.offset, 0]);		
	},

	/*
	Property: show
		Shows the element without a transition.

	Arguments:
		mode - (optional, string) 'horizontal' or 'vertical'; defaults to options.mode.
	*/

	show: function(mode){
		this[mode || this.options.mode]();
		this.open = true;
		return this.set([0, this.offset]);
	},

	/*
	Property: toggle
		Slides in or Out the element, depending on its state

	Arguments:
		mode - (optional, string) 'horizontal' or 'vertical'; defaults to options.mode.

	*/

	toggle: function(mode){
		if (this.wrapper.offsetHeight == 0 || this.wrapper.offsetWidth == 0) return this.slideIn(mode);
		return this.slideOut(mode);
	},

	increase: function(){
		this.element.setStyle(this.margin, this.now[0] + this.options.unit);
		this.wrapper.setStyle(this.layout, this.now[1] + this.options.unit);
	}

});

VBS.setPopularSliderStatus = function (doNotSetCookie) {
	var popLink = $('PopularLink');
	
	if (popLink.className.length == 0) { 
		popLink.className = "closed"; 
		popLink.parentNode.parentNode.className = "closed"; 
		Lib.setCookie("statuspopular", "closed", 30, '/', '', '' ); 
		
	}
	else { 
		popLink.className = ""; 
		popLink.parentNode.parentNode.className = ""; 
		Lib.deleteCookie("statuspopular", '/', ''); 

	}			
}

VBS.addSpotlightRightRollover = function () {
    if(!$$("#SubContent div.spotlight-sub")[0]) { return; } 
    
    var spotlightLinks = $$("div.spotlight-sub a");
    
    for(var i=0; i<spotlightLinks.length; i++) {
        var li =  spotlightLinks[i].getParent(); 
        li.navigationLink = spotlightLinks[i];
        
        li.addEvents({
            "mouseover": function() { 
                if(this.className.indexOf("last") !=-1) { this.className = this.className + "rollover"; }
                else { this.className = this.className + " rollover"; }
             },
		    "mouseout": function() {  
		         if(this.className.indexOf("last") !=-1) { this.className = this.className.replace("rollover", "" ); }
		         else { this.className = this.className.replace(" rollover", "" ); }
		      },  
		    "click": function() { location.href = this.navigationLink; } 
	    });
    } 
}

VBS.addExternalLink = function () {
	var externalLinks = $$("a");
	for(var i=0; i < externalLinks.length; i++) {
		if(externalLinks[i].type == "new-window") {
			externalLinks[i].addEvent("click", function(e) {
				e = new Event(e);
				window.open(this.href); 
				e.stop();				
			});
		}
	}
}

VBS.addKeyWord = function () {
	var keywordSeachBox = $("VbsSearch_Keywords");
	
	if(keywordSeachBox.value == "-- zoekterm --") {
		keywordSeachBox.className = "text toned-down";
	}
	
	
	keywordSeachBox.addEvents({
            "focus": function() {  
		        if(this.value== "-- zoekterm --") {
					this.value="";
					this.className = "text";
				}
		      },
			  "blur": function() {  
		        if(this.value.length == 0) {
					this.value="-- zoekterm --";
					this.className = "text toned-down";
				}
		      }
	    });
	
	var groups = $("VbsSearch_Groups");
	groups.textbox = keywordSeachBox;
	groups.addEvents({
            "focus": function() {  
		        if(groups.textbox.value== "-- zoekterm --") {
					groups.textbox.value="";
					groups.textbox.className = "text";
				}
		      }
	    });
	
}

VBS.showConfirm = function (deleteLink) {
   var  overlay = $("Overlay2");
   overlay.style.height = $("Main").offsetHeight-5 + "px"; 
   overlay.style.display = "block";
		
	if(Lib.IE6) { 
	    $("OverlayIFrame").style.display = "block";
	     $("OverlayIFrame").style.height = $("Main").offsetHeight-5 + "px"; 
    }
    
    var hyperlink = $(deleteLink.id);	
    var div = hyperlink.getNext();
	div.className = "validation-delete";
	
	div.getElements('a')[0].addEvent("click", function(e) {
				VBS.hideConfirm(hyperlink);
			});

}

VBS.hideConfirm = function (hideLink) {
    $("Overlay2").style.display = "none"; 
    if(Lib.IE6) { $("OverlayIFrame").style.display = "none";}
	
	var hyperlink = $(hideLink.id);	
	hyperlink.getParent().getParent().getParent().className = "validation-delete hide"; 
}

window.addEvent('domready', function(){ VBS.init(); }); 
	

-->


