Index: /branches/version-2_12-multilang/data/Smarty/templates/admin/mail/index.tpl
===================================================================
--- /branches/version-2_12-multilang/data/Smarty/templates/admin/mail/index.tpl	(revision 22230)
+++ /branches/version-2_12-multilang/data/Smarty/templates/admin/mail/index.tpl	(revision 22392)
@@ -54,5 +54,14 @@
 	
 	$(function(){
-		
+		var dateFormat = $.datepicker.regional['<!--{$smarty.const.LANG_CODE}-->'].dateFormat;
+
+        <!--{if $arrForm.search_b_start_year.value != '' && $arrForm.search_b_start_month.value != '' && $arrForm.search_b_start_day.value != ''}-->
+        var search_b_start_year  = '<!--{$arrForm.search_b_start_year.value|h}-->';
+        var search_b_start_month = '<!--{$arrForm.search_b_start_month.value|h}-->';
+        var search_b_start_day   = '<!--{$arrForm.search_b_start_day.value|h}-->';
+        var search_b_start_ymd = $.datepicker.formatDate(dateFormat, new Date(search_b_start_year, search_b_start_month - 1, search_b_start_day));
+        $("#datepickercustomersearch_b_start").val(search_b_start_ymd);
+        <!--{/if}-->
+        
 		$( "#datepickercustomersearch_b_start" ).datepicker({
 		beforeShowDay: function(date) {
@@ -67,5 +76,8 @@
 		,changeYear: 'true'
 		,onSelect: function(dateText, inst){
-			setDatecustomersearch_b_start(dateText);
+            var year  = inst.selectedYear;
+            var month = inst.selectedMonth + 1;
+            var day   = inst.selectedDay;
+            setDatecustomersearch_b_start(year + '/' + month + '/' + day);
 		},
 		showButtonPanel: true,
@@ -74,9 +86,34 @@
 		});
 		
-		$("#datepickercustomersearch_b_start").blur( function() {
-			var dateText = $(this).val();
-			setDatecustomersearch_b_start(dateText);
-		});
-		
+		$("#datepickercustomersearch_b_start").change( function() {
+            var dateText   = $(this).val();
+            var dateFormat = $.datepicker.regional['<!--{$smarty.const.LANG_CODE}-->'].dateFormat;
+            // console.log(dateText);
+            // console.log(dateFormat);
+            var date;
+            var year  = '';
+            var month = '';
+            var day   = '';
+            try {
+                date = $.datepicker.parseDate(dateFormat, dateText);
+                year  = date.getFullYear();
+                month = date.getMonth() + 1;
+                day   = date.getDay();
+            } catch (e) {
+                // console.log(e);
+                // clear date text
+                $(this).val('');
+            }
+            setDatecustomersearch_b_start(year + '/' + month + '/' + day);
+		});
+
+        <!--{if $arrForm.search_b_end_year.value != '' && $arrForm.search_b_end_month.value != '' && $arrForm.search_b_end_day.value != ''}-->
+        var search_b_end_year  = '<!--{$arrForm.search_b_end_year.value|h}-->';
+        var search_b_end_month = '<!--{$arrForm.search_b_end_month.value|h}-->';
+        var search_b_end_day   = '<!--{$arrForm.search_b_end_day.value|h}-->';
+        var search_b_end_ymd = $.datepicker.formatDate(dateFormat, new Date(search_b_end_year, search_b_end_month - 1, search_b_end_day));
+        $("#datepickercustomersearch_b_end").val(search_b_end_ymd);
+        <!--{/if}-->
+
 		$( "#datepickercustomersearch_b_end" ).datepicker({
 		beforeShowDay: function(date) {
@@ -91,5 +128,8 @@
 		,changeYear: 'true'
 		,onSelect: function(dateText, inst){
-			setDatecustomersearch_b_end(dateText);
+            var year  = inst.selectedYear;
+            var month = inst.selectedMonth + 1;
+            var day   = inst.selectedDay;
+            setDatecustomersearch_b_end(year + '/' + month + '/' + day);
 		},
 		showButtonPanel: true,
@@ -98,9 +138,34 @@
 		});
 		
-		$("#datepickercustomersearch_b_end").blur( function() {
-			var dateText = $(this).val();
-			setDatecustomersearch_b_end(dateText);
-		});
-		
+		$("#datepickercustomersearch_b_end").change( function() {
+            var dateText   = $(this).val();
+            var dateFormat = $.datepicker.regional['<!--{$smarty.const.LANG_CODE}-->'].dateFormat;
+            // console.log(dateText);
+            // console.log(dateFormat);
+            var date;
+            var year  = '';
+            var month = '';
+            var day   = '';
+            try {
+                date = $.datepicker.parseDate(dateFormat, dateText);
+                year  = date.getFullYear();
+                month = date.getMonth() + 1;
+                day   = date.getDay();
+            } catch (e) {
+                // console.log(e);
+                // clear date text
+                $(this).val('');
+            }
+            setDatecustomersearch_b_end(year + '/' + month + '/' + day);
+		});
+
+        <!--{if $arrForm.search_start_year.value != '' && $arrForm.search_start_month.value != '' && $arrForm.search_start_day.value != ''}-->
+        var search_start_year  = '<!--{$arrForm.search_start_year.value|h}-->';
+        var search_start_month = '<!--{$arrForm.search_start_month.value|h}-->';
+        var search_start_day   = '<!--{$arrForm.search_start_day.value|h}-->';
+        var search_start_day_ymd = $.datepicker.formatDate(dateFormat, new Date(search_start_year, search_start_month - 1, search_start_day));
+        $("#datepickercustomersearch_start").val(search_start_day_ymd);
+        <!--{/if}-->
+        
 		$( "#datepickercustomersearch_start" ).datepicker({
 		beforeShowDay: function(date) {
@@ -115,5 +180,8 @@
 		,changeYear: 'true'
 		,onSelect: function(dateText, inst){
-			setDatecustomersearch_start(dateText);
+            var year  = inst.selectedYear;
+            var month = inst.selectedMonth + 1;
+            var day   = inst.selectedDay;
+            setDatecustomersearch_start(year + '/' + month + '/' + day);
 		},
 		showButtonPanel: true,
@@ -122,9 +190,34 @@
 		});
 		
-		$("#datepickercustomersearch_start").blur( function() {
-			var dateText = $(this).val();
-			setDatecustomersearch_start(dateText);
-		});
-		
+		$("#datepickercustomersearch_start").change( function() {
+            var dateText   = $(this).val();
+            var dateFormat = $.datepicker.regional['<!--{$smarty.const.LANG_CODE}-->'].dateFormat;
+            // console.log(dateText);
+            // console.log(dateFormat);
+            var date;
+            var year  = '';
+            var month = '';
+            var day   = '';
+            try {
+                date = $.datepicker.parseDate(dateFormat, dateText);
+                year  = date.getFullYear();
+                month = date.getMonth() + 1;
+                day   = date.getDay();
+            } catch (e) {
+                // console.log(e);
+                // clear date text
+                $(this).val('');
+            }
+            setDatecustomersearch_start(year + '/' + month + '/' + day);
+		});
+
+        <!--{if $arrForm.search_end_year.value != '' && $arrForm.search_end_month.value != '' && $arrForm.search_end_day.value != ''}-->
+        var search_end_year  = '<!--{$arrForm.search_end_year.value|h}-->';
+        var search_end_month = '<!--{$arrForm.search_end_month.value|h}-->';
+        var search_end_day   = '<!--{$arrForm.search_end_day.value|h}-->';
+        var search_end_ymd = $.datepicker.formatDate(dateFormat, new Date(search_end_year, search_end_month - 1, search_end_day));
+        $("#datepickercustomersearch_end").val(search_end_ymd);
+        <!--{/if}-->
+        
 		$( "#datepickercustomersearch_end" ).datepicker({
 		beforeShowDay: function(date) {
@@ -139,5 +232,8 @@
 		,changeYear: 'true'
 		,onSelect: function(dateText, inst){
-			setDatecustomersearch_end(dateText);
+            var year  = inst.selectedYear;
+            var month = inst.selectedMonth + 1;
+            var day   = inst.selectedDay;
+            setDatecustomersearch_end(year + '/' + month + '/' + day);
 		},
 		showButtonPanel: true,
@@ -146,9 +242,34 @@
 		});
 		
-		$("#datepickercustomersearch_end").blur( function() {
-			var dateText = $(this).val();
-			setDatecustomersearch_end(dateText);
-		});
-		
+		$("#datepickercustomersearch_end").change( function() {
+            var dateText   = $(this).val();
+            var dateFormat = $.datepicker.regional['<!--{$smarty.const.LANG_CODE}-->'].dateFormat;
+            // console.log(dateText);
+            // console.log(dateFormat);
+            var date;
+            var year  = '';
+            var month = '';
+            var day   = '';
+            try {
+                date = $.datepicker.parseDate(dateFormat, dateText);
+                year  = date.getFullYear();
+                month = date.getMonth() + 1;
+                day   = date.getDay();
+            } catch (e) {
+                // console.log(e);
+                // clear date text
+                $(this).val('');
+            }
+            setDatecustomersearch_end(year + '/' + month + '/' + day);
+		});
+
+        <!--{if $arrForm.search_buy_start_year.value != '' && $arrForm.search_buy_start_month.value != '' && $arrForm.search_buy_start_day.value != ''}-->
+        var search_buy_start_year  = '<!--{$arrForm.search_buy_start_year.value|h}-->';
+        var search_buy_start_month = '<!--{$arrForm.search_buy_start_month.value|h}-->';
+        var search_buy_start_day   = '<!--{$arrForm.search_buy_start_day.value|h}-->';
+        var search_buy_start_ymd = $.datepicker.formatDate(dateFormat, new Date(search_buy_start_year, search_buy_start_month - 1, search_buy_start_day));
+        $("#datepickercustomersearch_buy_start").val(search_buy_start_ymd);
+        <!--{/if}-->
+        
 		$( "#datepickercustomersearch_buy_start" ).datepicker({
 		beforeShowDay: function(date) {
@@ -163,5 +284,8 @@
 		,changeYear: 'true'
 		,onSelect: function(dateText, inst){
-			setDatecustomersearch_buy_start(dateText);
+            var year  = inst.selectedYear;
+            var month = inst.selectedMonth + 1;
+            var day   = inst.selectedDay;
+            setDatecustomersearch_buy_start(year + '/' + month + '/' + day);
 		},
 		showButtonPanel: true,
@@ -170,9 +294,34 @@
 		});
 		
-		$("#datepickercustomersearch_buy_start").blur( function() {
-			var dateText = $(this).val();
-			setDatecustomersearch_buy_start(dateText);
-		});
-		
+		$("#datepickercustomersearch_buy_start").change( function() {
+            var dateText   = $(this).val();
+            var dateFormat = $.datepicker.regional['<!--{$smarty.const.LANG_CODE}-->'].dateFormat;
+            // console.log(dateText);
+            // console.log(dateFormat);
+            var date;
+            var year  = '';
+            var month = '';
+            var day   = '';
+            try {
+                date = $.datepicker.parseDate(dateFormat, dateText);
+                year  = date.getFullYear();
+                month = date.getMonth() + 1;
+                day   = date.getDay();
+            } catch (e) {
+                // console.log(e);
+                // clear date text
+                $(this).val('');
+            }
+            setDatecustomersearch_buy_start(year + '/' + month + '/' + day);
+		});
+
+        <!--{if $arrForm.search_buy_end_year.value != '' && $arrForm.search_buy_end_month.value != '' && $arrForm.search_buy_end_day.value != ''}-->
+        var search_buy_end_year  = '<!--{$arrForm.search_buy_end_year.value|h}-->';
+        var search_buy_end_month = '<!--{$arrForm.search_buy_end_month.value|h}-->';
+        var search_buy_end_day   = '<!--{$arrForm.search_buy_end_day.value|h}-->';
+        var search_buy_end_ymd = $.datepicker.formatDate(dateFormat, new Date(search_buy_end_year, search_buy_end_month - 1, search_buy_end_day));
+        $("#datepickercustomersearch_buy_end").val(search_buy_end_ymd);
+        <!--{/if}-->
+
 		$( "#datepickercustomersearch_buy_end" ).datepicker({
 		beforeShowDay: function(date) {
@@ -187,5 +336,8 @@
 		,changeYear: 'true'
 		,onSelect: function(dateText, inst){
-			setDatecustomersearch_buy_end(dateText);
+            var year  = inst.selectedYear;
+            var month = inst.selectedMonth + 1;
+            var day   = inst.selectedDay;
+            setDatecustomersearch_buy_end(year + '/' + month + '/' + day);
 		},
 		showButtonPanel: true,
@@ -194,7 +346,24 @@
 		});
 		
-		$("#datepickercustomersearch_buy_end").blur( function() {
-			var dateText = $(this).val();
-			setDatecustomersearch_buy_end(dateText);
+		$("#datepickercustomersearch_buy_end").change( function() {
+            var dateText   = $(this).val();
+            var dateFormat = $.datepicker.regional['<!--{$smarty.const.LANG_CODE}-->'].dateFormat;
+            // console.log(dateText);
+            // console.log(dateFormat);
+            var date;
+            var year  = '';
+            var month = '';
+            var day   = '';
+            try {
+                date = $.datepicker.parseDate(dateFormat, dateText);
+                year  = date.getFullYear();
+                month = date.getMonth() + 1;
+                day   = date.getDay();
+            } catch (e) {
+                // console.log(e);
+                // clear date text
+                $(this).val('');
+            }
+            setDatecustomersearch_buy_end(year + '/' + month + '/' + day);
 		});
 		
Index: /branches/version-2_12-multilang/data/Smarty/templates/admin/customer/index.tpl
===================================================================
--- /branches/version-2_12-multilang/data/Smarty/templates/admin/customer/index.tpl	(revision 22391)
+++ /branches/version-2_12-multilang/data/Smarty/templates/admin/customer/index.tpl	(revision 22392)
@@ -346,5 +346,5 @@
 		});
 		
-		$("#datepickercustomersearch_buy_end").blur( function() {
+		$("#datepickercustomersearch_buy_end").change( function() {
             var dateText   = $(this).val();
             var dateFormat = $.datepicker.regional['<!--{$smarty.const.LANG_CODE}-->'].dateFormat;
