﻿// JScript 文件


var XLtimer; //下拉弹出图片的时间事件。
var ADDIV;
var tabT;
var tabT1;
var tabT2;
var speed=30;   
var ImgNum=6; 
var serch;
var serchdown;
var MenuState=false;
var marginHeight=-400;
/*下拉图片*/
function SetADDIVvalue(adiv)
{
 ADDIV=adiv;
 SetAdDiv();
}
function SetAdDiv()
{
    XLtimer = setInterval("ShowADDiv()",20 );         
}
function ShowADDiv()
{
    marginHeight=marginHeight+10;                    
   ADDIV.style.marginTop=marginHeight+"px";
    if(marginHeight==0)
    {                               
        clearInterval(XLtimer);
        XLtimer = setInterval("StopADDiv()",8000);
    }                              
}
function StopADDiv()
{
    clearInterval(XLtimer);
    XLtimer = setInterval("HideADDiv()",20); 
}
function HideADDiv()
{
    marginHeight=marginHeight-10;  
    ADDIV.style.marginTop= marginHeight+"px";      
    if(marginHeight==-400)
    {
        clearInterval(XLtimer);      
        MenuState=true;        
    }                                   
}
function SetMenu()
{
    if(MenuState)
    return true;
}  

/*公益*/
 function Settab(tab,tab1,tab2)
 {
    tabT=tab;
    tabT1=tab1;
    tabT2=tab2;
    IndexXW();
 }
function IndexXW()
{   
    var gyhtm="";
    for ( i = 0; i < ImgNum; i++)
    {        
        gyhtm += "<img src='Images/Gongyi/img" + (i+1)+ ".jpg' >";
    } 
    tabT1.innerHTML=gyhtm;
    tabT2.innerHTML=tab1.innerHTML;    
    var MyMar=setInterval(Marquee,speed);
    tabT.onmouseover=function() {clearInterval(MyMar)};
    tabT.onmouseout=function() {MyMar=setInterval(Marquee,speed)};
}
function Marquee()
{
        if(tabT2.offsetWidth-tabT.scrollLeft<=0)
            tabT.scrollLeft-=tabT1.offsetWidth
        else        
            tabT.scrollLeft++;
}
    
    /*下拉图片*/
//首页传入 菜单id.
function SerchDown(ctl)
{
    if(ctl!=null)
         ctl.src="Images/cdbroadIndex_SerchImgBtn_Down.gif";  
}
function SerchMove(ctl)
{  
    if(ctl!=null)
        ctl.src="Images/cdbroadIndex_SerchImgBtn_Accross.gif";
}
function SerchOut(ctl)
{   
    if(ctl!=null)      
        ctl.src="Images/cdbroadIndex_SerchImgBtn_NoActive.gif";
}

function setSerch(edserch,edserchdown)
{
     serch=edserch;
     serchdown=edserchdown;
}
function SerchClick()
{        
       if(serch.value.Trim()=="")         
      {  
          alert("请输入要搜索的软件名称！"); 
         serch.focus();                     
      } 
       else
      {
         var va=serch.value.replace(/ {1,}/g,"%");
         window.location.href="SerchBuyResult.aspx?Type=0&Name="+va;
      }          
} 

function SerchDownClick()
{        
    if(serchdown.value.Trim()=="")         
    {  
        alert("请输入要搜索的软件名称！");   
        serchdown.focus();                     
    } 
    else
    {
        var va=serchdown.value.replace(/ {1,}/g,"%");
        window.location.href="SerchResult.aspx?Type=0&Name="+va;
    }  
} 
/*考神榜*/

function setOpacity(obj, value)
{
    if(document.all)
    {
        if(value == 100)                    
            obj.style.filter = "";
        else
         obj.style.filter = "alpha(opacity=" + value + ")"; 
    }
    else
     obj.style.MozOpacity = value / 100;                
}

function changeOpacity(obj, startValue, endValue, step, speed)
{
    if(step > 0 && startValue < endValue || step < 0 && startValue > endValue)
    {
        setOpacity(obj, endValue);
        return;
    }
    setOpacity(obj, startValue);
    setTimeout(function(){changeOpacity(obj, startValue-step, endValue, step, speed);}, speed);
}
function ShowDivMsg(txtType,BtDivMsg,BtDivMsg1,BtDivMsg2,DivMsg,DivMsg1,DivMsg2,Mq1)
{
//      Mq3.stop();
//      Mq2.stop();
    if(BtDivMsg==document.getElementById("BtExamList1"))Mq1.start();else Mq1.stop();
    BtDivMsg.className="BgExamDown";
    BtDivMsg1.className="BgExamUp";
    BtDivMsg2.className="BgExamUp";
    DivMsg1.style.display="none";
    DivMsg2.style.display="none";
    DivMsg.style.display="";
    if(txtType==1)SetText("职称英语考神榜","计算机","公务员");
    if(txtType==2)SetText("英语","职称计算机考神榜","公务员");
    if(txtType==3)SetText("英语","计算机","公务员考神榜");
    //Mq1.start();
    var step = 4, speed = 30;
    changeOpacity(DivMsg, 0, 100, -step, speed);
    
}
/*希望小学超链接*/
function SetHref()
{
    document.getElementById("schoolhref").innerHTML = "<a href='http://blog.sina.com.cn/bdjyxwxx' target='_blank' class='HreA' title='点此进入希望小学博客'>&gt;&gt;点击进入希望小学博客</a>";
}
