﻿function DNA()
{
	var This = this;

	this.requestname = DNA.caller ? String(DNA.caller).match(/^function\s+(\S+)\s*\(/)[1] : "DNA"; //发送者签名;
	this.xmlmodeonly = false; //仅XMLDOM模式
	this.data_source = false; //数据源

	for(i=0;i<arguments.length;i++)
	{
		if(typeof(arguments[i]) == "boolean")
		{
			this.xmlmodeonly = arguments[i] || false;
		}
		else if(arguments[i].search(/[.]/g) != -1 || arguments[i].search(/[/]/g) != -1)
		{
			this.data_source = arguments[i] || false;
		}
		else
		{
			this.requestname = arguments[i];
		}
	}

	this.environment = window.location.href.substr(0,7) == "http://" ? false : true; //是否为本地(true)运行，即是否可以跨域访问

	this.circulate = 0; //循环请求次数，始终循环设为 "always"
	this.circulate_time = 5000; //循环间隔时长，默认5000毫秒

	this.xmlhttp_object = false; //初始化 XMLHTTP 对象
	this.xmlhttp_version = ["MSXML2.XMLHttp.5.0","MSXML2.XMLHttp.4.0","MSXML2.XMLHttp.3.0","MSXML2.XMLHttp","Microsoft.XMLHttp"];
	this.xmlhttp_mode = true; //数据获取方式(异步true/同步false)
	this.xmlhttp_method = "GET"; //数据提交方式(GET/POST)
	this.xmlhttp_urlquery = new Array(); //存放以GET方式提交的数据
	this.xmlhttp_datasend = new Array(); //存放以POST方式提交的数据
	this.xmlhttp_total_submit = false; //最终提交数据
	this.xmlhttp_state = buildin_xmlhttp_state; //获取过程中不同时段调用函数
	this.xmlhttp_content = null; //获取的数据
	this.xmlhttp_compelte = buildin_xmlhttp_compelte; //获取完成时调用函数
	this.xmlhttp_fail = buildin_xmlhttp_fail; //获取失败时调用函数

	this.xmlhttp_server_code = 0; //服务器返回代码
	this.xmlhttp_retry_count = 0; //数据请求重试计数
	this.xmlhttp_reload_count = 0; //数据反复请求计数

	this.xmldom_object = false; //初始化 XMLDOM 对象
	this.xmldom_version = ["MSXML2.DOMDocument.3.0","MSXML2.DOMDocument","Microsoft.XmlDom","MSXML2.DOMDocument.5.0","MSXML2.DOMDocument.4.0"];
	this.xmldom_state = buildin_xmldom_state; //加载过程中不同时段调用函数
	this.xmldom_content = null; //XMLDOM主体
	this.xmldom_compelte = buildin_xmldom_compelte; //XMLDOM初始化完成时调用函数
	this.xmldom_fail = buildin_xmldom_fail; ////XMLDOM初始化出错时调用函数

	this.debug_curr = 000; //当前状态代码
	this.debug_show = true; //是否开启状态栏显示
	this.debug_info = new Array(); //类状态信息集

	this.debug_info[000] = "就绪。";

	this.debug_info[101] = "XMLHTTP对象初始化完成。";
	this.debug_info[102] = "XMLHTTP对象创建错误。";
	this.debug_info[103] = "未指定源。";
	this.debug_info[104] = "数据请求出错。";
	this.debug_info[105] = "服务器错误，代码 ";
	this.debug_info[107] = "数据获取完成。";
	this.debug_info[110] = "已放弃请求";
	this.debug_info[111] = "正在初始化...";
	this.debug_info[112] = "正在发送数据...";
	this.debug_info[113] = "正在接收数据...";
	this.debug_info[114] = "数据接收完成！";

	this.debug_info[201] = "XMLDOM对象初始化完成。";
	this.debug_info[202] = "XMLDOM对象创建错误。";
	this.debug_info[203] = "XMLDOM对象数据构建错误。";
	this.debug_info[204] = ""; //XMLDOM 错误内容
	this.debug_info[205] = "XMLDOM对象数据构建完成。";
	this.debug_info[206] = "Node Not Exist"; //XMLDOM相应节点不存在时返回消息
	this.debug_info[207] = "Attribulte Not Exist"; //XMLDOM相应节点属性不存在时返回消息
	this.debug_info[211] = "正在加载数据...";
	this.debug_info[212] = "正在解析数据...";
	this.debug_info[213] = "对象模型已经可用。";
	this.debug_info[214] = "数据加载完成。";
	this.debug_info[221] = "脚本执行成功。";
	this.debug_info[222] = "脚本执行出错。";
	this.debug_info[223] = "所有脚本执行完成。";
	this.debug_info[224] = "没有脚本可供执行。";

	this.debug_info[301] = "完成。";
	this.debug_info[302] = "指定ID的对象实例不存在。";
	this.debug_info[401] = "数据提交完成。";
	this.debug_info[402] = "数据提交出错。";

	this.debug = function(info) //设置状态代码
	{
		this.debug_curr = info;

		if(arguments[1]) //服务器错误代码
		{
			this.xmlhttp_server_code = arguments[1];
		}
	}

	this.state = function() //返回状态信息
	{
		var info = this.debug_info[this.debug_curr];

		if(this.debug_curr==105)
		{
			info += this.xmlhttp_server_code;
		}

		return info;
	}

	for(i=0;i<this.xmlhttp_version.length;i++) //XMLHTTP对象创建开始
	{
		try
		{
			this.xmlhttp_object = new ActiveXObject(this.xmlhttp_version[i]);
			this.debug(101);
			break;
		}
		catch(e)
		{
			this.debug(102);
		}
	}

	for(i=0;i<this.xmldom_version.length;i++) //XMLDOM对象创建开始
	{
		try
		{
			this.xmldom_object = new ActiveXObject(this.xmldom_version[i]);
			this.debug(201);
			break;
		}
		catch(e)
		{
			this.debug(202);
		}
	}

	this.xmlhttp = function() //XMLHTTP 的初始化接口
	{
		for(i=0;i<arguments.length;i++)
		{
			if(typeof(arguments[i]) == "boolean") //同步异步
			{
				this.xmlhttp_mode = arguments[i];
			}
			else //数据源;
			{
				this.data_source = arguments[i];
			}
		}
	}

	this.init = function() //开始请求数据
	{
		if(!this.data_source)
		{
			this.debug(103);
			return false;
		}

		try
		{
			this.xmlhttp_total_submit = new Array();
			this.xmlhttp_total_submit.get = 'random_stamp=' + String(Math.round((Math.random()*(411168860927)))); //防缓存机制
			this.xmlhttp_total_submit.post = 'CurrentRequester=' + String(this.requestname); //生成发送者签名

			for(var subject in this.xmlhttp_urlquery) //处理GET方式提交的数据
			{
				this.xmlhttp_total_submit.get += "&" + subject + "=" + this.xmlhttp_urlquery[subject];
			}

			var data_source = this.data_source + "?" + this.xmlhttp_total_submit.get; //构造包含查询URL的新地址

			this.xmlhttp_object.open(this.xmlhttp_method,data_source,this.xmlhttp_mode); //初始化数据源

			if(this.xmlhttp_method == "POST") //处理POST方式提交的数据
			{
				this.xmlhttp_object.setRequestHeader("Content-Type","application/x-www-form-urlencoded");

				for(var subject in this.xmlhttp_datasend)
				{
					this.xmlhttp_total_submit.post += "&" + subject + "=" + this.xmlhttp_datasend[subject];
				}
			}

			this.xmlhttp_object.onreadystatechange = function()
			{
				This.xmlhttp_state.call(This);

				if(This.xmlhttp_object.readyState == 4)
				{
					if(This.environment == true) //运行在本地
					{
						if(This.data_source.search("http://") == -1) //数据源在本地
						{
							This.buildin_xmlhttp_dataproc();
						}
						else
						{
							if(This.xmlhttp_object.status == 200) //来自HTTP
							{
								This.buildin_reset();
								This.buildin_xmlhttp_dataproc();
							}
							else
							{
								This.debug(105,This.xmlhttp_object.status); //获取内容出错
								This.buildin_retry();
							}
						}
					}
					else //运行于HTTP
					{
						if(This.xmlhttp_object.status == 200)
						{
							This.buildin_reset();
							This.buildin_xmlhttp_dataproc();
						}
						else
						{
							This.debug(105,This.xmlhttp_object.status);
							This.buildin_retry();
						}
					}

					if(This.xmlhttp_reload_count < This.circulate || This.circulate == "always") //循环初始化
					{
						This.buildin_reload();
					}
					else
					{
						return true;
					}
				}
			}

			if(this.xmlmodeonly)
			{
				this.buildin_xmldom_init(data_source);
			}
			else
			{
				this.xmlhttp_object.send(this.xmlhttp_total_submit.post);
			}
		}
		catch(e)
		{
			this.debug(104);
			this.buildin_retry();
			return false;
		}
	}

	this.get = function() //接收并组织待提交的信息:GET
	{
		if(arguments[0])
		{
			this.xmlhttp_urlquery[arguments[0]] = arguments[1] ? this.buildin_charconv(arguments[1]) : '';
		}
	}

	this.post = function() //接收并组织待提交的信息:POST
	{
		this.xmlhttp_method = "POST";

		if(arguments[0])
		{
			this.xmlhttp_datasend[arguments[0]] = arguments[1] ? this.buildin_charconv(arguments[1]) : '';
		}
	}

	this.buildin_xmlhttp_dataproc = function() //XMLHTTP 数据处理过程，处理完成时会尝试把 XMLDOM 初始化
	{
		this.debug(107);
		this.xmlhttp_content = this.xmlhttp_object.ResponseText;
		this.xmlhttp_compelte.call(this);

		if(this.xmlhttp_content.substr(0,5) == "<?xml" || this.xmlhttp_object.getResponseHeader("Content-Type") == "text/xml") //检验是否为 XML 格式内容
		{
			this.buildin_xmldom_init();
		}
	}

	this.buildin_retry = function() //出错时重新请求
	{
		if(this.xmlhttp_retry_count>4 || this.circulate>0)
		{
			if(this.xmlhttp_server_code == 0)
			{
				this.buildin_stateshow("数据获取出错，请稍后重试。");
			}
			else
			{
				this.xmlhttp_fail.call(this);
			}

			this.debug(110);

			return false;
		}
		else
		{
			this.xmlhttp_retry_count ++;
			this.buildin_stateshow("数据获取出错，正在重试：第 "+(this.xmlhttp_retry_count)+" 次...");
			this.retry = setTimeout(function(){This.init();},1000);
		}
	}

	this.buildin_reload = function() //重复请求
	{
		this.xmlhttp_reload_count ++;
		setTimeout(function(){This.init();},this.circulate_time);
	}

	this.buildin_reset = function() //复位
	{
		this.xmlhttp_retry_count = 0;
	}

	this.buildin_xmldom_init = function() //XMLDOM数据初始化
	{
		try
		{
			this.xmldom_object.async = true;

			this.xmldom_object.onreadystatechange = function()
			{
				This.xmldom_state.call(This);

				if(This.xmldom_object.readyState == 4)
				{
					if(This.xmldom_object.parseError.errorCode == 0)
					{
						This.buildin_xmldom_dataproc();
					}
					else
					{
						This.debug(202);
						This.debug_info[204] += "行 [" + This.xmldom_object.parseError.line + "] " + This.xmldom_object.parseError.reason;
						This.debug_info[204] += "\n" + This.xmldom_object.parseError.srcText;
						return false;
					}
				}
			}

			if(arguments[0])
			{
				this.xmldom_object.load(arguments[0]);
			}
			else
			{
				this.xmldom_object.loadXML(this.xmlhttp_content);
			}
		}
		catch(e)
		{
			this.debug(203);
			this.xmldom_fail.call(this);
			return false;			
		}
	}

	this.buildin_xmldom_dataproc = function() //XMLDOM 数据处理过程，处理完成时会尝试运行内嵌脚本
	{
		this.debug(214);
		this.xmldom_content = this.xmldom_object.documentElement;
		this.xmldom_compelte.call(this);

		try
		{
			for(i=0;i<this.xmldom_content.getElementsByTagName("SCRIPTS").length;i++)
			{
				try
				{
					eval(this.xmldom_content.getElementsByTagName("SCRIPTS")[i].text);
					this.debug(221);
				}
				catch(e)
				{
					this.debug(222);				
				}
			}
			
			if(i>0)
			{
				this.debug(223);
			}
		}
		catch(e)
		{
			this.debug(224);		
		}
	}

	this.xmldom_node = function(path) //取得节点数据，如指定第二个参数则取得相应节点属性
	{
		try
		{
			return arguments[1] ? this.xmldom_content.selectSingleNode(path).getAttribute(arguments[1]) : this.xmldom_content.selectSingleNode(path).text;
		}
		catch(e)
		{
			return arguments[1] ? this.debug_info[207] : this.debug_info[206]; //默认节点不存在时的返回信息，见上面的状态代码集
		}
	}

	this.xmldom_nodenum = function(path) //取得节点个数
	{
		try
		{
			return this.xmldom_content.selectNodes(path).length;
		}
		catch(e)
		{
			return 0;
		}
	}

	this.buildin_charconv = function(charactor) //替换特殊字符
	{
		if(!arguments[0]) return '';

		var char_return = String(charactor);

		char_return = char_return.replace(/[%]/g,"%25");
		char_return = char_return.replace(/[+]/g,"%2B");
		char_return = char_return.replace(/[/]/g,"%2F");
		char_return = char_return.replace(/[?]/g,"%3F");
		char_return = char_return.replace(/[#]/g,"%23");
		char_return = char_return.replace(/[&]/g,"%26");

		return char_return;
	}

	this.buildin_stateshow = function() //状态栏显示信息
	{
		if(this.debug_show)
		{
			window.status = arguments[0];
		}
	}

	function buildin_xmlhttp_state() //XMLHTTP装载进行时
	{
		switch(this.xmlhttp_object.readyState)
		{
			case 1:
			{
				this.debug(111);
				break;
			}
			case 2:
			{
				this.debug(112);
				break;
			}
			case 3:
			{
				this.debug(113);
				break;
			}
			case 4:
			{
				this.debug(114);
				break;
			}
		}
	}

	function buildin_xmldom_state() //XMLDOM装载进行时
	{
		switch(this.xmldom_object.readyState)
		{
			case 1:
			{
				this.debug(211);
				break;
			}
			case 2:
			{
				this.debug(212);
				break;
			}
			case 3:
			{
				this.debug(213);
				break;
			}
			case 4:
			{
				this.debug(214);
				break;
			}
		}
	}

	function buildin_xmlhttp_compelte() //默认 XMLHTTP 装载完成时调用函数
	{
		this.debug(107);
	}

	function buildin_xmldom_compelte() //默认 XMLDOM 装载完成时调用函数
	{
		this.debug(205);
	}

	function buildin_xmlhttp_fail() //默认 XMLHTTP 数据获取失败时调用函数
	{
		this.debug(110);
	}

	function buildin_xmldom_fail() //默认 XMLDOM 数据获取失败时调用函数
	{
		this.debug(203);
	}
}

function INFO(PARAMATER) //信息框
{
	var This = this;

	this.CONFIG = new Array();
	this.CONFIG.width = PARAMATER.width || 400; //信息框宽度
	this.CONFIG.height = PARAMATER.height || 300; //信息框高度
	this.CONFIG.color = PARAMATER.color || "#333333"; //信息框颜色
	this.CONFIG.title = PARAMATER.title || "ABOUT INFO ..."; //信息框标题 
	this.CONFIG.text = PARAMATER.text || "COPY RIGHT R&D CENTER - SUNSHINE STUDIO 2007"; //信息内容，支持HTML
	this.CONFIG.bgopt = PARAMATER.opacity || 70; //背景透明度
	this.CONFIG.optcolor = PARAMATER.bgcolor || "#000000"; //背景色调
	this.CONFIG.effect = PARAMATER.effect || false; //是否渐变淡入
	this.CONFIG.btnyes = PARAMATER.yes || false; //是否显示 确定 按钮
	this.CONFIG.btnno = PARAMATER.no || false; //是否显示 取消 按钮
	this.CONFIG.textyes = PARAMATER.YES || "确定"; //确定 按钮的文字
	this.CONFIG.textno = PARAMATER.NO || "取消"; //取消 按钮的文字
	this.CONFIG.notitle = PARAMATER.notitle || false; //隐藏标题
	this.CONFIG.cover = PARAMATER.needcover || false; //是否调用额外置顶层
	this.CONFIG.ignore = PARAMATER.ignore || false; //是否可以点击边缘区域退出

	this.InfoBox_Background_Opacity = 0; //背景淡入渐变初始值
	this.InfoBox_Background_Opaitvl = false; //渐变setInterval句柄

	this.InfoBox_Background = document.createElement("div"); //初始化背景
	this.InfoBox_Cover = document.createElement("div"); //额外置顶层
	this.InfoBox_Main = document.createElement("div"); //初始化信息框主体
	this.InfoBox_Title = document.createElement("h4"); //初始化标题栏
	this.InfoBox_Text = document.createElement("p"); //初始化内容
	this.InfoBox_Bottom = document.createElement("div"); //初始化底栏
	this.InfoBox_Yes = document.createElement("span"); //初始化确定按钮
	this.InfoBox_No = document.createElement("span"); //初始化取消按钮

	//配置背景
	this.InfoBox_Background.setAttribute("id","InfoBox_BG");
	this.InfoBox_Background.style.width = document.body.clientWidth + "px";
	this.InfoBox_Background.style.height = document.body.clientHeight > document.body.scrollHeight ? document.body.clientHeight + "px" : document.body.scrollHeight + "px";
	this.InfoBox_Background.style.position = "absolute";
	this.InfoBox_Background.style.top = "0";
	this.InfoBox_Background.style.left = "0";
	this.InfoBox_Background.style.opacity = String(this.CONFIG.optcolor/100);
	this.InfoBox_Background.style.background = this.CONFIG.optcolor;
	this.InfoBox_Background.style.zIndex = "10000";

	if(this.CONFIG.effect)
	{
		this.InfoBox_Background.style.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity=0)";
	}
	else
	{
		this.InfoBox_Background.style.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity="+this.CONFIG.bgopt+")";	
	}

	if(!this.CONFIG.ignore)
	{
		this.InfoBox_Background.onclick = function()
		{
			This.hide();
		}
	}

	//配置信息框主体
	this.InfoBox_Main.setAttribute("id","InfoBox");
	this.InfoBox_Main.style.width = this.CONFIG.width + "px";
	this.InfoBox_Main.style.height = this.CONFIG.height + "px";
	this.InfoBox_Main.style.position = "absolute";
	this.InfoBox_Main.style.top =  document.body.clientTop + 200;
	this.InfoBox_Main.style.left = (document.body.clientWidth-this.CONFIG.width)/2;
	this.InfoBox_Main.style.background = "#FFFFFF";
	this.InfoBox_Main.style.border = "1px solid " + this.CONFIG.color;
	this.InfoBox_Main.style.textAlign = "center";
	this.InfoBox_Main.style.font = "12px/1.6em Verdana, Geneva, Arial, Helvetica, sans-serif";
	this.InfoBox_Main.style.lineHeight ="25px";
	this.InfoBox_Main.style.zIndex = "10001";

	//配置标题栏
	if(!this.CONFIG.notitle)
	{
		this.InfoBox_Title.style.height = "26px";
		this.InfoBox_Title.style.background = this.CONFIG.color;
		this.InfoBox_Title.style.margin = "0";
		this.InfoBox_Title.style.padding = "1px";
		this.InfoBox_Title.style.paddingLeft = "8px";
		this.InfoBox_Title.style.opacity = "0.75";
		this.InfoBox_Title.style.border = "1px solid " + this.CONFIG.color;
		this.InfoBox_Title.style.textAlign = "left";
		this.InfoBox_Title.style.fontSize = "14px";
		this.InfoBox_Title.style.fontWeight = "normal";
		this.InfoBox_Title.style.letterSpacing = "1px";
		this.InfoBox_Title.style.color = "#FFFFFF";
		this.InfoBox_Title.style.cursor = "default";
		this.InfoBox_Title.innerHTML = this.CONFIG.title;
	}

	//配置底栏
	this.InfoBox_Bottom.setAttribute("id","InfoBox_Button");
	
	if(this.CONFIG.btnyes || this.CONFIG.btnno)
	{
		this.InfoBox_Bottom.style.width = "100%";
		this.InfoBox_Bottom.style.height = "40px";
		this.InfoBox_Bottom.style.paddingTop = "7px";
		this.InfoBox_Bottom.style.paddingRight = "7px";
		this.InfoBox_Bottom.style.textAlign = "Right";
		this.InfoBox_Bottom.style.background = "#FFFFFF";
		this.InfoBox_Bottom.style.cursor = "default";
		this.InfoBox_Bottom.style.borderTop = "1px solid #CCCCCC";
	}

	if(this.CONFIG.btnyes) //配置确定按钮
	{
		this.btnYes = function(){};

		this.InfoBox_Yes.style.width = "80px";
		this.InfoBox_Yes.style.height = "25px";
		this.InfoBox_Yes.style.marginRight = "1px";
		this.InfoBox_Yes.style.background = "#CCCCCC";
		this.InfoBox_Yes.style.textAlign = "Center";
		this.InfoBox_Yes.style.cursor = "pointer";
		this.InfoBox_Yes.innerText = this.CONFIG.textyes;

		this.InfoBox_Yes.onmouseover = function()
		{
			this.style.background = "#444444";
			this.style.color = "#FFFFFF";
		}

		this.InfoBox_Yes.onmouseout = function()
		{
			this.style.background = "#CCCCCC";
			this.style.color = "#000000";
		}

		this.InfoBox_Yes.onclick = function()
		{
			this.style.cursor = "default";
			This.hide();
			This.btnYes.call();
		}
	}

	if(this.CONFIG.btnno) //配置取消按钮
	{
		this.btnNo = function(){};

		this.InfoBox_No.style.width = "80px";
		this.InfoBox_No.style.height = "25px";
		this.InfoBox_No.style.background = "#CCCCCC";
		this.InfoBox_No.style.textAlign = "Center";
		this.InfoBox_No.style.cursor = "pointer";
		this.InfoBox_No.innerText = this.CONFIG.textno;

		this.InfoBox_No.onmouseover = function()
		{
			this.style.background = "#444444";
			this.style.color = "#FFFFFF";
		}

		this.InfoBox_No.onmouseout = function()
		{
			this.style.background = "#CCCCCC";
			this.style.color = "#000000";
		}

		this.InfoBox_No.onclick = function()
		{
			this.style.cursor = "default";
			This.hide();
			This.btnNo.call();
		}
	}

	//配置主体内容
	this.InfoBox_Text.style.width = "100%";

	if(this.CONFIG.notitle) //无标题
	{
		if(this.CONFIG.btnyes || this.CONFIG.btnno) //有按钮
		{
			this.InfoBox_Text.style.height = (this.CONFIG.height-40)+"px";
		}
		else //无按钮
		{
			this.InfoBox_Text.style.height = (this.CONFIG.height)+"px";	
		}
	}
	else //有标题
	{
		if(this.CONFIG.btnyes || this.CONFIG.btnno) //有按钮
		{
			this.InfoBox_Text.style.height = (this.CONFIG.height-61)+"px";
		}
		else //无按钮
		{
			this.InfoBox_Text.style.height = (this.CONFIG.height-21)+"px";	
		}	
	}
	
	this.InfoBox_Text.style.margin = "0";
	this.InfoBox_Text.style.padding = "10px";
	this.InfoBox_Text.style.wordBreak = "break-all";
	this.InfoBox_Text.style.textAlign = "Left";
	this.InfoBox_Text.style.cursor = "default";
	this.InfoBox_Text.innerHTML = this.CONFIG.text;

	if(PARAMATER.needcover) //配置置顶层
	{
		this.InfoBox_Cover.style.width = document.body.clientWidth + "px";
		this.InfoBox_Cover.style.height = document.body.clientHeight + "px";
		this.InfoBox_Cover.style.position = "absolute";
		this.InfoBox_Cover.style.top = "0";
		this.InfoBox_Cover.style.left = "0";
		this.InfoBox_Cover.style.background = "#FFFFFF";
		this.InfoBox_Cover.style.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity=0)";
		this.InfoBox_Cover.style.zIndex = "10050";
	}

	this.show = function() //显示信息框
	{
		if(document.getElementById("InfoBox")) //如果之前已经调用过则直接继承以避免开辟新内存空间
		{
			document.getElementById("InfoBox_BG").style.filter = this.CONFIG.effect ? "progid:DXImageTransform.Microsoft.Alpha(opacity=0)" : "progid:DXImageTransform.Microsoft.Alpha(opacity="+this.CONFIG.bgopt+")";
			document.getElementById("InfoBox_BG").style.display = "block";
			document.body.removeChild(document.getElementById("InfoBox"));
		}
		else
		{
			document.body.appendChild(this.InfoBox_Background); //载入背景
		}

		document.body.appendChild(this.InfoBox_Main);
		document.getElementById("InfoBox").style.top = document.body.scrollTop + 200;
		document.getElementById("InfoBox").style.display = "block";
		document.getElementById("InfoBox").focus();
		document.getElementById("InfoBox").appendChild(this.InfoBox_Title);
		document.getElementById("InfoBox").appendChild(this.InfoBox_Text);
		document.getElementById("InfoBox").appendChild(this.InfoBox_Bottom);
		document.getElementById("InfoBox_Button").appendChild(this.InfoBox_Yes);
		document.getElementById("InfoBox_Button").appendChild(this.InfoBox_No);

		if(this.CONFIG.needcover)
		{
			document.body.appendChild(this.InfoBox_Cover);	
		}
		
		if(this.CONFIG.effect == true)
		{
			//this.effect();
		}
	}

	this.hide = function() //隐藏信息框
	{
		clearInterval(this.InfoBox_Background_Opaitvl);
		
		if(this.CONFIG.needcover)
		{
			document.body.removeChild(this.InfoBox_Cover);
		}

		document.getElementById("InfoBox").style.display = "none";
		document.getElementById("InfoBox_BG").style.display = "none";
	}

	this.effect = function() //背景淡入效果，量加和时加还有待优化
	{
		this.InfoBox_Background_Opaitvl = setInterval(function()
		{
			if(This.InfoBox_Background_Opacity < This.CONFIG.bgopt)
			{
				document.getElementById("InfoBox_BG").style.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity="+This.InfoBox_Background_Opacity+")";
				This.InfoBox_Background_Opacity += 5; //量加
			}
			else
			{
				this.InfoBox_Background_Opacity = 0;
				clearInterval(This.InfoBox_Background_Opaitvl);
			}
		},1); //时加
	}
}

