﻿function GetXmlHttpObject(){
	var xmlHttp=null;
	try{
		xmlHttp=new XMLHttpRequest();
	}
	catch (e){
		try{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e){
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	return xmlHttp;
}
document.write("<style type=\"text/css\">*{padding:0; margin:0}.close{float:right;cursor:default}</style>")
function _$(id){
	return document.getElementById(id)
}
function AlertMsg(w,h,title,content){
	var msgw,msgh,msgbg,msgcolor,bordercolor,titlecolor,titlebg;
	msgw = w;
	msgh = h;
	msgbg = "#FFF";
	msgcolor = "#000";
	bordercolor = "#000";
	titlecolor = "#FFF";
	titlebg = "#369";
	var sWidth,sHeight;
	sWidth = screen.availWidth;
	if(screen.availHeight > document.body.scrollHeight){
		sHeight = screen.availHeight;
	}
	else{
		sHeight = document.body.scrollHeight;
	}
	var browser=navigator.appName;
	var b_version=navigator.appVersion ;
	var version=b_version.split(";");
	var trim_Version=version[1].replace(/[ ]/g,"");
	if(browser=="Microsoft Internet Explorer" && trim_Version=="MSIE6.0"){
		hideOrShowSelect(true);
		document.documentElement.style.overflow = "hidden";
	}
	else{
		try{
			document.body.style.overflow="hidden";
		}
		catch (err){
		}
	}
	var maskObj = document.createElement("div");
	maskObj.setAttribute('id','maskdiv');
	maskObj.style.position = "absolute";
	maskObj.style.top = "0";
	maskObj.style.left = "0";
	maskObj.style.background = "#777";
	maskObj.style.filter = "Alpha(opacity=30);";
	maskObj.style.opacity = "0.3";
	maskObj.style.width = sWidth + "px";
	maskObj.style.height = sHeight + "px";
	maskObj.style.zIndex = "10000";
	document.body.appendChild(maskObj);
	var msgObj = document.createElement("div")
	msgObj.setAttribute("id","msgdiv");
	msgObj.style.position ="absolute";
	msgObj.style.top = (screen.availHeight - msgh) / 4 + "px";
	msgObj.style.left = (screen.availWidth - msgw) / 2 + "px";
	msgObj.style.width = msgw + "px";
	msgObj.style.height = msgh + "px";
	msgObj.style.fontSize = "12px";
	msgObj.style.background = msgbg;
	msgObj.style.border = "1px solid " + bordercolor;
	msgObj.style.zIndex = "10001";
	var thObj = document.createElement("div");
	thObj.setAttribute("id","msgth");
	thObj.className = "DragAble";
	thObj.title = "按住鼠标左键可以拖动窗口！";
	thObj.style.cursor = "move";
	thObj.style.padding = "4px 6px";
	thObj.style.color = titlecolor;
	thObj.style.background = titlebg;
	var titleStr = "<a class='close' title='Close' onclick='CloseMsg()'>Close</a>"+"<span>"+ title +"</span>";
	thObj.innerHTML = titleStr;
	var bodyObj = document.createElement("div");
	bodyObj.setAttribute("id","msgbody");
	bodyObj.style.padding = "10px";
	bodyObj.style.lineHeight = "1.5em";
	var txt = document.createTextNode(content)
	bodyObj.appendChild(txt);
	document.body.appendChild(msgObj);
	_$("msgdiv").appendChild(thObj);
	_$("msgdiv").appendChild(bodyObj);
}
function CloseMsg(){
	document.body.removeChild(_$("maskdiv"));
	_$("msgdiv").removeChild(_$("msgth"));
	_$("msgdiv").removeChild(_$("msgbody"));
	document.body.removeChild(_$("msgdiv"));
	var browser=navigator.appName;
	var b_version=navigator.appVersion ;
	var version=b_version.split(";");
	var trim_Version=version[1].replace(/[ ]/g,"");
	if(browser=="Microsoft Internet Explorer" && trim_Version=="MSIE6.0"){
		document.documentElement.style.overflow = "";
		hideOrShowSelect(false);
	}
	else{
		try{
			document.body.style.overflow="";
		}
		catch (err){
		}
	}
}
var ie = document.all;
var nn6 = document.getElementById&&!document.all;
var isdrag = false;
var y,x;
var oDragObj;
function moveMouse(e){
	if (isdrag){
		oDragObj.style.top = (nn6 ? nTY + e.clientY - y : nTY + event.clientY - y)+"px";
		oDragObj.style.left = (nn6 ? nTX + e.clientX - x : nTX + event.clientX - x)+"px";
		return false;
	}
}
function initDrag(e){
	var oDragHandle = nn6 ? e.target : event.srcElement;
	var topElement = "HTML";
	while (oDragHandle.tagName != topElement && oDragHandle.className != "DragAble"){
		oDragHandle = nn6 ? oDragHandle.parentNode : oDragHandle.parentElement;
	}
	if (oDragHandle.className=="DragAble"){
		isdrag = true;
		oDragObj = oDragHandle.parentNode;
		nTY = parseInt(oDragObj.style.top);
		y = nn6 ? e.clientY : event.clientY;
		nTX = parseInt(oDragObj.style.left);
		x = nn6 ? e.clientX : event.clientX;
		document.onmousemove = moveMouse;
		return false;
	}
}
document.onmousedown = initDrag;
document.onmouseup = new Function("isdrag=false");
function LoadFrom(w,h,title,content){
	var msgw,msgh,msgbg,msgcolor,bordercolor,titlecolor,titlebg;
	msgw = w;
	msgh = h;
	msgbg = "#FFF";
	msgcolor = "#000";
	bordercolor = "#000";
	titlecolor = "#FFF";
	titlebg = "#369";
	var sWidth,sHeight;
	sWidth = screen.availWidth;
	if(screen.availHeight > document.body.scrollHeight){
		sHeight = screen.availHeight;
	}
	else{
		sHeight = document.body.scrollHeight;
	}
	var browser=navigator.appName;
	var b_version=navigator.appVersion ;
	var version=b_version.split(";");
	var trim_Version=version[1].replace(/[ ]/g,"");
	if(browser=="Microsoft Internet Explorer" && trim_Version=="MSIE6.0"){
		hideOrShowSelect(true);
		document.documentElement.style.overflow = "hidden";
	}
	else{
		try{
			document.body.style.overflow="hidden";
		}
		catch (err){
		}
	}
	var maskObj = document.createElement("div");
	maskObj.setAttribute('id','LoadFrommaskdiv');
	maskObj.style.position = "absolute";
	maskObj.style.top = "0";
	maskObj.style.left = "0";
	maskObj.style.background = "#777";
	maskObj.style.filter = "Alpha(opacity=30);";
	maskObj.style.opacity = "0.3";
	maskObj.style.width = sWidth + "px";
	maskObj.style.height = sHeight + "px";
	maskObj.style.zIndex = "10000";
	document.body.appendChild(maskObj);
	var msgObj = document.createElement("div")
	msgObj.setAttribute("id","LoadFrommsgdiv");
	msgObj.style.position ="absolute";
	msgObj.style.top = (screen.availHeight - msgh) / 4 + "px";
	msgObj.style.left = (screen.availWidth - msgw) / 2 + "px";
	msgObj.style.width = msgw + "px";
	msgObj.style.height = msgh + "px";
	msgObj.style.fontSize = "12px";
	msgObj.style.background = msgbg;
	msgObj.style.border = "1px solid " + bordercolor;
	msgObj.style.zIndex = "10001";
	var thObj = document.createElement("div");
	thObj.setAttribute("id","LoadFrommsgth");
	thObj.className = "DragAble";
	thObj.title = "按住鼠标左键可以拖动窗口！";
	thObj.style.cursor = "move";
	thObj.style.padding = "4px 6px";
	thObj.style.color = titlecolor;
	thObj.style.background = titlebg;
	var titleStr = "<a class='close' title='Close' onclick='LoadFromClose()'>Close</a>"+"<span>"+ title +"</span>";
	thObj.innerHTML = titleStr;
	var bodyObj = document.createElement("div");
	bodyObj.setAttribute("id","LoadFrommsgbody");
	var contentStr = "<iframe src='"+ content +"' name='uppic1' frameborder='0' scrolling='no' width='100%' height='"+(msgh-25)+"'></iframe>";
	bodyObj.innerHTML = contentStr;
	document.body.appendChild(msgObj);
	_$("LoadFrommsgdiv").appendChild(thObj);
	_$("LoadFrommsgdiv").appendChild(bodyObj);
}
function LoadFromcn(w,h,title,content){
	var msgw,msgh,msgbg,msgcolor,bordercolor,titlecolor,titlebg;
	msgw = w;
	msgh = h;
	msgbg = "#FFF";
	msgcolor = "#000";
	bordercolor = "#000";
	titlecolor = "#FFF";
	titlebg = "#369";
	var sWidth,sHeight;
	sWidth = screen.availWidth;
	if(screen.availHeight > document.body.scrollHeight){
		sHeight = screen.availHeight;
	}
	else{
		sHeight = document.body.scrollHeight;
	}
	var browser=navigator.appName;
	var b_version=navigator.appVersion ;
	var version=b_version.split(";");
	var trim_Version=version[1].replace(/[ ]/g,"");
	if(browser=="Microsoft Internet Explorer" && trim_Version=="MSIE6.0"){
		hideOrShowSelect(true);
		document.documentElement.style.overflow = "hidden";
	}
	else{
		try{
			document.body.style.overflow="hidden";
		}
		catch (err){
		}
	}
	var maskObj = document.createElement("div");
	maskObj.setAttribute('id','LoadFrommaskdiv');
	maskObj.style.position = "absolute";
	maskObj.style.top = "0";
	maskObj.style.left = "0";
	maskObj.style.background = "#777";
	maskObj.style.filter = "Alpha(opacity=30);";
	maskObj.style.opacity = "0.3";
	maskObj.style.width = sWidth + "px";
	maskObj.style.height = sHeight + "px";
	maskObj.style.zIndex = "10000";
	document.body.appendChild(maskObj);
	var msgObj = document.createElement("div")
	msgObj.setAttribute("id","LoadFrommsgdiv");
	msgObj.style.position ="absolute";
	msgObj.style.top = (screen.availHeight - msgh) / 4 + "px";
	msgObj.style.left = (screen.availWidth - msgw) / 2 + "px";
	msgObj.style.width = msgw + "px";
	msgObj.style.height = msgh + "px";
	msgObj.style.fontSize = "12px";
	msgObj.style.background = msgbg;
	msgObj.style.border = "1px solid " + bordercolor;
	msgObj.style.zIndex = "10001";
	var thObj = document.createElement("div");
	thObj.setAttribute("id","LoadFrommsgth");
	thObj.className = "DragAble";
	thObj.title = "按住鼠标左键可以拖动窗口！";
	thObj.style.cursor = "move";
	thObj.style.padding = "4px 6px";
	thObj.style.color = titlecolor;
	thObj.style.background = titlebg;
	var titleStr = "<a class='close' title='Close' onclick='LoadFromClose()'>关闭</a>"+"<span>"+ title +"</span>";
	thObj.innerHTML = titleStr;
	var bodyObj = document.createElement("div");
	bodyObj.setAttribute("id","LoadFrommsgbody");
	var contentStr = "<iframe src='"+ content +"' name='uppic1' frameborder='0' scrolling='no' width='100%' height='"+(msgh-25)+"'></iframe>";
	bodyObj.innerHTML = contentStr;
	document.body.appendChild(msgObj);
	_$("LoadFrommsgdiv").appendChild(thObj);
	_$("LoadFrommsgdiv").appendChild(bodyObj);
}
function LoadFromClose(){
	document.body.removeChild(_$("LoadFrommaskdiv"));
	_$("LoadFrommsgdiv").removeChild(_$("LoadFrommsgth"));
	_$("LoadFrommsgdiv").removeChild(_$("LoadFrommsgbody"));
	document.body.removeChild(_$("LoadFrommsgdiv"));
	var browser=navigator.appName;
	var b_version=navigator.appVersion ;
	var version=b_version.split(";");
	var trim_Version=version[1].replace(/[ ]/g,"");
	if(browser=="Microsoft Internet Explorer" && trim_Version=="MSIE6.0"){
		document.documentElement.style.overflow = "";
		hideOrShowSelect(false);
	}
	else{
		try{
			document.body.style.overflow="";
		}
		catch (err){
		}
	}
}
function AjaxLoading(xmlHttp){
	if(xmlHttp.readyState==4){
		CloseLoading();
	}
	else{
		DivLoading();
	}
}
function DivLoading(){
	if( _$("LoadDiv")){
		return ;
	}
	var msgw,msgh,msgbg,msgcolor,bordercolor,titlecolor,titlebg;
	msgw = 100;
	msgh = 100;
	msgbg = "#FFF";
	msgcolor = "#000";
	bordercolor = "#000";
	titlecolor = "#FFF";
	titlebg = "#369";
	var sWidth,sHeight;
	sWidth = screen.availWidth;
	if(screen.availHeight > document.body.scrollHeight){
		sHeight = screen.availHeight;
	}
	else{
		sHeight = document.body.scrollHeight;
	}
	var browser=navigator.appName;
	var b_version=navigator.appVersion ;
	var version=b_version.split(";");
	var trim_Version=version[1].replace(/[ ]/g,"");
	if(browser=="Microsoft Internet Explorer" && trim_Version=="MSIE6.0"){
		hideOrShowSelect(true);
		document.documentElement.style.overflow = "hidden";
	}
	else{
		try{
			document.body.style.overflow="hidden";
		}
		catch (err){
		}
	}
	var maskObj= document.createElement("div");
	maskObj.setAttribute('id','LoadDiv');
	maskObj.style.position = "absolute";
	maskObj.style.top = "0";
	maskObj.style.left = "0";
	maskObj.style.background = "#999";
	maskObj.style.filter = "Alpha(opacity=20);";
	maskObj.style.opacity = "0.2";
	maskObj.style.width = sWidth + "px";
	maskObj.style.height = sHeight + "px";
	maskObj.style.zIndex = "10000";
	document.body.appendChild(maskObj);
	var msgObj = document.createElement("div")
	msgObj.setAttribute("id","msgFromdiv");
	msgObj.style.position ="absolute";
	msgObj.style.top="50%";
	msgObj.style.left="50%";
	msgObj.style.marginLeft= "-"+ msgw/2+"px";
	msgObj.style.marginTop= "-"+ msgh/2+"px";
	msgObj.style.width = msgw + "px";
	msgObj.style.height = msgh + "px";
	msgObj.style.fontSize = "12px";
	msgObj.style.zIndex = "10001";
	var thObj = document.createElement("div");
	thObj.setAttribute("id","Loadmsgth");
	thObj.title = "正在加载，请稍后..！";
	var titleStr = "<img src='../images/indicator.gif'/>";
	thObj.innerHTML = titleStr;
	document.body.appendChild(msgObj);
	_$("msgFromdiv").appendChild(thObj);
}
function CloseLoading(){
	document.body.removeChild(_$("LoadDiv"));
	_$("msgFromdiv").removeChild(_$("Loadmsgth"));
	document.body.removeChild(_$("msgFromdiv"));
	var browser=navigator.appName;
	var b_version=navigator.appVersion ;
	var version=b_version.split(";");
	var trim_Version=version[1].replace(/[ ]/g,"");
	var browser=navigator.appName;
	var b_version=navigator.appVersion ;
	var version=b_version.split(";");
	var trim_Version=version[1].replace(/[ ]/g,"");
	if(browser=="Microsoft Internet Explorer" && trim_Version=="MSIE6.0"){
		document.documentElement.style.overflow = "";
		hideOrShowSelect(false);
	}
	else{
		try{
			document.body.style.overflow="";
		}
		catch (err){
		}
	}
}
function hideOrShowSelect(v){
	var allselect = document.getElementsByTagName("select");
	for (var i=0; i<allselect.length; i++){
		allselect[i].disabled =(v==true)?"disabled":"";
	}
}

