function qTcms_ajax_c(c,j){
		var h;
		if(typeof XMLHttpRequest!=="undefined"){
			h=new XMLHttpRequest()
		}else{
			var b=["Microsoft.XmlHttp","MSXML2.XmlHttp","MSXML2.XmlHttp.3.0","MSXML2.XmlHttp.4.0","MSXML2.XmlHttp.5.0"];
			for(var d=0,a=b.length;d<a;d++){
				try{
					h=new ActiveXObject(b[d]);
					break
				}catch(f){}
			}
		}
		h.onreadystatechange=g;
		function g(){
			if(h.readyState<4){return}
			if(h.status!==200){return}
			if(h.readyState===4){j(h)}
		}
		h.open("GET",c,true);
		h.send("")
	}
J1616.www.app = {};
J1616.www.app.note = {
    U: J1616.Util,
    W: J1616.www,
    O: ['haoma', 'haomaNum', 'haomaA1', 'haomaA2', 'haomaA3', '号码速记', 'note-main', 'note-hide', 'note-num', 'note-text', 500, 2000, 'jsb-s', ['note-login', 'note-reg','subm','uu','pp'], 'note-e', 0, ["93%", "96%", "68%", "70%"], ["672px", "700px", "476px", "504px"], 1],
    _input: function(s) {
        var J = J1616.www.app.note;
        var _s = $('#' + J.O[0]).val();
        $('#' + J.O[0]).attr("class", "num-c cc");
        if (_s == '号码速记') {
            $('#' + J.O[0]).val(s);
        } else {
            $('#' + J.O[0]).val(_s + s);
        }
    },
    _insertNote: function() {
        var J = this;
        var _s = $('#' + J.O[0]).val(),
        _s2 = $('#' + J.O[9]).val();
        if (_s != J.O[5]) {
            var _d = (_s2.length > 0) ? "\n": "";
            $('#' + J.O[9]).val(_s2 + _d + _s).scrollTop(document.getElementById(J.O[9]).scrollHeight);
            J._clearNum();
            J._saveNote();
        }
    },
    _clearNum: function() {
        var J = this;
        $('#' + J.O[0]).val(J.O[5]).attr("class", "num-c cm");
    },
    _clearBack: function() {
        var J = this;
        var _s = $('#' + J.O[0]).val();
        if (_s != J.O[5]) {
            if (_s == '' || _s.length == 1) {
                J._clearNum();
            } else {
                $('#' + J.O[0]).val(_s.substr(0, _s.length - 1));
            }
        }
    },
    _onoffNum: function() {
        var J = this,
        _d;
        _d = J.O[16];
        if ($('#' + J.O[8] + ':visible').length > 0) {
            $('#' + J.O[8]).hide();
			if(qTcms.Browser.moz){
				$('.' + J.O[12]).css("width", "90%");
				$('#' + J.O[6]).css("width", "93%");	
			}else if(qTcms.Browser.ie6){
				$('.' + J.O[12]).css("width", _d[0]);
				$('#' + J.O[6]).css("width", _d[1]);
			}else{
				$('.' + J.O[12]).css("width", "90%");
				$('#' + J.O[6]).css("width", "93%");				
			}
            $('#' + J.O[7]).html('<span title="显示"></span>').css("float", "right");
            J.U.setCookie("note-hide", 0, null, null);
            J.O[18] = 0;
        } else {
            $('#' + J.O[8]).show();
			if(qTcms.Browser.moz){
				$('.' + J.O[12]).css("width","65%");
				$('#' + J.O[6]).css("width", "67%");				
			}else if(qTcms.Browser.ie6){
				$('.' + J.O[12]).css("width", _d[2]);
				$('#' + J.O[6]).css("width", _d[3]);				
			}else{
				$('.' + J.O[12]).css("width","65%");
				$('#' + J.O[6]).css("width", "67%");
			}
            $('#' + J.O[7]).html('<em title="隐藏"></em>').css("float", "left");
            J.U.setCookie("note-hide", 1, null, null);
            J.O[18] = 1;
        }
    },
    _saveNote: function() {
        var J = this,
        _user = public_uid,
        _sd = _s = $('#' + J.O[9]).val(),
        _s2 = $('#' + J.O[14]).val();
        if (_s != _s2) {
            if (_user ==0) {
				
                if (_s.length > J.O[10]) {
                    alert('未登录用户只可储存' + J.O[10] + '字符!');
                    _s = _s.substr(0, J.O[10]);
                    $('#' + J.O[9]).val(_s).scrollTop(document.getElementById(J.O[9]).scrollHeight);
                }
                J1616.Util.setCookie("note", _s, null, null);
            } else {
                if (_s.length > J.O[11]) {
                    alert('已超过最大字符限制!');
                    _s = _s.substr(0, J.O[11]);
                    $('#' + J.O[9]).val(_s).scrollTop(document.getElementById(J.O[9]).scrollHeight);
                }
                try {
                    _s = (_s.substr(0, 1) == '\n' && J.O[15] == 1) ? _s.substr(1, _s.length) : _s;
					qTcms_ajax_c(p_dir+"Ztool/p/Ajax_value.asp?v=jishibenin"+"&m="+escape(_s)+"&t="+new Date().getTime(),function(d){
						
					}) 
                } catch(e) {
                    
                }
            }
        }
        $('#' + J.O[14]).val(_sd);
    },
    _getNote: function(u, d) {
		
        var J = this,
        bw = brower();
        d = (!d || d == 'null' || d == 'undefined' || d=="") ? "": d;
        if (u == 0) {
          //  $('#l-if').text("·欢迎使用在线记事本，为保存您的内容 ");		  
            $('#note-loginfo').show();
            $('.' + J.O[12]).show();
            if (bw[1] == false) {
                $('#' + J.O[9]).css({
                    "padding-top": "26px",
                    "height": "176px"
                });
            }
            d = (bw[1] && d.substr(0, 1) != '\n') ? "\n" + d: d;
        } else {
            $('#' + J.O[9]).css({
                "padding-top": "0",
                "height": "204px"
            });
            if (d == "" || d == "\n") {
                $('#l-if').text("欢迎使用在线记事本！");
                $('#note-loginfo').hide();
                $('.' + J.O[12]).show();
                if (bw[1] == false) {
                    J.O[15] == 0;
                    $('#' + J.O[9]).css({
                        "padding-top": "26px",
                        "height": "176px"
                    });
                } else {
                    J.O[15] = 1;
                }
            } else {
                J.O[15] == 0;
                $('.' + J.O[12]).hide();
            }
        }
        $('#' + J.O[14] + ',#' + J.O[9]).val(d);
    },
    _chkTop: function() {
        var J = this,
        _s = $('#' + J.O[9]).val(),
        bw = brower();
        if (bw[1] != false && J.O[15] == 1) {
            if (_s.substr(0, 1) != '\n') {
                $('#' + J.O[9]).val('\n' + _s);
            }
        }
    },
    _bindEvents: function() {
        var J = this;
        $('#' + J.O[0]).click(function() {
            if ($(this).val() == J.O[5]) {
                $(this).val('').attr("class", "num-c cc");
            }
        });
        $('form.jishiben').submit(function() {
            J._insertNote();
            $('#' + J.O[0]).blur();
            return false;
        });
        $('#' + J.O[1] + '>a').click(function() {
            J._input($(this).text());
            return false;
        });
        $('#' + J.O[2]).click(function() {
            J._clearNum();
            return false;
        });
        $('#' + J.O[3]).click(function() {
            J._clearBack();
            return false;
        });
        $('#' + J.O[4]).click(function() {
            J._insertNote();
            return false;
        });
        $('#' + J.O[7]).click(function() {
            J._onoffNum();
            return false;
        });
        $('#' + J.O[13][0]).click(function() {
            parent.J1616.www.index.p_login();
			//J1616.www.ac={i:true,n:"游客"};
            return false;
        });
        $('#' + J.O[13][1]).click(function() {
            parent.J1616.www.index.p_reg();
            return false;
        });
        $('#' + J.O[13][2]).click(function() {
										   
			qTcms_ajax_c(p_dir+"Members/regok.asp?action=login_b&soojs_u_email="+escape($('#' + J.O[13][3]).val())+"&soojs_u_pass="+escape($('#' + J.O[13][4]).val())+"&t="+new Date().getTime(),function(d){
				var str=d.responseText;			
				if(str.indexOf("{error}")!=-1){
					var str2=str.replace("{error}","");
					$('#note-loginfo').text(""+str2+"");
					$('#note-loginfo').addClass("note-loginfo_class");					
				}else{
					
					parent.d_ok(0);
					
					var a=str.split("{=====}")
					var uid=a[0];
					var un=a[1];
					var utext=a[2];
					
					J1616.www.app.note._getNote(uid,utext)
				}
			})            
            return false;
        });		
        $('.' + J.O[12]).click(function() {
            $(this).addClass("note-tip");
            $('#' + J.O[9]).addClass("note-t");
        });
        $('#' + J.O[9]).click(function() {
            $('.' + J.O[12]).addClass("note-tip");
            $(this).addClass("note-t").focus();
        }).blur(function() {
            $('.' + J.O[12]).removeClass("note-tip");
            $(this).removeClass("note-t");
            $('#' + J.O[14]).focus();
            J._saveNote();
        }).keyup(function() {
            J._chkTop();
        }).keypress(function() {
            $(this).addClass("note-t");
            $('.' + J.O[12]).addClass("note-tip");
        });
        if (J.U.getCookie("note-hide") == 0) {
            J._onoffNum()
        };
    },
    _wideScn: function(t) {
        var J = this,
        v;
        t = t ? J.O[16] : J.O[17];
        v = (J.O[18] == 0) ? [t[0], t[1]] : [t[2], t[3]];
        $('.' + J.O[12]).css("width", v[0]);
        $('#' + J.O[6]).css("width", v[1]);
    },
    _setTheme: function() {
        this._wideScn(parent.J1616.www.my1616.isWideScreen());
        var theme = parent.J1616.str2obj(parent.J1616.www.cfgs['my1616']);
        document.getElementById('sl').href = 'http://i.9533.com/style/' + [theme.th] + '/_s.css';
    },
    init: function() {
        this._bindEvents();
    }
};

