/*
  获取Element
  代替原来的$(_f3)函数
 */

function getEl(_f3){
	return document.getElementById(_f3);
}

/*
 *  方法:Array.removeByValue(value)
 *  功能:删除数组中第一个值与value相同的元素.
 *  参数:value元素的值.
 *  返回:在原数组上修改数组.
 */
Array.prototype.removeByValue = function(value)
{
	for(var i=0;i<this.length;i++)
	{
		if(this[i]==value)
			{
				this.remove(i);
				return true;
			}
	}
	return true;
}
/*
 *  方法:Array.baoremove(dx)
 *  功能:删除数组元素.
 *  参数:dx为元素的下标.
 *  返回:在原数组上修改数组.
 */

Array.prototype.remove = function(dx)
{
  if(isNaN(dx)||dx>this.length)
  {
	  return false;
  }
  this.splice(dx,1);
  return true;
}
//一维数组的排序
//type 参数 
//0 字母顺序（默认） 
//1 大小 比较适合数字数组排序
//2 拼音 适合中文数组
//3 乱序 有些时候要故意打乱顺序，呵呵
//4 带搜索 str 为要搜索的字符串 匹配的元素排在前面
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 a.localeCompare(b) }); break;
case 3:this.sort(function(){ return Math.random()>0.5?-1:1; }); break;
case 4:this.sort(function(a,b){ return a.indexOf(str)==-1?1:-1; }); break;
default:this.sort();
}
}
