/* Turkish initialisation for the jQuery UI date picker plugin. */
/* Written by Izzet Emre Erkan (kara@karalamalar.net). */
jQuery(function($){
	$.datepicker.regional['tr'] = {
		closeText: 'kapat',
		prevText: '&#x3c;geri',
		nextText: 'ileri&#x3e',
		currentText: 'bugün',
		monthNames: ['Ocak','Subat','Mart','Nisan','Mayis','Haziran',
		'Temmuz','Agustos','Eylül','Ekim','Kasim','Aralik'],
		monthNamesShort: ['Ocak','Subat','Mart','Nisan','Mayis','Haziran',//['Oca','Sub','Mar','Nis','May','Haz',
		'Temmuz','Agustos','Eylül','Ekim','Kasim','Aralik'],//'Tem','Agu','Eyl','Eki','Kas','Ara'],
		dayNames: ['Pazar','Pazartesi','Sali','Çarsamba','Persembe','Cuma','Cumartesi'],
		dayNamesShort: ['Pz','Pt','Sa','Ça','Pe','Cu','Ct'],
		dayNamesMin: ['Pz','Pt','Sa','Ça','Pe','Cu','Ct'],
		dateFormat: 'dd.mm.yy', firstDay: 1,
		isRTL: false};
});
/* German initialisation for the jQuery UI date picker plugin. */
/* Written by Milian Wolff (mail@milianw.de). */
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: ['Januar','Februar','März','April','Mai','Juni',//['Jan','Feb','Mär','Apr','Mai','Jun',
		'Juli','August','September','Oktober','November','Dezember'],//'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'],
		dateFormat: 'dd.mm.yy', firstDay: 1,
		isRTL: false};
});

$(document).ready(function() {
	month31 = [1,3,5,7,8,10,10];
	$('#day1').selectbox({  className: 'jquery-selectbox2'});
	$('#month1').selectbox({  className: 'jquery-selectbox2'}).bind('change', function(){	
		month31_de = false;														   
		for (key in month31) {
		  if (month31[key] == $(this).val()) {month31_de = true;}
		}
		if(month31_de) $(".sinputday1 .item-30").css("display","none");
		else $(".sinputday1 .item-30").css("display","block");
	});
	$('#year1').selectbox({  className: 'jquery-selectbox2'});
	$('#hour1').selectbox({  className: 'jquery-selectbox2'});
	$('#min1').selectbox({  className: 'jquery-selectbox2'});
	$('#age').selectbox({  className: 'jquery-selectbox'});
	

	$.datepicker.setDefaults($.extend({}, $.datepicker.regional[sd]));
	//Date1
	$('#date1').datepicker({ 
    beforeShow: readSelected, onSelect: updateSelected, 
    minDate: new Date(2009, 1 - 1, 1), maxDate: new Date(2018, 12 - 1, 31), numberOfMonths: 2,
    showOn: 'both', buttonImageOnly: true, buttonImage: theme+'css/images/calendar.png'}); 
	function readSelected() {  $('#date1').val(     $('#day1').val()+'/'+$('#month1').val()+'/'+$('#year1').val());return{};}   
	function updateSelected(date) {  
		sp_date = date.split(".");
		$('#day1').val(parseInt(sp_date[0]));  $('#month1').val(parseInt(sp_date[1]));  $('#year1').val(parseInt(sp_date[2])); 
		$("#day1").parents('.jquery-selectbox2').unselectbox();		$('#day1').selectbox({  className: 'jquery-selectbox2'});
		$('#month1').parents('.jquery-selectbox2').unselectbox();	$('#month1').selectbox({  className: 'jquery-selectbox2'});
		$('#year1').parents('.jquery-selectbox2').unselectbox();	$('#year1').selectbox({  className: 'jquery-selectbox2'});
		}
	////Date1
	

	$('#day2').selectbox({  className: 'jquery-selectbox2'});
	$('#month2').selectbox({  className: 'jquery-selectbox2'}).bind('change', function(){	
		month31_de = false;														   
		for (key in month31) {
		  if (month31[key] == $(this).val()) {month31_de = true;}
		}
		if(month31_de) $(".sinputday2 .item-30").css("display","none");
		else $(".sinputday2 .item-30").css("display","block");
	});
	$('#year2').selectbox({  className: 'jquery-selectbox2'});
	$('#hour2').selectbox({  className: 'jquery-selectbox2'});
	$('#min2').selectbox({  className: 'jquery-selectbox2'});
	
	//Date1
	$('#date2').datepicker({ 
    beforeShow: readSelected2, onSelect: updateSelected2, 
    minDate: new Date(2009, 1 - 1, 1), maxDate: new Date(2018, 12 - 1, 31), numberOfMonths: 2,
    showOn: 'both', buttonImageOnly: true, buttonImage: theme+'css/images/calendar.png'}); 
	function readSelected2() {  $('#date2').val(     $('#day2').val()+'/'+$('#month2').val()+'/'+$('#year2').val());return{};}   
	function updateSelected2(date) {  
		sp_date = date.split(".");
		$('#day2').val(parseInt(sp_date[0]));  $('#month2').val(parseInt(sp_date[1]));  $('#year2').val(parseInt(sp_date[2])); 
		$("#day2").parents('.jquery-selectbox2').unselectbox();		$('#day2').selectbox({  className: 'jquery-selectbox2'});
		$('#month2').parents('.jquery-selectbox2').unselectbox();	$('#month2').selectbox({  className: 'jquery-selectbox2'});
		$('#year2').parents('.jquery-selectbox2').unselectbox();	$('#year2').selectbox({  className: 'jquery-selectbox2'});
		}
	////Date1
});