/*---------------------------------------------------------------------------*\
| Subject: javascript framework
| Author: meizz
| Created: 2005-02-27
| Version: 2006-08-11
| -----------------------------------
| MSN: huangfr@msn.com QQ: 112889082
| Http://www.meizz.com copyright (c) meizz Mit-style license
| The above copyright notice and this permission notice shall be
| Included in all copies or substantial portions of the software
\*---------------------------------------------------------------------------*/
Window. System = function () {This. sethashcode ();}
System. DEBUG = true; // false
System. _ codebase = {};
Try
{
If (window! = Parent & parent. System & parent. system. _ codebase)
System. _ codebase = parent. system. _ codebase;
Else if ("undefined "! = Typeof opener & opener. System & opener. system. _ codebase)
System. _ codebase = opener. system. _ codebase;
Else if ("undefined "! = Typeof dialogarguments & dialogarguments. System)
System. _ codebase = dialogarguments. system. _ codebase;
}
Catch (Ex ){}
System. missing_argument = "missing argument ";
System. argument_parse_error = "the argument cannot be parsed ";
System. not_supported_xmlhttp = "your browser do not support XMLHTTP ";
System. file_not_found = "file not found ";
System. miscoding = "maybe file encoding is not ANSI or UTF-8 ";
System. namespace_error = "nonstandard namespace ";
System. hashcounter = 0;
System. CurrentVersion = "20060811 ";
VaR T = Document. getelementsbytagname ("script ");
T = (system. scriptelement = T [T. Length-1]). SRC. Replace (// \/g ,"/");
System. in1_ate = function (D, S) {for (var I in S) d [I] = s [I]; return D ;};
System. Path = (T. lastindexof ("/") <0 )? ".": T. substring (0, T. lastindexof ("/"));
System. getuniqueid = function () {return "MZ _" + (system. hashcounter ++). tostring (36 );};
System. tohashcode = function (E)
{
If ("undefined "! = Typeof E. hashcode) Return e. hashcode;
Return e. hashcode = system. getuniqueid ();
};
System. supportsxmlhttp = function ()
{
Return "object" = typeof (system. _ XMLHTTP | (system. _ XMLHTTP = new XMLHttpRequest ()));
};
System. _ getprototype = function (namespace, argu)
{
If ("undefined" = typeof system. _ prototypes [namespace]) return new system ();
For (var a = [], I = 0; I <argu. length; I ++) A [I] = "argu [" + I + "]";
Return eval ("New (system. _ prototypes ['" + namespace + "']) (" + A. Join (",") + ")");
};
System. Ie = navigator. useragent. indexof ("MSIE")> 0 &&! Window. Opera;
System. NS = navigator. Vendor = "Netscape ";
System. _ Alert = function (MSG) {If (system. Debug) Alert (MSG );};
System. _ parseresponsetext = function (s)
{
If (null = S | "\ ufffd" = S. charat (0) {system. _ alert (system. miscoding); Return "";}
If ("\ XeF" = S. charat (0) S = S. substr (3); // For Firefox
Return S. replace (/(^ | \ n) \ s * \/+ \ s * (using | import | include) \ (\ "| \')) /g, "$1 $2 ");
};
If (window. activexobject & (system. ie |! Window. XMLHttpRequest ))
{
Window. XMLHttpRequest = function ()
{
VaR msxmls = ['msxml3', 'msxml2', 'Microsoft '], ex;
For (VAR I = 0; I <msxmls. length; I ++)
Try {return New activexobject (msxmls [I] + '. xmlhttp')} catch (Ex ){}
System. _ XMLHTTP = "MZ"; throw new error (system. not_supported_xmlhttp );
}
}
System. load = function (namespace, PATH)
{
Try
{
If (system. supportsxmlhttp () {Path = system. _ mappath (namespace, PATH );
VaR x = system. _ XMLHTTP; X. Open ("get", path, false); X. Send (null );
If (X. readystate = 4)
{
If (X. Status = 0 |/^ file \:/I. Test (PATH ))
Return System. _ parseresponsetext (X. responsetext );
Else if (X. Status == 200) return system. _ parseresponsetext (X. responsetext );
Else if (X. Status = 404) system. _ alert (namespace + "\ n" + system. file_not_found );
Else throw new error (X. Status + ":" + X. statustext );}
} Else system. _ alert (system. not_supported_xmlhttp );
}
Catch (Ex) {system. _ alert (namespace + "\ n" + ex. Message);} return "";
};
System. _ EVAL = function (namespace, PATH)
{
// Alert ("system. _ eval (\" "+ namespace +" \ ") = \ r \ n" + system. _ codebase [namespace]);
Trypolicif({execscript=window.exe cscript (system. _ codebase [namespace]); else
{
VaR script = Document. createelement ("script"); script. type = "text/JavaScript ";
Script. innerhtml = "eval (system. _ codebase ['" + namespace + "']);";
Document. getelementsbytagname ("head") [0]. appendchild (SCRIPT );
SetTimeout (function () {script. parentnode. removechild (SCRIPT)}, 99 );
} Catch (Ex) {system. _ alert ("syntax error on load" + namespace );}
System. _ existences [namespace] = system. _ mappath (namespace, PATH );
};
System. _ EXIST = function (namespace, PATH)
{
If ("undefined" = typeof system. _ existences [namespace]) return false;
Return System. _ existences [namespace] = system. _ mappath (namespace, PATH );
};
System. _ mappath = function (namespace, PATH)
{
If ("string" = typeof Path & path. length> 3) return path. tolowercase ();
VaR P = (system. Path + "/" + namespace. Replace (/\./g, "/") + ". js"). tolowercase ();
Return P + ("undefined" = typeof path | path )? "":"? T = "+ math. Random ());
};
Window. Using = function (namespace, path, rename)
{
If (system. _ exist (namespace, PATH )){
VaR S = Window [namespace. substr (namespace. lastindexof (".") + 1)];
If (s! = System. _ prototypes [namespace]) S = system. _ prototypes [namespace]; return}
VaR code = namespace + "."; if (! /(^ | \.) [\ W \ $] +) + $/. Test (namespace ))
Throw new error (namespace + system. namespace_error );
For (VAR I = code. indexof ("."); I>-1; I = code. indexof (".", I + 1 )){
VaR E = code. substring (0, I), S = (E. indexof (".") =-1 )? "Window [\" "+ E +" \ "]": E;
If (E & "undefined" = typeof (s )){
Eval (S + "= function () {return system. _ getprototype (\" "+ E +" \ ", arguments )}");}}
If ("undefined" = typeof Path & "string" = typeof system. _ codebase [namespace])
{
System. _ eval (namespace, PATH);} else {If (code = system. Load (namespace, PATH )){
E = "$" + system. getuniqueid () + "_ id" + new date (). gettime () + "$ ";
S = "function" + E + "() {\ r \ n" + code + "; \ r \ nsystem. _ prototypes ['";
Code = namespace. substr (namespace. lastindexof (".") + 1 );
S + = namespace + "'] = Window ['" + (rename | code) + "'] =" + code + "; \ r \ n} "+ E + "();";
System. _ codebase [namespace] = s; S = ""; system. _ eval (namespace, PATH );}
}
};
Window. Import = function (namespace, path, rename) {using (namespace, path, rename )};
Window. instance = function (hashcode) {return system. _ instances [hashcode]};
Window. Include = function (namespace, PATH)
{
If (system. _ exist (namespace, PATH) return;
VaR code; If (! /(^ | \.) [\ W \ $] +) + $/. Test (namespace ))
Throw new error (namespace + system. namespace_error );
If ("undefined" = typeof Path & "string" = typeof (system. _ codebase [namespace])
{
System. _ eval (namespace, PATH);} else if (system. supportsxmlhttp ()){
If (code = system. Load (namespace, PATH) {system. _ codebase [namespace] = code;
System. _ eval (namespace, PATH) ;}} else {
VaR script = Document. createelement ("script"); script. type = "text/JavaScript ";
Script. src = system. _ existences [namespace] = system. _ mappath (namespace, PATH );
Document. getelementsbytagname ("head") [0]. appendchild (SCRIPT );
SetTimeout (function () {script. parentnode. removechild (SCRIPT)}, 99 );
}
};
Function. Read = 1; function. Write = 2; function. read_write = 3;
Function. Prototype. addproperty = function (name, initvalue, r_w)
{
VaR Capital = Name. charat (0). touppercase () + name. substr (1 );
R_w = r_w | function. read_write; name = "_" + name; var P = This. Prototype;
If ("undefined "! = Typeof initvalue) P [name] = initvalue;
If (r_w & function. Read) P ["get" + capital] = function () {return this [name];};
If (r_w & function. Write) P ["set" + capital] = function (v) {This [name] = V ;};
};
Function. Prototype. extends = function (superclass, classname)
{
VaR op = This. prototype, I, P = This. Prototype = new superclass ();
If (classname) p. _ classname = classname; for (I in OP) P [I] = op [I];
If (P. hashcode) delete system. _ instances [P. hashcode]; return P;
};
System. _ instances = {};
System. _ prototypes =
{
"System": system,
"System. Object": system,
"System. Event": system. Event
};
System. _ existences =
{
"System": system. _ mappath ("system "),
"System. Event": system. _ mappath ("system. Event "),
"System. Object": system. _ mappath ("system. Object ")
};
T = system. extends (object, "system"); system. Object = system;
T. decontrol = function () {var t; If (t = This. hashcode) delete system. _ instances [T]};
T. addeventlisteners = function (type, handle)
{
If ("function "! = Typeof handle)
Throw new error (This + "addeventlistener:" + handle + "is not a function ");
If (! This. _ listeners) This. _ listeners = {};
VaR id = system. tohashcode (handle), t = This. _ listeners;
If ("object "! = Typeof T [type]) T [type] ={}; T [type] [ID] = handle;
};
T. removeeventlistener = function (type, handle)
{
If (! This. _ listeners) This. _ listeners = {}; var T = This. _ listeners;
If (! T [type]) return; var id = system. tohashcode (handle );
If (T [type] [ID]) delete T [type] [ID]; If (T [type]) delete T [type];
};
T. dispatchevent = function (EVT)
{
If (! This. _ listeners) This. _ listeners = {};
VaR I, T = This. _ listeners, P = EVT. type;
Evt.tar get = EVT. srcelement = this; if (this [p]) This [p] (EVT );
If ("object" = typeof T [p]) for (I in T [p]) T [p] [I]. Call (this, EVT );
Delete evt.tar get; Delete EVT. srcelement; return EVT. returnvalue;
};
T. sethashcode = function ()
{
System. _ instances [(this. hashcode = system. getuniqueid ()] = this;
};
T. gethashcode = function ()
{
If (! This. hashcode) This. sethashcode (); return this. hashcode;
};
T. tostring = function () {return "[object" + (this. _ classname | "object") + "]" ;};
System. event = function (type) {This. type = type ;};
T = system. event. extends (system, "system. Event ");
T. returnvalue = true;
T. cancelbubble = false;
T.tar get = T. srcelement = NULL;
T. stoppropagation = function () {This. cancelbubble = true ;};
T. preventdefault = function () {This. returnvalue = false ;};
If (system. ie &&! System. Debug) include ("system. plugins. ie"); // ie userdata
If (window. Opera) include ("system. plugins. Opera"); // Opera Support
Include ("system. Global ");
Mztreeview2.rar