function $(id){return document.getElementById(id);}

function imgRotate(ver,int){
	var inTime = 6000;
	var outTime = 750;
	var num = Number(int)+1;

	if(int == 1){
		setTimeout(function(){imgRotate(ver,num);},inTime);	
	}else if(int == 2){
		fade('scrollIndex1','100','out',1);
		setTimeout(function(){imgRotate(ver,num);},outTime);	
	}else if(int == 3){
		$('scrollIndex2').style.display = '';
		fade('scrollIndex2','0','in',1);
		setTimeout(function(){imgRotate(ver,num);},inTime);
	}else if(int == 4){
		fade('scrollIndex2','100','out',1);
		setTimeout(function(){imgRotate(ver,num);},outTime);	
	}else if(int == 5){
		$('scrollIndex3').style.display = '';
		fade('scrollIndex3','0','in',1);
		setTimeout(function(){imgRotate(ver,num);},inTime);		
	}else if(int == 6){
		fade('scrollIndex3','100','out',1);
		setTimeout(function(){imgRotate(ver,num);},outTime);	
	}else if(int == 7){
		$('scrollIndex4').style.display = '';
		fade('scrollIndex4','0','in',1);
		setTimeout(function(){imgRotate(ver,num);},inTime);		
	}else if(int == 8){
		fade('scrollIndex4','100','out',1);
		setTimeout(function(){imgRotate(ver,num);},outTime);	
	}else if(int == 9){
		$('scrollIndex5').style.display = '';
		fade('scrollIndex5','0','in',1);
		setTimeout(function(){imgRotate(ver,num);},inTime);		
	}else if(int == 10){
		fade('scrollIndex5','100','out',1);
		setTimeout(function(){imgRotate(ver,num);},outTime);	
	}else if(int == 11){
		$('scrollIndex1').style.display = '';
		fade('scrollIndex1','0','in',1);
		setTimeout(function(){imgRotate(ver,1);},inTime);		
	}

}

function fade(objId,opacity,direction,start){
  if (document.getElementById) {
    obj = document.getElementById(objId);
    if ((opacity < 100 && opacity > 0) || start == 1){
      setOpacity(obj, opacity, direction);
	  if(direction == 'in'){
	      opacity += 10;
	  }else if(direction == 'out'){
	      opacity -= 10;
	  }
      window.setTimeout("fade('"+objId+"',"+opacity+",'"+direction+"')", 50);
    }else if(opacity == 0){
		obj.style.display = 'none';
//  }else{
//		fade('bannerImg','0','in');		
	}
  }
}

function setOpacity(obj, opacity) {
  opacity = (opacity == 100)?99.999:opacity;
  
  // IE/Win
  obj.style.filter = "alpha(opacity:"+opacity+")";
  
  // Safari<1.2, Konqueror
  obj.style.KHTMLOpacity = opacity/100;
  
  // Older Mozilla and Firefox
  obj.style.MozOpacity = opacity/100;
  
  // Safari 1.2, newer Firefox and Mozilla, CSS3
  obj.style.opacity = opacity/100;
}

