﻿(function ($) {
	window.switchTrComId = function(){
		if($('#ddlType option:selected').val()=='admin'){
			$('#trComId').hide();
		}else{
			$('#trComId').show();
		}
	}
    $(document).ready(function () {
        $("#btn_login").bind("click", function () {
            var ut = $("#ddlType option:selected").val();
            if (ut == "user") {
                var code = $("#tb_code").val();
                if (code.test("^[1-9]\\d{4}$") == false) {
                    alert("请填写正确的事务所代码！");
                    return false;
                }
            }
            if ($.trim($('#tb_username').val()) == '') {
                alert("请填写登录用户名");
                return false;
            }
            if ($.trim($('#tb_password').val()) == '') {
                alert("请填写登录密码");
                return false;
            }
            return true;
        });

		$('#btn_login').bind('mouseover',function(){
			$(this).attr('src','img_home/btn_login02.jpg');
		}).bind('mouseout',function(){
			$(this).attr('src','img_home/btn_login01.jpg');
		});
		
		$('#ddlType').bind('change',switchTrComId);

		switchTrComId();
    });
})(jQuery);
