Date.prototype.format = function(format) //author: meizz
	{
	var o = {
		"M+" : this.getMonth()+1, //month
		"d+" : this.getDate(), //day
		"h+" : this.getHours(), //hour
		"m+" : this.getMinutes(), //minute
		"s+" : this.getSeconds(), //second
		"q+" : Math.floor((this.getMonth()+3)/3), //quarter
		"S" : this.getMilliseconds() //millisecond
	}
	if(/(y+)/.test(format)) format=format.replace(RegExp.$1,
	(this.getFullYear()+"").substr(4 - RegExp.$1.length));
	for(var k in o)if(new RegExp("("+ k +")").test(format))
	format = format.replace(RegExp.$1,
	RegExp.$1.length==1 ? o[k] :
	("00"+ o[k]).substr((""+ o[k]).length));
	return format;
	}
	
	function randomArray(arrLen) {
	     var rArr = new Array(arrLen);
	     for (var i = 0; i<arrLen; i++) {
	         rArr[i] = Math.random();
	     }
	     return rArr;
	}

	function randomIndex(arrLen) {
	     var iArr = new Array(arrLen);
	     var rArr = randomArray(arrLen);   //建立随机数组,以备使用
	     for (var i = 0; i<arrLen; i++) {   //遍历数组,寻找最小的数字
	         iArr[i] = i;   //默认被比较的数字为最小数字,并记录索引
	         var t = rArr[i];   //记录该数字在临时变量中
	         for (var j = 0; j<arrLen; j++) {   //与所有数字进行比较
	             if (rArr[j]<t) {   //如果发现更小的数字,则更新
	                 iArr[i] = j;
	                 t = rArr[j];
	             }
	         }
	         delete t;
	         rArr[iArr[i]] = 1;   //将最小的数字设置成1.
	     }
	     return iArr;
	}
	function randomSort(arr) {
	     arrLen = arr.length;
	     var tArr = new Array(arrLen);   //建立临时数组,存放随机打乱的数组
	     var iArr = randomIndex(arrLen);   //建立随机索引
	     for (var i = 0; i<arrLen; i++) {
	         tArr[i] = arr[iArr[i]]; //根据随机索引完全打乱数组中所有的值
	     }
	     return tArr;
	}
	Array.prototype.remove=function(dx)
	{

	  if(isNaN(dx)||dx>this.length){return false;}
	  for(var i=0,n=0;i<this.length;i++)
	  {
	  if(this[i]!=this[dx])
	  {
	  this[n++]=this[i]
	  }
	  }
	  this.length-=1
	}
	function clone(myObj){
		  if(typeof(myObj) != 'object') return myObj;
		  if(myObj == null) return myObj;
		  
		  var myNewObj = new Object();
		  
		  for(var i in myObj)
		    myNewObj[i] = clone(myObj[i]);
		  
		  return myNewObj;
	}