function CONVERT() //编码转换类
{
	var BASE64_ENCODE_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";

	var BASE64_DECODE_CHARS = new Array
	(
		-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
		-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
		-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63,
		52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1,
		-1,　0,　1,　2,　3,  4,　5,　6,　7,　8,　9, 10, 11, 12, 13, 14,
		15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1,
		-1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
		41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1
	);

	this.base64_encode = function(character)
	{
		var RESULT = "";
		var STRING = new Array();
		var LENGTH = character.length;

		var i = 0;

		while(i < LENGTH)
		{
			STRING['A'] = character.charCodeAt(i++)&0xff;

			if(i == LENGTH)
			{
				RESULT += BASE64_ENCODE_CHARS.charAt(STRING['A']>>2) + BASE64_ENCODE_CHARS.charAt((STRING['A']&0x3)<<4) + "==";
				break;
			}

			STRING['B'] = character.charCodeAt(i++);

			if(i == LENGTH)
			{
				RESULT += BASE64_ENCODE_CHARS.charAt(STRING['A']>>2) + BASE64_ENCODE_CHARS.charAt(((STRING['A']&0x3)<< 4)|((STRING['B']&0xF0)>>4)) + BASE64_ENCODE_CHARS.charAt((STRING['B']&0xF)<<2) + "=";
				break;
			}

			STRING['C'] = character.charCodeAt(i++);

			RESULT += BASE64_ENCODE_CHARS.charAt(STRING['A']>>2) + BASE64_ENCODE_CHARS.charAt(((STRING['A']&0x3)<<4)|((STRING['B']&0xF0)>>4)) + BASE64_ENCODE_CHARS.charAt(((STRING['B']&0xF)<<2)|((STRING['C'] & 0xC0)>>6)) + BASE64_ENCODE_CHARS.charAt(STRING['C']&0x3F);　
		}

		return RESULT;
	}

	this.base64_decode = function(character)
	{
		var RESULT = "";
		var STRING = new Array();
		var LENGTH = character.length;

		var i = 0;

		while(i < LENGTH)
		{
			do
			{
				STRING['A'] = BASE64_DECODE_CHARS[character.charCodeAt(i++) & 0xff];
			}
			while(i < LENGTH && STRING['A'] == -1);

			if(STRING['A'] == -1) break;

			do
			{
				STRING['B'] = BASE64_DECODE_CHARS[character.charCodeAt(i++) & 0xff];
			}
			while(i < LENGTH && STRING['B'] == -1);

			if(STRING['B'] == -1) break;

			RESULT += String.fromCharCode((STRING['A'] << 2) | ((STRING['B'] & 0x30) >> 4));

			do
			{
				STRING['C'] = character.charCodeAt(i++) & 0xff;

				if(STRING['C'] == 61) return RESULT;

				STRING['C'] = BASE64_DECODE_CHARS[STRING['C']];
			}
			while(i < LENGTH && STRING['C'] == -1);

			if(STRING['C'] == -1)
			{
				break;
			}

			RESULT += String.fromCharCode(((STRING['B'] & 0XF) << 4) | ((STRING['C'] & 0x3C) >> 2));

			do
			{
				STRING['D'] = character.charCodeAt(i++) & 0xff;

				if(STRING['D'] == 61)
				{
					return RESULT;
				}

				STRING['D'] = BASE64_DECODE_CHARS[STRING['D']];
			}
			while(i < LENGTH && STRING['D'] == -1);

			if(STRING['D'] == -1) break;

			RESULT += String.fromCharCode(((STRING['C'] & 0x03) << 6) | STRING['D']);　　
		}

		return RESULT;
	}

	this.utf8to16 = function(character)
	{
		var STRING = new Array();
		var RESULT = new Array();
		var LENGTH = character.length;

		var i = 0;

		while(i<LENGTH)
		{
			var c = character.charCodeAt(i++);

			switch(c>>4)
			{ 
				case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7:
				{
					RESULT[RESULT.length] = character.charAt(i-1);
					break;
				}

				case 12: case 13:
				{
					STRING['A'] = character.charCodeAt(i++);
					RESULT[RESULT.length] = String.fromCharCode(((c&0x1F)<<6)|(STRING['A']&0x3F));
					break;
				}

				case 14:
				{
					STRING['A'] = character.charCodeAt(i++);
					STRING['B'] = character.charCodeAt(i++);
					RESULT[RESULT.length] = String.fromCharCode(((c&0x0F)<<12)|((STRING['A']&0x3F)<<6)|((STRING['B']&0x3F)<<0));
					break;
				}
			}
		}

		return RESULT.join('');
	}

	this.utf16to8 = function(character)
	{
		var STRING = "";
		var RESULT = new Array();
		var LENGTH = character.length;

		for(i=0;i<LENGTH;i++)
		{
			STRING = character.charCodeAt(i);

			if((STRING>=0x0001)&&(STRING<=0x007F))
			{
				RESULT[i] = character.charAt(i);
			}
			else if(STRING>0x07FF)
			{
				RESULT[i] = String.fromCharCode(0xE0|((STRING>>12)&0x0F) , 0x80|((STRING>>6)&0x3F) , 0x80|((STRING>>0)&0x3F));
			}
			else
			{
				RESULT[i] = String.fromCharCode(0xC0|((STRING>>6)&0x1F) , 0x80|((STRING>>0)&0x3F));
			}
		}

		return RESULT.join('');
	}

	this.urlencode = function(CHARACTER)
	{
		var RESULT = "";

		for(i=0;i<CHARACTER.length;i++)
		{
			var STRING = CHARACTER.charCodeAt(i);

			if(STRING>=0x4e00)
			{
				execScript("ascCode=hex(asc(\""+CHARACTER.charAt(i)+"\"))","vbscript");
				RESULT += ascCode.replace(/(.{2})/g, "%$1");
			}
			else
			{
				RESULT += escape(CHARACTER.charAt(i));
			}
		}
	
		return RESULT;
	}

	this.urldecode = function(CHARACTER)
	{
		var RESULT = "";

		for(i=0;i<CHARACTER.length;i++)
		{
			var STRING = CHARACTER.charAt(i);

			if(STRING == "+")
			{
				RESULT+=" ";
			}
			else if(STRING=="%")
			{
				var asc = CHARACTER.substring(i+1,i+3);

				if(parseInt("0x"+asc)>0x7f)
				{
					execScript("code=chr("+parseInt("0x"+asc+CHARACTER.substring(i+4,i+6))+")","vbscript");
					RESULT += code;
					i+=5;
				}
				else
				{
					execScript("code=chr("+parseInt("0x"+asc)+")", "vbscript");
					RESULT += code;
					i+=2;
				}
			}
			else
			{
				RESULT += STRING;
			}
		}

		return RESULT;
	}
}

