// JavaScript Document
function applyCss() {
    //主要動態按鈕-------------------------------------------------------------
    $(':button').addClass('btn_A_bg btn_h24 ButtonCursor HideFocus');
    $(':button').hover(function() {
        $(this).addClass('btn_A_bg2 btn_h24 ButtonCursor HideFocus');
    },
  	function() {
  	    $(this).removeClass('btn_A_bg2 btn_24 ButtonCursor HideFocus');
  	});
    $(':reset').addClass('btn_A_bg btn_h24 ButtonCursor HideFocus');
    $(':reset').hover(function() {
        $(this).addClass('btn_A_bg2 btn_h24 ButtonCursor HideFocus');
    },
  	function() {
  	    $(this).removeClass('btn_A_bg2 btn_24 ButtonCursor HideFocus');
  	});
    $(':submit').addClass('btn_A_bg btn_h24 ButtonCursor HideFocus');
    $(':submit').hover(function() {
        $(this).addClass('btn_A_bg2 btn_lh24 ButtonCursor HideFocus');
    },
  	function() {
  	    $(this).removeClass('btn_A_bg2 btn_h24 ButtonCursor HideFocus');
  	});
    //次要動態按鈕--------button_b-----------------------------------------------------
    $(".button_b").addClass('btn_Bs_bg ButtonCursor HideFocus');
    $(".button_b").hover(function() {
        $(this).addClass('btn_Bs_bg2 ButtonCursor HideFocus');
    },
  	function() {
  	    $(this).removeClass('btn_Bs_bg2 ButtonCursor HideFocus');
  	});
    //計算器按鈕--------button_c-----------------------------------------------------
    //  $(".button_c").attr({hidefocus:true});
    $(".button_c").addClass('btn_Cs_bg ButtonCursor HideFocus');
    $(".button_c").hover(function() {
        $(this).addClass('btn_Cs_bg2 ButtonCursor HideFocus');
    },
  	function() {
  	    $(this).removeClass('btn_Cs_bg2 ButtonCursor HideFocus');
  	});
    //動態頁籤-----------------------------------------------------------------
  	$(".tabs").tabs();
  	//日期選項
  	$('.datepicker').datepicker($.extend({
  	    yearRange: "-100:+50",
  	    showOn: 'both',
  	    showOptions: { direction: 'down' },
  	    buttonImageOnly: true,
  	    buttonImage: 'images/calendar.png',
  	    closeAtTop: false
  	}, $.datepicker.regional['zh-TW']));

    //資料表tabulationA(原名retireA)-------------------------------------------
    //odd單數列作用
    $(".tabulationA tbody tr:odd").addClass('labela02_bg2odd').hover(function() {
        $(this).addClass('labela02_bg3mouseup');
    },
  	function() {
  	    $(this).removeClass('labela02_bg3mouseup');
  	});
    //even雙數列作用
    $(".tabulationA tbody tr:even").addClass('labela02_bg2even').hover(function() {
        $(this).addClass('labela02_bg3mouseup');
    },
  	function() {
  	    $(this).removeClass('labela02_bg3mouseup');
  	});

    //資料表tabulationB(原名retireB)-------------------------------------------
    //odd單數列作用
    $(".tabulationB tbody tr:odd").addClass('labelB01_bg2odd').hover(function() {
        $(this).addClass('labelB01_bg3mouseup');
    },
  	function() {
  	    $(this).removeClass('labelB01_bg3mouseup');
  	});
    //even雙數列作用
    $(".tabulationB tbody tr:even").addClass('labelB01_bg2even').hover(function() {
        $(this).addClass('labelB01_bg3mouseup');
    },
  	function() {
  	    $(this).removeClass('labelB01_bg3mouseup');
  	});

    //理財管理學院---問答----------------------------------------
    $(".fundBoxQa_q").addClass('fundBoxQa_q_bg');
    $(".fundBoxQa_q").hover(function() {
        $(this).addClass('fundBoxQa_q_over');
    },
    function() {
        $(this).removeClass('fundBoxQa_q_over');
    });
    //問題支援---問答----------------------------------------
    $(".sfpQa_q").addClass('sfpQa_q_bg');
    $(".sfpQa_q").hover(function() {
        $(this).addClass('sfpQa_q_over');
    },
    function() {
        $(this).removeClass('sfpQa_q_over');
    });

    //一些TextBox的處理--------------------------------------------------
    //只能輸入一個小寫'p'和四個'\'  Constrain with max 'p' 1 occurence and '\' 4 occurrences
    $(".constrain-limit").constrain({
        limit: { "p": 1, "\\": 4 }
    });
    //除了英文字母大小寫不能輸入外其他都可以輸入  Constrain with alpha prohibited
    $(".constrain-prohibitalpha").constrain({
        prohibit: { regex: "[a-zA-Z]" }
    });
    //除了英文母音大小寫'aeiouAEIOU'不可輸入外其他都可以輸入  Constrain with vowels prohibited
    $(".constrain-prohibitalphachars").constrain({
        prohibit: { chars: "aeiouAEIOU" }
    });
    //除了特殊字元'\\~`.,/[]{}()-+=*&^%$#@!|'?<>:;'不可輸入外其他都可以輸入  
    $(".constrain-special").constrain({
        prohibit: { chars: "\\~`.,[]{}()-+=*&^%$#@!|'?<>:;" },
        limit: { "[a-zA-Z]": 1, "[0-9]": 9 }
    });
    //除了英文字母大小寫能輸入外其他都不可以輸入  Constrain with only alpha allowed
    $(".constrain-allowalpha").constrain({
        allow: { regex: "[a-zA-Z]" }
    });
    //除了數字和"/"能輸入外其他都不可以輸入
    $(".constrain-Date").constrain({
        limit: { "/": 2 },
        allow: { regex: "[0-9/]" }
        //        format: "0000/00/00", 
//        onblur: false
    });
    //除了英文母音大小寫'aeiouAEIOU'可輸入外其他都不可以輸入  Constrain with only vowels allowed
    $(".constrain-allowalphachars").constrain({
        allow: { chars: "aeiouAEIOU" }
    });
    //除了Double倍精准浮點數可以輸入外其他不可輸入不限制小數點長度  Numeric (double)
    $(".double").numeric({ format: "0.0" });
    //除了Double倍精准浮點數可以輸入外其他不可輸入限制小數點長度2  Numeric (double)
    $(".double-keyup2").numeric({ format: "0.00", onblur: false });
    //除了Double倍精准浮點數可以輸入外其他不可輸入限制小數點長度3  Numeric (double)
    $(".double-keyup").numeric({ format: "0.000", onblur: false });
    //除了整數以外其他不可以輸入  Numeric (int)
    $(".integer").numeric();

};
//-------------------------------
$(document).ready(function() {
    applyCss();
});
/*******/

