document.write("<script language=\"JavaScript\" src=\"..\/js\/prototype.js\"><\/script>");

//###################################
//以下是窗口控制
//###################################
function redirectWin(url) {

	/*document.location.href = url;
	return;*/
	var scrWidth  = screen.availWidth;
	var scrHeight = screen.availHeight;
	var ebanswersCSMWin = window.open(url,"ebanswersCSMWin", "resizable=1,scrollbars=No");
	ebanswersCSMWin.moveTo(0, 0);
	ebanswersCSMWin.resizeTo(scrWidth, scrHeight);
	window.opener = null;
	window.close(); 
	
}

// 弹出新窗口
function OpenWin(url, name, left, top, width, height)
{
	try
	{
		var pars = "toolbar=no,location=no,menubar=no,top=" + top + ",left=" + left + ", width=" + width + ",height=" + height;
		window.open(url, name, pars);
	}
	catch(err)
	{
		alert(err.description);
	}
			
}

// 弹出滚动条新窗口
function OpenWinBar(url, name, left, top, width, height)
{

	try
	{
		var pars = "toolbar=no,location=no,menubar=no,scrollbars=yes,top=" + top + ",left=" + left + ", width=" + width + ",height=" + height;
		window.open(url, name, pars);
	}
	catch(err)
	{
		alert(err.description);
	}
			
}

function LoginOpenWin(url, name)
{
	var scrWidth  = screen.availWidth;
	var scrHeight = screen.availHeight;
	var MainWin = window.open(url, name, "resizable=1, scrollbars=No, status=yes, toolbar=no, menubar=no");
	MainWin.moveTo(0, 0);
	MainWin.resizeTo(scrWidth, scrHeight);
	window.opener = null;
	
	//window.close(); 
}

function OpenModalWin(urlstr, width, height) {
	var xml=showModalDialog(urlstr, "", "dialogWidth:"+width+"px; dialogHeight:"+height+"px; status:0");
}

function OpenModalessWin(win, urlstr, width, height)
{
	var xml=showModelessDialog(urlstr, win, "dialogTop:0px;dialogLeft:0px; dialogWidth:"+width+"px; dialogHeight:"+height+"px; status:0");
}

// 关闭窗口
function CloseWin()
{
	var ua=navigator.userAgent
	var ie=navigator.appName=="Microsoft Internet Explorer"?true:false
	if(ie)
	{
		var IEversion=parseFloat(ua.substring(ua.indexOf("MSIE ")+5,ua.indexOf(";",ua.indexOf("MSIE "))))
		if(IEversion< 5.5)
		{
			var str  = '<object id=noTipClose classid="clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11">'
			str += '<param name="Command" value="Close"></object>';
			document.body.insertAdjacentHTML("beforeEnd", str);
			document.all.noTipClose.Click();
		}
		else
		{
			window.opener =null;
			window.close();
		}
	}
	else
	{
		window.close()
	}
}

//###################################
//以下是表单控件控制
//###################################

