function checkContactForm()
{
	if(jQuery.trim($("#contact_name").val()).length < 2)
	{
		alert('Naam is een verplicht veld');
		$("#contact_name").focus();
		return false;
	}
	
	if(jQuery.trim($("#contact_company").val()).length < 2)
	{
		alert('Bedrijfsnaam is een verplicht veld');
		$("#contact_company").focus();
		return false;
	}
	
	if(
		(jQuery.trim($("#contact_email").val()).length < 6) ||
		($("#contact_email").val().indexOf(".") == -1 ) ||
		($("#contact_email").val().indexOf("@") == -1 )
	)
	{
		alert('E-mail adres is een verplicht veld');
		$("#contact_email").focus();
		return false;
	}
	
	if(jQuery.trim($("#contact_message").val()).length < 6)
	{
		alert('Aanvraag is een verplicht veld');
		$("#contact_message").focus();
		return false;
	}
	
	$("#contact_send").val("True");
	
	return true;
}

function loadBackground(image)
{
	//alert("loadBackground(" + image + ")");
	var img = new Image();
	
	// wrap our new image in jQuery, then:
	$(img)
	// once the image has loaded, execute this code
		.load(function () {
			// set the image hidden by default    
			$(this).hide();
			
			// with the holding div #loader, apply:
			$("#Bg")
				// remove the loading class (so no background spinner), 
				//.removeClass('loading')
				// then insert our image
				.append(this);
				
				// fade our image in to create a nice effect
				$(this).fadeIn(500);
		})
		
		// if there was an error loading the image, react accordingly
		.error(function () {
			// notify the user that the image could not be loaded
		})
	
		// *finally*, set the src attribute of the new image to our image
		.attr('src', image);
}

function appendOnLoadAlert(str_msg)
{
	var appendOnLoadAlert_oldOnload = (window.onload) ? window.onload : function () { };
	window.onload = function () {appendOnLoadAlert_oldOnload();alert(str_msg);}
}

var str_prev = null;
function toggleItem(str_item)
{
	if (str_prev != null)
	{
		$(str_prev).toggle();
	}
	if (str_prev == str_item)
	{
		str_prev = null;
	}
	else
	{
		$(str_item).toggle();
		str_prev = str_item;
	}

	return false;
}

var swap_items = [];
function swap(item, text)
{
	var element = $('#'+item);
	
	element.find('.content').slideToggle(400, function()
	{
		element.toggleClass('open');
	});
	
	return false;
}

Cufon.replace('h1, h2, ol#menu li a, a.btnHome, div#solutions a');

$('document').ready(function(){

	$('a[rel=external]').live('click', function(){
		if ($(this).attr('target') == '')
		{
			$(this).attr('target','_blank');
		}
	});

	$('div#referenties').tinycarousel({duration:500});

	$('#homeLayers').bg();

});



