//公告暂停
function Stop()
{document.all("ShowNews").stop();}
//公告继续
function Go()
{document.all("ShowNews").start();}
//友情连接打开窗口
function OpenNewWindow(Item)
{
	var url = document.all(Item).value;
	if (url != "-1")
		open(url, "", "location=yes,menubar=yes,scrollbars=yes,resizable=yes,toolbar=yes,width="+(window.screen.width-10)+",height="+(window.screen.height-155)+",top=0,left=0");
}
//查询打开窗口
function OpenInfoSearch(url)
{	window.open(url, "InfoSearch", "location=no,menubar=no,scrollbars=no,resizable=no,toolbar=no,width=300,height=260,top=60,left=100");}
function OpenTelBookSearch(url)
{window.open(url, "TelBookS", "location=no,menubar=no,scrollbars=no,resizable=no,toolbar=no,width=500,height=420,top=100,left=150");}
function OpenSerachWindow(url)
{window.open(url, "", "location=no,menubar=no,scrollbars=no,resizable=no,toolbar=no,width=500,height=420,top=100,left=150");}
function OpenScoresSearchWindow(url)
{window.open(url, "", "location=no,menubar=no,scrollbars=no,resizable=no,toolbar=no,width=500,height=446,top=100,left=150");}
function OpenSerachLinkWindow(url)
{open(url);}
//导航增加内容
function AddFunction(FunctionName,FunctionLink)
{
	strOut = "<td class=\"topn\">";
	strOut += "<a href=\"" + FunctionLink ;
	strOut += "\"><font color=\"";
	strOut += FunctionColor;
	strOut += "\">";
	strOut += FunctionName ;
	strOut += "</font></a></td>"
	document.write (strOut);
}
//增加校园新闻内容
function AddSchoolyardNews(Id,Title)
{
	document.write ("<tr valign=middle onMouseOut=\"this.style.backgroundcolor=''\" onMouseOver=\"this.style.backgroundcolor='#d9eee3'\">");
    document.write ("<td height=20 width=18 align=\"center\"> <img height=7 src=\"/WS2003/public/images/default1/sdotgreen.gif\" width=7></td>");
    document.write ("<td height=20><a href=\"Javascript:OpenWin(");
    document.write (Id);
    document.write (")\"><font color=\"");
    document.write (NewsColor);
    document.write ("\">")
    if (Title.length<32) 
		document.write (Title);
	else
	{
		document.write (Title.substring(0,32));
		document.write ("...");
	}
    document.write ("</font></a<td></tr>");
}
function WriteNewsLine(NewsTitle, NewsID)
{
	var strOut;
	strOut = "<img src=\"/ws2003/public/images/default/bulletin_icon.gif\" align=\"center\"><a href=\"javascript:OpenWin('";
	strOut += NewsID;
	strOut += "');\"><font color=\"";
	strOut += NoticeColor;
	strOut += "\">";
	strOut += NewsTitle;
	strOut += "</font></a><br><br>";
	document.write (strOut);
}	
function AddArtList(Id,Title)
{
	url="/ws2003/teacherRoom/showNews.asp";
	document.write ("<tr><td><img src=\"/ws2003/public/images/default/bulletin_icon.gif\" width=\"8\" height=\"6\"><a href=\"Javascript:OpenWins(");
	document.write (Id);
	document.write (")\" ><font color=\"");
	document.write (ArtColor);
	document.write ("\">")
	if (Title.length>8)
	{
		document.write (Title.substring(0,9));
		document.write ("...");
	}
	
	else
		document.write (Title);
	document.write ("</font></a></td></tr>")
}
function OpenPopUpWindows(WindowSize, WindowTop, WindowLeft,Id)
{
	url = "/ws2003/public/asp/default/popupwindow.asp?Id="+Id;
	winname="公告"+Id;
	NoticeId = GetCookie("NoticeId");
	if (NoticeId == null)
		SetCookie("NoticeId",Id);
	else
	{
		str = NoticeId.split(",");
		Look = false;
		for (i=0;i<str.length;i++)
			if (Id == str[i])
				Look = true;
		if (Look)
			return true;
		else
			SetCookie("NoticeId",NoticeId+","+Id);
	}
	if(WindowSize == "0")
	{
		winname=open(url, winname, "location=no,menubar=no,scrollbars=no,resizable=yes,toolbar=no,width=350,height=270,top="+ WindowTop+",left="+WindowLeft);
	}
	else if(WindowSize == "1")
	{
		winname=open(url, winname, "location=no,menubar=no,scrollbars=no,resizable=yes,toolbar=no,width=450,height=350,top="+ WindowTop+",left="+WindowLeft);
	}
	else if(WindowSize == "2")
	{
		winname=open(url, winname, "location=no,menubar=no,scrollbars=no,resizable=yes,toolbar=no,width=680,height=500,top="+ WindowTop+",left="+WindowLeft);
	}
	else if(WindowSize == "3")
	{
		winname=open(url, winname, "fullscreen");
	}
}
function LogOut()
{
	if(confirm("是否真的退出系统？"))
		window.open("/ws2003/public/asp/default/logout.asp", "", "location=no,menubar=no,scrollbars=no,resizeable=no,toolbar=no,width=70,height=70,top=4000,left=4000");
}
function RegUser()
{
	window.open("/ws2003/public/asp/default/reguser.asp", "用户注册", "location=no,menubar=no,scrollbars=no,resizeable=no,toolbar=no,width=450,height=434,top=20,left=70");
}
function ChangeNumToGif(Num)
{
	var temp = "";
	result = "";
	temp = temp + Num;
	NumLength = temp.length;
	for(i=0; i<temp.length; i++)
	{
		x = temp.charAt(i);
		result = result+"<img class=\"jishuqi\" src=\"/ws2003/public/images/default/counter/"+x+".gif\">";//<font id=space1>&nbsp;</font>";
	}
	document.write("<font id=space1>&nbsp;</font>");
	document.write(result);
	document.write("<font id=space1>&nbsp;</font>");
}
function OpenHeadMasterEmailPage()
{
	url = "/ws2003/public/asp/default/headmasterEmail/sendEmail.asp";
	window.open(url, "", "location=no,menubar=no,scrollbars=yes,resizable=no,toolbar=no,width=600,height=450,top=60,left=60");
}
//首页公告窗口
function CheckSearchData()
{
	document.form1.SearchContent.value = KillSpace(document.form1.SearchContent.value);
	strtemp = document.form1.SearchContent.value;
	strtemp = strtemp.replace("'", "''");
	document.form1.SearchContent.value = strtemp;
	var IsContent = false;
	if(document.form1.SearchContent.value == "")
	{
		if(document.form1.lanmu.value == "0")
			SQLStr = "1=1";
		else if(document.form1.lanmu.value == "23")
			SQLStr = "isHot = '1'";
		else
			SQLStr = "flag = '" + document.form1.lanmu.value + "'";
	}
	else
	{
		var bDatatime;
		if(document.form1.lanmu.value == "0")
		{
			SQLStr = "";
		}
		else if(document.form1.lanmu.value == "23")
		{
			SQLStr = "isHot = '1' and ";
		}
		else
		{
			
			SQLStr = "flag = '" + document.form1.lanmu.value + "' and ";
		}
		switch (document.form1.SearchItem.value)
		{
			case "title":
				SQLStr += "title ";
				break;
			case "content":
				IsContent = true;
				SQLStr += "content ";
				break;
			case "outtime":
				bDatatime = true;
				SQLStr += "outtime ";
				if(IsDatetime(document.form1.SearchContent.value) == false)
				{
					alert("日期时间输入的格式不正确，\n正确的形式为2002-2-3 8:42:00或2002-2-3 8:42\n或2002/2/3 8:42:00或2002/2/3或2003-08-09\n请重填！");
					return false;
				}
				break;
			default:
				break;
		}
		if(SQLStr != "")
		{
			switch (document.form1.SearchType.value)
			{	//= > < <= >= like
				case "0":
					if(IsContent)
					{
						alert("内容只能使用包含查询，请重设");
						return false;
					}
					SQLStr += "= '" + document.form1.SearchContent.value + "'";
					break;
				case "1":
					if(IsContent)
					{
						alert("内容只能使用包含查询，请重设");
						return false;
					}
					SQLStr += "> '" + document.form1.SearchContent.value + "'";
					break;
				case "2":
					if(IsContent)
					{
						alert("内容只能使用包含查询，请重设");
						return false;
					}
					SQLStr += "< '" + document.form1.SearchContent.value + "'";
					break;
				case "3":
					if(IsContent)
					{
						alert("内容只能使用包含查询，请重设");
						return false;
					}
					SQLStr += "<= '" + document.form1.SearchContent.value + "'";
					break;
				case "4":
					if(IsContent)
					{
						alert("内容只能使用包含查询，请重设");
						return false;
					}
					SQLStr += ">= '" + document.form1.SearchContent.value + "'";
					break;
				case "5":
					if(bDatatime == true)
					{
						alert("日期时间不能用类似查询，请重设！");
						return false;
					}
					SQLStr += "like '%" + document.form1.SearchContent.value + "%'";
					break;
				default:
					break;
			}
		}
		else
			SQLStr = "1=1";
	}
	document.form1.SQLStr.value = SQLStr;
	return true;
}
function OpenWin(url)
{
	url = "/ws2003/newsCenter/showNews.asp?ID=" + url;
	open(url, "", "location=no,menubar=no,scrollbars=yes,resizable=no,toolbar=no,width=730,height=520,top=20,left=30");
}
function OpenWins(url)
{
	url = "/ws2003/teacherRoom/showNews.asp?ID=" + url;
	open(url, "", "location=no,menubar=no,scrollbars=yes,resizable=no,toolbar=no,width=600,height=500,top=40,left=70");
}
//弹出校长介绍窗口
function OpenMaster(url)
{
	url = "mi.asp?ID=" + url;
	open(url, "SchoolMaster", "location=no,menubar=no,scrollbars=yes,resizable=no,toolbar=no,width=730,height=520,top=20,left=30");
}
function ModifyPersonalInfo()
{
	window.open("/ws2003/public/asp/default/modifyuser.asp", "修改个人信息", "location=no,menubar=no,scrollbars=no,resizeable=no,toolbar=no,width=450,height=434,top=20,left=70");
}
function GetCookie(sName)
{
	var aCookie = document.cookie.split("; ");
  	for (var i=0; i < aCookie.length; i++)
  	{
	    var aCrumb = aCookie[i].split("=");
	    if (sName == aCrumb[0]) 
	      return unescape(aCrumb[1]);
  	}
  return null;
}
function SetCookie(sName, sValue)
{
  	document.cookie = sName + "=" + escape(sValue) +";path=/";
}
function OpenNoticeConfirm()
{
	window.open("/ws2003/public/asp/default/noticeconfirmlist.asp", "NoticeConfirm", "location=no,menubar=no,scrollbars=no,resizable=no,toolbar=no,width=500,height=420,top=100,left=150");
}
function swapimg(obj,imgurl)
{
	obj.src="/ws2003/public/images/default/icon/"+imgurl;
}
function SwitchColor(obj,colors)
{
	obj.bgColor=colors;
}
function seleradio(obj,i)
{
	obj[i].checked = true;
}