// dq5201314--OIXM

//=== start === 历史记录操作 === start ===\\
var history_title=new Array();
var history_body=new Array();
var page=0;


function addhistory(titlestr,bodystr)
{
	var i=history_title.length;
	history_title[i]=titlestr;
	history_body[i]=bodystr;
}
function pophistory(){
	history_title.pop();
	history_body.pop();
}
function reshowframe(date,nowindex)
{
	var temptstr=history_title[nowindex];
	var tempbstr=history_body[nowindex];
	var nob=history_title.length;
	for(var i=nowindex;i<nob-1;i++)
	{
		history_title[i]=history_title[i+1];
		history_body[i]=history_body[i+1];
	}
	history_title[nob-1]=temptstr;
	history_body[nob-1]=tempbstr;
	//showhistory();
	showframe(date,508);
}
function showhistory()
{
	var nob=history_title.length;
	if(nob<=10)
	{
		document.getElementById("controul").innerHTML=getpage(0,nob);
	}else{
		var tempstr="<div style=\"float:left;\" title=\"上八条\" onclick=\"javascript:setpage(-1)\"><img src=\"images/bt_ht.gif\"></div>"
		var tend=page*8+8;
		if(tend>nob){tend=nob};
		tempstr=tempstr+getpage(page*8,tend);
		tempstr=tempstr+"<div style=\"float:left;\" title=\"下八条\" onclick=\"javascript:setpage(1)\"><img src=\"images/bt_qj.gif\"></div>";
		document.getElementById("controul").innerHTML=tempstr;
	}
}
function getpage(start,end)
{
	var tempstr="";
	for(var i=start;i<end;i++)
	{
		tempstr=tempstr+"<div class=\"historyu\" title=\""+history_title[i]+"\" onclick=\"javascript:reshowframe(history_body["+i+"],"+i+")\">"+(i+1)+"</div>";
	}
	return tempstr;
}
function setpage(no)
{
	page=page+no;
	if(page<0)
	{
		page=0;
		alert("前面没有了");
		return;
	}
	if(page*8+1>history_title.length){
		page=page-1;
		alert("后面没有了");
		return;
	}
	showhistory();
}
//===  end  === 历史记录操作 ===  end  ===\\
function createxmlHttp()
{
	var xmlHttp = false;
	try{
		xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
	}catch (e){
		try{
			xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
		}catch (e2){
			xmlHttp = false;
		}
	}
	if (!xmlHttp && typeof XMLHttpRequest != 'undefined')
	{
		xmlHttp = new XMLHttpRequest();
	}
	return xmlHttp;
}
function showpage(url)//显示某一页面	url:页面地址
{
	
	
	showframe('<img src=\"images/loading.gif\">',200);
	Sleep(this,100);
	this.NextStep=function() 
	{
		xml = createxmlHttp();
		xml.open("GET",url,false);
		xml.send();
		var tempstr=bytes2BSTR(xml.responseBody);
		var temptitle=tempstr.split("</title>")[0];
		temptitle=temptitle.split("<title>")[1];
		tempstr=tempstr.split("<body>")[1];
		tempstr=tempstr.split("</body>")[0];
		document.getElementById("alert_inner").style.height="508px";
		document.getElementById("alert_inner").innerHTML=tempstr;
		addhistory(temptitle,tempstr);
	}
}

//--修改
//显示前一页或后一页	url:页面地址
function showadja(url)
{
	
	
	showframe('<img src=\"images/loading.gif\">',200);
	Sleep(this,100);
	this.NextStep=function() 
	{
		xml = createxmlHttp();
		xml.open("GET",url,false);
		xml.send();
		var tempstr=bytes2BSTR(xml.responseBody);
		var temptitle=tempstr.split("</title>")[0];
		temptitle=temptitle.split("<title>")[1];
		tempstr=tempstr.split("<body>")[1];
		tempstr=tempstr.split("</body>")[0];
		document.getElementById("alert_inner").style.height="508px";
		document.getElementById("alert_inner").innerHTML=tempstr;
		//addhistory(temptitle,tempstr);
	}
}
//--

