(function($){
	var initLayout = function() {
////////////////////////////////////////////////////////////////////////////////////////////
		$('.inputDate1').DatePicker({
			format:'m/d/Y',
				date: '2008-07-31',
			current: $('#inputDate1').val(),
			starts: 1,
			position: 'right',
			onBeforeShow: function(){
				$('#inputDate1').DatePickerSetDate($('#inputDate1').val(), true);
			},
			onChange: function(formated, dates){
				$('#inputDate1').val(formated);
				if ($('#closeOnSelect input').attr('checked')) {
					$('#inputDate1').DatePickerHide();
				}
			}
		});
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		$('.inputDate2').DatePicker({
			format:'d-m-y',
			date: '2008-07-31',
			//current: $('#inputDate2').val(),
			starts: 1,
			position: 'bottom',
			onBeforeShow: function(){
				$('#inputDate1').DatePickerSetDate($('#inputDate2').val(), true);
			},
			onChange: function(formated, dates){
				$('#inputDate2').val(formated);
				$('#inputDate2').DatePickerHide();
			}
		});
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		$('.inputDate3').DatePicker({
			format:'d-m-y',
				date: '2008-07-31',
		//	current: $('#inputDate3').val(),
			starts: 1,
			position: 'bottom',
			onBeforeShow: function(){
				$('#inputDate1').DatePickerSetDate($('#inputDate3').val(), true);
			},
			onChange: function(formated, dates){
				$('#inputDate3').val(formated);
				if ($('#closeOnSelect input').attr('checked')) {
					$('#inputDate3').DatePickerHide();
				}
			}
		});
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		$('.inputDate4').DatePicker({
			format:'m/d/Y',
				date: '2008-07-31',
			current: $('#inputDate4').val(),
			starts: 1,
			position: 'right',
			onBeforeShow: function(){
				$('#inputDate1').DatePickerSetDate($('#inputDate4').val(), true);
			},
			onChange: function(formated, dates){
				$('#inputDate4').val(formated);
				if ($('#closeOnSelect input').attr('checked')) {
					$('#inputDate4').DatePickerHide();
				}
			}
		});
				$('.inputDate5').DatePicker({
			format:'m/d/Y',
				date: '2008-07-31',
			current: $('#inputDate4').val(),
			starts: 1,
			position: 'right',
			onBeforeShow: function(){
				$('#inputDate1').DatePickerSetDate($('#inputDate5').val(), true);
			},
			onChange: function(formated, dates){
				$('#inputDate5').val(formated);
				if ($('#closeOnSelect input').attr('checked')) {
					$('#inputDate5').DatePickerHide();
				}
			}
		});
						$('.inputDate6').DatePicker({
			format:'m/d/Y',
				date: '2008-07-31',
			current: $('#inputDate4').val(),
			starts: 1,
			position: 'right',
			onBeforeShow: function(){
				$('#inputDate1').DatePickerSetDate($('#inputDate6').val(), true);
			},
			onChange: function(formated, dates){
				$('#inputDate6').val(formated);
				if ($('#closeOnSelect input').attr('checked')) {
					$('#inputDate6').DatePickerHide();
				}
			}
		});
								$('.inputDate7').DatePicker({
			format:'m/d/Y',
				date: '2008-07-31',
			current: $('#inputDate7').val(),
			starts: 1,
			position: 'right',
			onBeforeShow: function(){
				$('#inputDate1').DatePickerSetDate($('#inputDate7').val(), true);
			},
			onChange: function(formated, dates){
				$('#inputDate7').val(formated);
				if ($('#closeOnSelect input').attr('checked')) {
					$('#inputDate7').DatePickerHide();
				}
			}
		});
										$('.inputDate8').DatePicker({
			format:'m/d/Y',
				date: '2008-07-31',
			current: $('#inputDate4').val(),
			starts: 1,
			position: 'right',
			onBeforeShow: function(){
				$('#inputDate1').DatePickerSetDate($('#inputDate8').val(), true);
			},
			onChange: function(formated, dates){
				$('#inputDate8').val(formated);
				if ($('#closeOnSelect input').attr('checked')) {
					$('#inputDate8').DatePickerHide();
				}
			}
		});
$('.inputDate9').DatePicker({
			format:'m/d/Y',
				date: '2008-07-31',
			current: $('#inputDate4').val(),
			starts: 1,
			position: 'right',
			onBeforeShow: function(){
				$('#inputDate1').DatePickerSetDate($('#inputDate9').val(), true);
			},
			onChange: function(formated, dates){
				$('#inputDate9').val(formated);
				if ($('#closeOnSelect input').attr('checked')) {
					$('#inputDate9').DatePickerHide();
				}
			}
		});
$('.inputDate10').DatePicker({
			format:'m/d/Y',
				date: '2008-07-31',
			current: $('#inputDate4').val(),
			starts: 1,
			position: 'right',
			onBeforeShow: function(){
				$('#inputDate1').DatePickerSetDate($('#inputDate10').val(), true);
			},
			onChange: function(formated, dates){
				$('#inputDate10').val(formated);
				if ($('#closeOnSelect input').attr('checked')) {
					$('#inputDate10').DatePickerHide();
				}
			}
		});
$('.inputDate11').DatePicker({
			format:'m/d/Y',
				date: '2008-07-31',
			current: $('#inputDate4').val(),
			starts: 1,
			position: 'right',
			onBeforeShow: function(){
				$('#inputDate1').DatePickerSetDate($('#inputDate11').val(), true);
			},
			onChange: function(formated, dates){
				$('#inputDate11').val(formated);
				if ($('#closeOnSelect input').attr('checked')) {
					$('#inputDate11').DatePickerHide();
				}
			}
		});
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		var now3 = new Date();
		now3.addDays(-4);
		var now4 = new Date()
		$('#widgetCalendar').DatePicker({
			flat: true,
			format: 'd B, Y',
			date: [new Date(now3), new Date(now4)],
			calendars: 3,
			mode: 'range',
			starts: 1,
			onChange: function(formated) {
				$('#widgetField span').get(0).innerHTML = formated.join(' &divide; ');
			}
		});
		var state = false;
		$('#widgetField>a').bind('click', function(){
			$('#widgetCalendar').stop().animate({height: state ? 0 : $('#widgetCalendar div.datepicker').get(0).offsetHeight}, 500);
			state = !state;
			return false;
		});
		$('#widgetCalendar div.datepicker').css('position', 'absolute');
	};
	
	EYE.register(initLayout, 'init');
})(jQuery)
