//Codzer: FengFeng , Nnsky .Inc
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

//Ajax
var XmlHttp = function()
    {
     var XMLHttp;
       if(window.XMLHttpRequest)
        {
            XMLHttp=new XMLHttpRequest();
        
            if(XMLHttp.overrideMimeType)
                {
                    XMLHttp.overrideMimeType("text/xml");
                }
        }
        else if(window.ActiveXObject)
        {
            try
            {
                XMLHttp=new ActiveXObject("Msxml2.XMLHTTP");   
            }
            catch(e)
            {
                XMLHttp=new ActiveXObject("Microsoft.XMLHTTP");   
            }
        }
        return XMLHttp;
    }
var loading = function(type,typeID,Url) 	
   {
     var Ajax = XmlHttp();
     if (Ajax != null)
         {
		 Ajax.onreadystatechange = function ()
           {
             if (Ajax.readyState == 4 && Ajax.responseText)
                {$(type).innerHTML=Ajax.responseText;}
            };
		Ajax.open("get",Url+".asp?ID="+typeID, true);
		Ajax.send();
         }
   }
var Loading = function(type,typeID,Url) 	
   {
     var Ajax = XmlHttp();
     if (Ajax != null)
         {
		 Ajax.onreadystatechange = function ()
           {
             if (Ajax.readyState == 4 && Ajax.responseText)
                {$(type).innerHTML=Ajax.responseText;}
            };
		Ajax.open("get",Url+".aspx?ID="+typeID, true);
		Ajax.send();
         }
   }
//get_request_value   
function ShowTabs1(lx,th,id,en){
for (i=0;i<=en;i++)
{
eval("TabTitle_"+lx)[i].className=th;
eval("Tabs_"+lx)[i].style.display='none';
}
eval("TabTitle_"+lx)[id].className=th+"_on";
eval("Tabs_"+lx)[id].style.display='';
}

var $R = function (Str)   
{
	var search = Str+"=";
	if (location.href.length > 0)
	{
		offset = location.href.indexOf(search);
		if (offset != -1)
		{
			offset += search.length;
			end = location.href.indexOf("&", offset)
			if (end == -1)
			{
				end = location.href.length;
			}
			var returnvalue=decodeURIComponent(location.href.substring(offset, end)).toLowerCase()
		}
	}
	return returnvalue;
}
//Browser check
var Browser = new Object();

//shortcut method
var $ = function(s)
{
	return (typeof s == "object") ? s: document.getElementById(s);
};

var $N = function(s)
{
	return (typeof s == "object") ? s: document.getElementsByName(s);
};

var $T = function(s)
{
	return (typeof s == "object") ? s: document.getElementsByTagName(s);
};

var $C = function(tag)
{
	return document.createElement(tag);
};

var $A = function(a)
{
	if (!a)
	{
		return new Array();
	}
	else
	{
		var r = new Array();

		for (var i=0; i<a.length; i++)
		{
			r.push(a[i]);
		}

		return r;
	}
};

//Element
var Element = {
	isEmpty: function(e)
	{
		return /^\s*$/.test($(e).innerHTML);
	},

	isVisible: function(e)
	{
		return $(e).style.display != 'none';
	},

	show: function()
	{
		for (var i=0; i<arguments.length; i++)
		{
			$(arguments[i]).style.display = "block";
		}
	},

	hide: function()
	{
		for (var i=0; i<arguments.length; i++)
		{
			$(arguments[i]).style.display = "none";
		}
	},

	toggle: function()
	{
		for (var i=0; i<arguments.length; i++)
		{
			Element[Element.isVisible($(arguments[i])) ? 'hide': 'show']($(arguments[i]));
		}
	},

	remove: function()
	{
		for (var i=0; i<arguments.length; i++)
		{
			try
			{
				$(arguments[i]).parentNode.removeChild($(arguments[i]));
			}
			catch (e)
			{
			}
		}
	},

	create: function(parent, tag, attr)
	{
		var _e = $C(tag);

		for (var i=0; i<attr.length; i++)
		{
			_e.setAttribute(attr[i][0], attr[i][1]);
		}

		$(parent).appendChild(_e);
	},

	getElementWidth: function(e)
	{
		return $(e).offsetWidth;
	},

	getElementHeight: function(e)
	{
		return $(e).offsetHeight;
	},

	getElementLeft: function(e)
	{
		return (e==null) ? 0 : ($(e).offsetLeft + Element.getElementLeft($(e).offsetParent));
	},

	getElementTop: function(e)
	{
		return (e==null) ? 0 : ($(e).offsetTop + Element.getElementTop($(e).offsetParent));
	},

	scrollIntoView: function(e)
	{
		var x = Element.getElementLeft(e);
		var y = Element.getElementTop(e);
		window.scrollTo(x, y);
	}
};


//Hash
var HashTable = function()
{
	this.__construct();
};

HashTable.prototype = {
	__construct: function()
	{
		this._hash = new Object();
	},

	set: function(key, value, rewrite)
	{
		if (rewrite !== false)
		{
			this._hash[key] = value;
		}
		else if (this.get(key) != null)
		{
			this._hash[key] = value;
		}
	},

	get: function(key)
	{
		if (typeof this._hash[key] != "undefined")
		{
			return this._hash[key];
		}
		else
		{
			return null;
		}
	},

	remove: function(key)
	{
		delete this._hash[key];
	}
};