function XXTEA() //注意：要有前面 CONVERT 类的支持，与服务器端交互时页面使用 UTF-8 编码
{
	this.charst = new CONVERT();
	this.conste = 0x9E3779B9;

	this.buildin_CRYPTL = function(NUMS,BOOL)
	{
		var NUMS_LENGTH = NUMS.length;

		var NUMS_MOVE = (NUMS_LENGTH-1)<<2;

		if(BOOL)
		{
			var TRUE_MOVE = NUMS[NUMS_LENGTH - 1];

			if ((TRUE_MOVE<NUMS_MOVE-3) || (TRUE_MOVE>NUMS_MOVE))
			{
				return false;
			}
			else
			{
				NUMS_MOVE = TRUE_MOVE;
			}
		}

		for(i=0;i<NUMS_LENGTH;i++)
		{
			NUMS[i] = String.fromCharCode(NUMS[i]&0xff , NUMS[i]>>>8&0xff , NUMS[i]>>>16&0xff , NUMS[i]>>>24&0xff);
		}

		return BOOL ? NUMS.join('').substring(0,NUMS_MOVE) : NUMS.join('');
	}

	this.buildin_CRYPTS = function(CHARS,BOOL)
	{
		var CHARS_LENGTH = CHARS.length;

		var ARRAY = new Array();

		for (i=0;i<CHARS_LENGTH;i+=4)
		{
			ARRAY[i>>2] = (CHARS.charCodeAt(i)) | (CHARS.charCodeAt(i+1)<<8) | (CHARS.charCodeAt(i+2)<<16) | (CHARS.charCodeAt(i+3)<<24);
		}

		if(BOOL)
		{
			ARRAY[ARRAY.length] = CHARS_LENGTH;
		}

		return ARRAY;
	}

	this.encode = function(data,key)
	{
		if (data == "")
		{
			return "";
		}

		var S_DATA = this.buildin_CRYPTS(this.charst.utf16to8(data),true);
		var S_KEY = this.buildin_CRYPTS(this.charst.base64_encode(this.charst.utf16to8(key)),false);

		if (S_KEY.length<4)
		{
			S_KEY.length = 4;
		}

		var e = 0;
		var m = 0;
		var n = S_DATA.length - 1;
		var p = 0;
		var q = Math.floor(6+52/(n+1));
		var s = 0;
		var y = S_DATA[0];
		var z = S_DATA[n];

		while(0 < q--)
		{
			s = s + this.conste & 0xffffffff;
			e = s >>> 2 & 3;

			for (p=0;p<n;p++)
			{
				y = S_DATA[p+1];
				m = (z>>>5^y<<2) + (y>>>3^z<<4)^(s^y) + (S_KEY[p&3^e]^z);
				z = S_DATA[p] = S_DATA[p] + m&0xffffffff;
			}

			y = S_DATA[0];
			m = (z>>>5^y<<2) + (y>>>3^z<<4)^(s^y) + (S_KEY[p&3^e]^z);
			z = S_DATA[n] = S_DATA[n] + m&0xffffffff;
		}

		return this.charst.base64_encode(this.buildin_CRYPTL(S_DATA,false));
	}

	this.decode = function(data,key)
	{
		if (data == "")
		{
			return "";
		}

		var S_DATA = this.buildin_CRYPTS(this.charst.base64_decode(data),false);
		var S_KEY = this.buildin_CRYPTS(this.charst.base64_encode(this.charst.utf16to8(key)),false);

		if (S_KEY.length<4)
		{
			S_KEY.length = 4;
		}

		var e = 0;
		var m = 0;
		var n = S_DATA.length - 1;
		var p = 0;
		var q = Math.floor(6+52/(n+1));
		var s = q * this.conste & 0xffffffff;
		var y = S_DATA[0];
		var z = S_DATA[n-1];

		while(s!=0)
		{
			e = s >>> 2 & 3;

			for (p=n;p>0;p--)
			{
				z = S_DATA[p-1];
				m = (z>>>5^y<<2) + (y>>>3^z<<4)^(s^y) + (S_KEY[p&3^e]^z);
				y = S_DATA[p] = S_DATA[p]-m&0xffffffff;
			}

			z = S_DATA[n];
			m = (z>>>5^y<<2) + (y>>>3^z<<4)^(s^y) + (S_KEY[p&3^e]^z);
			y = S_DATA[0] = S_DATA[0] - m&0xffffffff;
			s = s - this.conste&0xffffffff;
		}

		return this.charst.utf8to16(this.buildin_CRYPTL(S_DATA,true));
	}
}

