$().ready(function() {
	$('#coda-slider-1').codaSlider();
	
	
	
	
	
		//BEGIN LOGIN FORM ONFOCUS
	$('#content input[type="text"], #content input[type="file"], #content textarea').addClass("idleField");
	
	$('#content input[type="text"], #content input[type="file"], #content input[type="password"], textarea').focus(function() {
		$(this).removeClass("idleField").addClass("focusField");
	    if (this.value == this.defaultValue){ 
	    	this.value = '';
		}
		if(this.value != this.defaultValue){
			this.select();
		}
	});
	
	$('#content input[type="text"], #content input[type="file"], #content textarea').blur(function() {
		$(this).removeClass("focusField").addClass("idleField");
	    if ($.trim(this.value) == ''){
	    	this.value = (this.defaultValue ? this.defaultValue : '');
		}
	});
	
	$('#content input[type="password"], #content input[type="file"], #content textarea').blur(function() {
		$(this).removeClass("focusField").addClass("idleField");
	    if ($.trim(this.value) == ''){
	    	this.value = (this.defaultValue ? this.defaultValue : '');
		}
	});
	
	
	//END LOGIN FORM ONFOCUS
	
	
	if( $('.routeDescription').length > 0) {	
	
		$('.routeDescription').parent().prepend('Postcode: <input class="routeInput" type="text" maxlength=6 size=6 /> ');
		
		$('.routeDescription').click(function(){
		
			var zipcode = $(this).parent().find('input').val();
						
			var pattern = /([1-9]){1}([0-9]){3}([a-zA-Z]){2}/;
			
			if(zipcode.match(pattern)) {
				
				var href = $(this).attr('href');
		
				urlArray = href.split('saddr=');
				
				var nwHref = urlArray[0] + 'saddr=' + zipcode + urlArray[1];
				
				$(this).attr({'href': nwHref});
				
			} else {
			
				alert('U heeft een ongeldige postcode ingevoerd.');
				
				return false;
				
			}
			
		}); 
		
	}
	
	$("input[type=file]").filestyle({ 
	    image: "/themes/consultancy/images/upload.png",
	    imageheight : 22,
	    imagewidth : 82,
	    width : 220
	 	});
		
		
		/*SECONDARAY NAVIGATION SELECTED CSS CLASS*/
	$("#header-nav ul li a").each(function() {
		var hreflink = $(this).attr("href");
		if (hreflink.toLowerCase()==location.href.toLowerCase()) {
		$(this).parent("li").addClass("selected");
	}
	});	
		
	
});

