function $get(id) {
	if (typeof id == 'string'){
		return document.getElementById(id);
	}else{
		return id;
	}
}
function autoHeight(){
	if (arguments.length<2){
		return ;
	}
	var heights = new Array();
	var elem;
	for (var i=0; elem = arguments[i]; i++){
		if (elem = $get(elem)){
			heights.push(elem.scrollHeight);
		}
	}
	heights.sortBy(2);
	for (var i=0; elem = arguments[i]; i++){
		if (elem = $get(elem)){
			elem.style.height = heights[0]+'px';
		}
	}
	
}
Array.prototype.sortBy = function(type,str){ 
	switch (type){ 
		case 0:
			this.sort(); 
			break;
		case 1:
			this.sort(function(a,b){ return a-b; }); 
			break;
		case 2:
			this.sort(function(a,b){ return b-a; }); 
			break;
		case 3:
			this.sort(function(a,b){ return a.localeCompare(b) }); 
			break;
		case 4:
			this.sort(function(){ return Math.random()>0.5?-1:1; }); 
			break;
		case 5:
			this.sort(function(a,b){ return a.indexOf(str)==-1?1:-1; }); 
			break;
		default:
			this.sort();
   }
} 
