﻿
	jQuery(function() {
	
		var dpCfg = {
		
			showOtherMonths : true,
			maxDate         : new Date(),
			showAnim        : (jQuery.browser.msie) ? 'show' : 'fadeIn',
			duration        : (jQuery.browser.msie) ? '' : 'normal',
			yearRange       : ((new Date()).getFullYear() - 5) + ':' + ((new Date()).getFullYear() + 0),
			onClose         : function() { jQuery('#frDate').blur(); },
			closeAtTop      : false,
			changeFirstDay  : false
		};
		
		// "Am" und "Bis"-Inputs mit Datepicker belegen.
		jQuery('#frDate').datepicker(dpCfg);
		
		jQuery('#frDate').bind('focus blur keydown keyup', function() {
				
			var tmpArray = this.value.split('.');
			
			var tmpDay = tmpArray[0] || '';
			var tmpMonth = tmpArray[1] || '';
			var tmpYear = tmpArray[2] || '';
			
			tmpDay = (tmpDay.toLowerCase() == 'TT') ? '' : tmpDay ;
			tmpMonth = (tmpMonth.toLowerCase() == 'MM') ? '' : tmpMonth ;
			tmpYear = (tmpYear.toLowerCase() == 'JJJJ') ? '' : tmpYear ;
			
			jQuery('#frWrReviewForm #tag').get(0).value = (tmpDay.length == 1) ? '0' + tmpDay : tmpDay;
			jQuery('#frWrReviewForm #monat').get(0).value = (tmpMonth.length == 1) ? '0' + tmpMonth : tmpMonth;
			jQuery('#frWrReviewForm #jahr').get(0).value = tmpYear;											
		});
	});
