// Help text array
var helpContent = {
  'HOME_PAGE_HELP' : '<table id="" cellspacing="0" cellpadding="1" border="0" width="100%" class="smallnormalText" style="text-align:justify;"><tr><td>Deal directly with hiring companies and bypass recruiters that post the majority of jobs on online recruiting sites or job boards.<br />Genotrope uses your history to map out your &ldquo;professional graph&rdquo; and match you with prospective employers.<br />Genotrope is based on a peer-produced database of companies and the links that connect them to other companies. As users add companies and links, the amount and quality of opportunities will increase. Check out the companies in your profile to make sure they are fully linked to the investors and past companies of the executives and founders.<br><br>We have compiled a list of blogs and feeds that we hope you will find relevant to the Start-up and Emerging Technology Market. Have fun researching companies and exploring the associated company graphs.<br><br>Who knows, you might find a company you like. We will be glad to get you a conversation going with the hiring manager.<br><br>Contact Us with any comments, questions or gripes <a style="cursor:pointer; text-decoration:underline;" href="mailto:support@genotrope.com?subject=Feedback" title="mailto:support@genotrope.com?subject=Questions">support@genotrope.com</a></td></tr></table><br>',
  'RESEARCH_COMPANIES_HELP':'<table id="" cellspacing="0" cellpadding="1" border="0" width="100%" class="smallnormalText" style="text-align:justify;"><tr><td colspan="2"><i>Graph Controls</i>:</td></tr><tr><td valign="top">MouseOver</td><td>Item pops up window to view Status, Industry, Comments and Link Type.</td></tr><tr><td valign="top" width="17%">Navigate Graph</td><td><b>Click a node to navigate</b> to that record and make it the focus node and view the next graph.</td></tr><tr><td valign="top">Back Button</td><td>Returns to last record viewed.</td></tr><tr><td valign="top">Pan</td><td>Click in blank space to move graph in any direction. <b>Moving a grouping towards the center</b> increases the size of the Nodes. Moving groups changes orientation of companies and uncovers ones hidden.</td></tr><tr><td colspan="2"><br />Lacking revenue or current products, the best data points to evaluate a startup are the track record of the investors and the past histories of the executives and founders. Genotrope presents this information to you in an easy to research format.<br><br>We are in a &ldquo;cold start&rdquo; launch. Our database is not comprehensive and therefore, our users may not yet have an optimal experience. Our editors and autocrats are busy building out the database of companies and connections. With help from you, we should have the data mostly up to date in short order. Take a look at the companies in your profile and make sure to add any links that are missing. This will insure you have the maximum amount of opportunities presented to you on the Find Companies/Jobs page. The criteria for links are the following: Investors, Founders Last Company and Executives Last Company.</td></tr></table><br>',
  'HIT_LIST_HELP' : '<table id="" cellspacing="0" cellpadding="1" border="0" width="100%" class="smallnormalText" style="text-align:justify;"><tr><td>Over 50% of positions are filled without a job description posting. Recruiters routinely place a candidate when no requirement is posted while qualified candidates refrain from submitting themselves due to no posted job on the company website. Not submitting yourself to a great company could be a mistake.<br /><br />Your Professional Graph can be sorted by Industry or Company Status to organize how you research your opportunities. You can do research by clicking on the company name, which will take you to the specific record of that company. Moving back and forth from the Find Companies page to the Research Company pages, checking the boxes to the left of the company name as you proceed, you can build a list of potential opportunities. Once you have targeted a few prospects, the submit resume button allows you to upload your resume and send them to your chosen companies via Genotrope. After submitting your resume, <b>Genotrope contacts the company on your behalf</b>, giving you better representation than just submitting a resume to a black hole.</td></tr></table><br>',
  'PROFILE_LIST_HELP' : '<table id="" cellspacing="0" cellpadding="1" border="0" width="100%" class="smallnormalText" style="text-align:justify;"><tr><td><u>Getting Started:</u><br/><b>Input and save your work history</b> into your Profile so we can build your &ldquo;professional graph&rdquo;.<br/>Propose a company when it is not in our database and then add it to your past/current employers.<br/><b>Visit the Find Jobs</b> page to see the potential employers in your Professional Graph of companies.<br/><b>Apply Now to the companies</b> you find that meet your criteria. <br/><br/>Genotrope uses your work history to map out your &ldquo;professional graph&rdquo; of related companies. These companies will offer you opportunities with a higher probability of fit from a cultural as well as market standpoint.<br>Genotrope is based on a peer-produced database of companies and the links that connect them to other companies. As users add companies and links, the amount and quality of opportunities will increase.<br/>To maximize your list of potential employers, be sure to <b>add any companies not in the database</b> and check the records of your profile companies to <b>insure that the links to other companies have been established</b>. The link criteria are investors and past companies of the executives and founders.<br>This way you will maximize the amount of opportunities presented to you on the Find Companies/Jobs page.<br><br>The RSS feed on the FindJobs page connects you to the message channel of companies in your professional graph and watched companies generated from your Profile/Watch List page. This allows you to anonymously keep updated on their business and hiring activity. When you decide, you can pursue opportunities based upon the information you receive by going to Research Companies or Find Companies/Jobs page and submitting your resume.<br><br><u>Watch List:</u><br/>The Watch List companies are companies that you are interested in that are not in your professional graph. They can be selected in the Details section from the Companies Page and are displayed in your Profile/Watch List page. They then show up on the Find Companies/Jobs page giving you the ability to monitor them on your RSS channel as well as submit your resume at any time.</td></tr></table><br/>',
  'FAQ_PAGE_HELP' : '<table id="" cellspacing="0" cellpadding="1" border="0" width="100%" class="smallnormalText" style="text-align:justify;"><tr><td align="center"><br><br>Help content in progress. Watch this space.<br><br></td></tr></table><br>',
  'ADMIN_PAGE_HELP' : '<table id="" cellspacing="0" cellpadding="1" border="0" width="100%" class="smallnormalText" style="text-align:justify;"><tr><td align="center"><br><br>Help content in progress. Watch this space.<br><br></td></tr></table><br>'
};

