   /*
       *初始化XMLHTTP
       */
        function getXMLHTTP(){
            var xmlhttp=false;
            try{
                xmlhttp=new XMLHttpRequest();
            }catch(e){
                try{
                    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
                }catch(e){
                    alert("你的浏览器不支持Ajax");
                }
            }
            return xmlhttp;
        }
        /*收集数据并发送XMLHTTP请求*/
        function xmlsend(){
            var xmlhttp=getXMLHTTP();
            var input_str=document.getElementById("DropDownList2").value;
            if(input_str.length>0){
            var count=10;
            xmlhttp.open("Get","../Ashx/Handler.ashx?input_str="+input_str+"&count=50",true);
            
           
            // document.getElementById ("message").style.display="block";
            xmlhttp.onreadystatechange=function(){
           
            
            if(xmlhttp.readyState==4){
          
           
                  if(xmlhttp.status==200){
                    //  document.getElementById ("message").style.display="none";
                       if(xmlhttp.responseText!=""){
                    
                     
                  //var json = xmlhttp.responseText.evalJSON(); 
                      var json=JSON.parse(xmlhttp.responseText);      
                   
                      //   var html="<table>"; 
                    //     var ss="";                   
                    //alert(json.student.length)
                   var ddl=  document.getElementById ("ListBox2");
                   
                   ddl.options.length=0
                        for(var i = 0;i<json.student.length;i++)
                    {                   
                        var o = new Option();
                    o.innerText =json.student[i].tea0;
                    o.value =json.student[i].tea1;
                      if (o.innerText!='null')
                     {
                     ddl.appendChild(o);
                      }
                    }
                     
//                        var color = "#f5f5f5";
//                        if(i%2 == 0)
//                            color="#fff"                        
//                        html +="<tr style=\"background-color:" + color + ";\"><td>" + json.student[i].StuId + "</td><td>" + json.student[i].StuItemNo + "</td><td>" + json.student[i].StuPwd + "</td><td>" + json.student[i].StuNo + "</td><td><img src='Image/"+json.student[i].StuFirstName+"' width=\"50px\" height=\"60px\" /></td><td>" + json.student[i].StuName + "</td><td>" + json.student[i].StuSex + "</td><td> <a href=\"#\" onclick=\"dele("+json.student[i].StuNative+")\">删</a> <a href=\"#\" onclick=\"upda("+json.student[i].StuBirthDate+")\">改</a> <a href=\"#\" onclick=\"sele("+json.student[i].StuProperties+")\">查</a> </td></tr>";
                          //  ss+=json.student[i].AAA1;
                  //  }
                    
                   // alert(ss);
                        // html += "</table>";   
                       // var xmldoc=xmlhttp.responseXML.documentElement;   
                     //var jj=xmldoc.getElementById("TextBox1");
                     
                       //var selectnode=xmldoc.getElementById('TextBox1'); 
                      // var  objNodeList ＝ xmldoc.getElementsByTagName('*');
                    //  alert(jj);           　　 
                     //var t=xmldoc.getElementByName('TextBox1');
                     
                    //  var k= xmldoc.getElementsBYID('TextBox1');
                   //  alert(xmlhttp.responseText);  
                      
                   // document.getElementById ("Text3").value =xmlhttp.responseText;
                              }
               }
            }
         }
         xmlhttp.send(null);
         }else{
           // document.getElementById("Select1").innerHTML="";
           // document.getElementById("Select1").style.display="none";
         }
        }
        
        
  //------------------------------------------------------------------
   function xmlsend2(k){
    
            var xmlhttp=getXMLHTTP();
            var input_str=document.getElementById("t_"+k).value;
               var text=  document.getElementById("v_"+k);
        //   alert(input_str)
            if(input_str.length>0){
            var count=10;
            xmlhttp.open("Get","../Ashx/Handler2.ashx?input_str="+encodeURI(input_str)+"&count=1",true);
            
         //  alert(i+"_"+j+"_"+k);
            // document.getElementById ("message").style.display="block";
            xmlhttp.onreadystatechange=function(){
           
            
            if(xmlhttp.readyState==4){
          
           
                  if(xmlhttp.status==200){
                    //  document.getElementById ("message").style.display="none";
                       if(xmlhttp.responseText!=""){
                    
                   
                 // var json = xmlhttp.responseText.evalJSON(); 
                    //  var json = JSON.parse(xmlhttp.responseText); 
                    var json=JSON.parse(xmlhttp.responseText); 
                    
                   //   alert(xmlhttp.responseText)
                   
                      //   var html="<table>"; 
                    //     var ss="";                   
                    //alert(json.student.length)
                     
                  
                 // showInfo.hideLayer(event,div_111);
                   var ddl=  document.getElementById ("ListBox2");
                 
                 
                    //--------------------------------------------------------------------
                 
                       if (json.student.length>0)
                   {
                   if (json.student.length==1)
               
                 {
                     if (input_str==json.student[0].tea0)
                     {
                 
                        text.value=json.student[0].tea1;
                       
                   }
                   }
               
                   //-------------------------------------------------------------------
             

                     //ddl.options.length=0
                
                        for(var i = 0;i<json.student.length;i++)
                    {                   
                        var o = new Option();
                    o.innerText =json.student[i].tea0;
                    o.value =json.student[i].tea1;
                      if (o.innerText!='null')
                     {
                     ddl.appendChild(o);
                      }
                    }
                 
                    //--------------------------------------------------------------
                                   
                   
                      
                    } 
                    else
                    {
            
                   text.value="";
            
                   
                    }              
                   
                 }
               }
            }
         }
         xmlhttp.send(null);
         }else{
          //alert('为空')
          
          // var text=  document.getElementById ("v_"+i+"_"+j+"_"+k);
          text.value="";
            //ffclose();
         }
}

