
// define global variables
fxSlideObjectArray = new Array();   
   
   
Window.addEvent('domready',fxSlideObjectArray = function() { 
   // How long should the slide take?
   var slideDuration = 500; //ms
    
   // define global variables
   fxSlideObjectArray = new Array();   
   
   var i = 1;
   //loop through all possible Fx slide objects
   while ($('fxSlideObject'+i)) {
		// create Fx object
		fxSlideObjectArray[i] = new Fx.Slide('fxSlideObject'+i,{duration: slideDuration});
		
		//detect if toggle button  is defined
		if($('toggleFxSlideObject'+i)) {
			//add functionality to the toggle buttons
			$('toggleFxSlideObject'+i).addEvent('click', function(e){
				var idString = this.id;
				var lastDigit = idString.charAt(idString.length-1);
				e = new Event(e);
				fxSlideObjectArray[lastDigit].toggle(); 
				e.stop();  
				});
			}
		//detect if show button  is defined
		if($('showFxSlideObject'+i)) {
			//add functionality to the show buttons
			$('showFxSlideObject'+i).addEvent('click', function(e){
				var idString = this.id;
				var lastDigit = idString.charAt(idString.length-1);
				e = new Event(e);
				fxSlideObjectArray[lastDigit].slideIn(); 
				e.stop();
				});
			}

		//detect if hide button  is defined
		if($('hideFxSlideObject'+i)) {
		   //add functionality to the hide buttons
			$('hideFxSlideObject'+i).addEvent('click', function(e){
			    
				var idString = this.id;
				var lastDigit = idString.charAt(idString.length-1);
				e = new Event(e);
				fxSlideObjectArray[lastDigit].slideOut(); 
				e.stop();
				});
			} 
			
		// Perform autohide (enhancement: do this per element
		if($('autohide')) {
			fxSlideObjectArray[i].hide();
			}
		
		// Make the element shown (was hidden to prevent showing it at DOM load)
		$('fxSlideObject'+i).setStyle('display','block');

			
		// next object
		i++;
		}
		
	// Scroll to top of page if autohide to be sure 
	if($('autohide')) {
	   scroll(0,0);
		}
	
	return fxSlideObjectArray;
	
   });