function AddToFavorites(){
if (document.all)
	window.external.AddFavorite(location.href, document.title);
else if (window.sidebar)
	window.sidebar.addPanel(document.title, location.href, "")
}

function DrillDown(id)	{
	var drillID = document.getElementById(id);
	if (drillID.style.display == 'none')
		drillID.style.display = '';
	else
		drillID.style.display = 'none';
}
function textCounter(field, countfield, maxlimit) {
	if (field.value.length > maxlimit)
		field.value = field.value.substring(0, maxlimit);
	else
		countfield.value = maxlimit - field.value.length;
}
function CountWords (field_str, show_field) {
	show_word_count=1;
	show_char_count=0;
	var char_count = field_str.length;
	var fullStr = field_str + " ";
	fullStr = fullStr.replace(/\&\w+;/ig,"");
	var stripped = fullStr.replace(/(<([^>]+)>)/ig,"");
	var initial_whitespace_rExp = /^[^A-Za-z0-9]+/gi;
	var left_trimmedStr = stripped.replace(initial_whitespace_rExp, "");
	var non_alphanumerics_rExp = rExp = /[^A-Za-z0-9]+/gi;
	var cleanedStr = left_trimmedStr.replace(non_alphanumerics_rExp, " ");
	var splitString = cleanedStr.split(" ");
	var word_count = splitString.length -1;

	if (fullStr.length <2) { word_count = 0; }
	if (word_count == 1) { wordOrWords = " word"; } else { wordOrWords = " words"; }
	if (char_count == 1) { charOrChars = " character"; } else { charOrChars = " characters"; }
	if (show_word_count & show_char_count) { show_field.value= word_count + wordOrWords + "\n" + "    " + char_count + charOrChars; }
	else {
		if (show_word_count) { show_field.value= word_count + wordOrWords; }
		else { if (show_char_count) { show_field.value= char_count + charOrChars; } }
	}
	return word_count;
}
String.prototype.trim = function() {

 // skip leading and trailing whitespace
 // and return everything in between
  var x=this;
  x=x.replace(/^\s*(.*)/, "$1");
  x=x.replace(/(.*?)\s*$/, "$1");
  return x;
}