Index: /branches/version-2_13-dev/html/js/eccube.js
===================================================================
--- /branches/version-2_13-dev/html/js/eccube.js	(revision 23064)
+++ /branches/version-2_13-dev/html/js/eccube.js	(revision 23065)
@@ -21,166 +21,4 @@
  */
 
-$(function() {
-    // 規格1選択時
-    $('select[name=classcategory_id1]')
-        .change(function() {
-            var $form = $(this).parents('form');
-            var product_id = $form.find('input[name=product_id]').val();
-            var $sele1 = $(this);
-            var $sele2 = $form.find('select[name=classcategory_id2]');
-
-            // 規格1のみの場合
-            if (!$sele2.length) {
-                checkStock($form, product_id, $sele1.val(), '0');
-                // 規格2ありの場合
-            } else {
-                setClassCategories($form, product_id, $sele1, $sele2);
-            }
-        });
-
-    // 規格2選択時
-    $('select[name=classcategory_id2]')
-        .change(function() {
-            var $form = $(this).parents('form');
-            var product_id = $form.find('input[name=product_id]').val();
-            var $sele1 = $form.find('select[name=classcategory_id1]');
-            var $sele2 = $(this);
-            checkStock($form, product_id, $sele1.val(), $sele2.val());
-        });
-});
-/**
- * 規格2のプルダウンを設定する.
- */
-function setClassCategories($form, product_id, $sele1, $sele2, selected_id2) {
-    if ($sele1 && $sele1.length) {
-        var classcat_id1 = $sele1.val() ? $sele1.val() : '';
-        if ($sele2 && $sele2.length) {
-            // 規格2の選択肢をクリア
-            $sele2.children().remove();
-
-            var classcat2;
-
-            // 商品一覧時
-            if (typeof productsClassCategories != 'undefined') {
-                classcat2 = productsClassCategories[product_id][classcat_id1];
-            }
-            // 詳細表示時
-            else {
-                classcat2 = classCategories[classcat_id1];
-            }
-
-            // 規格2の要素を設定
-            for (var key in classcat2) {
-                var id = classcat2[key]['classcategory_id2'];
-                var name = classcat2[key]['name'];
-                var option = $('<option />').val(id ? id : '').text(name);
-                if (id == selected_id2) {
-                    option.attr('selected', true);
-                }
-                $sele2.append(option);
-            }
-            checkStock($form, product_id, $sele1.val() ? $sele1.val() : '__unselected2',
-                $sele2.val() ? $sele2.val() : '');
-        }
-    }
-}
-
-/**
- * 規格の選択状態に応じて, フィールドを設定する.
- */
-function checkStock($form, product_id, classcat_id1, classcat_id2) {
-
-    classcat_id2 = classcat_id2 ? classcat_id2 : '';
-
-    var classcat2;
-
-    // 商品一覧時
-    if (typeof productsClassCategories != 'undefined') {
-        classcat2 = productsClassCategories[product_id][classcat_id1]['#' + classcat_id2];
-    }
-    // 詳細表示時
-    else {
-        classcat2 = classCategories[classcat_id1]['#' + classcat_id2];
-    }
-
-    // 商品コード
-    var $product_code_default = $form.find('[id^=product_code_default]');
-    var $product_code_dynamic = $form.find('[id^=product_code_dynamic]');
-    if (classcat2
-        && typeof classcat2['product_code'] != 'undefined') {
-        $product_code_default.hide();
-        $product_code_dynamic.show();
-        $product_code_dynamic.text(classcat2['product_code']);
-    } else {
-        $product_code_default.show();
-        $product_code_dynamic.hide();
-    }
-
-    // 在庫(品切れ)
-    var $cartbtn_default = $form.find('[id^=cartbtn_default]');
-    var $cartbtn_dynamic = $form.find('[id^=cartbtn_dynamic]');
-    if (classcat2 && classcat2['stock_find'] === false) {
-
-        $cartbtn_dynamic.text('申し訳ございませんが、只今品切れ中です。').show();
-        $cartbtn_default.hide();
-    } else {
-        $cartbtn_dynamic.hide();
-        $cartbtn_default.show();
-    }
-
-    // 通常価格
-    var $price01_default = $form.find('[id^=price01_default]');
-    var $price01_dynamic = $form.find('[id^=price01_dynamic]');
-    if (classcat2
-        && typeof classcat2['price01'] != 'undefined'
-        && String(classcat2['price01']).length >= 1) {
-
-        $price01_dynamic.text(classcat2['price01']).show();
-        $price01_default.hide();
-    } else {
-        $price01_dynamic.hide();
-        $price01_default.show();
-    }
-
-    // 販売価格
-    var $price02_default = $form.find('[id^=price02_default]');
-    var $price02_dynamic = $form.find('[id^=price02_dynamic]');
-    if (classcat2
-        && typeof classcat2['price02'] != 'undefined'
-        && String(classcat2['price02']).length >= 1) {
-
-        $price02_dynamic.text(classcat2['price02']).show();
-        $price02_default.hide();
-    } else {
-        $price02_dynamic.hide();
-        $price02_default.show();
-    }
-
-    // ポイント
-    var $point_default = $form.find('[id^=point_default]');
-    var $point_dynamic = $form.find('[id^=point_dynamic]');
-    if (classcat2
-        && typeof classcat2['point'] != 'undefined'
-        && String(classcat2['point']).length >= 1) {
-
-        $point_dynamic.text(classcat2['point']).show();
-        $point_default.hide();
-    } else {
-        $point_dynamic.hide();
-        $point_default.show();
-    }
-
-    // 商品規格
-    var $product_class_id_dynamic = $form.find('[id^=product_class_id]');
-    if (classcat2
-        && typeof classcat2['product_class_id'] != 'undefined'
-        && String(classcat2['product_class_id']).length >= 1) {
-
-        $product_class_id_dynamic.val(classcat2['product_class_id']);
-    } else {
-        $product_class_id_dynamic.val('');
-    }
-}
-
 (function( window, undefined ){
 
@@ -520,4 +358,138 @@
     };
 
+    /**
+     * 規格2のプルダウンを設定する.
+     */
+    common.setClassCategories = function($form, product_id, $sele1, $sele2, selected_id2) {
+        if ($sele1 && $sele1.length) {
+            var classcat_id1 = $sele1.val() ? $sele1.val() : '';
+            if ($sele2 && $sele2.length) {
+                // 規格2の選択肢をクリア
+                $sele2.children().remove();
+
+                var classcat2;
+
+                // 商品一覧時
+                if (eccube.productsClassCategories !== undefined) {
+                    classcat2 = eccube.productsClassCategories[product_id][classcat_id1];
+                }
+                // 詳細表示時
+                else {
+                    classcat2 = eccube.classCategories[classcat_id1];
+                }
+
+                // 規格2の要素を設定
+                for (var key in classcat2) {
+                    var id = classcat2[key]['classcategory_id2'];
+                    var name = classcat2[key]['name'];
+                    var option = $('<option />').val(id ? id : '').text(name);
+                    if (id == selected_id2) {
+                        option.attr('selected', true);
+                    }
+                    $sele2.append(option);
+                }
+                eccube.common.checkStock($form, product_id, $sele1.val() ? $sele1.val() : '__unselected2',
+                    $sele2.val() ? $sele2.val() : '');
+            }
+        }
+    };
+
+    /**
+     * 規格の選択状態に応じて, フィールドを設定する.
+     */
+    common.checkStock = function($form, product_id, classcat_id1, classcat_id2) {
+
+        classcat_id2 = classcat_id2 ? classcat_id2 : '';
+
+        var classcat2;
+
+        // 商品一覧時
+        if (typeof eccube.productsClassCategories != 'undefined') {
+            classcat2 = eccube.productsClassCategories[product_id][classcat_id1]['#' + classcat_id2];
+        }
+        // 詳細表示時
+        else {
+            classcat2 = eccube.classCategories[classcat_id1]['#' + classcat_id2];
+        }
+
+        // 商品コード
+        var $product_code_default = $form.find('[id^=product_code_default]');
+        var $product_code_dynamic = $form.find('[id^=product_code_dynamic]');
+        if (classcat2
+            && typeof classcat2['product_code'] != 'undefined') {
+            $product_code_default.hide();
+            $product_code_dynamic.show();
+            $product_code_dynamic.text(classcat2['product_code']);
+        } else {
+            $product_code_default.show();
+            $product_code_dynamic.hide();
+        }
+
+        // 在庫(品切れ)
+        var $cartbtn_default = $form.find('[id^=cartbtn_default]');
+        var $cartbtn_dynamic = $form.find('[id^=cartbtn_dynamic]');
+        if (classcat2 && classcat2['stock_find'] === false) {
+
+            $cartbtn_dynamic.text('申し訳ございませんが、只今品切れ中です。').show();
+            $cartbtn_default.hide();
+        } else {
+            $cartbtn_dynamic.hide();
+            $cartbtn_default.show();
+        }
+
+        // 通常価格
+        var $price01_default = $form.find('[id^=price01_default]');
+        var $price01_dynamic = $form.find('[id^=price01_dynamic]');
+        if (classcat2
+            && typeof classcat2['price01'] != 'undefined'
+            && String(classcat2['price01']).length >= 1) {
+
+            $price01_dynamic.text(classcat2['price01']).show();
+            $price01_default.hide();
+        } else {
+            $price01_dynamic.hide();
+            $price01_default.show();
+        }
+
+        // 販売価格
+        var $price02_default = $form.find('[id^=price02_default]');
+        var $price02_dynamic = $form.find('[id^=price02_dynamic]');
+        if (classcat2
+            && typeof classcat2['price02'] != 'undefined'
+            && String(classcat2['price02']).length >= 1) {
+
+            $price02_dynamic.text(classcat2['price02']).show();
+            $price02_default.hide();
+        } else {
+            $price02_dynamic.hide();
+            $price02_default.show();
+        }
+
+        // ポイント
+        var $point_default = $form.find('[id^=point_default]');
+        var $point_dynamic = $form.find('[id^=point_dynamic]');
+        if (classcat2
+            && typeof classcat2['point'] != 'undefined'
+            && String(classcat2['point']).length >= 1) {
+
+            $point_dynamic.text(classcat2['point']).show();
+            $point_default.hide();
+        } else {
+            $point_dynamic.hide();
+            $point_default.show();
+        }
+
+        // 商品規格
+        var $product_class_id_dynamic = $form.find('[id^=product_class_id]');
+        if (classcat2
+            && typeof classcat2['product_class_id'] != 'undefined'
+            && String(classcat2['product_class_id']).length >= 1) {
+
+            $product_class_id_dynamic.val(classcat2['product_class_id']);
+        } else {
+            $product_class_id_dynamic.val('');
+        }
+    };
+
     // 名前空間の重複を防ぐ
     if (window.eccube === undefined) {
@@ -526,4 +498,35 @@
     // グローバルに使用できるようにする
     window.eccube.common = common;
+
+    /**
+     * Initialize.
+     */
+    $(function() {
+        // 規格1選択時
+        $('select[name=classcategory_id1]')
+            .change(function() {
+                var $form = $(this).parents('form');
+                var product_id = $form.find('input[name=product_id]').val();
+                var $sele1 = $(this);
+                var $sele2 = $form.find('select[name=classcategory_id2]');
+
+                // 規格1のみの場合
+                if (!$sele2.length) {
+                    eccube.common.checkStock($form, product_id, $sele1.val(), '0');
+                    // 規格2ありの場合
+                } else {
+                    eccube.common.setClassCategories($form, product_id, $sele1, $sele2);
+                }
+            });
+
+        // 規格2選択時
+        $('select[name=classcategory_id2]')
+            .change(function() {
+                var $form = $(this).parents('form');
+                var product_id = $form.find('input[name=product_id]').val();
+                var $sele1 = $form.find('select[name=classcategory_id1]');
+                var $sele2 = $(this);
+                eccube.common.checkStock($form, product_id, $sele1.val(), $sele2.val());
+            });
+    });
 })(window);
