
function carousel_initCallback(carousel) {
    jQuery('.topnavigation a').bind('mousemove', function() {
    	var number = jQuery(this).attr('id').split('_');
        carousel.scroll(jQuery.jcarousel.intval(number[1] - 1));
        return false;
    });
    
    jQuery('#carousel-next').bind('click', function() {
        carousel.next();
        return false;
    });

    jQuery('#carousel-prev').bind('click', function() {
        carousel.prev();
        return false;
    });
    
    
};

$(document).ready(function() {
	
	// menu vast zetten
	
	$('.topnavigation').stickyScroll({ mode: 'manual' });
	
	// popup
	
	anchorid	= '';
	counter		= 0;
	
	$("a[rel='collection']").each(function(index)
	{
		if ($(this).attr('id') != anchorid)
		{
			anchorid 	= $(this).attr('id');
			counter 	= counter + 1;
			$(this).colorbox({inline:true, href:"#inline_" + counter});
			
			if ($(this).attr('id') == 'a_' + dress)
			{
				$(this).colorbox({open:true, inline:true, href:"#inline_" + counter});
			}
		}
	});
	$(".new").click(function()
	{
		$(this).colorbox();
	});


	// menu hover
	
	if (!jQuery("#node_01").hasClass('active'))
	{
		jQuery("#img_1").bind('mouseover', function() { $("#img_1").attr('src', '/images/merken/logo_pure_a.png'); });
		jQuery("#img_1").bind('mouseout', function() { $("#img_1").attr('src', '/images/merken/logo_pure.png'); });
	}
	
	if (!jQuery("#node_02").hasClass('active'))
	{
		jQuery("#img_2").bind('mouseover', function() { $("#img_2").attr('src', '/images/merken/logo_hip_a.png'); });
		jQuery("#img_2").bind('mouseout', function() { $("#img_2").attr('src', '/images/merken/logo_hip.png'); });
	}
	
	if (!jQuery("#node_03").hasClass('active'))
	{
		jQuery("#img_3").bind('mouseover', function() { $("#img_3").attr('src', '/images/merken/logo_romantisch_a.png'); });
		jQuery("#img_3").bind('mouseout', function() { $("#img_3").attr('src', '/images/merken/logo_romantisch.png'); });
	}
	
	if (!jQuery("#node_04").hasClass('active'))
	{
		jQuery("#img_4").bind('mouseover', function() { $("#img_4").attr('src', '/images/merken/logo_gekledejaponnen_a.png'); });
		jQuery("#img_4").bind('mouseout', function() { $("#img_4").attr('src', '/images/merken/logo_gekledejaponnen.png'); });
	}
	
	if (!jQuery("#node_05").hasClass('active'))
	{
		jQuery("#img_5").bind('mouseover', function() { $("#img_5").attr('src', '/images/merken/logo_simply_a.png'); });
		jQuery("#img_5").bind('mouseout', function() { $("#img_5").attr('src', '/images/merken/logo_simply.png'); });
	}
	
	if (!jQuery("#node_06").hasClass('active'))
	{
		jQuery("#img_6").bind('mouseover', function() { $("#img_6").attr('src', '/images/merken/logo_lovelybridal_a.png'); });
		jQuery("#img_6").bind('mouseout', function() { $("#img_6").attr('src', '/images/merken/logo_lovelybridal.png'); });
	}
	
	if (!jQuery("#node_07").hasClass('active'))
	{
		jQuery("#img_7").bind('mouseover', function() { $("#img_7").attr('src', '/images/merken/logo_pretty_a.png'); });
		jQuery("#img_7").bind('mouseout', function() { $("#img_7").attr('src', '/images/merken/logo_pretty.png'); });
	}
	
	if (!jQuery("#node_08").hasClass('active'))
	{
		jQuery("#img_8").bind('mouseover', function() { $("#img_8").attr('src', '/images/merken/logo_eigencollectie_a.png'); });
		jQuery("#img_8").bind('mouseout', function() { $("#img_8").attr('src', '/images/merken/logo_eigencollectie.png'); });
	}

	jQuery("#carousel").jcarousel({
		scroll: 1,
		wrap: 'circular',
		auto: 4,
		animation: 400,
		easing: 'swing',
		initCallback: carousel_initCallback,
		buttonNextHTML: null,
		buttonPrevHTML: null
	});
	
	if ($('.afspraak').length)
	{
		$('.afspraak').datePicker();
		
		jQuery(".afspraak").bind('change', function() 
		{ 
			if ($('.afspraak').val() != '')
			{
				var datum = $('.afspraak').val();
				
				splitdate = datum.split("-");
				var newdate = splitdate[1] + '/' + splitdate[0] + '/' + splitdate[2];
					
				var dtm = new Date(newdate);
		  		var day = dtm.getDayName().toLowerCase();
		  		
		  		$('#day').val(day); 
		  		$("#time").removeOption(/./);
		  		
		  		if (day == 'zondag' || day == 'maandag')
		  		{
		  			//niks doen	
		  			var myOptions = {
						"Geen afspraak mogelijk" : "Geen afspraak mogelijk"
					};
		  		}
		  		else
		  		{
					var myOptions = {
						"9.30 uur" : "9.30 uur",
						"13.30 uur" : "13.30 uur"
					};
		  		}
				
				if (day == 'zaterdag')
		  		{
					var myOptions = {
						"9.30 uur" : "9.30 uur",
						"12.00 uur" : "12.00 uur",
						"14.30 uur" : "14.30 uur"
					};
				}
				
				$("#time").addOption(myOptions, false);
			}
		});	
	}
});


