/*
 * Renzo's Delicatessen
 *
 * JavaScript
 * renzos-effects.js
 *
 * Copyright 2009, Marganza (www.marganza.nl)
 */

$(document).ready(function ()
{
	/**
	 * Module panels
	 */
	
	// Click events
	$("#moduleCatering .header").click(function() { window.location.href = "/catering/"; });
	$("#moduleShop .header").click(function()     { window.location.href = "/winkel/"; });
	$("#moduleWebshop .header").click(function()  { window.location.href = "/webshop/"; });
	
	// Mouse over events
	moduleBindMouseOverEvt("Catering");
	moduleBindMouseOverEvt("Shop");
	moduleBindMouseOverEvt("Webshop");
	
	$(".button").mouseover(function() { $(this).attr("src", "/images/arrowButtonOver.gif") });
	$(".button").mouseout(function()  { $(this).attr("src", "/images/arrowButton.gif") });
	
	$(".buttonR").mouseover(function() { $(this).attr("src", "/images/refreshButtonOver.gif") });
	$(".buttonR").mouseout(function()  { $(this).attr("src", "/images/refreshButton.gif") });

	$(".buttonA").mouseover(function() { $(this).attr("src", "/images/addButtonOver.gif") });
	$(".buttonA").mouseout(function()  { $(this).attr("src", "/images/addButton.gif") });

	$(".buttonD").mouseover(function() { $(this).attr("src", "/images/deleteButtonOver.gif") });
	$(".buttonD").mouseout(function()  { $(this).attr("src", "/images/deleteButton.gif") });
	
	$(".blockOverlay").mouseover(function()
		{
			var blockId = $(this).attr("id");
			    blockId = blockId.substring(5);			
			$("#hlBlock" + blockId).css("backgroundImage", "url('/images/transOverlay40.png')");
			$("#button"  + blockId).attr("src", "/images/arrowButtonOver.gif")										
		});
	$(".blockOverlay").mouseout(function() 
		{
			var blockId = $(this).attr("id");
			    blockId = blockId.substring(5);			
			$("#hlBlock" + blockId).css("backgroundImage", "url('/images/transOverlay65.png')");
			$("#button"  + blockId).attr("src", "/images/arrowButton.gif")			
		});		

    // Overlay window: recipes
    $("a#recipes").fancybox({
        'padding' : 0,
        'overlayColor' : '#000000',
        'overlayOpacity' : 0.6,
        'width' : 850,
        'height' : 450
    });        
    
    // Overlay window: product information
    $(".shopProducts a").fancybox({
        'padding' : 0,
        'overlayColor' : '#000000',
        'overlayOpacity' : 0.6,
        'width' : 640,
        'height' : 560,
        'type' : 'iframe'
    });      
});

function moduleBindMouseOverEvt(key)
{
	$("#module" + key + " .header").mouseover(function() { $("#arrowButton" + key).attr("src", "/images/arrowButtonOver.gif") });
	$("#module" + key + " .header").mouseout(function()  { $("#arrowButton" + key).attr("src", "/images/arrowButton.gif") });	
}
