/** copyright xurun 2007-5-10**/
var layerContent = ""
		+"<div id=\"screenFrontDiv\"  style=\"position:absolute;visibility:hidden;width:100%;height:100%;background: #efefef;filter:alpha(opacity=50);opacity:0.50\"></div><div   id='systemDialog'     style=\"position:absolute;visibility:hidden;\"><iframe scrolling=\"no\" width=\"350\" height=\"149\" frameborder=\"0\" name=\"dialogframe\"  id=\"dialogframe\" src=\"/public/comDialog.htm\"></iframe></div>";

document.write (layerContent);

var tzrcConfirmReturn;
function  systemDialogContent(tip){
	dialogframe.document.getElementById("dialogInfomation").innerHTML = "<font class=\"title_r\">"+tip+"</font>";
}

function getObj(objname){
	var obj;
	if (document.layers){
		obj = document.layers[objname];
    }
    else if (document.all){
		obj = document.all[objname];
    }
    else if (document.getElementById){
        obj = document.getElementById(objname);
    }
	return obj;
}

function showtzrcTipDialog(value,focusobj,needScreenDiv){
	try{
		systemDialogContent(value);
		if(needScreenDiv==false){
			var disFrontObj = getObj("screenFrontDiv");
			//disFrontObj.style.left=document.body.scrollLeft;
			//disFrontObj.style.top=document.body.scrollTop;
			disFrontObj.style.left=0;
			disFrontObj.style.top=0;
			disFrontObj.style.height=document.body.scrollHeight;
			disFrontObj.style.width=document.body.scrollWidth;
			disFrontObj.style.visibility="visible";
			//parent.document.body.scroll="no" ;
		}

		var disObj = getObj("systemDialog");
		var x = document.body.scrollLeft;	
	    var y = document.body.scrollTop;
        
         //获取屏幕宽度
		 //availWidth = parseInt(window.screen.availWidth);
	     //availHeight = parseInt(window.screen.availHeight);

         //获取可见区域 宽度 高度
		 availWidth = parseInt(document.body.clientWidth);
	     availHeight = parseInt(document.body.clientHeight);
        
	     tblWidth = 350;

		  //y = y + availHeight/4;
	      //x = (availWidth - tblWidth)/2;
    

		//disObj.style.left=x+"px";
		//disObj.style.top=y+"px";
		GetCenterXY_ForLayer(disObj);
		disObj.style.visibility="visible";
		dialogframe.document.all("dialogShowConfirmButton").style.display="none";
		dialogframe.document.all("dialogShowTipButton").style.display="";
		dialogframe.document.all("dialogButton").focus();
		if(focusobj!=null){
			beforDialogObj = focusobj;
		}
	}catch(e){
		alert(value);
		if(focusobj!=null){
			focusobj.focus();
		}
	}
}

/*添加两个参数 x，y定位对话框位置*/
function showtzrcTipDialogNew(value,focusobj,needScreenDiv,x,y){
	try{
		systemDialogContent(value);
		if(needScreenDiv==false){
			var disFrontObj = getObj("screenFrontDiv");
			//disFrontObj.style.left=document.body.scrollLeft;
			//disFrontObj.style.top=document.body.scrollTop;
			disFrontObj.style.left=0;
			disFrontObj.style.top=0;
			disFrontObj.style.height=document.body.scrollHeight;
			disFrontObj.style.width=document.body.scrollWidth;
			disFrontObj.style.visibility="visible";
			//parent.document.body.scroll="no" ;
		}

		var disObj = getObj("systemDialog");
		
		//disObj.style.left=x+"px";
		//disObj.style.top=y+"px";
		GetCenterXY_ForLayer(disObj);
		disObj.style.visibility="visible";
		dialogframe.document.all("dialogShowConfirmButton").style.display="none";
		dialogframe.document.all("dialogShowTipButton").style.display="";
		dialogframe.document.all("dialogButton").focus();
	    if(focusobj!=null){
			beforDialogObj = focusobj;
		}
	}catch(e){
		alert(value);
		if(focusobj!=null){
			focusobj.focus();
		}
	}
}

