function array_remove_key(key,array_data)
{
	var array_data_result = new Array();
	for(var tmp_key in array_data)
	{	
		if(tmp_key != key)
		{
			array_data_result[tmp_key] = array_data[tmp_key];
		}
	}	
	
	return array_data_result;
}

/**
* Function : dump()
* Arguments: The data - array,hash(associative array),object
*    The level - OPTIONAL
* Returns  : The textual representation of the array.
* This function was inspired by the print_r function of PHP.
* This will accept some data as the argument and return a
* text that will be a more readable version of the
* array/hash/object that is given.
*/
	function dump(arr,level) {
	var dumped_text = "";
	if(!level) level = 0;
	
	//The padding given at the beginning of the line.
	var level_padding = "";
	for(var j=0;j<level+1;j++) level_padding += "    ";
	
	if(typeof(arr) == 'object') { //Array/Hashes/Objects
	 for(var item in arr) {
	  var value = arr[item];
	 
	  if(typeof(value) == 'object') { //If it is an array,
	   dumped_text += level_padding + "'" + item + "' ...\n";
	   dumped_text += dump(value,level+1);
	  } else {
	   dumped_text += level_padding + "'" + item + "' => \"" + value + "\"\n";
	  }
	 }
	} else { //Stings/Chars/Numbers etc.
	 dumped_text = "===>"+arr+"<===("+typeof(arr)+")";
	}
	return dumped_text;
	} 

function js_in_array(the_needle, the_haystack)
{
  var the_hay = the_haystack.toString();
  if(the_hay == ''){
      return false;
  }
  var the_pattern = new RegExp(the_needle, 'g');
  var matched = the_pattern.test(the_haystack);
  return matched;
}

function js_get_array_matches(needle, haystack)
{
	var array_matches = new array();
	var i = 0;
	var j = 0;
	
	while (i<haystack.length) 
	{
		if (haystack[i].substring(0,needle.length) == needle) 
		{
			array_matches[j] = haystack[i];
			j++;
		}
		i++;
	}
	return array_matches;
}

function is_array(array_obj)
{
	if(array_obj)
	{
		return (typeof(array_obj.length)=="undefined" ? false :true);
	}
	
	return false;
}

function replace_values(array_replacements,array_dest)
{
	if(!is_array(array_dest)) array_dest = new Array();
	if(!is_array(array_replacements)) return array_dest;
				
	for(var key in array_replacements)	
	{
		array_dest[key] = array_replacements[key];
	}
		
	return array_dest;
}

function get_paired_params_joined(array_variables,s_join)
{
	if(!is_array(array_variables)) return "";
	
	array_result = get_paired_params(array_variables);
	
	return array_result.join(s_join);
}

	function get_paired_params(array_variables)
	{
		a_data = new Array();
		
		var i=0;
		for(var key in array_variables)
		{
			if(!is_array(array_variables[key]))
			{
				a_data[i] = key  + "=" + array_variables[key];	
				i++;
			}
		}
		
		return a_data;
	}