var err_a_en=""

function myAlert(){
	
}

function showURL(url) {
	showLoading();
	CommonAction.getContent(url, {callback:function (content) {
		hideLoading();
		$("content").innerHTML = content;
	}});
}
function showLoading() {
	var html = "<div id='loading' class='loading'>";
	html += "<img src='/images/loading.gif' border=0 align='absmiddle'>";
	html += "&nbsp;&nbsp;<b>Loading...</b>";
	html += "</div>";
	DialogShow(html, 300, 150);
}
function hideLoading() {
	var objLoading = $("loading");
	if (objLoading && objLoading.style.display != "none") {
		DialogHide();
		objLoading.style.display = "none";
	}
}
function showDialog(message) {
	var title = arguments[1] || "提示";
	var html = "<table id=dialog width=100% cellpadding=3 cellspacing=0 border=0 class=dialog><tr><th>";
	html += title;
	html += "</th><th style='text-align:right'><img src='/images/close.gif' align=absmiddle border=0 onclick='return DialogHide();'></th></tr>";
	html += "<tr><td colspan=2>";
	html += message;
	html += "</td></tr>";
	html += "<tr><td colspan=2 align=center>";
	html += "<button id=dialogCanncel onclick='return DialogHide();' class=normalButton>确 定</button>";
	html += "</td></tr></table>";
	DialogShow(html, 300, 250);
}

function showDialog2(message,url) {
	var title = "提示";
	var html = "<table id=dialog width=100% cellpadding=3 cellspacing=0 border=0 class=dialog><tr><th>";
	html += title;
	html += "</th><th style='text-align:right'><img src='/images/close.gif' align=absmiddle border=0 onclick='return DialogHide();'></th></tr>";
	html += "<tr><td colspan=2>";
	html += message;
	html += "</td></tr>";
	html += "<tr><td colspan=2 align=center>";
	html += "<button id=dialogCanncel onclick='DialogHide();location.href=\""+url+"\"' class=normalButton>确 定</button>";
	html += "</td></tr></table>";
	DialogShow(html, 300, 250);
}
function DialogShow(showdata, w, h) {
	ScreenConvert();
	var objDialog = $("DialogMove");
	if (!objDialog) {
		objDialog = document.createElement("div");
	}
	objDialog.id = "DialogMove";
	var winW = 800;
	var winH = 600;
	if (document.body.clientHeight) {
		winW = document.body.clientWidth;
		winH = document.body.clientHeight;
	}
	var DiglogX, DiglogY;
	DiglogX = winW / 2 + document.body.scrollLeft - w / 2;
	DiglogY = winH / 2 + document.body.scrollTop - h / 3;
	var oS = objDialog.style;
	oS.display = "block";
	oS.top = DiglogY + "px";
	oS.left = DiglogX + "px";
	oS.margin = "0px";
	oS.padding = "0px";
	oS.width = w + "px";
	oS.height = h + "px";
	oS.position = "absolute";
	oS.zIndex = "5";
	objDialog.innerHTML = showdata;
	document.body.appendChild(objDialog);
}
function DialogHide() {
	ScreenClean();
	var objDialog = $("DialogMove");
	if (objDialog) {
		objDialog.style.display = "none";
	}
}
function ScreenConvert() {
	//lock keyboard
	document.onkeydown = function(){return false;}
	
	var objScreen = $("ScreenOver");
	if (!objScreen) {
		objScreen = document.createElement("div");
	}
	var oS = objScreen.style;
	objScreen.id = "ScreenOver";
	oS.display = "block";
	oS.top = oS.left = oS.margin = oS.padding = "0px";
	var wh = "120%";
	if (document.body.clientHeight) {
		wh = document.body.clientHeight + "px";
		if (document.body.scrollHeight > document.body.clientHeight) {
			wh = document.body.scrollHeight + "px";
		}
	} else {
		if (window.innerHeight) {
			wh = window.innerHeight + "px";
		} else {
			wh = "120%";
		}
	}
	oS.width = "120%";
	//oS.height = wh;
	oS.height = "120%";
	oS.position = "absolute";
	oS.zIndex = "5";
	oS.background = "#cdcdcd";
	oS.filter = "alpha(opacity=40)";
	oS.opacity = 40 / 100;
	oS.MozOpacity = 40 / 100;
	document.body.appendChild(objScreen);
	var allselect = document.getElementsByTagName ? document.getElementsByTagName("select") : new Array();
	for (var i = 0; i < allselect.length; i++) {
		allselect[i].style.visibility = "hidden";
	}
}
function ScreenClean() {
	//unlock keyboard
	document.onkeydown = function(){return true;}
	
	var objScreen = $("ScreenOver");
	if (objScreen) {
		objScreen.style.display = "none";
	}
	var allselect = document.getElementsByTagName ? document.getElementsByTagName("select") : new Array();
	for (var i = 0; i < allselect.length; i++) {
		allselect[i].style.visibility = "visible";
	}
}
/*** 全局错误处理 ***/
function errorHandler(message) {
	hideLoading();
	showDialog(message, "错误!");
}
/*** 远程调用前执行的函数 ***/
function preHook(){
	DWREngine.setPreHook(null);
	CommonAction.filter({callback:function (isLogin) {
		if(!isLogin){
			hideLoading();
			window.location = "/index.jsp";
			alert("操作超时，请您重新登陆！");
		}
	}});
	DWREngine.setPreHook(preHook);
}
/**date to int*/
function time2int(str){
 var time;
 var strs=str.split(":");
 if(strs[0].charAt(0)=='0'){
  strs[0]=strs[0].charAt(1);
 }
 if(strs[1].charAt(0)=='0'){
  strs[1]=strs[1].charAt(1);
 }
 time=parseInt(strs[0])*60+parseInt(strs[1]);
 return time;
}
/**string to date*/
function str2date(str){
 if(str==''){
 	return undefined;
 }
 var strs=str.split("-");
 return Date.parse(strs[1]+'/'+strs[2]+'/'+strs[0]);
}
function invalidPass(password){
	for(i=0;i<password.length;i++){
		var num=password.charCodeAt(i);
		if(num<33||num>127){
			return true;
		}
	}
}