//-----------------------------------------------------------------

   function Get_Data(){
            var xmlhttp=getXMLHTTP();
            var input_str=document.getElementById("banji").value;
            var ter=document.getElementById("xueqi").value;
            var xueqi_name=document.all("xueqi").options[document.all("xueqi").selectedIndex].text;
            var banji_name=document.all("banji").options[document.all("banji").selectedIndex].text;   
            if(input_str.length>0){
            var count=10;
            xmlhttp.open("Get","../Ashx/Handler_data.ashx?input_str="+input_str+"&count="+ter,true);
             document.getElementById ("message").style.display="block";
            xmlhttp.onreadystatechange=function(){              
            if(xmlhttp.readyState==4){  
                  if(xmlhttp.status==200){
                      document.getElementById ("message").style.display="none";
                       if(xmlhttp.responseText!=""){          
                     var tl=document.getElementById("title");
                      tl.innerHTML=xueqi_name+"xxxx学校"+banji_name+"任课表设置"; 
                       tl.style.display="block";        
                        var bottom=document.getElementById("bt5");
                        bottom.style.display="block";                            
                    // alert(xmlhttp.responseText);               
               var ct=document.getElementById("kkk");       
                ct.innerHTML=xmlhttp.responseText;  
                              }
                              else
                              {
                                var tl=document.getElementById("title");
                      tl.innerHTML=xueqi_name+"xxxx学校"+banji_name+"任课表设置";   
                      tl.style.display="none";     
                        var bottom=document.getElementById("bt5");
                        bottom.style.display="none";                            
                               var ct=document.getElementById("kkk");       
                ct.innerHTML="<table class='table' width='100%'><tr><td>抱歉，请先设置学期科目计划，再添加任课信息!!</td></tr></table>";  
                              }
                              
                              
                              
               }
            }
         }
         xmlhttp.send(null);
         }else{
         
         }
        }

//---------------------------------