function Nebula() //资源池
{
	var RSCBIN = new Array();

	this.create = function(object)
	{
		var curr_num = RSCBIN.length;

		if(!object)
		{
			if(arguments[1])
			{
				RSCBIN[arguments[1]] = false;
			}
			else
			{
				RSCBIN[curr_num] = false;
			}
		}
		else
		{
			if(arguments[1])
			{
				RSCBIN[arguments[1]] = object;
			}
			else
			{
				RSCBIN[curr_num] = object;
			}
		}

		if(arguments[1])
		{
			return arguments[1];
		}
		else
		{
			return curr_num;
		}
	}

	this.get = function()
	{
		var curr_get = arguments[0]+1 ? arguments[0] : RSCBIN.length-1;

		return RSCBIN[curr_get];
	}
}

function EventKey() //键盘事件
{
	this.keyfunction = new Array();
	this.keystring = "";

	var This = this;

	this.keyadd = function(keycode,event)
	{
		this.keystring = 'if(event.keyCode=='+keycode+') '+event;
		this.keyfunction[this.keyfunction.length] = this.keystring;
	}

	this.keyapply = function()
	{
		document.onkeydown = function() //事件重定义
		{
			if(event.srcElement.tagName!='TEXTAREA')
			{
				with(document.all)
				{
					for(i=0;i<This.keyfunction.length;i++)
					{
						try
						{
							eval(This.keyfunction[i]);
						}
						catch(e){};
					}
				}
			}
		}
	}
}

