var Poll = {
	update: function(content)
	{
		new Element.update('poll-holder', content);
	}
};

var Newsletter = {
	update: function(content)
	{
		new Element.update('newsletter-holder', content);
	},
	error: function(content)
	{
		new Element.update('newsletter-error', content);
	}
};

var Say = {
	hello: function(text)
	{
		alert(text);
	}
};

var Ticker = Class.create({
	initialize: function(total, first)
	{
		this.frequency = 10;
		this.div = 'ticker-item-';
		
		this.actual = first;
		this.total = total;
		
		this.fire();
	},
	
	change: function()
	{
		$(this.div+this.actual).hide();
		
		if(this.actual < this.total) {
			this.actual++;
		} else {
			this.actual = 1;
		}
		
		$('ticker-item-'+this.actual).show();
	},
	
	fire: function()
	{
		this.timer = setInterval(this.change.bind(this), this.frequency * 1000);
	}
});

var FlashWindow = {
	open: function(url, width, height, title)
	{
		var left = Math.round((screen.width  - width) / 2);
		var top = Math.round((screen.height - height) / 2);
		
		var attributes = 'width=' + width + ','
							+ 'height='+ height + ','
							+ 'top=' + top + ','
							+ 'left=' + left + ','
							+ 'directories=0,'
							+ 'location=0,'
							+ 'resizable=0,'
							+ 'menubar=0,'
							+ 'toolbar=0,'
							+ 'scrollbars=0,'
							+ 'status=0'
		;
		
		w = window.open(url, '', attributes);
	}
};