function GET_data(recid){


            var xmlhttp=getXMLHTTP();
             
          
            var count=10;
            xmlhttp.open("Get","../Ashx/Get_data.ashx?recid="+recid,true);
            
          
           //  document.getElementById ("message").style.display="block";
            xmlhttp.onreadystatechange=function(){              
            if(xmlhttp.readyState==4){  
                  if(xmlhttp.status==200){
                   //   document.getElementById ("message").style.display="none";
                       if(xmlhttp.responseText!=""){  
                       
                              
                              
                        //  alert(xmlhttp.responseText) ;
                    var tl=document.getElementById("div_1");
                   
              tl.innerHTML=xmlhttp.responseText;  
                              }
                          
                              
                              
                              
               }
            }
         }
         xmlhttp.send(null);
   
         
         
}
//-----------------------------------------

function school_dell(recid){


            var xmlhttp=getXMLHTTP();
             
          
            var count=10;
            xmlhttp.open("Get","../Ashx/school_dell.ashx?recid="+recid,true);
            
          
           //  document.getElementById ("message").style.display="block";
            xmlhttp.onreadystatechange=function(){              
            if(xmlhttp.readyState==4){  
                  if(xmlhttp.status==200){
                   //   document.getElementById ("message").style.display="none";
                       if(xmlhttp.responseText!=""){  
                       
                              
                              
                       alert(xmlhttp.responseText) ;
                    //var tl=document.getElementById("div_1");
                   
              //tl.innerHTML=xmlhttp.responseText;  
                              }
                          
                              
                              
                              
               }
            }
         }
         xmlhttp.send(null);
   
         
         
}
//-----------------------------------
//加载个人权限
function get_quanxian(){

  document.getElementById("div_1").style.display="none";
            var xmlhttp=getXMLHTTP();
             
               var input_str=document.getElementById("Tea").value;
               if(input_str.length>0){
           
             // alert(input_str);
            var count=10;
            xmlhttp.open("Get","../Ashx/quanxian.ashx?recid="+input_str,true);
            
          
             document.getElementById ("message").style.display="block";
            xmlhttp.onreadystatechange=function(){              
            if(xmlhttp.readyState==4){  
                  if(xmlhttp.status==200){
                      document.getElementById ("message").style.display="none";
                       if(xmlhttp.responseText!=""){  
                       
                              
                             
                //       alert(xmlhttp.responseText) ;
              if (input_str!="00")
              {
                var btn=document.getElementById("btn");
              btn.style.display="block";
                    var tl=document.getElementById("div_1");        
              tl.innerHTML=xmlhttp.responseText;  
             tl.style.display="block";
              }
              else 
              {
                var tl=document.getElementById("div_1");        
              tl.innerHTML=xmlhttp.responseText;  
            tl.style.display="block";
              var btn=document.getElementById("btn");
              btn.style.display="none";
              
              }
              
                              }
                          
                              
                              
                              
               }
            }
         }
         xmlhttp.send(null);
   }
 else
   {
   
   }
         
         
}

//--------------------------------------