//附加功能模块开始
//////////////////////////////////////////////////////////////////

function showkeycode() //给出键盘按键相应KeyCode
{
	//用法：document.onkeydown = showkeycode;
	with(document.all)
	{
		__("当前按键代码："+event.keyCode);
	}
}

function resizeImg(target,ignoresize,newsize) //图片大小调整
{
	var imgs = _(target).getElementsByTagName("IMG");
	for(var i=0;i<imgs.length;i++)
	{
		if(imgs[i].width > ignoresize)
		{
			imgs[i].width = newsize;
		}	
	}
}

function hideImg(target) //隐藏图片
{
	var imgs = _(target).getElementsByTagName("IMG");
	for(var i=0;i<imgs.length;i++)
	{
		imgs[i].style.display = "none";
	}
}

function FixImage() //修复无效图片地址，作用于 window.onload
{
	try
	{
		for(i=0;i<document.images.length;i++)
		{
			if(!document.images[i].complete)
			{
				document.images[i].style.visibility = "hidden";
			}
		}
	}
	catch(e){}
}

function opendialog() //打开网页对话框
{
	var dlgsrc = arguments[0];
	var dlgargu = arguments[1];
	var dlgwidth = arguments[2];
	var dlgheight = arguments[3];
	var dlgother = arguments[4];
	var dlgfeature = "dialogWidth="+dlgwidth+"px;dialogHeight="+dlgheight+"px;"+dlgother;
	var dlgvalue = window.showModalDialog(dlgsrc,dlgargu,dlgfeature);
}

