function mouseover()
{
	document.getElementById("submit").style.background = "url(http://www.renetuin.nl/images/mouseover.jpg)";
}
	
function mouseout()
{
	document.getElementById("submit").style.background = "url(http://www.renetuin.nl/images/mouseout.jpg)";
}

function ClearInput(value, id){ // This calls our function ClearInput, and the two variables we will need for it to function the original value and the id.
	var input = document.getElementById(id); // Gets the input field based on its id.
		
	if(value != input.value){ // If the default value is equal to the current value.
		input.value = ''; // Empty It.
	}
	else{ // Else the value is not equal to the current input field value.
		value = input.value; // Leave it the same.
	} // End Else.
}

// Functon to Show out Busy Div
function updatePage(html){
	window.setTimeout( function(){
		$('#result').html(html);
	}, 100);
}

$(document).ready(function() {
	// $.AJAX Example Request
	$('#nav_projecten li a').live('click', function(eve){
		eve.preventDefault();
		
		var link = $(this).attr('href');
		var categorie = $('select[name=categorie]').val();
		
		var url = link.split("#");
		urlrefresh = '#'+url[1];
		
		if(url[0].length == 57)
		{
			var dest_url = url[0]+'0/'+categorie;
		}
		else{
			var dest_url = url[0]+'/'+categorie;
		}
		
		$.ajax({
			url: dest_url,
			type: "GET",
			dataType: "html",
			success: function(html) {
				updatePage(html);
			}
		});
		
		window.location=urlrefresh;
	});	
	
	$('.categorie').change(function() {
		var categorie = $('select[name=categorie]').val();
		
		$.ajax({
			url: 'main/projecten/0/'+categorie,
			type: "GET",
			dataType: "html",
			success: function(html) {
				updatePage(html);
			}
		});
		
		window.location='#top_projecten';
		
	});
	
	$('.categorielink').live('click', function(eve){
		eve.preventDefault();
		var categorielink = $(this).attr('href');
		$('select[name=categorie]').val(categorielink);
		
		$.ajax({
			url: 'main/projecten/0/'+categorielink,
			type: "GET",
			dataType: "html",
			success: function(html) {
				updatePage(html);
			}
		});
		
		window.location='#top_projecten';
		
	});
	
});
