title: Javascript does not recognize function
body: <p>I am new to programming in Javascript and this one has clearly 'clean bowled' me :(........</p>
  
  <p>The following code snippet highlights some text by searching for and modifying the respective text nodes. Text node searching is done by using a Jquery functionality:</p>
  
  <blockquote>
    <p>window.addEventListener("load", highlightSummarySentences , false);</p>
  </blockquote>
  
  <pre><code>function highlightSummarySentences() {
      var docName = thisPage;
      var numSentences = getCookie(docName+"Num");
      var linkSentenceNum = getCookie(docName + 'LinkingSentence');
      for(var i=0; i&lt;numSentences; i++) {
          var matchMe = getCookie(docName+i);
          try {
              if (matchMe &amp;&amp; i==(linkSentenceNum)) {
                  highlightText(matchMe, clickedSentenceColour);
              }
              else if(matchMe){
                  highlightText(matchMe, summarySentenceColour);
              }
          } catch (e) {;
          }
      }
  }
  </code></pre>
  
  <p>The for loop runs once and highlights the appropriate text after which it exits and the page becomes completely white. The following error is seen in the error console:</p>
  
  <blockquote>
    <p>Error: getCookie is not defined</p>
  </blockquote>
  
  <p>but I guess its not getCookie. The script just refuses to recognize any function or variable after the above event. I have no idea what might be causing the script to behave this way. I am developing in firefox.</p>
  
  <p>Please give me a hint! Let me know if I should paste more code of give more information. </p>
  
  <p>Thanks,</p>