function SetCookie(name,value,expires) //设置Cookie (名称,值,过期天数)
{
	var expDate = new Date();
	expDate.setTime(expDate.getTime()+expires*60*60*24);
	var expString = ((expires==null) ? "" : (";expires="+expDate.toGMTString()))
	document.cookie = name + "=" + escape(value) + expString;
}

function GetCookie(name) //读取Cookie
{
	var result = null;
	var myCookie = document.cookie + ";";
	var searchName = name + "=";
	var startOfCookie = myCookie.indexOf(searchName);
	var endOfCookie;
	if (startOfCookie != -1)
	{
		startOfCookie += searchName.length;
		endOfCookie = myCookie.indexOf(";",startOfCookie);
		result = unescape(myCookie.substring(startOfCookie, endOfCookie));
	}

	return result;
}

//扩展应用开始
//////////////////////////////////////////////////////////////////

function quickget(target,source) //快速填充
{
	var data = new DNA("data",source);

	data.xmlhttp_compelte = function()
	{
		if(this.debug_curr == 107)
		{
			try
			{
				_(target).innerHTML = this.xmlhttp_content;
				this.debug(301);
			}
			catch(e)
			{
				this.debug(302);
			}
		}
	}

	data.init();
}

function quickpost(item,value,source) //快速提交，如果服务器端返回值等于RAND值则表示提交成功
{
	var RAND = Math.random();
	var data = new DNA("data",source);
	data.post("RAND",RAND);
	data.post(item,value);

	data.xmlhttp_compelte = function()
	{
		if(this.xmlhttp_content == RAND)
		{
			this.debug(401);
			return true;
		}
		else
		{
			this.debug(402);
			return false;
		}
	}

	data.init();
}

