window.addEvent('domready', function() {
	//exibeTelefones();
	startTheater();
});

function startTheater() {
	$$('#destaqueIndex a').each(function(el) {
		el.set({
			'href':'javascript:void(0)',
			'events': {
				'click':function() {
					FxDuration = 800;
					mainFx = new Fx.Style('destaqueIndex', 'opacity', {
						duration:FxDuration,
						wait:false,
						transition:Fx.Transitions.Cubic.easeOut
					});
					if (typeof(FxFadeOut) != 'undefined') {
						FxFadeOut.stop();
					}
					FxFadeOut = mainFx.start(0);
					if (typeof(newTheater) != 'undefined' && loadingImage) {
						return;
					}
					loadingImage = true;
					//setTimeout(function() {
						newTheater = new Asset.image(this.getProperty('name'), {
							onload:function() {
								$('destaqueIndex').setStyle('background', 'url(' + newTheater.getProperty('src') + ')');
								if (typeof(FxFadeIn) != 'undefined') {
									FxFadeIn.stop();
								}
								FxFadeIn = mainFx.start(1);
								loadingImage = false;
							}
						});
					//}.bind(this), (FxDuration - (FxDuration * 0.25)));
					this.blur();
				}
			}
		});
	});
}