	/* Global Variable */
	var G_USER_ID_MIN  = 4;
	var G_USER_ID_MAX  = 16;
	var G_NICK_ID_MIN  = 4;
	var G_NICK_ID_MAX  = 16;
	var G_PASSWORD_MIN = 4;
	var G_PASSWORD_MAX = 16;

    function IsIE()
    {
        var bIE = false;
        if(navigator.appName != "Microsoft Internet Explorer")
        {
            bIE = false;
        }
        else
        {
            bIE = true;
        }

        return bIE
    }

    function GetKeyCode(event)
    {
        var eKey;
        if(!IsIE())
        {
            eKey = event.which;
        }
        else
        {
            eKey = event.keyCode;
        }

        return eKey
    }

    function fnCheckKeyCode(e, ex, nType)
    {
        var bIE;
        var eKey = GetKeyCode(e);

        if ((eKey >= 96) && (eKey <= 105)) {
        	eKey = eKey - 48;
        }

       // if(!(8==eKey||13==eKey||0==eKey))
				if (!(8==eKey || 13==eKey || 0==eKey || 9==eKey || 46==eKey ))
        {
            var bInCode;
            if(1 == nType)
                bInCode = ex.test(String.fromCharCode(eKey));
            else
                bInCode = !ex.test(String.fromCharCode(eKey));

            if (bInCode)
            {
                if(!IsIE())
                {
                    e.preventDefault();
                }
                else
                {
                    e.returnValue = false;
                }

                return false;
            }
        }

        return true;
    }

    function fnCheckNum(obj, e)
    {
        var ex = /^[0-9]/;
        if(!fnCheckKeyCode(e, ex, 0))
        {
            return false;
        }
        return true;
    }

    function fnCheckEngNum(obj, e)
    {
        var ex = /^[a-zA-Z0-9]/;
        if(!fnCheckKeyCode(e, ex, 0))
        {
            return false;
        }

        return true;
    }

	function chkRangeLength(obj, min, max) {
		if ((obj.value.length >= min) && (obj.value.length <= max)) {
			return true;
		} else {
			return false;
		}
	}

	function fnTrim(target) {
		return target.replace(/(^\s*)|(\s*$)/gi, "");
	}

	function fnStringCut(target, max_length) {
	 	var sum_length = 0;
		var restr = "";
		var tail = "";

		for(var i= 0;i < target.length; i++) {
			if( escape(target.charAt(i)).length > 3 ) {
				v_length = 2;
			} else if (target.charAt(i) == '<' || target.charAt(i) == '>') {
				v_length = 4;
			} else {
				v_length = 1 ;
			}

	  		if (max_length < (sum_length + v_length)) {
	  			tail = "..";
	  			break;
	  		}

		  	sum_length += v_length;
	  		restr += target.charAt(i);
	 	}

	 	return (restr + tail);
	}

	function commify(num) {
  		var reg = /(^[+-]?\d+)(\d{3})/;
		num += '';

		  while (reg.test(num))
			num = num.replace(reg, '$1' + ',' + '$2');
		  return num;
	}

	function login_confirm(url){
	  	if(confirm("您需要注册成为CCTV证券资讯网会员才可使用相应服务。如已注册请登陆！")){
	  		window.location.href = url;
	  	}
	}