function showframe(date,height)//显示幕布	date:要显示的HTML代码，height:幕布的高度
{
   var sWidth,sHeight;
   sWidth=document.body.scrollWidth;
   if (document.body.scrollHeight>document.body.clientHeight)
   {
   	sHeight=document.body.scrollHeight;
   }else{
   	sHeight=document.body.clientHeight;
   }
   if(!document.getElementById("bgdiv"))
   {
	   var bgObj=document.createElement("div");
	   bgObj.setAttribute('id','bgdiv');
	   bgObj.style.position="absolute";
	   bgObj.style.top="0";
	   bgObj.style.background="#cccccc";
	   bgObj.style.filter="progid:DXImageTransform.Microsoft.Alpha(style=3,opacity=25,finishOpacity=75";
	   bgObj.style.opacity="0.5";
	   bgObj.style.left="0";
	   bgObj.style.width=sWidth + "px";
	   bgObj.style.height=sHeight + "px";
	   bgObj.style.zIndex = "10000";
	   document.body.appendChild(bgObj);
	   var msgObj=document.createElement("div")
	   msgObj.setAttribute("id","framediv");
	   msgObj.style.position = "absolute";
	   msgObj.style.left = (screen.width)/2-797/2+document.body.scrollLeft;
	   msgObj.style.top = "12px";
	   msgObj.style.width = "797px";
	   msgObj.style.height = "583px";
	   msgObj.style.overflow= "hidden";
	   msgObj.style.zIndex = "10001";
	   document.body.appendChild(msgObj);
	   //document.getElementById("framediv").innerHTML="<div id=\"floal_left\"><img src=\"images/alert_1.gif\"></div><div id=\"alert_body\"><div><img src=\"images/alert_3.gif\" border=\"0\" usemap=\"#zxldq\"><map name=\"zxldq\"><area shape=\"rect\" coords=\"680,44,700,63\" href=\"javascript:closeframe();\"><area shape=\"rect\" coords=\"655,44,677,64\" href=\"javascript:minframe();\"></map></div><div id=\"alert_innerbg\"><div id=\"alert_inner\"></div></div><div><img src=\"images/alert_4.gif\"></div></div><div id=\"floal_left\"><img src=\"images/alert_2.gif\"></div>";
	   document.getElementById("framediv").innerHTML="<div id=\"floal_left\"><img src=\"images/alert_1.gif\"></div><div id=\"alert_body\"><div><img src=\"images/alert_3.gif\" border=\"0\" usemap=\"#zxldq\"><map name=\"zxldq\"><area shape=\"rect\" coords=\"680,44,700,63\" href=\"javascript:closeframe();\"></map></div><div id=\"alert_innerbg\"><div id=\"alert_inner\"></div></div><div><img src=\"images/alert_4.gif\"></div></div><div id=\"floal_left\"><img src=\"images/alert_2.gif\"></div>";
   }
   var innerdiv=document.getElementById("alert_inner");
   if(height>508)
   {
	   innerdiv.style.height="508px";
	}else{
	   innerdiv.style.height=height+"px";
	}
	if(date!="")
	{
		innerdiv.innerHTML=date;
	}
}
function closeframe()//删除幕布
{
	bgObj=document.getElementById("bgDiv");
	msgObj=document.getElementById("framediv");
	document.body.removeChild(bgObj);
	document.body.removeChild(msgObj);
	//显示访问历史页面
	
	//showpage("ProfNewsInSchool.aspx");
	//history.go(-1);
	pophistory();  
	//showhistory();
	
	//修改--
	//显示访问历史页面的最后一页
	var nob=history_title.length;
	if(nob>0)
	{
		reshowframe(history_body[nob-1],nob-1)
	}
	//alert("test");
	//--
}
function minframe()//最小化幕布
{
	bgObj=document.getElementById("bgDiv");
	msgObj=document.getElementById("framediv");
	document.body.removeChild(bgObj);
	document.body.removeChild(msgObj);
	showhistory();
}
//=== start ===实现暂停功能===strat===\\
function Sleep(obj,iMinSecond) 
 {  
  if (window.eventList==null)  
  window.eventList=new Array();
  var ind=-1; 
  for (var i=0;i<window.eventList.length;i++) 
  {   
   if (window.eventList[i]==null)  
   {  
    window.eventList[i]=obj;    
    ind=i;   
    break;   
   }  
  }  
  if (ind==-1) 
  {   
   ind=window.eventList.length;   
   window.eventList[ind]=obj; 
  }  
  setTimeout("GoOn(" + ind + ")",iMinSecond); 
 } 
 function GoOn(ind) 
 {  
  var obj=window.eventList[ind]; 
  window.eventList[ind]=null; 
  if (obj.NextStep) obj.NextStep(); 
  else obj();
 }
 //=== end ===实现暂停功能===end===\\
 var content=new Array();
 content[0]="<div style=\"height:30px;\"></div><div style=\"float:left;width:108px;\"></div><img style=\"float:left;cursor:pointer;\" onclick=\"showpage('"+url[0]+"')\" src=\"images/bxds.gif\" width=\"102\" height=\"78\"><div style=\"float:left;width:80px;\"></div><img style=\"float:left;cursor:pointer;\" onclick=\"showpage('"+url[1]+"')\" src=\"images/xwds.gif\" width=\"102\" height=\"78\"><div style=\"float:left;width:80px;\"></div><img style=\"float:left;cursor:pointer;\" onclick=\"showpage('"+url[2]+"')\" src=\"images/msjs.gif\" width=\"102\" height=\"78\">";
 content[1]="<div style=\"height:30px;\"></div><div style=\"float:left;width:160px;\"></div><img style=\"float:left;cursor:pointer;\" onclick=\"showpage('"+url[4]+"')\" src=\"images/ywgx.gif\" width=\"102\" height=\"78\"><div style=\"float:left;width:160px;\"></div><img style=\"float:left;cursor:pointer;\" onclick=\"showpage('"+url[5]+"')\" src=\"images/yygl.gif\" width=\"102\" height=\"78\">"
