
max = function( a, b ) {
	return ( a > b ) ? a : b;
}

Equalizer = Class.create();

Equalizer.prototype = {
	initialize: function() {
		if ( !arguments.length ) {
			throw( "The constructor requires at least one parameter" );
		}
		this.divs = new Array();
		
		this.minHeightSupported = ( typeof document.body.style.maxHeight != "undefined" ) ? true : false;
		
		for( var index = 0; index < arguments.length; index++ ) {
			var theDiv = $( arguments[index] );
			if ( theDiv ) {
				this.divs.push( theDiv );
			}
		}
		if ( this.divs.length == 0 ) {
			throw( "Error!" );
		}
		this.maxHeight = this.getMaxHeight();
		this.forceHeights( this.maxHeight );
	},
	
	getMaxHeight: function() {
		var maxHeight = 0;
		for ( var index = 0; index < this.divs.length; index++ ) {
			maxHeight = max( this.divs[index].getHeight(), maxHeight );
		}
		return maxHeight;
	},
	
	forceHeights: function( maxHeight ) {
		maxHeight += 'px';
	
		for( var index = 0; index < this.divs.length; index++ ) {
			if ( this.minHeightSupported ) {
				this.divs[index].style.minHeight = maxHeight;
			}
			else {
				this.divs[index].style.height = maxHeight;
			}
		}
	}
	
}

Equalizer.keep = function( obj ) {
	var newHeight = obj.getMaxHeight();
	if ( newHeight > obj.maxHeight ) {
		obj.forceHeights( newHeight );
	}
}




function SwitchId(obj, tabName)
{
for(i=1;i<8;i++)
{
if(document.getElementById("a"+i))
	{
		document.getElementById("a"+[i]).style.display='none'
		document.getElementById("tab"+[i]).className=''
	}
else
	{
		document.getElementById(obj).style.display='block'
		document.getElementById(tabName).className='selected'
	}
}
}
