<!--
window.onerror=fnErrorTrap;
//window.onunload=HelpMe();
var iSelTRid=0,iSelRecID=0;
document.execCommand("BackgroundImageCache", false, true);					// IE 6 下缓存背景图，防止鼠标发抖
function $(obj){return document.getElementById(obj)}						//  getElementById() 返回第一个
function $N(obj){return document.getElementsByName(obj)}					//  Name数组，仅限于<form>里的name元素

function fnStartInit(){	if(document.readyState=="complete") genderGird();}
			   
function genderGird(){ if(typeof(GridTable)!="undefined") {GridViewColor("GridTable");GridTable.attachEvent('onclick', gRowID)}}

function GridViewColor(GridViewId){	  //交替行颜色和选中颜色
NormalColor="#f9f9f9";AlterColor="#fff";HoverColor="#f0f0f0";SelectColor="#FCE269";

var AllRows = $(GridViewId).getElementsByTagName("tr");

//设置每一行的背景色和事件，循环从1开始而非0，可以避开表头那一行
for(var i=1; i<AllRows.length; i++){

//设定本行默认的背景色
AllRows[i].style.background = i%2==0?NormalColor:AlterColor;
AllRows[i].selected=false;

//如果指定了鼠标指向的背景色，则添加onmouseover/onmouseout事件
//处于选中状态的行发生这两个事件时不改变颜色
if(HoverColor != ""){AllRows[i].onmouseover = function(){if(!this.selected)this.style.background = HoverColor;}
if(i%2 == 0){AllRows[i].onmouseout = function(){if(!this.selected)this.style.background = NormalColor;}}
else{AllRows[i].onmouseout = function(){if(!this.selected)this.style.background = AlterColor;}}}

//如果指定了鼠标点击的背景色，则添加onclick事件,在事件响应中修改被点击行的选中状态
if(SelectColor != ""){
AllRows[i].onclick = function(){
for(var i=1; i<AllRows.length; i++)
{
	AllRows[i].style.background = i%2==0?NormalColor:AlterColor;
	AllRows[i].selected=false;
}
this.style.background = this.style.background==SelectColor?HoverColor:SelectColor;
this.selected = !this.selected;
}
}
}
}

function tOf(obj){return typeof(obj)=="undefined"}
function gRowID() //得到当前点击的表格所在 行 
  {   
	  var el= event.srcElement;   
	  while(el.tagName!="TR"&&el.tagName!="TABLE")   
		 el=el.parentElement   
		 try
		 {
			iSelTRid=el.rowIndex;
			var elNewCell=el.parentElement.rows[iSelTRid].cells;
			if(elNewCell(0).children(0).type=='checkbox'&&elNewCell(0).children(0).value!=0) iSelRecID=elNewCell(0).children(0).value; 
		 }
		 catch(e){iSelTRid=0;}  
  }
  
function AddTr()	 //增加行
{
  var oRowNum=GridTable.rows.length;
  var elRow=GridTable.insertRow();
   var elNewCell=GridTable.rows[oRowNum-1].cells
  for(var i=0; i<elNewCell.length; i++){
      var elCell = elRow.insertCell();
      elCell.innerHTML =elNewCell(i).innerHTML;elCell.style.display =elNewCell(i).style.display;
      if(i==0) elCell.children(0).value=0;
      if(i==1&&elCell.children(0).type=='checkbox') elCell.children(0).value=0;
      if(elCell.children(0).type=='text') elCell.children(0).value='';
      }
  iSelTRid=oRowNum;
  GridViewColor("GridTable");
}

