﻿// JScript 文件

//window.onload = Init();
//{droplist();}
function openadd(id)
{
 
if (id == null || id == "")
{
    window.open('HallManage.aspx','培训班增加','height=500,width=660,menubar=no,titlebar=no,toolbar=no');
    }
    else
    {window.open('HallManage.aspx?halleditid='+ id,'培训班修改','height=500,width=660,menubar=no,titlebar=no,toolbar=no');}
    return false;
}
function NotSave()
{



    if(document.all("HallName").value =='' && document.all("HallDesc").value =='' && document.all("HallUsercount").value  =='' )
    {
        location.href='HallList.aspx';
    }
    else
    {
      if(confirm("已填写或修改的内容，是否抛弃吗?")) 
         {
            location.href='HallList.aspx';
         }
         else
         {
            return false;
         }
    }
}

function Button7_onclick() {
    location.href='HallList.aspx';
}



function droplist()
{
document.all("HallCZDS").style.visibility="hidden";
     var abc = document.all("HallRate").value;
     GoType(abc);
      document.all("HallType").value = document.all("HallTypeValue").value;
}

function onvaluetype(mycount)
{

    document.all("HallTypeValue").value = mycount.value;
  
}


  function GoType (drop)
        {
       
        document.all("HallType").style.display=""; 
         document.all("HallType").options.length = 0 ;

            var result = ""; 
　　        var xmlHttp = new ActiveXObject("MSXML2.XMLHTTP"); 
　          xmlHttp.open("Post", "../App/AjaxPost.aspx?TypeID=" +  drop, false); 
　　        xmlHttp.send(""); 
　　        result = xmlHttp.responseText; 
　　        if(result!="")
           {



                var allArray = result.split(",");

               

                for(var i=1;i<allArray.length;i++)
                 {


                  
                    var thisArray = allArray[i].split("|");



                    document.all("HallType").options.add(new Option(thisArray[1].toString(),thisArray[0].toString()));
                      if( document.all("HallTypeValue").value.length == 0)
                    {
                        document.all("HallTypeValue").value = thisArray[0].toString();
                    }
                     
    

}

}
else
{
    document.all("HallTypeValue").value = "";
}

}
function dianshukg()
{
  
    if(document.all("CheckBox1").checked)
    {
         document.all("HallCZDS").style.visibility="visible";
    }
    else
     document.all("HallCZDS").style.visibility="hidden";
}




  function GoHalls(theid)
        {
      
        document.all("LabelHall").innerHTML= "";
         if(theid.value == "0")
        {
               document.all("LabelHall").innerHTML = "";
        }
else
{

            var result = ""; 
　　        var xmlHttp = new ActiveXObject("MSXML2.XMLHTTP"); 
　          xmlHttp.open("Post", "App/AjaxPost.aspx?HallID=" +  theid.value, false); 
　　        xmlHttp.send(""); 
　　        result = xmlHttp.responseText; 
　　        if(result!="")
           {



               
                    
                        document.all("LabelHall").innerHTML ="<font color='red'>您选择的是：</font>"+ result;
                    
                     
    



}
else
{
       document.all("LabelHall").innerHTML = "";
}
}

       
}



      

function zhenduan()
{
         
        var nick =document.all("TextBox1").value;
       
        if(nick.length <= 4)
        {
          document.all("Label1").innerHTML="<font color='red'>名称必须在4位以上</font>";
           document.all("ImageButton1").style.visibility="hidden";
            return false;
        }
        if(nick=="")
        {
    
        }
        else
        {
             var result = ""; 
　　        var xmlHttp = new ActiveXObject("MSXML2.XMLHTTP"); 
　          xmlHttp.open("Post", "App/AjaxPost.aspx?nike=" +  nick, false); 
　　        xmlHttp.send(""); 
　　        result = xmlHttp.responseText; 
　　     
　　           if(result!="")
               {
                 
                       if(result=="n0")
                       {
                      
                         document.all("Label1").innerHTML="<font color='red'>已存在此名称</font>";
                           document.all("ImageButton1").style.visibility="hidden";
                     
                       }
                       else
                       {
                     
                         document.all("Label1").innerHTML ="<font color='red'>此名称可以注册使用</font>";
                           document.all("ImageButton1").style.visibility="visible";
                     
                       }
                  
                       
                  
                }
                else
                {
                     document.all("Label1").innerHTML="";
                }
               
                   
        }
        
     
    
       
      
}