-
Index: /branches/version-2_13-dev/data/Smarty/templates/admin/order/product_select.tpl
===================================================================
--- /branches/version-2_13-dev/data/Smarty/templates/admin/order/product_select.tpl	(revision 23063)
+++ /branches/version-2_13-dev/data/Smarty/templates/admin/order/product_select.tpl	(revision 23065)
@@ -60,9 +60,9 @@
 
         if(!class1_id){
-            err_text = productsClassCategories[product_id]['__unselected2']['#0']['stock_find'] ? '' : '只今品切れ中です';
+            err_text = eccube.productsClassCategories[product_id]['__unselected2']['#0']['stock_find'] ? '' : '只今品切れ中です';
         }else if(class1_id && !class2_id){
-            err_text = productsClassCategories[product_id][class1_id]['#0']['stock_find'] ? '' : '只今品切れ中です';
+            err_text = eccube.productsClassCategories[product_id][class1_id]['#0']['stock_find'] ? '' : '只今品切れ中です';
         }else{
-            err_text = productsClassCategories[product_id][class1_id]['#' + class2_id]['stock_find'] ? '' : '只今品切れ中です';
+            err_text = eccube.productsClassCategories[product_id][class1_id]['#' + class2_id]['stock_find'] ? '' : '只今品切れ中です';
         }
 