function onDelTr(pStr)		//确认删除一行
{
  if(GridTable.rows.length>2&&iSelTRid>=1) 
  {
		var elNewCell=GridTable.rows[iSelTRid].cells;
		if(elNewCell(0).children(0).value==0) {delTR();iSelTRid--;return;} 
		if(elNewCell(0).children(0).type=='checkbox'&&elNewCell(0).children(0).value!=0) if(pStr!="undefined") 
		{
			cap=(elNewCell(1).children(0)==null)?elNewCell(1).innerText:elNewCell(1).children(0).value;
			if(confirm('确认删除 ['+cap+']?')) goTo("../inc/delData.asp?tab="+pStr+"&id="+elNewCell(0).children(0).value+"");
		}
  }
}
function setPYM(v,n)
{
	var hz=v.value;
	v=v.parentElement;
	if(typeof(v.nextSibling)=="undefined") return;
	for(j=0;j<n;j++) 
	{
		if(typeof(v.nextSibling)!="undefined"&&v!=null){v=v.nextSibling;}
		else {break;return};
	}
	if(v!=null) v.children(0).value=hz.trim()!=""?getPYM(hz):"";isDataChanged=true;
}
function goTo(sStr){waitMe1();postFrame.location.href=sStr;}
function saveData(oForm){event.cancelBubble=true;waitMe1();oForm.target="postFrame";oForm.submit();}
function showPostFrame()
{
	if(typeof(PostFrame)=="undefined")document.body.insertAdjacentHTML('beforeEnd','<iframe id="postFrame" name="postFrame" style="height:0; visibility: inherit; width:0; z-index:-1;" BORDER=0 FRAMESPACING=0 scrolling=no frameborder=0 src="about:blank"></iframe>');
}

function waitMe1(v)
{
	showPostFrame();
	if(typeof(waitBox)=="undefined")
	{
		swt=document.body.clientWidth;
		sht=(document.body.scrollHeight>document.body.offsetHeight)?document.body.scrollHeight:document.body.offsetHeight;
		document.body.insertAdjacentHTML('beforeEnd','<div id="waitBox" style="display:none;position:absolute;top:0px;left:0px;width:'+swt+'px; height:'+sht+'px;z-index:666;filter:Alpha(opacity=30); background-color: #999;" ondblclick="hideMe()"><div align="center"><table width="100%" height="60%" border="0" align="center" cellpadding="0" cellspacing="0"><tr><td align="center"><span class=20BackTitle style="color:#FFFFFF;background-color: #000066" id=out1>正在提交数据……</span></td></tr></table></div></div>');
	}
	waitBox.filters.alpha.opacity=30;waitBox.style.display="";//waitBox.focus();
	if(typeof(v)!="undefined"){re = /\n/g;waitBox.filters.alpha.opacity=100;waitBox.innerHTML=v.replace(re,"<br>");} 
}
function showd(obj,value){if(value==1){$(obj).style.display=""}else $(obj).style.display="none";}

function hideMe()
{
	//if(isDataChanged) if(!confirm('有数据改变了，确认关闭？'))return;
	if(typeof(waitBox)!="undefined") showd("waitBox",0);
	if(typeof(SubFrame)!="undefined") showd("SubFrame",0);
	if(typeof(suggest)!="undefined") showd("suggest",0);
	if(typeof(yyDIV)!="undefined") showd("yyDIV",0);
        if(typeof(ypbmFrame)!="undefined") showd("ypbmFrame",0);}

function showMsg(v)	 //提示框
{
	if(typeof(popBox)=="undefined")
	{
		document.body.insertAdjacentHTML('beforeEnd','<div id="popBox" style="position:absolute;top:-85px; width:0px; height:0px;z-index:999;filter:Alpha(opacity=100);"><table width="250" border="0" cellspacing="0" cellpadding="0"><tr><td><img src="../images/i_box1.gif"></td></tr><tr><td height="47" align="right" valign="top" background="../images/i_box2.gif"><table width="95%" border="0" cellspacing="0" cellpadding="0"><tr><td height="20" class=105LanZ1><b>提示<b></td></tr><tr><td height="27" id="tipText" class=9org></td></tr></table></td></tr><tr><td><img src="../images/i_box3.gif"></td></tr></table></div>');
	}
	tipText.innerHTML=v;
	iStep=document.body.scrollTop+120;
	popBox.style.posTop=-85;
	popBox.filters.alpha.opacity=100;
	popBox.style.posLeft =(document.body.clientWidth-popBox.clientWidth)/2;
	timeID=setInterval("showLayer();", 10);
}
function showLayer()
{
	if(popBox.style.posTop<iStep){popBox.style.posTop+=10;}else{clearInterval(timeID);timeID=setInterval("waitSome();", 1500);}
}

function waitSome(){clearInterval(timeID);timeID=setInterval("hideLayer();", 50);}
function hideLayer()
{
	if(popBox.style.posTop>80)
	{
		popBox.style.posTop-=5;popBox.filters.alpha.opacity-=20;if(typeof(waitBox)!="undefined") waitBox.filters.alpha.opacity-=10;
	}
	else {hideMe();clearInterval(timeID);location.reload();}
}

