window.addEvent( 'domready', function() {

	window.fireEvent( 'resize' );

});

window.addEvent( 'domready', function() {
	
	$$('.button' ).each( function( element ) {

		if ( element.hasClass( 'disabled' ) )
			return;
		
		var fx = new Fx.Morph( element, {duration: 175, wait: false} );
		element.addEvent('mouseenter', function(){ fx.start({ 'background-color': '#d4d4d4', 'color': '#000000' }); });
		element.addEvent('mouseleave', function(){ fx.start({ 'background-color': '#eeeeee', 'color': '#000000' }); });

	});

	$$( 'a.popupimage' ).each( function( i ) {
	
		i.addEvent( 'click', function( event ) {
		
			new Event( event ).stop();
			
			var popup = this.retrieve( 'PopupImage' );
			
			if ( !popup )
			{
				popup = new PopupImage( this, {
					src: this.getProperty( 'href' ),
					title: this.getProperty( 'title' ),
					description: this.getElement( 'span' ).get( 'text' ),
					details: true
				} );
				
				this.store( 'PopupImage', popup );
			}
			
			popup.show.apply( popup );
			
		});
	
	});

});