function showanswer(name){
	if(document.getElementById(name).style.display=="none"){
		if(name=="answer2"){
			document.getElementById("answer2").style.display="block";
			document.getElementById("answer2b").style.display="block";
			document.getElementById("answer2c").style.display="block";
			document.getElementById("answer2d").style.display="block";
			document.getElementById("answer2e").style.display="block";
			document.getElementById("answer2f").style.display="block";
		}if(name=="answer20"){
			document.getElementById("answer20").style.display="block";
			document.getElementById("answer20a").style.display="block";
			document.getElementById("answer20b").style.display="block";
			document.getElementById("answer20c").style.display="block";
			document.getElementById("answer20d").style.display="block";
			document.getElementById("answer20e").style.display="block";
			document.getElementById("answer20f").style.display="block";
		}else{
			document.getElementById(name).style.display="block";
		}
	}else{
	if(name=="answer2"){
			document.getElementById("answer2").style.display="none";
			document.getElementById("answer2b").style.display="none";
			document.getElementById("answer2c").style.display="none";
			document.getElementById("answer2d").style.display="none";
			document.getElementById("answer2e").style.display="none";
			document.getElementById("answer2f").style.display="none";
		}if(name=="answer20"){
			document.getElementById("answer20").style.display="none";
			document.getElementById("answer20a").style.display="none";
			document.getElementById("answer20b").style.display="none";
			document.getElementById("answer20c").style.display="none";
			document.getElementById("answer20d").style.display="none";
			document.getElementById("answer20e").style.display="none";
			document.getElementById("answer20f").style.display="none";
		}else{
			document.getElementById(name).style.display="none";
		}
	}
	
}
