Cufon.replace('.slogan');

$(document).ready(function(){
	$.fn.colorbox.settings.transition = "fade";
	$.fn.colorbox.settings.bgOpacity = "0.9";
	$.fn.colorbox.settings.contentCurrent = "afbeelding {current} van {total}";
	$("#productfotos a").colorbox( { closeOnOverlayClick: true } );
});

$(function()
{
	
	/* --------------------------------	*/
	/* menu						 		*/
	/* --------------------------------	*/
	var menu = {};
	
	menu.laatstGeopend = null;
	menu.timeoutTime = 2000;
	menu.timeout = null;
	
	menu.init = function()
	{
		/* hover op li */
		$("#menu>li").hover(
			function() 
			{ 		
				// als laatstegeopend dezelfde is als de huidige, dan de timeout verwijderen
				if($(this).hasClass("hover"))
				{
					clearTimeout(menu.timeout);
				}
				// nieuwe uitschuiven
				else
				{
					$("#menu>li>ul").hide();
					$("#menu>li").not(this).removeClass("hover");
					
					$(this).addClass("hover");	
					$(">ul", this).hide().fadeIn(300);
					
					// selectbox in <ie7 verwijderen
					if($.browser.msie && $.browser.version < 7)	{
						$("select").css({ visibility: 'hidden' });	
					}
				}
			},
			function() 
			{ 
				// timeout zetten om na x aantal sec te sluiten
				menu.laatstGeopend = this;
				menu.timeout = setTimeout(function()
				{
					$(menu.laatstGeopend).removeClass("hover"); 
					
					// selectbox in <ie7 tonen
					if($.browser.msie && $.browser.version < 7)	{
						$("select").css({ visibility: 'visible' });	
					}
				}, menu.timeoutTime);
			}
		);
	}

	menu.init();

	// sifr
	if(typeof sIFR == "function")
	{
		// This is the preferred "named argument" syntax
		sIFR.replaceElement(named({sSelector:".categorieen h2, #zijbalk_home h2", sFlashSrc: config.submap +"fla/helvetica.swf", sColor:"#000000", sWmode:'transparent'}));
	}

	// default text in zoekbox
	$(".zoeken #txt_zoeken").inputDefaultText({ default_txt:"Zoek op trefwoord of artikel" });
	
	$("form#frm_zoeken").submit( function()
	{
		if ( $(".zoeken #txt_zoeken").val() == "Zoek op trefwoord of artikel" || $(".zoeken #txt_zoeken").val() == "" )
		{
			$(".zoeken #txt_zoeken").focus();
			alert("U heeft geen zoekterm ingevoerd.");
			return false;
		}
	});

});