function showBoxInfo(pType,succ,msg)    //pType:操作类型[del or save],succ：成功失败,msg:提示文字
{
	if(pType=="del"&&succ==1) 
	{
		delTR();
		iSelTRid=0;
		showMsg(msg);
	}
	if(pType=="save"&&succ==1) showMsg(msg);
	if(!succ){alert(msg);hideMe();}
}
function delTR(){if(iSelTRid) GridTable.deleteRow(iSelTRid);iSelTRid=0}
function showKSusr(fr,id,pid,cap,km){var pFrame=fr.location.pathname;fr.location=pFrame+'?cap='+cap+'&id='+id+'&pid='+pid+'&km='+km;}
function rndNum(){return new Date().getMilliseconds().toString();}

function showSubFrame(url,w,h,t,cap)			//iframe地址,宽度，高度，top位置,标题
{   if(typeof(SubFrame)!="undefined"){SubFrame.removeNode(true);yyDIV.removeNode(true)}
	if(typeof(SubFrame)=="undefined"||typeof(SubFrame)=="unknown")
	{
	   document.body.insertAdjacentHTML('beforeEnd','<div id="SubFrame" style="position:absolute;width:'+w+'px; height:'+h+'px;z-index:999; border:1px solid #73A2D6;layer-background-color:FFFFCC;"><table title=双击关闭 width='+w+' border="0" align="center" cellpadding="0" cellspacing="0" background="../images/r_0.gif" style="cursor:move"  onclick="event.cancelBubble=true;" ondblclick="hideMe()"><tr height=23><td width="95%" class=105HeiBold align=center>&nbsp;'+cap+'</td><td width="5%" align=center><img src="../images/sysIcon/icon15.gif" style="cursor:hand" title=双击关闭 onclick="hideMe()" /></td></tr></table><iframe id=cFrame name=cFrame BORDER=0 FRAMESPACING=0 scrolling=auto frameborder=0 width="'+w+'" height="'+h+'"></iframe></div><div id=yyDIV  style="position:absolute;z-index:998;background-color:C9C9C9;filter:Alpha(opacity=30);"></div>');
	}
	cFrame.document.close();cFrame.document.open();cFrame.location=url+((url.indexOf('?')>0)?"":"?1=1")+'&cache='+rndNum();
	SubFrame.style.posTop =t;
	SubFrame.style.posLeft =(document.body.clientWidth-SubFrame.clientWidth)/2;
	SubFrame.style.display="";
	SubFrame.focus();
	iSelRecID=0;
	yyDIV.style.width =w;
	yyDIV.style.height =h+25;
	yyDIV.style.posTop =t+8;
	yyDIV.style.left =SubFrame.style.posLeft+8;
	yyDIV.style.display="";
    //dragMe("SubFrame");
}

var version = navigator.appVersion;
var ie5=(version.indexOf("MSIE 5")>-1)?1:0;
var ie6=(version.indexOf("MSIE 6")>-1)?1:0;

function fnErrorTrap(sMsg,sUrl,sLine){
	var oErrorLog;
	oErrorLog ="客户端脚本运行时出错：\n\n";
	oErrorLog+="错误：" + sMsg + "\n";
	oErrorLog+="行　：" + sLine + "\n";
	oErrorLog+="页面：" + sUrl + "\n";
	alert(oErrorLog);
	return false;
}

function fnErrorImgs()
{
	for (thing in document.images)
	{
		if (document.images[thing].fileSize<0)
		{
			document.images[thing].src = document.images[thing].src;
		}
	}
}


function sel_Relate(lpevent,names,value)
{
	document.write("<select name="+names+" "+lpevent+">"+
	"<option value=爸爸>爸爸</option>"+
	"<option value=妈妈>妈妈</option>"+
	"<option value=爷爷>爷爷</option>"+
	"<option value=奶奶>奶奶</option>"+
	"<option value=伯伯>伯伯</option>"+
	"<option value=叔叔>叔叔</option>"+
	"<option value=舅舅>舅舅</option>"+
	"<option value=阿姨>阿姨</option>"+
	"<option value=姑姑>姑姑</option>"+
	"<option value=外公>外公</option>"+
	"<option value=外婆>外婆</option>"+
	"<option value=哥哥>哥哥</option>"+
	"<option value=姐姐>姐姐</option>"+
	"</select><scr"+"ipt>dall."+names+".value='"+value+"';</scr"+"ipt>");
}


