			
function fadeIt(direction) {
     if(document.getElementById('image1')){
		 var imageObj1 = new fx.Opacity('image1');
    	 imageObj1.setOpacity(0);	
		}
	
	if(document.getElementById('image2')){
		var imageObj2 = new fx.Opacity('image2');
		imageObj2.setOpacity(0);
	}	
	
	
	if(document.getElementById('image3')){
		var imageObj3 = new fx.Opacity('image3');
		imageObj3.setOpacity(0);
	}	
	
	if(document.getElementById('image4')){
	  var imageObj4 = new fx.Opacity('image4');	
	  imageObj4.setOpacity(0);
	} 
	  
		var imageObj = new fx.Opacity('image'+count, {duration:500});
	    imageObj.setOpacity(1);
		imageObj.custom(1,0);	
		if(direction=='forwards') {
			if(count < total) {
				count=count+1;
			} else {
				count=1;
			}
		} else {
			if(count > 1) {
				count=count-1;
			} else {
				count=total;
			}
		}

		if(document.getElementById('image'+count).style.display!='block') {
			document.getElementById('image'+count).style.display='block';
		}

				
		var imageObj = new fx.Opacity('image'+count, {duration:500});
		
		imageObj.setOpacity(0);
		imageObj.custom(0,1);
		
		showCount();
		scrollTimer();
	}
	
function hideThem() {
		document.getElementById('image1').style.display='block';
		for(var loopCount = 2; loopCount <= total; loopCount++) {
		    var imageObj = new fx.Opacity('image'+loopCount);
			imageObj.setOpacity(0);
		}
	}
	
	function showCount() {
		document.getElementById('counterBox').innerHTML=count+'/'+total;
	}
	
	  scrollTime = 5000;
	
	function scrollTimer() {
		window.clearTimeout(tOut);
		tOut = setTimeout("fadeIt('forwards');",scrollTime); 
	}
	
 function showLarge(count) {
	if(document.getElementById('image1')){
	 var imageObj1 = new fx.Opacity('image1');
     imageObj1.setOpacity(0);	
	}
	
	if(document.getElementById('image2')){
		var imageObj2 = new fx.Opacity('image2');
		imageObj2.setOpacity(0);
	}	
	
	
	if(document.getElementById('image3')){
		var imageObj3 = new fx.Opacity('image3');
		imageObj3.setOpacity(0);
	}	
	
	if(document.getElementById('image4')){
	  var imageObj4 = new fx.Opacity('image4');	
	  imageObj4.setOpacity(0);
	} 
		
	var imageObj = new fx.Opacity('image'+count);
	imageObj.setOpacity(1);
	document.getElementById('counterBox').innerHTML=count+'/'+total;
			
}

