function getEvent()
{
  if(document.all)
  {
    return window.event;//如果是ie
  }
  func=getEvent.caller;
  while(func!=null)
  {
    var arg0=func.arguments[0];
    if(arg0)
    {
      if((arg0.constructor==Event || arg0.constructor ==MouseEvent)
       ||(typeof(arg0)=="object" && arg0.preventDefault && arg0.stopPropagation))
       {
          return arg0;
       }
    }
    func=func.caller;
  }
  return null;
}

function skySelectCheckList()
{
	var slist;
	slist = $("checkSelect");
	var t;
	t=slist.checked;
	var dom = document.getElementsByTagName("*");
    var el = event.srcElement ? event.srcElement : event.target;
    for(i = 0; i < dom.length; i ++ )
    {
      //window.alert(dom[i].tagName);
      if(dom[i].tagName == "INPUT" && dom[i].type.toLowerCase() == "checkbox")
      {

         dom[i].checked = t;
      }
   }
}
function SelectAll()
{

   //var dom = document.all;
   //var dom = document.getElementById("*");
   // var evt=getEvent();
   //var el=evt.srcElement || evt.target;
    //var el = event.srcElement;
	var dom = document.getElementsByTagName("*");
 
   var el = event.srcElement ? event.srcElement : event.target;
   for(i = 0; i < dom.length; i ++ )
   {
      //window.alert(dom[i].tagName);
      if(dom[i].tagName == "INPUT" && dom[i].type.toLowerCase() == "checkbox")
      {

         dom[i].checked = true;
      }
   }


}
function SelectFX()
{
   var dom = document.all;
   var el = event.srcElement;

   for(i = 0; i < dom.length; i ++ )
   {
      if(dom[i].tagName == "INPUT" && dom[i].type.toLowerCase() == "checkbox")
      {
         if(dom[i].checked == true)

         {
            dom[i].checked = false;
         }
         else
         {
            dom[i].checked = true;
         }

      }
   }


}
function isValidCode(strCode)
{
   var i, cChar
   var strValidID = "0123456789-";
   for (i = 0; i < strCode.length; i ++ )
   {
      cChar = strCode.charAt(i);
      if(strValidID.indexOf(cChar) == - 1) return false;
   }
   return true;
}

function openwebinfo(url)
{
   var k = window.showModalDialog(url, window, 'dialogWidth:950px;status:no;dialogHeight:500px');
}
function SkyConfig()
{
   info = "系统提示您:您确实要提交授权信息吗?"
   return window.confirm(info)
   /*
   var info, s, v;
   s = document.getElementById("TxtSoftReg");
   v = s.value;
   window.alert(v);
   window.alert(v.length);
   if(v == "" || v.length < > 32)
   {
   window.alert("系统提示您:错误的授权文件信息！");
   }
   else
   {
   info = "系统提示您:您确实要提交授权信息吗?"
   return window.confirm(info)
   }
   */
}
function SkyDBConfig()
{
   info = "系统提示您:您确实要数据初始化吗？ 注意：信息初试化后不能恢复，您需要重新输入相关的信息！"
   return window.confirm(info)
}
function SkyOpen(src)
{
  var res;
   res = showModalDialog('/admin/documentindex.aspx', 'sky', 'dialogWidth: 900px; dialogHeight: 800px; center: yes; resizable: no; scroll: no; status: no;');
	//alert(res)
   if (res == undefined)
   {
      window.alert("系统提示您，您没有选择相关需要的信息！");
   }
   else
   {
      var m = $(src)
      m.value = res;
	  try
	  {
		
	  }
	  catch(e){}
   }
}
function $(id)
{
   return document.getElementById(id);
}

function SkyShowConfirm(info)
{
	var cinfo;
	cinfo= "〖学校教务管理系统提示您！〗";
	if(window.confirm(cinfo+info))
	{
		return true;
	}
	else
	{
		return false;
	}
}

function SkyAlertInfo(info)
{
	window.alert("〖学校教务管理系统提示您！〗"+info);
}

//##############################################################################
function Skyopenweb(weburl,info)
		{
			if(confirm(info))
			{
			var url;
			url=weburl
			//window.location.href=url;
			 // window.open(url,'manage','top=0,left=0,scrollbars=yes,resizable=no,width=10,height=10');
			var k = window.showModalDialog(url, window, 'dialogWidth:750px;status:no;dialogHeight:500px');
			return k;
		}
}
//##############################################################################


function killErrors(){
return true;
}
window.onerror = killErrors;


function SkyUserLogo(img, t)
{
   var m;
   m = document.getElementById("userlogo")
   m.src = "/Admin/Style/default/Logo.gif";
   top.document.title = t + " 建议使用1024*768分辨率";
   m = document.getElementById("softName")
   m.innerHTML = t;
}

function SoftTopParentName(t)
{
   top.document.title = t;
}
//#################################################################################################################
//表格颜色控制
//#################################################################################################################
var  highlightcolor='#c1ebff';
//此处clickcolor只能用win系统颜色代码才能成功,如果用#xxxxxx的代码就不行,还没搞清楚为什么:(
var  clickcolor='#51b2f6';
function  changeto(){
source=event.srcElement;
if  (source.tagName=="TR"||source.tagName=="TABLE")
return;
while(source.tagName!="TD")
source=source.parentElement;
source=source.parentElement;
cs  =  source.children;
//alert(cs.length);
if  (cs[1].style.backgroundColor!=highlightcolor&&source.id!="nc"&&cs[1].style.backgroundColor!=clickcolor)
for(i=0;i<cs.length;i++){
	cs[i].style.backgroundColor=highlightcolor;
}
}

function  changeback(){
if  (event.fromElement.contains(event.toElement)||source.contains(event.toElement)||source.id=="nc")
return
if  (event.toElement!=source&&cs[1].style.backgroundColor!=clickcolor)
//source.style.backgroundColor=originalcolor
for(i=0;i<cs.length;i++){
	cs[i].style.backgroundColor="";
}
}

function  clickto(){
source=event.srcElement;
if  (source.tagName=="TR"||source.tagName=="TABLE")
return;
while(source.tagName!="TD")
source=source.parentElement;
source=source.parentElement;
cs  =  source.children;
//alert(cs.length);
if  (cs[1].style.backgroundColor!=clickcolor&&source.id!="nc")
for(i=0;i<cs.length;i++){
	cs[i].style.backgroundColor=clickcolor;
}
else
for(i=0;i<cs.length;i++){
	cs[i].style.backgroundColor="";
}
}
//#################################################################################################################
function skyDataGridList(id)
{
	var info;
	if(id==1){info="您确认要增加新数据吗？";}
	if(id==2){info="您确认要修改新数据吗？";}
	if(id==3){info="您确认要删除新数据吗？";}
	return SkyShowConfirm(info);
}