function arrayContainsValue(arr, value)
{
	for(var i = 0 ; i < arr.length ; i++)
	{
		if(arr[i] == value)
			return true;
	}
	
	return false;
}

// Figures out how many "in"s there are
function lengthOfAssociativeArray(arr)
{
	var n = 0;
	
	for(var i in arr)
	{
		if(typeof(arr[i]) != "function")
			n++;
	}
	
	return n;
}

// Takes a date formatted as YYYY-MM-DD and returns it formatted as MM-DD-YYYY
function dateYearFirstToYearLast(str)
{
	// Let's replace any /'s with -'s (just in case)
	str = str.replace(/\//g, "-");
	
	var startDateComponents = str.split(/-/);
	
	if(!startDateComponents || startDateComponents.length != 3)
		return str;
	
	return startDateComponents[1]+"-"+startDateComponents[2]+"-"+startDateComponents[0];
}

// Takes a date formatted as MM-DD-YYYY and returns it formatted as YYYY-MM-DD
function dateYearLastToYearFirst(str)
{
	// Let's replace any /'s with -'s (just in case)
	str = str.replace(/\//g, "-");
	
	var startDateComponents = str.split(/-/);
	
	if(!startDateComponents || startDateComponents.length != 3)
		return str;
		
	return startDateComponents[2]+"-"+startDateComponents[0]+"-"+startDateComponents[1];
}

String.prototype.trim = function()
{
	return this.replace(/^\s+/, "").replace(/\s+$/, "");
}