﻿// JScript 文件
var timer;
var interval=1;
window.onload = function () {



    //class begin
    //ClassBtnHover();

    //scall();

    var accord = new accordion.runaccordion();

    try {
        var dw = document.getElementById("content_text_box_dw").getElementsByTagName("A");
        for (var d = 0; d < dw.length; d++) {
            dw[d].title = "Download";
            dw[d].style.background = "url(../images/Save.gif) no-repeat right center";
            var ht = dw[d].innerHTML;
            dw[d].innerHTML = dw[d].innerHTML.replace("\/uploads\/", "");

        }
        //document.getElementById("content_text_box_dw")=dw.replace("\/uploads\/","");

    } catch (e) { }

    //class end
    var shop_hover_title = $(".hover_title_links");
    var shops = $(".shops");
    for (var i = 0; i < shop_hover_title.length; i++) {
        shop_hover_title[i].i = i;
        shop_hover_title[i].onmouseover = function () {
            for (var j = 0; j < shop_hover_title.length; j++) {
                shop_hover_title[j].style.color = "#999";
                //shop_hover_title[j].style.background="url(images/title_link_bg.gif) no-repeat";
                //shop_hover_title[j].style.fontWeight="normal";
            }
            var x = $(".more_1");
            x.css("display", "none");
            if (this.i == 0) {
                document.getElementById("nav_55_more").style.display = "inline";
                document.getElementById("nav_56_more").style.display = "none";
                document.getElementById("nav_57_more").style.display = "none";
                document.getElementById("nav_95_more").style.display = "none";
            } else if (this.i == 1) {
                document.getElementById("nav_55_more").style.display = "none";
                document.getElementById("nav_56_more").style.display = "inline";
                document.getElementById("nav_57_more").style.display = "none";
                document.getElementById("nav_95_more").style.display = "none";
            } else if (this.i == 2) {
                document.getElementById("nav_55_more").style.display = "none";
                document.getElementById("nav_56_more").style.display = "none";
                document.getElementById("nav_57_more").style.display = "inline";
                document.getElementById("nav_95_more").style.display = "none";
            } else if (this.i == 3) {
                document.getElementById("nav_55_more").style.display = "none";
                document.getElementById("nav_56_more").style.display = "none";
                document.getElementById("nav_57_more").style.display = "none";
                document.getElementById("nav_95_more").style.display = "inline";
            }


            this.style.color = "#3ba8c0";
            document.getElementById("center_artical_box").firstChild.style.background = "url(Templates/dingyistyle/images/tag_3_" + this.href.split("-")[1].toString() + ".gif) 6px top no-repeat";
            //this.style.background="url(images/title_link_hover_bg.gif) no-repeat";
            //this.style.fontWeight="bold";
            for (var j = 0; j < shops.length; j++) {
                shops[j].style.display = "none";
            }
            $(this.href.substr(this.href.indexOf("#"), this.href.length)).fadeIn("slow");
        }

        shop_hover_title[i].onclick = function () {
            this.blur();
            return false;
        }

    }



    //tag resource
    var shop_hover_title_zl = $(".zlhover_title_links");
    var shopszl = $(".zlshops");
    for (var i = 0; i < shop_hover_title_zl.length; i++) {
        shop_hover_title_zl[i].i = i;
        shop_hover_title_zl[i].onmouseover = function () {
            for (var j = 0; j < shop_hover_title_zl.length; j++) {
                shop_hover_title_zl[j].style.color = "#999";
                //shop_hover_title_zl[j].style.background="url(images/title_link_bg.gif) no-repeat";
                //shop_hover_title_zl[j].style.fontWeight="normal";
            }

            //---
            var x = $(".more_2");
            x.css("display", "none");
            if (this.i == 0) {
                document.getElementById("nav_69_more").style.display = "inline";
                document.getElementById("nav_70_more").style.display = "none";
            } else if (this.i == 1) {
                document.getElementById("nav_69_more").style.display = "none";
                document.getElementById("nav_70_more").style.display = "inline";
            }
            //---


            this.style.color = "#3ba8c0";
            document.getElementById("resouse_box").firstChild.style.background = "url(Templates/dingyistyle/images/tag_2_" + this.href.split("-")[1].toString() + ".gif) 6px top no-repeat";
            //this.style.background="url(images/title_link_hover_bg.gif) no-repeat";
            //this.style.fontWeight="bold";
            for (var j = 0; j < shopszl.length; j++) {
                shopszl[j].style.display = "none";
            }
            $(this.href.substr(this.href.indexOf("#"), this.href.length)).fadeIn("slow");
        }

        shop_hover_title_zl[i].onclick = function () {
            this.blur();
            return false;
        }

    }

    //teachers show

    var t = $(".thcs");
    t.mouseover(
  function () {
      $(this).css("cursor", "pointer");
  }
);
    t.click(
  function () {
      $("#teacher_big_pic").css("display", "none");
      document.getElementById("teacher_big_pic").firstChild.src = $(this).attr("src");
      document.getElementById("teacher_big_pic").href = $(this).parent().children(".title_t")[0].href;

      $("#teacher_big_pic").fadeIn("slow");
  }
);





}






