﻿
$().ready(function() {$("#form2").validate({ignore:'.ignore',event: "blur",rules:{txt_key: { maxlength: 20}},
		messages: {  txt_key:{ maxlength: jQuery.format("")}}});
	$('input').focus(function(){	}); }) 
$().ready(function() { 
    i = 9; 
		jQuery().ajaxStart(function() {
			 
		}).ajaxStop(function() {
			 
		}).ajaxError(function(a, b, e) {
			 throw e; 
		});
		
	$("#form1").validate({ 
	/*
	  submitHandler: function(form) {
			jQuery(form).ajaxSubmit({
				target: null,
				url:'/json/login.aspx',
				type:'POST',
				dataType: "json",
				 success: function(response) { 
						if ( response ) {
						    var q = eval(response);
							if(q.rs)
							 {
							 //setUser(q.rs,q.msg);
							    location.href="/user/";
							 }
							else
							    KAlert("登录失败，请重新登录");
						} else {
						    KAlert("出错了，请稍候再试");
						}
		        }
			});
		}, */
	    event: "blur",
		rules: {
			    txt_user: {
				    required: true,
				    minlength: 3,
				    maxlength: 25
		    	},
		    	txt_pwd:
		    	{
		    	    required: true,
				    minlength: 6,
				    maxlength: 20
		    	}
		}                                
	});  
});
 $().ready(function() { 
 $('#Nav1 a').addClass("navcomm");
  checklogins(); 
	$('#dialog').jqm({ 
    overlay: 70, /* 0-100 (int) : 0 is off/transparent, 100 is opaque */
    overlayClass: 'whiteOverlay'
    })
    .jqDrag('.jqDrag');  
}); 
function checklogins()
{
 $.ajax({
       type: "POST",
       url: "/json/checkreg.aspx", 
       dataType:'text',   
       data:'',
       success: function(msg){ 
        var q = eval('('+msg+')');
          setUser(q.rs,q.us);
       }
    }); 
}

function setUser(rs,us)
{  
    if(rs)
    {
        $('#login').css("display","block");
        $('#nologin').css("display","none");
        $('#username').html(""+us+"， 您好！");
    }
    else
    {
        $('#login').css("display","none");
        $('#nologin').css("display","block");
    }
}
function KAlert(info)
{ 
    $('#dialog').jqmShow().find('#jqmdMSG').html(info); 
}