/**
 * NetDirector Image Rotator
 * This is a proxy designed to allow other image rotators to be used easily.
 *
 * This version uses the jquery.cycle rotator
 */

netdirector.imageRotator = {
	settings: {},

	add: function (settings) {
		this.settings['ir_'+ settings.id] = settings;
	},

	onReady: function() {
		var self = this;

		$('.imageRotator').each(function(index, entry) {
			var id = $(entry).attr('id');
			var settingsKey = id.replace('imageRotator_', '');
			var config = self.settings['ir_'+ settingsKey];

			$('#'+ id +' .rotator img')
				.css('width', config.width +'px')
				.css('height', config.height +'px');

			$('#'+ id +' .rotator')
				.css('width', config.width +'px')
				.css('height', config.height +'px');
			$('#'+ id +' .rotator').cycle('fade', 2000);
		});
	}
}

$().ready(function () {
	netdirector.imageRotator.onReady();
});

