if (!ws) var ws = {};
if (!ws.cr) ws.cr = {};
if (!ws.cr.arrayUtils) ws.cr.arrayUtils = {};
if (ArrayUtils == null) var ArrayUtils = ws.cr.arrayUtils;


if (!Array.prototype.forEach) { 
  Array.prototype.forEach = function(fn){ 
	 for ( var i = 0; i < this.length; i++ ) { 
	      fn( this[i], i, this ); 
	 } 
  }; 
} 
	
ArrayUtils.inList = function (list, str) {
	return (jQuery.inArray(str,list) > -1);
}; 

ArrayUtils.find = function (array, element) {
	if(!array || !ArrayUtils.isArray(array)) {
		throw {
			name: "IllegalArgumentException",
			message: "Please pass a valid argument array type"
		}
	}	
	var index = -1;
	for(var i = 0; i < array.length; i++) {		
		if(array[i] == element) {
			index = i;
			break;
		}
	}
	return index;
};


/**Usage  ArrayUtils.isArray(myArray);
 * Checks if an object is an array
 * @param object to be checked
 * return boolean : true if is Array else false
 */
ArrayUtils.isArray = function (a) {
	return Object.prototype.toString.apply(a) === '[object Array]';
};

