
//selects a text in a search box
function selectTxt (searchBox) {
  searchBox.focus();
  searchBox.select();
}

//dirty way of getting a corresponding menu highlighted based on a URL
function selectURL () {
  var url = '' + window.location;
  var urlparts = url.split('/');
  var urlLength = urlparts.length;
  var tabInFocus = urlparts[urlLength-1];
  
  // || tabInFocus == 'Backstroke' 
    //|| tabInFocus == 'Breastroke' || tabInFocus == 'Butterfly'
  if (tabInFocus == 'Freestyle') {
    var tabToFocus = document.getElementById('tab1');
    tabToFocus.className='focus';
  }
  else if (tabInFocus == 'Backstroke') {
    var tabToFocus = document.getElementById('tab2');
    tabToFocus.className='focus';
  }
  else if (tabInFocus == 'Breastroke') {
    var tabToFocus = document.getElementById('tab3');
    tabToFocus.className='focus';
  }
  else if (tabInFocus == 'Drills-Tips') {
    var tabToFocus = document.getElementById('tab5');
    tabToFocus.className='focus';
  }
  else if (tabInFocus == 'Butterfly') {
    var tabToFocus = document.getElementById('tab4');
    tabToFocus.className='focus';
  }
  else if (tabInFocus == 'Other') {
    var tabToFocus = document.getElementById('tab6');
    tabToFocus.className='focus';
  }
  else {
    var tabToFocus = document.getElementById('tab0');
    tabToFocus.className='focus';
  }
}

//declare global variables
  //var mem = 0;
  //var num = 0;
  //var i = 0;  
  
//checks if the post has the summary span tag
//if post has more than one span tag, it won't work      
function displayMoreLink(postUrl) { 
    //get all spans in a post
 /* var spans = window.document.getElementsByTagName('span');
  num = 0;
  alert (spans.length);
    //get the first span name (fullpost)
  var spanName = " " + spans[0].className + " ";
  
     //check if the tag is called summary
     //in this case, it will always be the first span tag in the page
     //so if the first post has a fullpost span tag, it will be shown
     //the spans array keeps getting bigger and bigger as the posts are added, 
     //so without a loop it is not possible to do this     
  if (spanName.indexOf("fullpost") != -1) 
  {
    num++;
  }
  if(num != mem){  */
  document.write('<a href=' + postUrl + ' onClick=\'javascript:pageTracker._trackPageview("/inbound/ReadTheFullPost");\'>... for full article click here!</a>');
 // }
  //mem = num; 
}   
