<!--
function rotateReNorthAds() {
  reNorthAdIndex = Math.floor(Math.random() * renorthads.length);
  var imagesource = renorthads[reNorthAdIndex].getSrc();
  window.document.getElementById("renorthimage").src = imagesource;
  window.document.getElementById("renorthimageurl").href=renorthads[reNorthAdIndex].getUrl();
  reNorthTimer = setTimeout("rotateReNorthAds()", 30000);
}

function showRandomAdsOnLoad(){
  bannerAdIndex = Math.floor(Math.random() * bannerAds.length);
  rightColAdIndex = Math.floor(Math.random() * rightColAds.length);

  window.document.getElementById("bannerAdSrc1").src = bannerAds[bannerAdIndex].src1;
  window.document.getElementById("bannerAdUrl1").href = bannerAds[bannerAdIndex].url1;
  window.document.getElementById("bannerAdSrc2").src = bannerAds[bannerAdIndex].src2;
  window.document.getElementById("bannerAdUrl2").href = bannerAds[bannerAdIndex].url2;
  window.document.getElementById("bannerAdSrc3").src = bannerAds[bannerAdIndex].src3;
  window.document.getElementById("bannerAdUrl3").href = bannerAds[bannerAdIndex].url3;

  window.document.getElementById("rightColAdSrc1").src = rightColAds[rightColAdIndex].src;
  window.document.getElementById("rightColAdUrl1").href = rightColAds[rightColAdIndex].url;
}

// Global variables for keeping track of rotated ads
// adCount - the number of ads that have been displayed
// adCycles - the number of times the script has cycled through all ads
// adUses - an array containing the number of times each ad was used
// maxMisses - the number of times the script will attempt to try picking a random
//   number that has not been choosen already, when that time is reached it
//   will iterate through all ads and pick one that has not been picked in that cycle.
var adCount = 0;
var adCycles = 0;
var adUses = new Array();
var maxMisses = 100;

function rotatePrAds() {
  var validIdx = 0;
  var numMisses = 0;
  while (validIdx <= 0) {
    // choose a random number based on the number of ads.
  	PrAdIndex = Math.floor(Math.random() * (PrAds.length-1));
  	// check to make sure that the ad has not been used in the current cycle
  	if (typeof(adUses[PrAdIndex]) == "undefined") {
  		adUses[PrAdIndex] = 1;
  		validIdx = 1;
  	} else {
  		if (adUses[PrAdIndex] <= adCycles) {
  			// increment the number of uses for this ad
  			adUses[PrAdIndex] = adUses[PrAdIndex] + 1;
  			validIdx = 1;
  		} else {
  			// we were not able to determine a number randomly, so increment the misses
  			// if we hit maxMisses then iterate through adUses and find the next ad that 
  			// has not been used.
  			numMisses = numMisses + 1;
  			if (numMisses > maxMisses) {
  				for (i = 0; i < PrAds.length; i++) {
  					if (typeof(adUses[i]) == "undefined") {
						adUses[i] = 1;
						PrAdIndex = i;
						validIdx = 1;	
						break;
  					} else {
  						if ( adUses[i] <= adCycles) {
							adUses[i] = adUses[i] + 1;
							PrAdIndex = i;
							validIdx = 1;	
							break;
						}
  					}
  				}
  			}
  		}
  	}
  }
  // Increment the ad counter, so that we know when we ran through the cycle.
  adCount = adCount + 1;
  if ((adCount % PrAds.length) == 0) {
  	// we ran through a cycle so increment adCycles
  	adCycles = adCycles + 1;
  }
  
  // this is old code that remains unchanged
  var imagesource = PrAds[PrAdIndex].getSrc();
  if(document.getElementById("primage")) { // iffed by CW 5/10 - only do if primage exists
  	window.document.getElementById("primage").src = imagesource;
  	window.document.getElementById("primageurl").href=PrAds[PrAdIndex].getUrl();
  }
// GMb 04/19/07 Commented this out because we do not want the print ads to rotate any more
//PrTimer = setTimeout("rotatePrAds()", 10000);
}

function ecnPopUp(address)
{
  newWin = window.open(address, this.target, this.settings);
  newWin.focus();
  return false;
} 
var newwindow;
function ecnPopper(url)
{
       var winFeatures="toolbar=no,status=no,menubar=no,location=no,scrollbars=yes,resizable=yes"
	newwindow=window.open(url,'name',winFeatures);
	if (window.focus) {newwindow.focus()}
}
function ecnToggleWeeklies() {
   var sub = document.getElementById('ecn_nav_sub');
   if (sub.style.display != 'block')
   {
      sub.style.display = 'block';
   }else{
      sub.style.display = 'none';
   }
}
sfHover = function() {
	var sfEls = document.getElementById("topnav").getElementsByTagName("li");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace("sfhover", "");
		}
	}
}