function note_login(a, b) {
    J1616.www.app.note._getNote(((a == 'in') ? 1 : 0), b);
}
function setTheme() {
    J1616.www.app.note._setTheme();
}
function brower() {
    var userAgent = navigator.userAgent.toLowerCase();
    var is_opera = userAgent.indexOf('opera') != -1 && opera.version();
    var is_moz = (navigator.product == 'Gecko') && userAgent.substr(userAgent.indexOf('firefox') + 8, 3);
    var is_ie = (userAgent.indexOf('msie') != -1 && !is_opera) && userAgent.substr(userAgent.indexOf('msie') + 5, 1);
    return [is_opera, is_moz, is_ie];
}
J1616.www.app.note.init();
var public_uid=0;
function get_mytxt(){
	qTcms_ajax_c(p_dir+"Ztool/p/Ajax_value.asp?v=jishiben"+"&t="+new Date().getTime(),function(d){
		var str=d.responseText;			
		J1616.www.app.note._getNote(public_uid,str)
	})  	
}
window.onload = function() {
    try {
        var i = J1616.www.ac.i,
        N = J1616.www.app.note;
       // N._setTheme();
	    public_uid=qTcms.U_GetUid();
		
        N._getNote(public_uid, public_uid==0?J1616.www.note.__cfg:get_mytxt());
    } catch(e) {}
};
