function string_subtract(str1, str2)
{
  var pos = str1.indexOf(str2);
  if( pos == -1 ) return str1;
  return str1.substr(0, pos) + str1.substr(pos + str2.length);
}

function createPurr (heading,msg,sticky) {
	var notice = purrContainer(heading,msg);
	$(notice).purr(
		{
			usingTransparentPNG: true,
			fadeInSpeed: 300,
			isSticky: sticky==1?true:false
		}
	);
}

function purrContainer (heading,msg) {
	var notice = '<div class="notice">'
			  + '<div class="notice-body">' 
				  + '<h3>'+heading+'</h3>'
				  + '<p>'+msg+'</p>'
			  + '</div>'
			  + '<div class="notice-bottom">'
			  + '</div>'
		  + '</div>';
		
	return notice;
}

function urlencode(str) {
	return escape(str).replace('+', '%2B').replace('%20', '+').replace('*', '%2A').replace('/', '%2F').replace('@', '%40');
}

function urldecode(str) {
	return unescape(str.replace('+', ' '));
}

function getElementsByContent(searchTerm,elem)
{
	var search = searchTerm.toLowerCase();
    return $(elem).filter(function() {
    	$(this).text().toLowerCase() == search;
    });
}

//$('table.display').find('td:contains("1")').next().next().next().next().next().next().html('New code');
