jQuery.validator.addMethod("defaultInvalid", function(value, element) 
{
    if (element.value == element.defaultValue)
    {
        return false;
    }
    return true;
});

$(document).ready(function()
{
	$("a[rel='lightbox']").colorbox(
    {
        iframe: true,
        width: 650,
        height: '80%'
    });
    
    $('.innerfade').innerfade({
		speed: 750,
		timeout: 5000,
		type: 'random'
	});
    
    $(".validateForm").validate({
        errorPlacement: function(error, element) {
			error.prependTo( element.parent().next() );
		},
		// set this class to error-labels to indicate valid fields
		success: function(label) {
			// set &nbsp; as text for IE
			label.html("&nbsp;").addClass("checked");
		}
    });
    
    $(".clearInput").focus(function(srcc)
    {
        if ($(this).val() == this.defaultValue)
        {
            $(this).val("");
        }
    });
    
    $(".clearInput").blur(function()
    {
        if ($(this).val() == "")
        {
            $(this).val(this.defaultValue);
        }
    });
    
    $(".clearInput").blur();
    
    $("#passwordText").focus(function()
    {
        if ($(this).val() == this.defaultValue)
        {
            $(this).hide();
            $('#password').val('').show().focus();
        }
    });
    
    $("#password").blur(function()
    {
        
        if ($(this).val() == "")
        {
            $(this).hide();
            $('#passwordText').val('Wachtwoord').show();
        }
    });
});

function reloadCaptcha()
{
	document.getElementById('captcha').src = document.getElementById('captcha').src+ '?' +new Date();
}