function msgbox(title,text) //消息框
{
	var PARA = new Array();

	PARA.width = 400;
	PARA.height = 200;
	PARA.title = title;
	PARA.text = text;
	PARA.yes = true;
	PARA.no = false;
	PARA.effect = true;

	var MSGBOX = new INFO(PARA);
	
	if(arguments.length>2)
	{
		MSGBOX.btnYes = arguments[2][0] ? arguments[2][0] : function(){};
	}

	MSGBOX.show();
}

function choose(title,text) //选择框
{
	var PARA = new Array();

	PARA.width = 400;
	PARA.height = 200;
	PARA.title = title;
	PARA.text = text;
	PARA.yes = true;
	PARA.no = true;

	var CHOOSE = new INFO(PARA);

	if(arguments.length>2)
	{
		CHOOSE.btnYes = arguments[2][0] ? arguments[2][0] : function(){};
		CHOOSE.btnNo = arguments[2][1] ? arguments[2][1] : function(){};
	}

	CHOOSE.show();
}

function wait() //等待框
{
	var PARA = new Array();

	PARA.width = 400;
	PARA.height = 100;
	PARA.title = "请稍候...";
	PARA.needcover = true;
	PARA.text = "";
	PARA.text += '<table width="100%" height="100%">';
	PARA.text += '<tr>';
	PARA.text += '<td width="80" align="center"><img src="images/loading.gif"></td>';
	PARA.text += '<td width="320">系统处理中，请等待...</td>';
	PARA.text += '</tr>';
	PARA.text += '</table>';

	WAIT = new INFO(PARA);

	this.begin = function()
	{
		WAIT.show();
	}

	this.end = function()
	{
		WAIT.hide();
	}
}

