﻿// JavaScript Document
window.onload=function(){
   //fadeIn=setInterval(showIndexAdv,100);
   closeAdv()
}
var fi=0;
var fadeIn;
var fadeOut;
var timeOut;
//渐变显示浮动广告
function showIndexAdv(){
   var advPic=document.getElementById("apDiv1");
   if(document.all){
		  fi+=5;
	      advPic.style.filter="alpha(opacity="+fi+")";
	      if(fi>=100) {
			  clearInterval(fadeIn);
			  //timeOut=setTimeout("fadeOut=setInterval(hideIndexAdv,100)",4000);
			  }
   }
   else{
		  fi+=0.05;
		  advPic.style.opacity=fi;
		  if(fi>=1.00) {
			  clearInterval(fadeIn);
			  //timeOut=setTimeout("fadeOut=setInterval(hideIndexAdv,100)",4000);
			  }
   }
}
//渐变隐藏浮动广告
function hideIndexAdv(){
   var advPic=document.getElementById("apDiv1");
   if(document.all){
		  fi-=5;
	      advPic.style.filter="alpha(opacity="+fi+")";
	      if(fi<=0) {clearInterval(fadeOut); document.getElementById("apDiv2").style.display="block";document.body.removeChild(document.getElementById("apDiv1"));}
   }
   else{
		  fi-=0.05;
		  advPic.style.opacity=fi;
		  if(fi<=0) {clearInterval(fadeOut); document.getElementById("apDiv2").style.display="block";document.body.removeChild(document.getElementById("apDiv1"));}
   }
}
//关闭浮动广告
function closeAdv(){//document.getElementById("apDiv2").style.display="block";
clearInterval(fadeIn);clearInterval(fadeOut); clearTimeout(timeOut);document.body.removeChild(document.getElementById("apDiv1"));}

//下载文件
function toDownload(){
   cancelToPro();
   location.href="http://www.318.com.cn/downloads/联道应用天地.exe";
}

//广告条滚动
function move(){
    if(document.getElementById("apDiv1"))document.getElementById("apDiv1").style.top=30+getScrollTop()+"px";
	if(document.getElementById("apDiv2"))document.getElementById("apDiv2").style.top=166+getScrollTop()+"px";
	if(document.getElementById("proDiv"))document.getElementById("proDiv").style.top=180+getScrollTop()+"px";
  }
  window.onscroll=move;
  function getScrollTop() 
 { 
    var scrollTop=0; 
    if(document.documentElement&&document.documentElement.scrollTop) 
    { 
        scrollTop=document.documentElement.scrollTop; 
    } 
    else if(document.body) 
    { 
        scrollTop=document.body.scrollTop; 
    } 
    return scrollTop; 
} 
