/* JS Document Oh Espresso
   (c) 2009 Nicholas Bosseler 
   <nicholas@oskard.be>
*/

/*************************************
 DOC READY
/*************************************/
$(document).ready(function(){

	// LANG SELECT MOUSEOVER
	$(function() {
		$("#langselect img.nl, #langselect img.fr").hover(function() {
			$(this).attr("src", $(this).attr("src").split("_gray").join("_red"));
		},
		function() {
			$(this).stop(true,false);
			$(this).attr("src", $(this).attr("src").split("_red").join("_gray"));
		});
	});
	
	// BLENDS MOUSEOVER
	$(function() {
		$("div.blends a img.blend").hover(function() {
			$(this).attr("src", $(this).attr("src").split("-thumb").join("-thumb-sel"));
		},
		function() {
			$(this).stop(true,false);
			$(this).attr("src", $(this).attr("src").split("-thumb-sel").join("-thumb"));
		});
	});
	
	// OTHER MOUSEOVER
	$(function() {
		$("img.registreer, img.online_shop, img.terug, img.verder").hover(function() {
			$(this).attr("src", $(this).attr("src").split("idle").join("over"));
		},
		function() {
			$(this).stop(true,false);
			$(this).attr("src", $(this).attr("src").split("over").join("idle"));
		});
	});

	// HIDE SERIENUMMER DIV (IN FORM)
	$('div.serienummer').css('display','none'); // show-hide in niceforms.js
	
	// FANCYBOX IMG ENLARGE
	$("a#inline").fancybox({
		'hideOnContentClick': false,
		'overlayShow': true,
		'overlayOpacity': 0.8,
		'frameWidth': 570,
		'frameHeight': 400,
	});
	
	// FANCYBOX IMG ENLARGE
	$("a.enlarge").fancybox({
		'overlayShow': true,
		'overlayOpacity': 0.8,
		//'zoomSpeedIn': 500,
		//'zoomSpeedOut': 500
	});
	
	// FANCYBOX ACTIE NL
	$("a#launch_action_nl").fancybox({
		'overlayShow': true,
		'overlayOpacity': 0.8,
		'frameWidth': 560,
		'frameHeight': 315,
		'hideOnContentClick': false,
		'callbackOnClose': function()
		{
			history.go(-1); // terug naar pagina waar je op zat (fixt ook de bg-bug)
		}
	}).trigger('click');
	
	// FANCYBOX ACTIE FR (10px hoger dan nl)
	$("a#launch_action_fr").fancybox({
		'overlayShow': true,
		'overlayOpacity': 0.8,
		'frameWidth': 560,
		'frameHeight': 325,
		'hideOnContentClick': false,
		'callbackOnClose': function()
		{
			history.go(-1); // terug naar pagina waar je op zat (fixt ook de bg-bug)
		}
	}).trigger('click');

}); // end doc ready

/*************************************
 CHANGE PRODUCT SHOT COLOR
/*************************************/
function changeColor(color, lang)
{
	$('#oh-espresso').attr('src','../img/espresso_'+color+lang+'.jpg');
	$('#oh-espresso').parent().attr('href','../img/espresso_'+color+'_large.jpg');
}


