/**** 全局变量 ****/
var slideSpeed = 5000;  
var is_Roll = true; 

/**** 图片预载 ****/
var fadeImg = new Array(); 
fadeImg[0]="public/images/1_e.jpg"
fadeImg[1]="public/images/2_e.jpg"
fadeImg[2]="public/images/3_e.jpg"
fadeImg[3]="public/images/4_e.jpg"

var preLoadImg = new Array();
for (var i=0;i<fadeImg.length;i++){
    preLoadImg[i] = new Image();
    preLoadImg[i].src = fadeImg[i];
}

/**** 自动滚动 ****/
var j=0;
function runSlideShow() {
  if(is_Roll){
      if (document.all) {
          document.images.ImgSlide.style.filter="blendTrans(duration=0.3)";
          document.images.ImgSlide.filters.blendTrans.Apply();
       }
      document.images.ImgSlide.src = preLoadImg[j].src;
      if(document.all){
          document.images.ImgSlide.filters.blendTrans.Play();
       }
      j = j + 1;
      if(j>(fadeImg.length-1))j=0;
   }
}

/**** OnMouseOver 事件 ****/
function changeImg(N){ 
      is_Roll = false;  //停止滚动
      ImgSlide.filters[0].Apply();
      document.ImgSlide.src = preLoadImg[N].src;
      ImgSlide.filters[0].play(); 
}

/**** OnMouseOut 事件 ****/
function stopImg(N){ 
    is_Roll = true;
    j=N;
}

/**** 执行切换渐变 ****/
function toSlide(){
   if(fadeImg.length > 1){
       setInterval(runSlideShow ,slideSpeed);
   }
}

/**** 添加到window.onload执行代码 ****/
/**** 或者可以单独使用 <script language="javascript">window.onload=function(){runSlideShow();toSlide()}</script> ****/
if (document.all){
 window.attachEvent('onload',function(){runSlideShow();toSlide()})//IE中
}
else{
 window.addEventListener('load',function(){runSlideShow();toSlide()},false);//firefox
}

function fEvent(sType,oInput){
		switch (sType){
			case "focus" :
				oInput.isfocus = true;
			case "mouseover" :
				oInput.style.borderColor = '#e20404';
				break;
			case "blur" :
				oInput.isfocus = false;
			case "mouseout" :
				if(!oInput.isfocus){
					oInput.style.borderColor='#cccccc';
				}
				break;
		}
}