function endsWith(str1, str2) {
	var l = str2.length;
	if(str1.length < l) return false;
	if(str1.length == l) return str1==str2;
	part = str1.substr(str1.length - l, l);
	if(part == str2) return true;
	return false;
}

function matchNumber(str) {
	if(typeof(str)!="string") return false;
	var re7 = /^[0-9]{3}-[0-9]{4}$/;
	var re10 = /^[0-9]{3}-[0-9]{3}-[0-9]{4}$/;
	var re11 = /^1-[0-9]{3}-[0-9]{3}-[0-9]{4}$/;
	var parens = /^\([0-9]{3}\) ?[0-9]{3}-[0-9]{4}$/;
	var match = re7.test(str);
	if(match == false) match = re10.test(str);
	if(match == false) match = re11.test(str);
	if(match == false) match = parens.test(str);
	return match;
}

function endOfURI(old) {
	var i = old.indexOf("/");
	if(i==-1) return old;
	else return endOfURI(old.substring(i+1));
}

function shortenURI(old) {
	var uri = "";
	uri = old.substring(0, 7);
	var temp = old.substring(7);
	uri = uri + temp.substring(0, temp.indexOf("/")+1);
	uri = uri + ".../";
	uri = uri + endOfURI(temp);
	return uri;
}

function URIencode(sStr) {
    return escape(sStr).replace(/\+/g, '%2B').replace(/\"/g,'%22').replace(/\'/g, '%27').replace(/\//g, '%2F');
}