@@ -98,5 +98,5 @@
 
                 // 規格2に選択肢を割り当てる
-                classcats = productsClassCategories[product_id][sele1.value];
+                classcats = eccube.productsClassCategories[product_id][sele1.value];
                 i = 0;
                 for (var classcat_id2_key in classcats) {
@@ -117,5 +117,5 @@
         classcat_id1 = form.classcategory_id1.value;
         classcat_id2 = form.classcategory_id2 ? form.classcategory_id2.value : '';
-        classcat2 = productsClassCategories[product_id][classcat_id1]['#' + classcat_id2];
+        classcat2 = eccube.productsClassCategories[product_id][classcat_id1]['#' + classcat_id2];
         // 商品規格
         eleDynamic = document.getElementById('product_class_id' + product_id);
@@ -128,5 +128,5 @@
         } else {
             // 規格が1つのみの場合
-            classcat1 = productsClassCategories[product_id][classcat_id1]['#0'];
+            classcat1 = eccube.productsClassCategories[product_id][classcat_id1]['#0'];
             eleDynamic.value = classcat1.product_class_id;
         }
Index: /branches/version-2_13-dev/data/Smarty/templates/sphone/products/detail.tpl
===================================================================
--- /branches/version-2_13-dev/data/Smarty/templates/sphone/products/detail.tpl	(revision 23058)
+++ /branches/version-2_13-dev/data/Smarty/templates/sphone/products/detail.tpl	(revision 23065)
@@ -29,5 +29,5 @@
         var $sele1 = $form.find('select[name=classcategory_id1]');
         var $sele2 = $form.find('select[name=classcategory_id2]');
