title: convert this php code to javascript - strpos, str_replace, substr
body: <p>I have a piece of code written in PHP inside my javascript tag. I figured it would be better to have all javascript inside my script tag.</p>
  
  <p>So I would need help to convert these 3 lines of code in javascript:</p>
  
  <pre><code>if (strpos($video['thumbs']['master'], '/thumbs_old/') !== false) {
      $position = strpos($video['thumbs']['master'], '.flv');
      $oldFlipBookThumb = str_replace(substr($video['thumbs']['master'], $position), '.flv', $video['thumbs']['master']);
   }
  </code></pre>