

  'use strict';

  var container = document.getElementById('mentor-widget');
  var html = '<header class="score-widget-header"><div class="widget-site-logo widget-item"><img src="https://www.score.org/sites/all/themes/custom/score/src/images/logos/logo-tagline-small-transparent.png" width="250"></div><div class="widget-description widget-item"></div></header><div class=\"cta-block2-collection smart-grid\" data-row-items-xlarge=\"3\"><aside class=\"menu-block cta-block2 cta-block2--blue\" data-eq-pts=\"med: 500\"> <div class=\"cta-block2__content\">                  <h5>SEARCH FOR A MENTOR</h5>                  <p>Get free expert advice. Search by keyword/topic or click&nbsp;below to see SCORE&rsquo;s mentor profiles.</p>                </div>                    <form action=\"https://www.score.org/content/search-mentor\" class=\"menu-block__form\" id=\"menu-block-search-mentors\" type=\"GET\" target=\"_blank\">                      <input class=\"menu-block__input\" id=\"mentor-search-keyword\" name=\"f[0]\" placeholder=\"Enter Keyword\" type=\"text\" /> <button class=\"menu-block__submit cta-block2__cta\" name=\"go\" type=\"submit\">Search</button>                    </form>                  </aside><aside class=\"menu-block cta-block2 cta-block2--green\" data-eq-pts=\"med: 500\"> <div class=\"cta-block2__content\">                  <h5>ASK YOUR QUESTION</h5>                  <p>Enter your zip code then&nbsp;submit your business question and let us pair you with an expert.</p>                </div>                    <form action=\"https://www.score.org/menu-block-mentor-match\" class=\"menu-block__form\" method=\"POST\" target=\"_blank\">                      <input class=\"hidden\" name=\"referrer_id\" type=\"hidden\" value=\"\" \\>                      <input class=\"menu-block__input\" name=\"postal\" placeholder=\"Enter Zip Code\" /> <button class=\"menu-block__submit cta-block2__cta\" name=\"go\" type=\"submit\">Submit</button>                    </form>                  </aside><aside class=\"menu-block cta-block2\" data-eq-pts=\"med: 500\"> <div class=\"cta-block2__content\">                  <h5>FIND A SCORE BRANCH</h5>                  <p>Find the SCORE office near&nbsp;you for local advice, training, and resources.</p>                </div>                    <form action=\"https://www.score.org/content/find-location?referrer_id=\" class=\"menu-block_form menu-block_form--inline\" method=\"POST\" target=\"_blank\">                      <input class=\"menu-block__input\" name=\"loc\" placeholder=\"Enter City, State, or Zip\" type=\"text\" /> <button class=\"menu-block__submit cta-block2__cta\" name=\"go\" type=\"submit\">Go</button>                    </form>                  </aside>';
  container.innerHTML = html;

  var cssId = 'find-mentor-styles';  // you could encode the css path itself to generate id..
  if (!document.getElementById(cssId))
  {
    var head  = document.getElementsByTagName('head')[0];
    var link  = document.createElement('link');
    link.id   = cssId;
    link.rel  = 'stylesheet';
    link.type = 'text/css';
    link.href = 'https://www.score.org/sites/all/themes/custom/score/dest/find-mentor-widget.css';
    link.media = 'all';
    head.appendChild(link);
  }
  // Structure the keyword search and submit to correct domain.
  var form = document.getElementById('menu-block-search-mentors');
  form.onsubmit = function() {
    var keyword = document.getElementById('mentor-search-keyword').value;

    window.open('https://www.score.org/content/search-mentor?f[0]=content:' + keyword + '');

    return false;
  }
