// JavaScript Document
var oldText = '';

$(document).ready(function() {
	$("a[rel='lightbox']").colorbox();
	$(".youtube").colorbox({iframe:true, width:560, height:340});
	$('.product_a').parent().next().hide();
	$('.product_a, .product_b').click(function() { 
		$(this).parent().next().slideToggle('600');
		if ($(this).css('background-image').match (/product_down/))
			$(this).css( { 'background-image': 'url(/images/product_right.gif)', 'color': '#998f84' } );
		else
			$(this).css( { 'background-image': 'url(/images/product_down.gif)', 'color': '#63574a' } );
	});
	
	$(".product_get").click(function() {
		$(this).hide();
		$("#shop_product_info").load ('/ajax.php', {cmd: 'geefAdd', product: $(this).attr('rel') }, function() { 
			$("#shop_product_info").show();
		});
	});
	
	$(".product_delete").click(function() {
		$.get("/ajax.php", { cmd: 'deleteProduct', product_id: $(this).attr('rel') }, function (data) {
			$("#total_prijs").html(data);
		});
		$(this).parent().parent().fadeOut(300);
	});
	
	$("#next_to1").click(function() { 
		location.href = '/' + $("body").attr('class') + '/winkelwagen/shop';
	});
	
	$("#next_to2").click(function() { 
		location.href = '/' + $("body").attr('class') + '/winkelwagen/stap-2';
	});
	
	$("#herbereken").click(function() {
		javascript:document.forms['aantallen'].submit();
		//location.href = '/' + $("body").attr('class') + '/winkelwagen';
	});
	
	$('.forgot_emailaddress').focus(function()
	{
		if($(this).val() == 'mijn e-mailadres' || $(this).val() == 'my e-mailaddress')
		{
			oldText = $(this).val();
			$(this).val('')
		}
	}).blur(function()
	{
		if($(this).val() == '')
		{
			$(this).val(oldText);
		}
	});
	
	$("div#bigfoto img:first").css('display', 'block').attr('rel', 'active');
	
	if ($("div#bigfoto img").length > 1)
		setInterval(doBigFoto, 3000);
	
});
	
function doBigFoto () {
	
	var elm = $("div#bigfoto img:[rel=active]");
	
	elm.attr('rel', '').fadeOut(600);
	if (elm.next().length == 0)
		elm.siblings('img:first').fadeIn(600).attr('rel', 'active');
	else
		elm.next().fadeIn(600).attr('rel', 'active');
	
}