function G(id){
    return document.getElementById(id);
};
function GC(t){
   return document.createElement(t);
};
String.prototype.trim = function(){
          return this.replace(/(^\s*)|(\s*$)/g, '');
};
function isIE(){
      return (document.all && window.ActiveXObject && !window.opera) ? true : false;
} 
 

function popCoverDiv(){
   if (G("cover_div")) {
    G("cover_div").style.display = '';
   } else {
    var coverDiv = GC('div');
    document.body.appendChild(coverDiv);
    coverDiv.id = 'cover_div';
    with(coverDiv.style) {
     position = 'absolute';
     background = '#CCCCCC';
     left = '0px';
     top = '0px';
     var bodySize = getBodySize();
     width = bodySize[0] + 'px'
     height = bodySize[1] + 'px';
     zIndex = 98;
     if (isIE()) {
      filter = "Alpha(Opacity=60)";
     } else {
      opacity = 0.6;
     }
    }
   }
}
function getBodySize(){
   var bodySize = [];
   with(document.documentElement) {
    bodySize[0] = (scrollWidth>clientWidth)?scrollWidth:clientWidth;
    bodySize[1] = (scrollHeight>clientHeight)?scrollHeight:clientHeight;
   }
   return bodySize;
}
function cancelSign(){
    G("sign_div").style.display = 'none';
    G("cover_div").style.display = 'none';
    document.body.style.overflow = '';
};

function okSigntype()
{
   var xmlHttpSksi = new ActiveXObject("MSXML2.XMLHTTP"); 
   var t = 0 , typeid=0,pid=0;
   var radio1 = document.getElementsByName("typelist"); 
   for(i=0;i<radio1.length;i++)
   {   
        if(radio1[i].checked==true)
        {   
            
          
            typeid = radio1[i].value;
              document.all("LabelHall").innerHTML = "选择的培训班是：" + document.all("span"+String(typeid)).innerHTML;
         
            document.all("Hidden1").value = typeid;  
         t=t+1;
        }
   }
   if(t > 0)
   {
    
   
    G("sign_div").style.display = 'none';
    G("cover_div").style.display = 'none';
    document.body.style.overflow = '';
      
      
      
    }
    else
    {
        document.getElementById("span2").innerHTML ='<font color=red> <b>还未选择<b/></font>';
    }
    
  
}


function popSign(){
   var loginDivWidth = 300;
   var sign_in_flow;

    

    
   sign_in_flow = "<div>"+
   "<table style='width: 500'><tr><td style='background:#3173B0;height:15px; text-align: center;width:500;'><strong><span style='color:#ffffff'>选择新用户所在培训班</span></strong></td></tr>" + 
   "<tr><td align='center'><table style='width: 92%'>"+bodys+"</table></td></tr><tr>"+
   "<td align='right'><span id='span2'></span><input type='button' value='确认' onclick='okSigntype()'; /><input type='button' value='关闭' onclick='cancelSign();'/></td></tr></table></div>";
   
 
   if (G("sign_div")) {
    G("sign_div").style.display = '';
   } else {
    var signDiv = GC('div');
    document.body.appendChild(signDiv);
    signDiv.id = 'sign_div';
    signDiv.align = "center";
  
    with (signDiv.style) {
     position = 'absolute';
     left = 260;//(document.documentElement.clientWidth - loginDivWidth)/2 + 'px';
     top = 10;//(document.documentElement.clientHeight - 300)/2 + 'px';
     width = 500;// + 'px';
     zIndex = 99;
     background = '#FFFFFF';
     border = '#66CCFF solid 1px';
    }
   }
    G("sign_div").innerHTML = sign_in_flow;
 
  
}
function popSignFlow(az_id) {
   popCoverDiv();  
   popSign(az_id);  
   document.body.style.overflow = "hidden";
     
      
}