function submit() //提交信息框
{
	var SUBMIT = false;

	this.start = function()
	{
		var PARA = new Array();

		PARA.width = 400;
		PARA.height = 170;
		PARA.effect = true;
		PARA.yes = true;
		PARA.title = arguments[0] ? arguments[0] : "数据提交";
		PARA.needcover = true;
		PARA.text = "";
		PARA.text += '<table width="100%" height="100%">';
		PARA.text += '<tr>';
		PARA.text += '<td width="80" align="center"><img src="images/loading.gif"></td>';
		PARA.text += '<td width="320">信息提交中，请等待...</td>';
		PARA.text += '</tr>';
		PARA.text += '</table>';
	
		SUBMIT = new INFO(PARA);
		SUBMIT.show();
	}

	this.ok = function()
	{
		var TEXT = "";
		TEXT += '<table width="100%" height="100%">';
		TEXT += '<tr>';
		TEXT += '<td width="80" align="center"><img src="images/Submit_OK.gif"></td>';
		TEXT += '<td width="320">';
		TEXT += arguments[0]?arguments[0]:"提交成功！";
		TEXT += '</td>';
		TEXT += '</tr>';
		TEXT += '</table>';

		SUBMIT.InfoBox_Text.innerHTML = TEXT;
		SUBMIT.show();
	}

	this.fail = function()
	{
		var TEXT = "";
		TEXT += '<table width="100%" height="100%">';
		TEXT += '<tr>';
		TEXT += '<td width="80" align="center"><img src="images/Submit_Fail.gif"></td>';
		TEXT += '<td width="320">';
		TEXT += arguments[0] ? arguments[0] : "提交出错！";
		TEXT += '</td>';
		TEXT += '</tr>';
		TEXT += '</table>';

		SUBMIT.InfoBox_Text.innerHTML = TEXT;
		SUBMIT.show();
	}
}

//全局对象初始化开始
//////////////////////////////////////////////////////////////////////
var __ = function(){window.status = arguments[0];}; //状态栏信息
var _ = document.getElementById; //相当于$()
