Prototype.Browser.IE6 = ( parseFloat(navigator.userAgent.split('MSIE')[1]) == 6 ) ? true : false;
Prototype.Browser.IE5_5 = ( parseFloat(navigator.userAgent.split('MSIE')[1]) == 5.5 ) ? true : false;


var Util = {
	resize: function()
	{
		var min_width = Element.getStyle(document.body, 'min-width');
		var set_width = ( min_width ) ? false : true;
	
		min_width = min_width || '1045';
		min_width = min_width.gsub('px', '');
		
		var width = document.viewport.getWidth();
		
		var right_pos = (( width < min_width ) ? (width - min_width) : 0) + 'px';

		
		if ( set_width )
		{
			var body_width = ( width < min_width ) ? '1045px' : '';
			Element.setStyle(document.body, {width: body_width});
		}
	},
	
	getScrollOffset: function()
	{
		var x = 0, y = 0;
		if ( typeof( window.pageYOffset ) == 'number' )
		{
			//Netscape
			y = window.pageYOffset;
			x = window.pageXOffset;
		}
		else if ( document.body && ( document.body.scrollLeft || document.body.scrollTop ) )
		{
			//DOM
			y = document.body.scrollTop;
			x = document.body.scrollLeft;
		}
		else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) )
		{
			//IE6 standards compliant mode
			y = document.documentElement.scrollTop;
			x = document.documentElement.scrollLeft;
		}
		return {left: x, top: y};
	},
	
	getMaxHeight: function(elements, inclusive)
	{
		// Check if height must include padding
		if ( inclusive == undefined )
		{
			inclusive = false;
		} 
		
		var max = 0
		var height;
		
		elements.each( function(element) {
			
			if ( !inclusive )
			{
				var padding = parseInt(element.getStyle('paddingTop').gsub('px', '')) + parseInt(element.getStyle('paddingBottom').gsub('px', ''));
			}
			else
			{
				var padding = 0;
			}
			
			var height = element.getHeight() - padding;
			if ( height > max )
			{
				max = height;
			}
		});
		
		return max;
	}
};

Effect.Transitions.slowstop = function(pos)
{
	return 1 - Math.pow(0.60, 20 * pos);
}

// Attach events
document.observe('dom:loaded', Images.fixAll);
document.observe('dom:loaded', Util.resize);

Event.observe(window, 'resize', Util.resize);