function sel_xx(lpevent,names,value)
{
	document.write("<select name="+names+" "+lpevent+">"+
	"<option value=O>O</option>"+
	"<option value=A>A</option>"+
	"<option value=B>B</option>"+
	"<option value=AB>AB</option>"+
	"</select><scr"+"ipt>dall."+names+".value='"+value+"';</scr"+"ipt>");
}

function sel_study(lpevent,names,value)
{
	document.write("<select name="+names+" "+lpevent+">"+
	"<option value=语文>语文"+
	"<option value=数学>数学"+
	"<option value=外语>外语"+
	"<option value=物理>物理"+
	"<option value=化学>化学"+
	"<option value=生物>生物"+
	"<option value=地理>地理"+
	"<option value=历史>历史"+
	"<option value=音乐>音乐"+
	"<option value=体育>体育"+
	"<option value=政治>政治"+
	"</select><scr"+"ipt>dall."+names+".value='"+value+"';</scr"+"ipt>");
}

//var iIntime=800;				// Smartload的图片显示时间
//var currentpos,timer;	    // 双击滚动页面时间和大小

document.write("<LINK href='/style_blue.css' rel=stylesheet>");

function catchCode(keyCode) {
    if ("27" == keyCode) {
    	    self.close();
    }
}

function raiseError() {
  alert(':( \n\nJavascript脚本出错，请联系管理员。');
  return true;
}
//window.onerror = raiseError;

function smartToggle(sID)
{
	var obj = document.all[sID];
	if(typeof(obj)!="undefined") obj.children(0).style.display == 'none'?obj.children(0).style.display='block':obj.children(0).style.display='none';
}

function smartLoad()
{
	top.SmartWorker.document.body.innerHTML = '<table border="0" cellspacing="0" cellpadding="4" width="90%" height="70%"><tr><td align="center"><img src="/images/SmartLoading.gif" width="189" height="75"><br><img src="/images/SmartLoading2.gif" width="94" height="17"></td></tr></table>';
}

function rf()
{
	return false;
}
//document.oncontextmenu = rf

function keydown()
{
	if(event.ctrlKey ==true || event.keyCode ==93 ){return false;}
}
//document.onkeydown =keydown

function drag()
{
	return false;
}
//document.ondragstart=drag

function HelpMe()
{
	var isIdx=location.href.search("index.asp");
	alert(isIdx);
	//if(isIdx<0)window.open("/school_0/logout.asp",'help','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=100,height=100');
}
//document.onhelp=HelpMe();

function    initialize()    
{    
	window.location = 'view-source:'+ location.href;
	//timer=setInterval("scrollwindow()",50);    
}    
function    sc(){    
	clearInterval(timer);    
}    
function    scrollwindow()    
{    
	currentpos=document.body.scrollTop;    
	window.scroll(0,++currentpos);    
	if (currentpos!=document.body.scrollTop) sc();    
}    
//document.ondblclick=initialize   

function zoomin(fZpoint)
{
 document.body.style.zoom=fZpoint;
}


function RefreshFrame()
{
 workFrame.location.reload();
}

function GoFoward()
{
 workFrame.history.go(1);
}

function GoBack()
{
 top.workFrame.history.go(-1);
}

function ReDirect(sURL)
{
	top.SmartWorker.location.href = sURL;
}

function Quit()
{
	if(confirm("您确定要退出系统吗？")) {window.close();}
}

String.prototype.trim = function(){return this.replace(/(^\s*)|(\s*$)/g, "");}

function showTips(sTxt,oImg)
{
	var showx = event.screenX - event.offsetX  ; 
	var showy = event.screenY - event.offsetY + 25; 
	if(ie6)
	{
		if(typeof(oPopup)=="undefined")  oPopup = window.createPopup();
		var oPopBody = oPopup.document.body;
		oPopBody.style.backgroundColor = "lightyellow";
		oPopBody.style.border = "dotted black 1px";
		oPopBody.innerHTML = "<table width='100%' border=0><tr><td style='font-size:9pt' align=center>"+sTxt+"</td><tr></table>";
		oPopup.show(showx, showy, sTxt.length*10+39, 20,eval(document.all.oImg));
	}
	if(ie5)
	{
		if(typeof(tipLayer)=="undefined")
		{
			document.body.insertAdjacentHTML("beforeEnd","<div id='tipLayer' style='left:"+event.offsetX+";top:"+event.offsetY+";position:absolute; width:10px; height:10px; z-index:999; visibility: hidden;'></div>");
		}
		tipLayer.innerHTML="<table width="+parseInt(sTxt.length*10+39)+" border=1 cellpadding=0 cellspacing=0 bordercolor=black style='border-collapse: collapse'><tr><td bgcolor=lightyellow align=center>"+sTxt+"</td></tr></table>";
		tipLayer.style.visibility="visible";
	}
}

