﻿// JavaScript Document

var opacity="80";                //IE下背景层的透明度
var opacity2="0.8";              //火狐下背景层的透明度
var mywindowwidth="700";         //窗口默认宽度
var mywindowheight="450";        //窗口默认高度
var i=0;
document.writeln("<div id=\"ts_background\" style=\"position:absolute;left:0px;top:0px;width:0px;height:0px;z-index:998;background-color: #000000;filter: Alpha(Opacity="+opacity+");Opacity:"+opacity2+";visibility: hidden;\" ></div>");
document.writeln("<div id=\"ts_window\" style=\"position:absolute;left:0px;top:0px;width:" + mywindowwidth + "px;z-index:999;border:1px solid #D2D2D2; background-color:#F4F4F4; visibility: hidden;padding:0px; margin:0px;\">");
document.writeln("<table width=\"100%\"  border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-right-width: 1px; border-right-color: #99BBE8; border-bottom-color: #99BBE8; border-left-color: #99BBE8; border-bottom-width: 1px; border-left-width: 1px;\" bordercolor=\"#71A0DD\" >");
document.writeln("<tr>");
document.writeln("<td height=\"26\" background=\"../images/white-top-bottom.gif\">");
//document.writeln("<td height=\"26\">");
document.writeln("<span id=\"ts_windowtitle\" style=\"font-weight: bold;color: #003399;	padding-left: 15px;font-size: 12px;\"></span>");
document.writeln("</td>");
document.writeln("<td width=\"20%\" style=\"text-align:right;\" background=\"../images/white-top-bottom.gif\"><img src=\"../images/ico1.gif\" alt=\"关闭窗口\" width=\"15\" height=\"15\" style=\"cursor:pointer;margin-top:1px;\" onclick=\"ajax_windowclose()\">&nbsp;&nbsp;</td>");
//document.writeln("<td width=\"20%\" style=\"text-align:right;\" background=\"\"><img src=\"../images/ico1.gif\" alt=\"关闭窗口\" width=\"15\" height=\"15\" style=\"cursor:pointer;margin-top:1px;\" onclick=\"ajax_windowclose()\">&nbsp;&nbsp;</td>");
document.writeln("</tr>");

document.writeln("<tr>");
document.writeln("<td colspan=\"2\" valign=\"top\"><iframe scrolling=\"auto\" frameborder=\"0\" width=\"100%\" height=\""+ (parseInt(mywindowheight)-27) +"\" src=\"about:blank\" id=\"ts_mywindow\"></iframe></td>");
document.writeln("</tr>");
document.writeln("</table></div>");

/*
document.writeln("<div id=\"ts_background\" style=\"position:absolute;left:0px;top:0px;width:0px;height:0px;z-index:998;filter: Alpha(Opacity="+opacity+");Opacity:"+opacity2+";visibility: hidden;\" ></div>");
document.writeln("<div id=\"ts_window\" style=\"position:absolute;left:0px;top:0px;width:" + mywindowwidth + "px;z-index:999;border:0px solid #D2D2D2; visibility: hidden;padding:0px; margin:0px;\">");
document.writeln("<table width=\"100%\"  border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border:solid 0px #99BBE8\">");
document.writeln("<tr>");
//document.writeln("<td height=\"26\" background=\"../images/white-top-bottom.gif\">");
document.writeln("<td height=\"16\">");
document.writeln("<span id=\"ts_windowtitle\" style=\"font-weight: bold;color: #003399;	padding-left: 15px;font-size: 12px;\"></span>");
document.writeln("</td>");
//document.writeln("<td width=\"20%\" style=\"text-align:right;\" background=\"../images/white-top-bottom.gif\"><img src=\"../images/ico1.gif\" alt=\"关闭窗口\" width=\"15\" height=\"15\" style=\"cursor:pointer;margin-top:1px;\" onclick=\"ajax_windowclose()\">&nbsp;&nbsp;</td>");
document.writeln("<td width=\"20%\" style=\"text-align:right;\" background=\"\"><img src=\"../images/ico1.gif\" alt=\"关闭窗口\" width=\"15\" height=\"15\" style=\"cursor:pointer;margin-top:1px;\" onclick=\"ajax_windowclose()\">&nbsp;&nbsp;</td>");
document.writeln("</tr>");

document.writeln("<tr>");
document.writeln("<td colspan=\"2\" valign=\"top\"><iframe scrolling=\"auto\" frameborder=\"0\" width=\"100%\" height=\""+ (parseInt(mywindowheight)-27) +"\" src=\"about:blank\" id=\"ts_mywindow\"></iframe></td>");
document.writeln("</tr>");
document.writeln("</table></div>");
*/

function ajax_window(tit,url,winwidth,winheight){
	TheOpacity();
	if(winwidth!=""){
		mywindowwidth=winwidth;
	}
	if(winheight!=""){
		mywindowheight=winheight;
	}
	var topz;
	if(parseInt(document.documentElement.clientHeight)<parseInt(mywindowheight)){
		topz=document.documentElement.scrollTop;
	}else{
		topz=parseInt(document.documentElement.clientHeight/2)-parseInt(mywindowheight/2)+document.documentElement.scrollTop;
	}
	document.getElementById("ts_background").style.width=document.body.scrollWidth+"px";
	if(parseInt(document.documentElement.scrollHeight)>800){
		document.getElementById("ts_background").style.height=document.body.scrollHeight+"px";
	}else{
		document.getElementById("ts_background").style.height="800px";
	}
	
	document.getElementById("ts_background").style.visibility="visible";
	document.getElementById("ts_window").style.left=parseInt(document.body.scrollWidth/2-parseInt(mywindowwidth/2))+"px";
	document.getElementById("ts_window").style.width=parseInt(mywindowwidth)+"px";
	document.getElementById("ts_window").style.height=parseInt(mywindowheight)+"px";
	document.getElementById("ts_mywindow").height=parseInt(mywindowheight)-27;
	document.getElementById("ts_window").style.top=topz+"px";
	document.getElementById("ts_window").style.visibility="visible";
	document.getElementById("ts_windowtitle").innerHTML=tit;
	document.getElementById("ts_mywindow").src=url;
}
function ajax_windowclose(){
	NoOpacity()
	document.getElementById("ts_window").style.left="0px";
	document.getElementById("ts_window").style.top="0px";
	document.getElementById("ts_window").style.visibility="hidden";
	document.getElementById("ts_windowtitle").innerHTML="";
	document.getElementById("ts_mywindow").src="about:blank";
}
function TheOpacity(){
	if(i<parseInt(opacity)){
		i+=20;
		if(document.all){
			document.getElementById("ts_background").filters.Alpha.opacity = i;
		}else{
			document.getElementById("ts_background").style.MozOpacity = i/100;
		}
	setTimeout("TheOpacity()",100);
	}else{
		clearTimeout();
	}
}
function NoOpacity(){
	if(i>0){
		i-=20;
		if(document.all){
			document.getElementById("ts_background").filters.Alpha.opacity = i;
		}else{
			document.getElementById("ts_background").style.MozOpacity = i/100;
		}
		setTimeout("NoOpacity()",100);
	}else{
		clearTimeout();
		document.getElementById("ts_background").style.width="0px";
		document.getElementById("ts_background").style.height="0px";
		document.getElementById("ts_background").style.visibility="hidden";
	}
}
