Array.prototype.delArrayElement = function (value) {
	var i;
	var arr = new Array()
	for (i=0; i < this.length; i++) {
		if (this[i] != value) {			arr.push(this[i]);
		}
	}
	return arr;
};

Array.prototype.inArray = function (value) {
	var i;
	for (i=0; i < this.length; i++) {
        if (this[i] === value) {
                return true;
        }
	}
	return false;
};

function inObject(object, value) {
	ok = false;
	$.each(object, function(i, val){
		if (val === value){
			ok = true;
		}
	});
	return ok;
};

Array.prototype.findPosition = function (value) {
	var i;
	for (i=0; i < this.length; i++) {
        if (this[i] === value) {
                return i;
        }
	}
	return false;
};

String.prototype.getToObj = function (){	var str = this;
	if (str[0]==="#"){		str = str.substr(1);
	}
	str = decodeURI(str);
	var arr = str.split("&");
	var obj = new Object();
	var _arr = new Array();
	$.each(arr, function(){		_arr = this.split("=");
		if (!obj[_arr[0]]) obj[_arr[0]] = new Array();
		obj[_arr[0]].push(_arr[1]);	});
	return obj;
};

jQuery.fn.check = function(mode) {
   var mode = mode || 'on';
   return this.each(function()
   {
     switch(mode) {
       case 'on':
         this.checked = true;
         break;
       case 'off':
         this.checked = false;
         break;
       case 'toggle':
         this.checked = !this.checked;
         break;
     }
   });
};

Array.prototype.toInt = function(){	var array = new Array();
	for (i=0; i < this.length; i++) {
        array.push(this[i]*1.0);
	}
	return array;
}

Array.prototype.max = function(){
    var max = 0;
	for (i=0; i < this.length; i++) {
        if (this[i] > max) {
                max = this[i];
        }
	}
	return max;
};

Array.prototype.min = function( array ){
    var min = this[0];
	for (i=0; i < this.length; i++) {
        if (this[i] < min) {
                min = this[i];
        }
	}
	return min;
};