//验证密码是否为空
function getStrength (passwd){

    var pt1 = /^[0-9a-zA-Z!,@#$%^&*?_~]{8,16}$/;

    var pt2 = /[a-z]/;

    var pt3 = /[A-Z]/;

    var pt4 = /[0-9]/;

    var pt5 = /[!,@#$%^&*?_~]/;

    if (!pt1.test(passwd)|| !pt2.test(passwd) || !pt3.test(passwd) || !pt4.test(passwd) || !pt5.test(passwd) ) {

      alert('密码不符合校验规则！');

      return false;

    }

    return true;

}


// 验证输入内容是否为空
function CheckEmpty(control, msg)
{	
	if (document.all(control).value == "")
	{
		alert(msg);
		return false;
	}
	return true;
}

// 验证输入内容是否为空
function CheckEmptyZD(value, msg)
{	
	if (value == "")
	{
		alert(msg);
		return false;
	}
	return true;
}

// 设置控件是否显示
function DisabledControl(control, isDiabled)
{
	if (document.all(control) != null)
	{
		if (isDiabled)
		{
			document.all(control).disabled = "disabled";
		}
		else
		{
			document.all(control).disabled = "";
		}
	}
}

//验证是否全部是数字
function isDigit(s)
{
	var patrn=/^[0-9]{1,20}$/;
	if (!patrn.exec(s)) return false
	return true
}

function isNumber(oNum)
{
  if(!oNum) return false;
  var strP=/^\d+(\.\d+)?$/;
  if(!strP.test(oNum)) return false;
  try{
  if(parseFloat(oNum)!=oNum) return false;
  }
  catch(ex)
  {
   return false;
  }
  return true;
}

//###################################
//以下是Xml控制
//###################################

// 解析xml
function ParseXml(xml)
{
	//var orderDoc = new ActiveXObject("MSXML2.DOMDocument.3.0");
	var orderDoc;
	var arrSignatures = ["MSXML2.DOMDocument.5.0", "MSXML2.DOMDocument.4.0",
						"MSXML2.DOMDocument.3.0", "MSXML2.DOMDocument",
						"Microsoft.XmlDom"];
						 
	for (var i=0; i < arrSignatures.length; i++) {
		try 
		{
			orderDoc = new ActiveXObject(arrSignatures[i]);
		
		} catch (oError) {
			//ignore
		}
	} 
	if (orderDoc == null)
	{
		return null;
	}
	orderDoc.loadXML(xml);

	var node=orderDoc.selectSingleNode("ResultData/Error");
	var err;
	if (node != null)
	{
		err = node.text;
	}
	else
	{
		err = "";
	}
	var node1=orderDoc.selectSingleNode("ResultData/Data");
	var data;
	if (node1 != null)
	{
		data = node1.text;
	}
	else
	{
		data = "";
	}

	var oTempCar= new Object();
	oTempCar.error=err;
	oTempCar.data=data;
	return oTempCar;
}

// 解析xml,返回Node值
function ParseXmlNode(xml)
{
	//var orderDoc = new ActiveXObject("MSXML2.DOMDocument.3.0");
	var orderDoc;
	var arrSignatures = ["MSXML2.DOMDocument.5.0", "MSXML2.DOMDocument.4.0",
						"MSXML2.DOMDocument.3.0", "MSXML2.DOMDocument",
						"Microsoft.XmlDom"];
						 
	for (var i=0; i < arrSignatures.length; i++) {
		try 
		{
			orderDoc = new ActiveXObject(arrSignatures[i]);
		
		} catch (oError) {
			//ignore
		}
	} 
	if (orderDoc == null)
	{
		return null;
	}
	orderDoc.loadXML(xml);

	var node=orderDoc.selectSingleNode("ResultData/Error");
	var err;
	if (node != null)
	{
		err = node.text;
	}
	else
	{
		err = "";
	}
	var node1=orderDoc.selectSingleNode("ResultData/Data");
	var data;
	if (node1 != null)
	{
		data = node1.text;
	}
	else
	{
		data = "";
	}

	return data;
}

// 获取页面parameter
function getparastr(strname)
{
	var hrefstr,pos,parastr,para,tempstr;
	hrefstr = window.location.href;
	pos = hrefstr.indexOf("?")
	parastr = hrefstr.substring(pos+1);
	para = parastr.split("&");
	tempstr="";
	for(var i=0;i<para.length;i++)
	{
		tempstr = para[i];
		pos = tempstr.indexOf("=");
		if(tempstr.substring(0,pos) == strname)
		{
		return tempstr.substring(pos+1);
		}
	}
	return null;
}

function showLoadingMsg() {

	try {		
					
			var div = document.all.loadingdiv;
			div.style.left = (document.body.clientWidth/2 - 90) + "px";
			div.style.top = (document.body.clientHeight/2 - 30) + "px";
			//div.style.left = (100) + "px";
			//div.style.top = (100) + "px";
			div.style.height = "40px";
			div.style.width = "180px";
			div.style.display = "inline";
			
		
	} catch (e) {
		alert(e.discription);
	}
}

function hideLoadintMsg() {
	try {
		
			var div = document.all.loadingdiv;
			div.style.display = "none";
		

	} catch (e) {
		alert(e.discription);
	}
}


function showCreatingMsg() {

	try {		
					
			var div = document.all.creatingdiv;
			div.style.left = (document.body.clientWidth/2 - 90) + "px";
			div.style.top = (document.body.clientHeight/2 - 30) + "px";
			//div.style.left = (100) + "px";
			//div.style.top = (100) + "px";
			div.style.height = "40px";
			div.style.width = "350px";
			div.style.display = "inline";
			
		
	} catch (e) {
		alert(e.discription);
	}
}

function hideCreatingMsg() {
	try {
		
			var div = document.all.creatingdiv;
			div.style.display = "none";	

	} catch (e) {
		alert(e.discription);
	}
}