    var divs
    var stories=new Array()
    var x=0
    // find all the div tags
    divs = document.getElementsByTagName('div')
    // loop through div tags to find ids of 'storyx' 
    for (i=0;i < divs.length;i++)
      {
        if (divs[i].getAttribute('id')) {
            if (divs[i].getAttribute('id').indexOf('story') >= 0) {
             //create an array of found stories
             stories[x] = divs[i].getAttribute('id');
             x = x + 1;
            }
        }
      }
      
    // select random story
    iStory = Math.floor(Math.random()*stories.length)
    
            
    // show only the selected story
    for (x=0;x < stories.length ;x++)
        {
            story = document.getElementById(stories[x])
            // if not the selected story don't display the story div.
            if (story.id != stories[iStory]) {
                story.style.display = "none";
                }
        }