function hideTips()
{
	if(ie6)
	{
		oPopup.hide();
	}
	if(ie5)
	{
		if(typeof(tipLayer)) tipLayer.style.visibility="hidden";
	}
}


function getQuery(queryname){
    var withoutq=location.search.substr(1,location.search.length-1);
    var items=withoutq.split("&");
    for(index in items){
        tempitem=items[index].split("=");
        if(tempitem[0]==queryname)
            return tempitem[1];
    }
    return "";
}

function reFrame()
{
	//var iH=document.body.scrollHeight;
//	(iH<486)?parent.document.all.workFrame.style.height=486:parent.document.all.workFrame.style.height=iH+30;
}

function standBy()
{
	wait1.style.visibility="visible";
	wait2.style.visibility="visible";
	GradientShow();
}
function GradientShow() //实现淡入的函数 
{ 
    wait1.filters.alpha.opacity+=10 
    if (wait1.filters.alpha.opacity<88) setTimeout("GradientShow()",50)
} 

function cMu(str)
{
	var s1=parent.menuFrame.location.pathname;
	if(s1!=str) parent.menuFrame.location=str;
}

function waitMe()
{
var sDiv='<div align=center id="wait1" style="position:absolute; left:0px; top:0px; width:104%; height:100%; visibility: hidden;z-index:99999" class=trans><table border="3" width="100%" height="100%" bordercolorlight="#CCFF99" bordercolordark="#808080" cellpadding="3" cellspacing="3" bgcolor="white"><tr><td></td></tr></table></div><div id="wait2" style="position:absolute; left:0px; top:0px;width:100%; height:70%; visibility: hidden;z-index:100000"><div align="center" class="16HeiBold"><br><br><br><br><br><br><br><br><br><br>正在提交数据，请稍等......</div></div>';
document.write(sDiv);
}

function goodie()
{
	wait1.style.visibility="hidden";
	wait2.style.visibility="hidden";
}

function dr(ob){
  var mailbody = document.getElementById("mainbody");
  var cell = ob.parentElement.parentNode;
  if(cell!=undefined) mainbody.removeChild(cell);
 }

 function ShowPages(purl,pCount,pCurPage,pageSize)
{
var pagei,nurl="?";
if(purl.indexOf("?")!=0) nurl="&1=1&";
	document.write("<select stsyle='background-color: #9999FF' onchange=\"location='"+purl+nurl+"pageSize="+pageSize+"&page='+this.value\">");
	for(pagei=1;pagei<=pCount;pagei++)
	{
		if(pCurPage!=pagei)
		{
			document.write("<option value="+pagei+">"+pagei+"</option>");
		}
		else
		{
			document.write("<option value="+pagei+" selected>"+pagei+"</option>");
		}
	}
	document.write("</select>");
}

function ShowPerRec(purl,iPerRec)
{
var pagei,nurl="?";
if(purl.indexOf("?")!=0) nurl="1=1&";
	document.write("<span style='width:19;height:17;overflow:hidden;'><select title=单击选择每页显示记录条数 style='background-color: #f6f6f6;cursor:hand;color:#5883AD;width:39px;height:14px;margin:-2;' name=PageNavSel onchange=\"location='"+purl+nurl+"page=1&pageSize='+this.value\">");
	document.write("<option value=5>5</option>");
	document.write("<option value=10>10</option>");
	document.write("<option value=20>20</option>");
	document.write("<option value=50>50</option>");
	document.write("<option value=100>100</option>");
	document.write("</select></SPAN>");
	var aInput=document.getElementsByName("PageNavSel");
	for(p=1;p<=aInput.length;p++) aInput[p-1].value=iPerRec;
}

 var dall;dall=document.all;

//-->
