/* Simplified Chinese translation for the jQuery Timepicker Addon /
/ Written by Will Lu */
(function($) {
	$.timepicker.regional['zh-CN'] = {
		closeText: unescape('%u5173%u95ED'),
		prevText: '&#x3C;'+unescape('%u4E0A%u6708'),
		nextText: unescape('%u4E0B%u6708')+'&#x3E;',
		currentText: unescape('%u4ECA%u5929'),
		monthNames: [unescape('%u4E00%u6708'),unescape('%u4E8C%u6708'),unescape('%u4E09%u6708'),unescape('%u56DB%u6708'),unescape('%u4E94%u6708'),unescape('%u516D%u6708'),unescape(
		'%u4E03%u6708'),unescape('%u516B%u6708'),unescape('%u4E5D%u6708'),unescape('%u5341%u6708'),unescape('%u5341%u4E00%u6708'),unescape('%u5341%u4E8C%u6708')],
		monthNamesShort: [unescape('%u4E00%u6708'),unescape('%u4E8C%u6708'),unescape('%u4E09%u6708'),unescape('%u56DB%u6708'),unescape('%u4E94%u6708'),unescape('%u516D%u6708'),unescape(
		'%u4E03%u6708'),unescape('%u516B%u6708'),unescape('%u4E5D%u6708'),unescape('%u5341%u6708'),unescape('%u5341%u4E00%u6708'),unescape('%u5341%u4E8C%u6708')],
		dayNames: [unescape('%u661F%u671F%u65E5'),unescape('%u661F%u671F%u4E00'),unescape('%u661F%u671F%u4E8C'),unescape('%u661F%u671F%u4E09'),unescape('%u661F%u671F%u56DB'),unescape('%u661F%u671F%u4E94'),unescape('%u661F%u671F%u516D')],
		dayNamesShort: [unescape('%u5468%u65E5'),unescape('%u5468%u4E00'),unescape('%u5468%u4E8C'),unescape('%u5468%u4E09'),unescape('%u5468%u56DB'),unescape('%u5468%u4E94'),unescape('%u5468%u516D')],
		dayNamesMin: [unescape('%u65E5'),unescape('%u4E00'),unescape('%u4E8C'),unescape('%u4E09'),unescape('%u56DB'),unescape('%u4E94'),unescape('%u516D')],
		weekHeader: unescape('%u5468'),
		yearSuffix: unescape('%u5E74'),
		timeOnlyTitle: unescape('%u9009%u62E9%u65F6%u95F4'),
		timeText: unescape('%u65F6%u95F4'),
		hourText: unescape('%u5C0F%u65F6'),
		minuteText: unescape('%u5206%u949F'),
		secondText: unescape('%u79D2%u949F'),
		millisecText: unescape('%u5FAE%u79D2'),
		microsecText: unescape('%u5FAE%u79D2'),
		timezoneText: unescape('%u65F6%u533A'),
		currentText: unescape('%u73B0%u5728%u65F6%u95F4'),
		closeText: unescape('%u5173%u95ED'),
		timeFormat: '',
		dateFormat:'yy-mm-dd',
		changeMonth: true,
		changeYear: true,
		amNames: ['AM', 'A'],
		pmNames: ['PM', 'P'],
		isRTL: false,
		showTime:false,
		showHour:false,
		showMinute:false,
		showSecond:false
	};
	$.timepicker.setDefaults($.timepicker.regional['zh-CN']);
})(jQuery);



try{
	$("[data-datetimepicker]").each(function(index, element) {
		var the=$(this);
		var options=the.attr("data-datetimepicker")?the.attr("data-datetimepicker"):"{}";
		options=eval("(" +options+ ")");
		if(the.prev('[name="'+options.name+'"]').length<1){
			the.before('<input type="hidden" name="'+options.name+'">');
		}
		the.datetimepicker({
			onSelect:typeof(options.onSelect)!="undefined"?options.onSelect:function(){
				function datetime_to_unix(datetime){
					var tmp_datetime = datetime.replace(/:/g,'-');
					tmp_datetime = tmp_datetime.replace(/ /g,'-');
					var arr = tmp_datetime.split("-");
					var now = new Date(Date.UTC(arr[0],arr[1]-1,arr[2],-8,0,0));
					return parseInt(now.getTime()/1000);
				}
				$('[name="'+options.name+'"]').val(datetime_to_unix(the.val()));
			}
		});
	});
}catch(e){}



