﻿//author:leozhang
//description:plugin for form validate
//create date:2009-03-06

jQuery.fn.extend({
    isnull:function(){        
            showTip3($(this).attr("name"),$.trim($(this).val())=='',"isnull");                     
    },
    checkNull:function(){    
            if ($.trim($(this).val())==''){
              showTip3($(this).attr("name"),true,"isnull"); 
              return false;
            };   
            return true;              
    },
    clear:function(){        
           $(this).val('');         
    },
    chinese:function(){        
           showTip3($(this).attr("name"),!verify("chinese",$(this).val()),"chinese");        
    },
    english:function(){        
           showTip3($(this).attr("name"),!verify("english",$(this).val()),"english");        
    },    
    format:function(type){        
           showTip3($(this).attr("name"),!verify(type,$.trim($(this).val())),"format");        		   
    },
    outsize:function(size)
    {       
           showTip3($(this).attr("name"),!$(this).val().length>size,"outsize");                   
    },
    inregion:function(min,max)
    {       
           var a;
           if(min<=$(this).val().length && $(this).val().length<=max){
                a=true;
           }
           else{
                a=false;
           }
           showTip3($(this).attr("name"),!a,"inregion");                   
    },
    checkbox:function(){
        showTip3($(this).attr("name"),!valiCheckBox($(this).attr("name")),"checkbox");            
    },
    select:function(){
        var b;
        if($(this).attr("value")==''){
            b=false;
        }
        else{
            b=true;
        }
        showTip3($(this).attr("name"),!b,"select");            
    },    
    same:function(compareValue){
        var c;
        if($(this).val()==compareValue && compareValue.length>0){
            c=false;
        }    
        else{
            c=true;
        }
        showTip3($(this).attr("name"),c,"same");            
    },
	number:function(){
        showTip3($(this).attr("name"),!valiCheckBox($(this).attr("name")),"number");            
    }
});


