jQuery(function($){
	$.datepicker.regional['de'] = {
		closeText: 'schließen',
		prevText: '&#x3c;zurück',
		nextText: 'Vor&#x3e;',
		currentText: 'heute',
		monthNames: ['Januar','Februar','März','April','Mai','Juni',
		'Juli','August','September','Oktober','November','Dezember'],
		monthNamesShort: ['Jan','Feb','Mär','Apr','Mai','Jun',
		'Jul','Aug','Sep','Okt','Nov','Dez'],
		dayNames: ['Sonntag','Montag','Dienstag','Mittwoch','Donnerstag','Freitag','Samstag'],
		dayNamesShort: ['So','Mo','Di','Mi','Do','Fr','Sa'],
		dayNamesMin: ['So','Mo','Di','Mi','Do','Fr','Sa'],
		weekHeader: 'Wo',
		dateFormat: 'dd.mm.yy',
		firstDay: 1,
		isRTL: false,
		showMonthAfterYear: false,
		yearSuffix: ''};
	$.datepicker.setDefaults($.datepicker.regional['de']);
});

$().ready(function() {
	$('.contact-form').find('.inputfield').each(function(){
		$(this).val($(this).attr('title'));
	});
	$('.contact-form').find('.inputfield').focus(function(){
		if($(this).attr('title') == $(this).val()){
			$(this).val('');
		}
	}).blur(function(){
		if($(this).val().length < 1){
			$(this).val($(this).attr('title'));
		}
	});
	
	$('#datepicker').datepicker({
		// showOn: "button",
		buttonImage: "../images/calendar.jpg",
		buttonImageOnly: true,
		showOn: "both",
		beforeShowDay: function(date){
			var today = new Date();
			today.setDate(today.getDate());
			
			var checking = new Date(date);
			var array = [];
			// && checking.getDay() != 6 && checking.getDay() != 0
			if(checking > today ) {
				array[0] = true;
				return array;
			} else {
				array[0] = false;
				return array;
			}
		},
		
		onSelect: function(){
			$('#datepicker').focus();
			$('#datepicker').blur();
			
		}
	});
});