HashTable.getInstance = function()
{
	if (!this.__instance__)
	{
		this.__instance__ = new HashTable();
	};

	return this.__instance__;
};

//Page object
var Page = {
	getPageWidth: function()
	{
		return document.documentElement.scrollWidth || document.body.scrollWidth || 0;
	},

	getPageHeight: function()
	{
		return document.documentElement.scrollHeight || document.body.scrollHeight || 0;
	},

	getBodyWidth: function()
	{
		return document.documentElement.clientWidth || document.body.clientWidth || 0;
	},

	getBodyHeight: function()
	{
		return document.documentElement.clientHeight || document.body.clientHeight || 0;
	},

	getBodyLeft: function()
	{
		return window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft || 0;
	},

	getBodyTop: function()
	{
		return window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;
	},

	getBody: function()
	{
		return {
			width  : this.getBodyWidth(),
			height : this.getBodyHeight(),
			left   : this.getBodyLeft(),
			top    : this.getBodyTop()
		};
	},

	getScreenWidth: function()
	{
		return window.screen.width;
	},

	getScreenHeight: function()
	{
		return window.screen.height;
	}
};

//Cod
var FengFeng = new Object();

//错误提示信息模式窗口
FengFeng.Modal = {
	showSelect: function()
	{
		var sel = $T("select");

		for (var i=0; i<sel.length; i++)
		{
			sel[i].style.visibility = "visible";
		}
	},

	hideSelect: function()
	{
		var sel = $T("select");

		for (var i=0; i<sel.length; i++)
		{
			sel[i].style.visibility = "hidden";
		}
	},

	showFloat: function()
	{
		$("sLayer").style.width = Page.getPageWidth() + "px";
		$("sLayer").style.height = Page.getPageHeight() + "px";
		Element.show("sLayer");
	},

	hideFloat: function()
	{
		Element.hide("sLayer");
	}
};

FengFeng.Modal.Box = {
	show: function(style_id,body_width,body_height,error)
	{
		$(style_id).style.width = body_width;
		$(style_id).style.height = body_height;
		FengFeng.Modal.hideSelect();
		FengFeng.Modal.showFloat();
		$(style_id).style.left = (Page.getBodyWidth() - body_width)/2 + "px";
		$(style_id).style.top = Page.getBodyTop() + 100 + "px";
		Element.show(style_id);
//		$("msg").innerHTML = error || "出错啦!";
		Element.show(style_id);

		FengFeng.Modal.Box.oY = Page.getBodyTop();
		FengFeng.Modal.Box.oTimer = window.setInterval("FengFeng.Modal.Box.scroll('"+style_id+"')", 1);
	},
	hide: function(style_id)
	{
		FengFeng.Modal.showSelect();
		FengFeng.Modal.hideFloat();
		Element.hide(style_id);
//		$("Login_Frame").src = "about:blank";

		window.clearInterval(FengFeng.Modal.Box.oTimer);
	},
	oY: 0,
	oTimer: null,
	scroll: function(style_id)
	{   
	    //var styleid="sPost";
		var winY = Page.getBodyTop();
		var curY = Element.getElementTop(style_id);

		var percent = 0.2 * (winY - FengFeng.Modal.Box.oY);

		if (percent > 0)
		{
			percent = Math.ceil(percent);
		}
		else
		{
			percent = Math.floor(percent);
		}

		$(style_id).style.top = curY + percent + "px";
		FengFeng.Modal.Box.oY += percent;

		FengFeng.Modal.showFloat();
	}
};

FengFeng.Modal.Frame = {
	show: function(style_id,body_width,body_height,frame_id,url)
	{
		$(style_id).style.width = body_width;
		$(frame_id).width = body_width - 40;
		$(frame_id).height = body_height - 40;
		FengFeng.Modal.hideSelect();
		FengFeng.Modal.showFloat();
		$(style_id).style.left = (Page.getBodyWidth() - body_width)/2 + "px";
		$(style_id).style.top = Page.getBodyTop() + 100 + "px";
		Element.show(style_id);
		$(frame_id).src = url;

		FengFeng.Modal.Frame.oY = Page.getBodyTop();
		FengFeng.Modal.Frame.oTimer = window.setInterval("FengFeng.Modal.Frame.scroll('"+style_id+"')", 1);
	},

	hide: function(style_id,frame_id)
	{
		FengFeng.Modal.showSelect();
		FengFeng.Modal.hideFloat();
		Element.hide(style_id);
		$(frame_id).src = "about:blank";

		window.clearInterval(FengFeng.Modal.Frame.oTimer);
	},

	oY: 0,
	oTimer: null,
	scroll: function(style_id)
	{
		var winY = Page.getBodyTop();
		var curY = Element.getElementTop(style_id);

		var percent = 0.2 * (winY - FengFeng.Modal.Frame.oY);

		if (percent > 0)
		{
			percent = Math.ceil(percent);
		}
		else
		{
			percent = Math.floor(percent);
		}

		$(style_id).style.top = curY + percent + "px";
		FengFeng.Modal.Frame.oY += percent;

		FengFeng.Modal.showFloat();
	}
};