-        setClassCategories($form, product_id, $sele1, $sele2, classcat_id2_selected);
+        eccube.common.setClassCategories($form, product_id, $sele1, $sele2, classcat_id2_selected);
     }
     $(function(){
Index: /branches/version-2_13-dev/data/Smarty/templates/default/products/list.tpl
===================================================================
--- /branches/version-2_13-dev/data/Smarty/templates/default/products/list.tpl	(revision 23064)
+++ /branches/version-2_13-dev/data/Smarty/templates/default/products/list.tpl	(revision 23065)
@@ -27,5 +27,5 @@
         var $sele1 = $form.find('select[name=classcategory_id1]');
         var $sele2 = $form.find('select[name=classcategory_id2]');
-        setClassCategories($form, product_id, $sele1, $sele2, classcat_id2_selected);
+        eccube.common.setClassCategories($form, product_id, $sele1, $sele2, classcat_id2_selected);
     }
     // 並び順を変更
Index: /branches/version-2_13-dev/data/Smarty/templates/default/products/detail.tpl
===================================================================
--- /branches/version-2_13-dev/data/Smarty/templates/default/products/detail.tpl	(revision 23063)
+++ /branches/version-2_13-dev/data/Smarty/templates/default/products/detail.tpl	(revision 23065)
@@ -30,5 +30,5 @@
         var $sele1 = $form.find('select[name=classcategory_id1]');
         var $sele2 = $form.find('select[name=classcategory_id2]');
-        setClassCategories($form, product_id, $sele1, $sele2, classcat_id2_selected);
+        eccube.common.setClassCategories($form, product_id, $sele1, $sele2, classcat_id2_selected);
     }
     $(document).ready(function() {
Index: /branches/version-2_13-dev/data/class/pages/products/LC_Page_Products_List.php
===================================================================
--- /branches/version-2_13-dev/data/class/pages/products/LC_Page_Products_List.php	(revision 23064)
+++ /branches/version-2_13-dev/data/class/pages/products/LC_Page_Products_List.php	(revision 23065)
@@ -539,5 +539,5 @@
         $this->productStatus = $this->arrProducts['productStatus'];
         unset($this->arrProducts['productStatus']);
-        $this->tpl_javascript .= 'var productsClassCategories = ' . SC_Utils_Ex::jsonEncode($objProduct->classCategories) . ';';
+        $this->tpl_javascript .= 'eccube.productsClassCategories = ' . SC_Utils_Ex::jsonEncode($objProduct->classCategories) . ';';
         if (SC_Display_Ex::detectDevice() === DEVICE_TYPE_PC) {
             //onloadスクリプトを設定. 在庫ありの商品のみ出力する
Index: /branches/version-2_13-dev/data/class/pages/products/LC_Page_Products_Detail.php
===================================================================
--- /branches/version-2_13-dev/data/class/pages/products/LC_Page_Products_Detail.php	(revision 23055)
+++ /branches/version-2_13-dev/data/class/pages/products/LC_Page_Products_Detail.php	(revision 23065)
@@ -148,5 +148,5 @@
         }
 
-        $this->tpl_javascript .= 'classCategories = ' . SC_Utils_Ex::jsonEncode($objProduct->classCategories[$product_id]) . ';';
+        $this->tpl_javascript .= 'eccube.classCategories = ' . SC_Utils_Ex::jsonEncode($objProduct->classCategories[$product_id]) . ';';
         $this->tpl_javascript .= 'function lnOnLoad()
         {' . $this->js_lnOnload . '}';
Index: /branches/version-2_13-dev/data/class/pages/admin/order/LC_Page_Admin_Order_ProductSelect.php
===================================================================
--- /branches/version-2_13-dev/data/class/pages/admin/order/LC_Page_Admin_Order_ProductSelect.php	(revision 22926)
+++ /branches/version-2_13-dev/data/class/pages/admin/order/LC_Page_Admin_Order_ProductSelect.php	(revision 23065)
@@ -161,5 +161,5 @@
     function getTplJavascript(&$objProduct)
     {
-        return 'productsClassCategories = ' . SC_Utils_Ex::jsonEncode($objProduct->classCategories) . '; ';
+        return 'eccube.productsClassCategories = ' . SC_Utils_Ex::jsonEncode($objProduct->classCategories) . '; ';
     }
 
