// stop BackgroundImageCache voor IE				
try	{ document.execCommand("BackgroundImageCache", false, true); } catch(e) { }

	Cufon.replace('h1, h2.kop, h3, #occasion h2, #iframe h2, #inloggen h4, #kds-mijn-gegevens h2, #kds-overzicht h2');

	Cufon.replace('#breadcrumbs li', {hover:true}	);



function bepaalAgendaDatum(datum_url)
{
	$.get(submap + "/agenda/" + datum_url + "/?" + Math.random(),
		  function(data){
			window.location.reload();
  		});
}

/**
 * variabelen met jQuery met een $ beginnen!!!
 */
$(function()
{
	/* submenu effectje en timeout */
	Menu.apply("#menu > li");

		
	$(".agenda td, \
            #merken li, \
            #occasions li, \
            #menu ul li, \
            .occasion-van-de-week").hoverClick();

	// default value bij formulieren
	$("input:text[title], textarea[title]").each(function() {
		$(this).defaultvalue( $(this).attr("title") );
	});

	$('.kalender td').hover(
		function()
		{
			$('.agenda-items', this).show();
		},
		function()
		{
			$('.agenda-items', this).hide();
		}
	);

	//effectje op merken menu links
	$('.merken li').each(
		function()
		{
			$(this).append("<span class=\"effectje\"><a><" + "/" + "a><" + "\/span>");
			$('.effectje a', this).addClass('link').attr('href', $(this).children('a').attr('href')).attr('title', $(this).children('a').attr('title') );
			$('.effectje a.link', this).width($(this).width());
			$('.effectje a.link', this).height($(this).height());

            $('.effectje a.link', this).click(function(e)
            {
				object_link = $(this).parents('li').find('> a');
                object_link.trigger('click');

				if( object_link.hasClass('opencolorbox'))
				{
	               	e.preventDefault();
				}
            })

			//animatie toevoegen
			$(this).not('.actief').hover(
				function()
				{
					$('.effectje', this).stop().animate({top:'0'}, 400)
				}
				,
				function()
				{
					$('.effectje', this).stop().animate({top:'-90px'}, 400)
				}
			)
		}
	);

});

function controleer_login(formulier)
{
    if ($("#auth_form_cookie").val() == "")
    {
        if( $("#inloggen #form_auth_gebruikersnaam").val().length < 2 || $("#inloggen #form_wachtwoord").val().length < 2)
        {
            $("#inloggen").append('<div id="inloggen-melding"/>');
            $("#inloggen-melding").html("Vul svp een gebruikersnaam en wachtwoord in.");
            $("#inloggen-melding").fadeIn(200);

            setTimeout( function()
                    {
                    $("#inloggen-melding").fadeOut(500);
                    }, 4000);

            return false
        }
        else
        {
            $("#inloggen-melding").css({display:'none'});
            return true;
        }
    }
}

function controleerWachtwoordHerstellen()
{
	if( $("#inloggen #emailadres").val().length < 5)
	{
		$("#inloggen").append('<div id="inloggen-melding"/>');
		$("#inloggen-melding").html("Vul uw e-mailadres in.");
		$("#inloggen-melding").fadeIn(200);

		setTimeout( function()
				{
				$("#inloggen-melding").fadeOut(500);
				}, 4000);

		return false;
	}
	else
	{
		$("#inloggen-melding").css({display:'none'});
		return true;
	}
}