function showtzrcConfirmDialog(value,needScreenDiv){
	try{
		systemDialogContent(value);
		if(needScreenDiv!=false){
			var disFrontObj = getObj("screenFrontDiv");
			disFrontObj.style.left="0px";
			disFrontObj.style.top="0px";	
			disFrontObj.style.visibility="visible";
			disFrontObj.style.height=document.body.scrollHeight;
			disFrontObj.style.width=document.body.scrollWidth;
			disFrontObj.style.visibility="visible";
			//parent.document.body.scroll="no" ;
		}

		var disObj = getObj("systemDialog");
		var x = document.body.scrollLeft;	
	    var   y = document.body.scrollTop;
        
        //获取可见区域 宽度 高度
		 availWidth = parseInt(document.body.clientWidth);
	     availHeight = parseInt(document.body.clientHeight);
        
	     tblWidth = 350;
        
                
		  y = y + availHeight/4;
	      x = (availWidth - tblWidth)/2;
    

		disObj.style.left=x+"px";
		disObj.style.top=y+"px";
		GetCenterXY_ForLayer(disObj);
		disObj.style.visibility="visible";
		dialogframe.document.all("dialogShowConfirmButton").style.display="";
		dialogframe.document.all("dialogShowTipButton").style.display="none";
		/******如果第三个参数为onlyShowOK  begin*******/
		var argArr=showtzrcConfirmDialog.arguments;
		if(argArr.length>2&&argArr[2]=="onlyShowOK")
		{
			dialogframe.document.all("cancel").style.display="none";
		}
		/******如果第三个参数为onlyShowOK  begin*******/
		dialogframe.document.all("confirmButton").focus();
	}catch(e){
		alert("系统不支持FireFox浏览器，请使用IE或者IE内核的浏览器!");
	}
}

function hiddentzrcTipDialog(){
	parent.document.body.scroll="yes" ;
	var disObj = getObj("top.document.systemDialog");
	disObj.style.visibility="hidden";
	if(top.document.beforDialogObj!=null){
		top.document.beforDialogObj.focus();
	}
}

/**
*定义ConfirmDialogWrapper
*@param value 提示值
*@param needScreenDiv 是否使用屏蔽
*@param ok 确定回调方法
*@param ok 取消回调方法
*@author pky
*/
function tzrcConfirmDialogWrapper(mValue,mNeedScreenDiv){
	this.value=mValue;
	this.needScreenDiv=mNeedScreenDiv;
}
//显示对话框
tzrcConfirmDialogWrapper.prototype.showDialog=function(){
showtzrcConfirmDialog(this.value,this.needScreenDiv);
document.getElementById("dialogframe").height=10;
document.getElementById("dialogframe").height=document.getElementById("dialogframe").contentWindow.document.body.scrollHeight;
};
//响应取消键，可重载
tzrcConfirmDialogWrapper.prototype.cancel=function(){};
//响应确定键，可重载
tzrcConfirmDialogWrapper.prototype.ok=function(){};
var confirmDialog;

/**
*定义TipDialogWrapper
*@param value 提示值
*@param needScreenDiv 是否使用屏蔽
*@param ok 确定回调方法
*@param ok 取消回调方法
*@author pky
*/
function tzrcTipDialogWrapper(mValue,mNeedScreenDiv){
	this.value=mValue;
	this.needScreenDiv=mNeedScreenDiv;
}
//显示对话框
tzrcTipDialogWrapper.prototype.showDialog=function(){
	showtzrcTipDialog(this.value,null,this.needScreenDiv);
	document.getElementById("dialogframe").height=10;
	document.getElementById("dialogframe").height=document.getElementById("dialogframe").contentWindow.document.body.scrollHeight;
	};
//响应确定键，可重载
tzrcTipDialogWrapper.prototype.ok=function(){};
var tipDialog;

//将悬浮层的位置定位在body可见区域中央
function GetCenterXY_ForLayer(objdiv){
	var objTop;
	var objLeft;
	if (document.documentElement  && document.documentElement.clientHeight)
	{ 
		var styleWidth=objdiv.style.width.substring(0,objdiv.style.width.length-2);
		var clientHeight=objdiv.clientHeight;
		styleWidth = 350;
		objLeft = parseInt(document.documentElement.scrollLeft+(document.documentElement.clientWidth - styleWidth)/2)+'px';
		var relTop=(document.documentElement.clientHeight-clientHeight)/2 > 0 ? (document.documentElement.clientHeight-clientHeight)/2:0;
		objTop = parseInt(document.documentElement.scrollTop+relTop)+'px';
	} 
	else if (document.body) 
	{ 
		var x = document.body.scrollLeft;	
	    var   y = document.body.scrollTop;
        //获取可见区域 宽度 高度
		 availWidth = parseInt(document.body.clientWidth);
	     availHeight = parseInt(document.body.clientHeight);
	     tblWidth = 350;   
		 objTop = y + availHeight/4;
	     objLeft = (availWidth - tblWidth)/2;
	} 
	objdiv.style.top = objTop;
	objdiv.style.left = objLeft;
	return objdiv;
}