/* 
   Page Turner Javascript: 
   4/28/06  Chris Wible
   Based on pagebreak.js by Jim G.
   
   If javascript is enabled, reads page for div named storydisplay. Splits that 
   up by divs with ids for what pages they are and a class of page. Then parses 
   the url for a page parameter and activates the div with that id, leaving the 
   rest hidden. A page index and location indicators are added through the DOM.
*/

function pageTurner()
{
   if (document.getElementById('storydisplay') && document.getElementById('page2'))
   {// if this page contains a story do stuff
   	url = getUrl();
      pages = getTotalPages();
      page = getCurrentPage();
      togglePages('none');
      story = document.getElementById('storydisplay');
      if (page != 0)
      { // if there's a page number, make that one visible
         showPage(page);
      }else{ // if page num equals 0, show everything
         togglePages('block');
      }
      pageIndex();
   }
}
function getUrl()
{ // go get me the url
	return(unescape(window.location.href));
}
function getTotalPages()
{ // count all of the divs within the story to get total pages
   var story = document.getElementById('storydisplay');
   var count = story.getElementsByTagName('div').length;
   return count;
}
function getCurrentPage() 
{ // parses url and returns page #, returns 1 if page # not found
	if (url.indexOf("page=") != -1)
   { // if the url contains page=, that's our page. Otherwise it's page 1
		var page = parseInt(url.substring(url.indexOf("page=") + 5, url.length));
	}else{
		page = 1;
	}
   if (page > pages)
   { // if page number is higher than the available pages, make it 1
      page = 1;
   }
	return(page);
}
function showPage(page)
{ // turns on the display of the current page
   var curr = document.getElementById('page'+page);
   curr.style.display = "block";
}
function togglePages(display)
{ // hide all the apges
   for(i=1; i <= pages; i++)
   {
      var p = document.getElementById('page'+i);
      p.style.display = display;
   }
}
function pageIndex()
{ // prints out the menu items at beginning and end of the story
   var index = document.createElement('p');
   if (url.indexOf("page=") != -1)
   { // strip out old page number from url string
      url = url.substring(0, (url.indexOf('page=')-1));
   }
   if (url.indexOf("?") == -1)
   { // if there is no ? in the url add one, otherwise, add a +
      url = url+'?';
   }else{
      url = url+'+';
   }
   var view = document.createElement('a'); //create an anchor element
   var bread = document.createElement('p');
   if (page != 0)
   { // if we are on a page, display our location and a view toggle
      crumbs = document.createTextNode('(page '+ page +' of '+ pages +')');
      bread.appendChild(crumbs);
      story.insertBefore(bread, story.firstChild);
      viewText = document.createTextNode('View as a single page');
      view.setAttribute('href',url+'page=0');
   }else{ // otherwise, we are showing the whole story - but offer a toggle
      viewText = document.createTextNode('View as a multiple pages');
      view.setAttribute('href',url+'page=1');
   }
   view.appendChild(viewText);
   view.className='view';
   bread.className='breadcrumbs';
   bread.appendChild(view);
   story.insertBefore(bread, story.firstChild);
   if (page < pages && page != 0)
   { // if there's more story attach teaser text
      var cont = document.createElement('p');
      inued = document.createTextNode('This Story Is Continued...');
      cont.appendChild(inued);
      index.appendChild(cont);
	}
   if (pages > 1 && page != 0)
   { // if we have multiple pages, write links
      if (page > 1)
      { // if you can go back, print it out
         var link = document.createElement('a');
         var prev = document.createTextNode('<< Prev');
         link.setAttribute('href',url+'page='+(page - 1));
         link.className='prev';
         link.appendChild(prev);
         index.appendChild(link);
      }
      for(i=1; i <= pages; i++)
      { // make one link for every page
         var link = document.createElement('a');
         var num = document.createTextNode(i);
         link.setAttribute('href',url+'page='+i);
         if (i == page) 
         { // highlight the active page
            link.className='active';
         }else{
            link.className='inactive';
         }
         link.appendChild(num);
         index.appendChild(link);
      }
      index.className='index';
      story.appendChild(index);
   }
   if (page < pages && page != 0)
   { // if we can go forward, print it out
      var link = document.createElement('a');
      var next = document.createTextNode('Next >>');
      link.setAttribute('href',url+'page='+(page + 1));
      link.className='next';
      link.appendChild(next);
      index.appendChild(link);
	}
}
-->