//////////// Funciones a pasar a otro archivos .js //////////////	

	function substr_count (haystack, needle, offset, length) 
	{
		var pos = 0, cnt = 0;
		haystack += '';
		needle += '';
		if (isNaN(offset)) {offset = 0;}
		
		if (isNaN(length)) {length = 0;}

		offset--;

		while ((offset = haystack.indexOf(needle, offset+1)) != -1)
		{
			if (length > 0 && (offset+needle.length) > length)
			{
				return false;
			}
			else
			{
				cnt++;
			}
		}
		return cnt;
	}

	function ltrim(s) 
	{
		return s.replace(/^\s+/, "");
	}

	function rtrim(s) 
	{
		return s.replace(/\s+$/, "");
	}

	function trim(s) 
	{
		return rtrim(ltrim(s));
	}
	
//////////////////////////////////////////////////////////////////
