﻿// JScript 文件
var openwin=function(){
        $.blockUI({ 
            message: $('#divXunpan'), 
            css: { 
                    padding:        0, 
                    margin:         0, 
                    width:          '600px', 
                    top:            ($(window).height() - 600) /2 + 'px', 
                    left:           ($(window).width() - 542) /2 + 'px', 
                    textAlign:      'center', 
                    color:          '#000', 
                    border:         '1px solid #aaa',  
                    cursor:         'pointer' 
                } 
        }); 
}


var checkLength=function(obj,text,min,max){
        if ( obj.value.length > max || obj.value.length < min ) {
				obj.className="error";
				obj.focus();
				return false;
		} else {
		        return true;
	    }
	}

	var checkFeedBackPhone = function(obj) {
	    var reg = /^[0-9]{1,20}$/;
	    if (!reg.exec(obj.value)) {
	        obj.className = "error";
	        obj.focus();
	        return false;
	    }
	    return true;
	}
	var checkForm = function() {
	    var bValid = true;
	    var title = document.getElementById("txtTitle"),
                content = document.getElementById("txtContent"),
                phone = document.getElementById("txtPhone");

	    bValid = bValid && checkLength(title, "", 2, 30);
	    bValid = bValid && checkLength(content, "", 2, 2000);
	    bValid = bValid && checkFeedBackPhone(phone);
	    return bValid;
	}
  var checkPhone=function()
  {
        var bValid = true;
        var  title=document.getElementById("phone");
        bValid = bValid && checkNo(title);
        return bValid;
  }
  
  var checkNo=function(obj){
	    if(obj.value.length==0)
        {
           obj.className="error";
		   obj.focus();
		   return false;
        }    
        if(obj.value.length!=11)
        {
           obj.className="error";
		   obj.focus();
		   return false;
        }
        return true;
   }
   