<!--           

if(typeof Prototype === 'undefined')  { throw("rotator.js requires Prototype.js library"); }
var Rotator = { Version: '1.0' };

var Rotator = Class.create();

Rotator.prototype = {
                             
    // initialize()  
    
    initialize: function(elementname, directory) 
    {                                                   
        this.elementName = elementname;
        this.directory = directory; 
        this.queue = Effect.Queues.get('pageScope');                      
        this.runRotator();
    },    
    
    runRotator: function()
    {                                                               
        var rotator = $(this.elementName);
        var images = rotator.immediateDescendants();  
        for(i=0;i<images.length;i++){
            if(images[i].visible())
            {                                                          
                this.last = images[i].firstDescendant().readAttribute('value');
                this.current = images[i]; 
            }else
            {
                this.next = images[i];
            }      
        }                     
        //this.current.setStyle({zIndex: 2});                    
        //this.next.setStyle({zIndex: 1});
        //this.next.show(); 
        this.effectOut();           
        this.ajaxRotator();         
        this.effectIn();
            
    }, 
    
    ajaxRotator: function()
    {  
        if(this.isSecure())
        {
            new Ajax.Updater(this.next.id, 'https://www.serialsearch.co.nz/ajaxfrontSecure/rotator/'+this.last+'/'+this.directory, {method: 'get'});
        }else
        {
            new Ajax.Updater(this.next.id, 'http://www.serialsearch.co.nz/ajaxfront/rotator/'+this.last+'/'+this.directory, {method: 'get'});
        }                                                                                                                                   
        
    },
    
    effectOut: function()
    {                              
        this.current.fade({queue:{position:'end',scope:'pageScope',limit:2}});        
    }, 
    
    effectIn: function()
    {
        this.next.appear({queue:{position:'end',scope:'pageScope',limit:2}});  
    },
    
    isSecure: function()
    {
       return window.location.protocol == 'https:';
    }
       
      
} 

function initRotator() { myRotator = new Rotator('impactImage','homepage');    }  
//Event.observe(window, 'load', initRotator, false);  
new PeriodicalExecuter(initRotator, 10);                                    

        
                                                   

-->