/**
 * Returns the inner html to display help.
 * The one which is selected will be
 * rendered first, and then the remaining
 * will be rendered. If no data is found
 * for the selected tab, the help will be
 * created in the order of the array created
 */
function renderHelp(selected) {
  var helpHTML = '';
  var helpSelected = selected+'_HELP';
  helpHTML += ('<table id="" cellspacing="1" cellpadding="1" border="0" width="100%" class="smallnormalText">');
  helpHTML += ('    <tr>');
  helpHTML += ('        <td class="smallText" style="text-decoration:underline;">');
  helpHTML += ('            '+(menuNames[selected]).replace(/(&nbsp;)+/g, ""));
  helpHTML += ('        </td>');
  helpHTML += ('    </tr>');
  helpHTML += ('    <tr>');
  helpHTML += ('        <td valign="top">');
  helpHTML += ('            '+helpContent[helpSelected]);
  helpHTML += ('        </td>');
  helpHTML += ('    </tr>');
  helpHTML += ('    <tr>');
  helpHTML += ('        <td><center><hr width="500px" color="#ffa600" /></center></td>');
  helpHTML += ('    </tr>');
  /*
  // render selected one
  for(help in helpContent) {
    if(help == helpSelected) {
      helpHTML += ('    <tr>');
      helpHTML += ('        <td class="smallText">');
      helpHTML += ('            '+(menuNames[selected]).replace(/(&nbsp;)+/, ""));
      helpHTML += ('        </td>');
      helpHTML += ('    </tr>');
      helpHTML += ('    <tr>');
      helpHTML += ('        <td valign="top" height="362px">');
      helpHTML += ('            '+helpContent[helpSelected]);
      helpHTML += ('        </td>');
      helpHTML += ('    </tr>');
      helpHTML += ('    <tr>');
      helpHTML += ('        <td><center><hr width="500px" color="#ffa600" /></center></td>');
      helpHTML += ('    </tr>');
      break;
    }
  }
  // render remaining
  for(help in helpContent) {
    if(help != helpSelected && help != 'extend') {
      helpHTML += ('    <tr>');
      helpHTML += ('        <td class="smallText">');
      helpHTML += ('            '+(menuNames[help.substring(0, help.indexOf('_HELP'))]).replace(/(&nbsp;)+/, ""));
      helpHTML += ('        </td>');
      helpHTML += ('    </tr>');
      helpHTML += ('    <tr>');
      helpHTML += ('        <td valign="top" height="362px">');
      helpHTML += ('            '+helpContent[help]);
      helpHTML += ('        </td>');
      helpHTML += ('    </tr>');
      helpHTML += ('    <tr>');
      helpHTML += ('        <td><center><hr width="500px" color="#ffa600" /></center></td>');
      helpHTML += ('    </tr>');
    }
  }
  */
  helpHTML += ('</table>');
  return helpHTML;
}

/**
 * Displays help panel. First creates
 * the title and then help content. Hides
 * COMPANY_MAP div and set overlay to
 * stop any further mouse interactions
 */
function showHelpPanel(selected) {
  // set innerHTML for help title
  var helpPanelTitle = document.getElementById('helpPanelTitle');
  if(helpPanelTitle) {
    helpPanelTitle.innerHTML = '<img src="/genotrope/chameleon/icons/question.gif" alt="Help" title="Help" style="position:relative;top:3px;" width="16px" height="16px" />&nbsp;<label class="bigbluetext">Help</label>';
  }
  // set inner html for help content
  var helpPanelContent = document.getElementById('helpPanelContent');
  if(helpPanelContent) {
    helpPanelContent.innerHTML = renderHelp(selected);
  }
  // hide company map, as applet has greater z-index in mozilla
  var el = document.getElementById('COMPANY_MAP');
  if (el) {
    el.style.visibility = 'hidden';
  }
  // overlay to stop mouse interaction
  overlay(true);
  // display help panel
  document.getElementById('helpPanel').style.visibility='visible';
}

/**
 * Hide help panel. Clears the help content,
 * removes overlay and if the COMPANY_MAP
 * div is available, displays it.
 */
function hideHelpPanel() {
  // Make sure that the help panel is visible.
  document.getElementById('helpPanel').style.visibility = "hidden";
  // clear inner html for help content
  var helpPanelContent = document.getElementById('helpPanelContent');
  if(helpPanelContent) {
    helpPanelContent.innerHTML = '';
  }
  // remove overlay
  overlay(false);
  // show company map, if found
  var el = document.getElementById('COMPANY_MAP');
  if (el) {
    el.style.visibility = 'visible';
  }
}
