document.observe('dom:loaded', function(e) {
  var n=Math.floor(Math.random()*10);
  var h = $$('.jqalternate-bg');
  if (h[0]) {h[0].setStyle({backgroundImage:'url(http://www.tn.gov/css/2008a/A/images/banner/banner'+n+'.jpg)'});};
  
  // set up popups
  if (pop = $$('.popTrigger')) {
    pop.each(function(p){
      p.title = "This link opens a new browser window.";
  		p.onclick = function(){
  		  var popup = window.open(p.href, 'popup', 'resizable=yes,scrollbars=yes,toolbar=no,location=no,width=500,height=500');
  		  popup.focus();
  		  return false;
		  };
  	});
  };
  if (navpop = $$('.navpop')) {
    navpop.each(function(np){
      np.title = "This link opens a new browser window.";
			np.onclick = function(){
				var navpopup = window.open(np.href, 'navpopup', 'resizable=yes,scrollbars=yes,toolbar=yes,location=yes,menubar=yes,width=700,height=500');
				navpopup.focus();
				return false;
			};
		});
  };
  
  if ($('txtSize')) {
    $('txtSize').setStyle({'display':'block'});
  };
  
  if ($('txtS') && $('txtL')) {
    var fontSize = 1;
    $('txtS').observe('click', function(e) {
      e.stop();
      fontSize -= 0.1;
      $$('body')[0].setStyle({fontSize:fontSize+'em'});
    });
    $('txtL').observe('click', function(e) {
      e.stop();
      fontSize += 0.1;
      $$('body')[0].setStyle({fontSize:fontSize+'em'});
    });
  };
  
  if ($('txtO')) {
    $('txtO').observe('click', function(e) {
      e.stop();
      $$('link').each(function(l){l.disabled = true;});
      $$('embed').invoke('setStyle', {'display':'none'});
    });
  };
  
});