$(document).ready(
	function()
	{
		bindProducten();
		if ($("body").attr("id") == 'home')
		{
			setTimeout("bindHome()", 5000);
		}
	}
);

function bindProducten()
{
	$("#content-img a").click(
		function()
		{
			$("#modalShade").show();

			$.get(	"/js/modal.php",
				{
					"paginaID"	:	$(this).attr("title")
				},
				function(data)
				{
					$("#modalGalerij").replaceWith(data);
					$("#modalGalerij").show();
				}
			);	
			return false;
		}
	);

	$("#modalGalerij .galerijnav a").live("click",
		function()
		{
			$.get(	"/js/modal.php",
				{
					"paginaID"	:	$(this).attr("rel")
				},
				function(data)
				{
					$("#modalGalerij").replaceWith(data);
					$("#modalGalerij").show();
				}
			);	

			return false;
		}
	);

	$(".btnModalClose").live("click", 
		function()
		{
			$("#modalShade").hide();
			$("#modalGalerij").hide();
		}
	);
}

var CURIMAGE = 0;

function bindHome()
{
	var link;
	var tekst;

	$("#header-image .home"+CURIMAGE).css('z-index', 10).fadeOut(2000);
	CURIMAGE++;
	if (CURIMAGE > 3)
	{
		CURIMAGE = 0;
	}
	$("#header-image .home"+CURIMAGE).css('z-index', 20).fadeIn(3000);

	switch (CURIMAGE)
	{
		case 0:	link = "/tiffany.html";
			tekst = "Bekijk onze Tiffany collectie";
			break;
		case 1:	link = "/dealers.html";
			tekst = "Bezoek onze dealers";
			break;
		case 2:	link = "/voor_horeca.html";
			tekst = "Lumilamp horeca";
			break;
		case 3:	link = "/catalogus.html";
			tekst = "Catalogus aanvragen";
			break;
		default:	link = "/tiffany.html";
			tekst = "Bekijk onze Tiffany collectie";
			break;
	}

	$("p.header-image-tekst a").fadeOut(1000,
		function()
		{
			$(this).attr("href", link).html(tekst).fadeIn(1000);
		}
	);


	setTimeout("bindHome()", 6000);
}