//加载部门权限
function get_quanxian_Dep(){

  document.getElementById("div_1").style.display="none";
            var xmlhttp=getXMLHTTP();
             
               var input_str=document.getElementById("Dep").value;
               if(input_str.length>0){
           
             // alert(input_str);
            var count=10;
            xmlhttp.open("Get","../Ashx/quanxian_Dep.ashx?recid="+input_str,true);
            
          
             document.getElementById ("message").style.display="block";
            xmlhttp.onreadystatechange=function(){              
            if(xmlhttp.readyState==4){  
                  if(xmlhttp.status==200){
                      document.getElementById ("message").style.display="none";
                       if(xmlhttp.responseText!=""){  
                       
                              
                             
                //       alert(xmlhttp.responseText) ;
              if (input_str!="00")
              {
                var btn=document.getElementById("btn");
              btn.style.display="block";
                    var tl=document.getElementById("div_1");        
              tl.innerHTML=xmlhttp.responseText;  
             tl.style.display="block";
              }
              else 
              {
                var tl=document.getElementById("div_1");        
              tl.innerHTML=xmlhttp.responseText;  
            tl.style.display="block";
              var btn=document.getElementById("btn");
              btn.style.display="none";
              
              }
              
                              }
                          
                              
                              
                              
               }
            }
         }
         xmlhttp.send(null);
   }
 else
   {
   
   }
         
         
}
//-----------------------------
//加载角色权限
function get_quanxian_role(){

  document.getElementById("div_1").style.display="none";
            var xmlhttp=getXMLHTTP();
             
               var input_str=document.getElementById("role").value;
               if(input_str.length>0){
           
             // alert(input_str);
            var count=10;
            xmlhttp.open("Get","../Ashx/quanxian_role.ashx?recid="+input_str,true);
            
          
             document.getElementById ("message").style.display="block";
            xmlhttp.onreadystatechange=function(){              
            if(xmlhttp.readyState==4){  
                  if(xmlhttp.status==200){
                      document.getElementById ("message").style.display="none";
                       if(xmlhttp.responseText!=""){  
                       
                              
                             
                //       alert(xmlhttp.responseText) ;
              if (input_str!="00")
              {
                var btn=document.getElementById("btn");
              btn.style.display="block";
                    var tl=document.getElementById("div_1");        
              tl.innerHTML=xmlhttp.responseText;  
             tl.style.display="block";
              }
              else 
              {
                var tl=document.getElementById("div_1");        
              tl.innerHTML=xmlhttp.responseText;  
            tl.style.display="block";
              var btn=document.getElementById("btn");
              btn.style.display="none";
              
              }
              
                              }
                          
                              
                              
                              
               }
            }
         }
         xmlhttp.send(null);
   }
 else
   {
   
   }
         
         
}

//------------------------保存权限
function save_qx(){


            var xmlhttp=getXMLHTTP();
             
               var input_str=document.getElementById("Tea").value;
               if(input_str.length>0){
               alert(input_str);
            var count=10;
            xmlhttp.open("Get","../Ashx/save_qx.ashx?recid="+input_str,true);
            
          
           //  document.getElementById ("message").style.display="block";
            xmlhttp.onreadystatechange=function(){              
            if(xmlhttp.readyState==4){  
                  if(xmlhttp.status==200){
                   //   document.getElementById ("message").style.display="none";
                       if(xmlhttp.responseText!=""){  
                       
                              
                              
                      alert(xmlhttp.responseText) ;
                    //var tl=document.getElementById("div_1");
                   
              //tl.innerHTML=xmlhttp.responseText;  
                              }
                          
                              
                              
                              
               }
            }
         }
         xmlhttp.send(null);
   }
 else
   {
   
   }
         
         
}

//----------------------------------------


//----------

 
 function load_man_nav(teaid){

            var xmlhttp=getXMLHTTP();
             
              // var input_str=document.getElementById("Tea").value;
            
             
             //  alert(input_str);
            
            var count=10;
            xmlhttp.open("Get","Ashx/load_man_nav.ashx?recid="+teaid,true);
            
          
           //  document.getElementById ("message").style.display="block";
            xmlhttp.onreadystatechange=function(){              
            if(xmlhttp.readyState==4){  
                  if(xmlhttp.status==200){
                   //   document.getElementById ("message").style.display="none";
                       if(xmlhttp.responseText!=""){  
                       
                           
                              
                      //alert(xmlhttp.responseText) ;
                      var  dd=document.getElementById ("nav");
                      dd.innerHTML=xmlhttp.responseText;
 
                      
                   // initinav('系统设置');
                    //var tl=document.getElementById("div_1");
                   
              //tl.innerHTML=xmlhttp.responseText;  
                              }
                          
                              
                              
                              
               }
            }
         }
         xmlhttp.send(null);
  
         
         
}