jQuery(document).ready(function(){
	
	// Shadowbox
	Shadowbox.init({
		language: 'nl',
	    players:  ['img', 'html', 'iframe', 'qt', 'wmp', 'swf', 'flv'], 
	    onClose: function(){ window.location.reload(); }
	});
	
	// Right nav slider
	$('#right_nav h2 a').click (function () {
		
		// Fetch clicked ul
		list = $(this).parent().next('ul');
		
		// Check for active class
		if ($(list).css('display') == 'none') {
			
			// Hide the active
			$('#right_nav ul').slideUp(500, function () {
				
				// Show the current one
				$(list).slideDown(800);
			});
			
		}
	});
	
	/**
	 * Multiselects
	 */
	
	$('div.multiselect a').bind('click', function () {
		
		// Hide all other
		$('div.multiselect .options').not($(this).parent().children('.options')).hide();
		
		// Toggle
		$(this).parent().children('.options').toggle();
	});
	
	// Close button
	$('div.multiselect .options a').bind('click', function () { $(this).parent().hide(); });
	
	/**
	 * My account
	 */
	
	$('input.addtype').bind('change', function () { $('input#switch').val($(this).attr('name')); $('input#action').val('switch'); $('form#personal').submit(); });
	$('input[name="custype"], input#same_delivery_address, select.country').bind('change', function () { $('input#action').val('switch'); $('form#personal').submit(); });
	$('div#select-delivery a#select').bind('click', function () { $('input#action').val('load'); $('form#personal').submit(); });
	
	/**
	 * Global
	 */
	
	//$('#right_nav ul').css('display', 'none').eq(0).css('display', 'block');
	
	// Dialogs
 	$("a#dialog").fancybox({
 		
 		'frameWidth': 300,
 		'frameHeight': 85,
 		'overlayShow': false
 	});
 	
 	// Newsletter dialog
 	$('a#newsletter').fancybox({'framewidth': 400, 'frameHeight': 200, 'overlayShow': false, 'hideOnContentClick': false});
 	
	$("a#dialog").trigger('click');
})
