// Places the balloon for a help tip.
function placeHelpTip(helpID) {
	var tipIcon = $('tipIcon__' + helpID);
	var tip = $('tip__' + helpID);
	x = tipIcon.viewportOffset()[0] - 117;
	y = tipIcon.viewportOffset()[1]-tip.getHeight()+5;
	tip.setStyle('top:' + y + 'px; left:' + x + 'px');
}


// Generates a reference (for help items) from a string.  Essentially, this takes
// a string and replaces all spaces with underscores and then removes all 
// invalid characters for a URL.
function generateHelpRef(str) {
  // replace spaces with underscore
  var str = str.toLowerCase().gsub(' ', '_');
  
  // remove invalid characters
  var helpRef = '';
  var validChars = /[A-Z,a-z,0-9,_,\-,]/
  for (var i=0; i < str.length; i++) {
    if (str[i].match(validChars))
      helpRef = helpRef + str[i];
  }
  
  return helpRef;
}