function ClassBtnHover(){
  var x=document.getElementsByTagName("img");
  
  for(var i=0; i<x.length; i++){    
    if(x[i].className == "class_btn_img"){      
      x[i].onmouseover=function(){
        var y=document.getElementsByTagName("img");
        for(var j=0; j<y.length; j++){
          if(y[j].className == "class_btn_img"){
          
          
            if(y[j].src.indexOf("_hover")>-1){
              y[j].src=y[j].src.split("_hover")[0]+".gif";
            }
          }
        }

        this.src=this.src.split(".gif")[0]+"_hover.gif";    
        
      $(".class_tables").css("display","none");
      var idd=$(this).parent().attr("id").split("_")[3];
      $("#class_tables_"+idd).css("display","block");      
    
      }
    }
  }
  
}



var req=null;


function GetXmlHttpObject(){
    var xmlHttpNew = null;
    try {
        xmlHttpNew = new XMLHttpRequest();
    } 
    catch (e) {
        try {
            xmlHttpNew = new ActiveXObject("Msxml2.XMLHTTP");
        } 
        catch (e) {
            xmlHttpNew = new ActiveXObject("Microsoft.XMLHTTP");
        }
    }
    return xmlHttpNew;
}


//Get Search
function GetSearch(){
  var dom=document.getElementById("search_ul_result");
  dom.innerHTML="<font style='color:#CCC; font-size:18px; font-family:Arial;'>Loading...</font>";
  var q=document.getElementById("search_text_input").value;
  if(q=="" || q.length==1){
    var dom=document.getElementById("search_ul_result");
    dom.innerHTML="<li>搜索范围太广，请重新输入!</li>";
    return;
  }
  req=GetXmlHttpObject();
  if (req == null) {
        alert("浏览器不支持 AJAX!");
        return;
  }
  
  var url = "/components/GetSearch.aspx" + "?fresh=" + Math.random(); ;
  req.onreadystatechange = GetSearchOK;
  req.open("POST", url, true);
  req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  var param="k="+q;
  req.send(param);
}

function GetSearchOK(){
  if(req.readyState == 4){
     var dom=document.getElementById("search_ul_result");
     var result="";
     var x=req.responseXML.documentElement.childNodes;
     if(x[0].childNodes[0].firstChild.nodeValue=="no"){
       dom.innerHTML="<li>没有您想要的结果!</li>";
     }
     try{
       
       for(var i=0; i<x.length; i++){
         result+="<li><a target='_target' href='";
         result+=x[i].childNodes[1].firstChild.nodeValue;
         result+="'>";
         result+=x[i].childNodes[0].firstChild.nodeValue;
         result+="</a></li>";
       }
       dom.innerHTML=result;
     }catch(e){}      
  }  
}







// JScript 文件

//var k=$.ajax({
//  url: "Templates/dingyitemplates/kecheng.html",
//  dataType : "html",
//  success: function(html){    
//    //alert(1);
//    $("#center_accordion").html(html);
//  }
//});










//////////////////////////////////////////////////////// Accordion Class Begin /////////////////////////////////////////////////
var accordion=new Object();
accordion.outerid="accordion_box";
accordion.runaccordion=function(){
  
  var btns=document.getElementsByTagName("a");
  //Set btn's id
  for(var i=0; i<btns.length; i++){
    if(btns[i].className=="accordbtn"){
      btns[i].setAttribute("id","accordbtn_"+i); 
      btns[i].parentNode.setAttribute("id","block_"+i); 
      btns[i].parentNode.childNodes[0].setAttribute("id","accord_text_box_"+i);
      $("#accordbtn_"+i).click(
        function(){
            //---
          for(var j=0; j<btns.length; j++){            
            if($("#block_"+j).css("width")=="337px"){
              $("#accord_text_box_"+j).hide();
              $("#block_"+j).animate(
                {width : "36px"}  
              );
              
            }            
          }
          $(this).parent().animate(
               {width : "337px"}
           ); 
          $("#accord_text_box_"+$(this).attr("id").split("_")[1]).show();          
          //---
        }
      );
    }
  }
}

//////////////////////////////////////////////////////// Accordion Class End ///////////////////////////////////


  

//////////////////////////////////////////////// BaoMing Begin /////////////////////////////////////////////////
function ClassReg(d){
  //alert(this.parentNode.parentNode.parentNode.parentNode.childNodes[1].childNodes[1].nodeValue);
  //alert(d.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.childNodes[1].getElementsByTagName("b")[0].innerHTML);
  var classname="";
  try{
    classname=d.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.getElementsByTagName("b")[0].innerHTML;
  }catch(e){
    classname="课程名称";
  }
  var timestr="";
  try{
    timestr=d.parentNode.parentNode.innerText;
    timestr=timestr.replace("在线报名" , "");
  }catch(e){
    timestr="时间";
  }
  var content=encodeURI(classname+"-"+timestr);
  window.open("../baoming.aspx?content="+content);
}
//////////////////////////////////////////////// BaoMing Begin /////////////////////////////////////////////////




///////////////////////DuiLianBegin//////////////////////////////

///////////////////////DuiLianEnd//////////////////////////////