function tview(id)
{
	var obj=document.getElementById(id);
	document.getElementById("tcontent").innerHTML=obj.innerHTML;
}
function submitform(id)//xmlHttp提交表单
{
	var thisform=document.getElementById(id);
	url=thisform.action;
	xml = createxmlHttp();
	xml.open("POST",url,false);
	xml.setRequestHeader("CONTENT-TYPE","application/x-www-form-urlencoded");
	xml.send(getforminput(id));
	var tempstr=bytes2BSTR(xml.responseBody);
	var temptitle=tempstr.split("</title>")[0];
	temptitle=temptitle.split("<title>")[1];
	tempstr=tempstr.split("<body>")[1];
	tempstr=tempstr.split("</body>")[0];
	document.getElementById("alert_inner").style.height="508px";
	document.getElementById("alert_inner").innerHTML=tempstr;
	addhistory(temptitle,tempstr);
}
function getforminput(id)//取得表单中的字段及值
{
	var thisform=document.getElementById(id);
	var inputs=new Array();
	for(var i=0;i<thisform.length;i++)
	{
		var e=thisform.elements[i];
		if(e.tagName.toLowerCase()=="input"||e.tagName.toLowerCase()=="textarea")
		{
			if(e.type.toLowerCase()=="button"){continue;}
			if((e.type.toLowerCase()=="radio"||e.type.toLowerCase()=="checkbox")&&e.checked==false){continue;}
			inputs.push(e.name+"="+escape(e.value));
		}
	}
	return inputs.join("&");
}
function resetform(id)//重设表单
{
	document.getElementById(id).reset();
}