// JavaScript Document


//script changes the hover effects on the sponsor logos along each side of the page
var revert = new Array();
var inames = new Array('hboydnelson', 'kikfm', 'ksax', 'kxra', 'MN-Mobile-Billboards-logo', 'West_Central_Sanitation_logo', 'budweiser', 'cool94', 'echopress', 'eldens', 'ellingsons', 'gardenville', 'gamesgalore', 'centurylink' );

// Preload sponsor images
if (document.images) {
  var flipped = new Array();
  for(i=0; i< inames.length; i++) {
    flipped[i] = new Image();
    flipped[i].src = "sponsor_logos/"+inames[i]+"2.jpg";
  }
}

// flips the sponsor images to the hover image
function over(num) {
  if(document.images) {
    revert[num] = document.images[inames[num]].src;
    document.images[inames[num]].src = flipped[num].src;
  }
}
function out(num) {
  if(document.images) document.images[inames[num]].src = revert[num];
}





// will open up external links in a new window
function externalLinks() {
  if (!document.getElementsByTagName && document.getElementById) return;

  var anchors = document.getElementsByTagName("a");

  for (var i=0; i<anchors.length; i++) {
   var anchor = anchors[i];
   if (anchor.getAttribute("href") &&
       anchor.getAttribute("rel") == "external")
       anchor.target = "_blank";
 }
}
window.onload = externalLinks;




// We only want the slideshow thunbnails to display when javascript is enabled 
document.write('<style>.noscript { display: none; }</style>');




// Jquery for the Toggle Events on the Index Page
$(function() {
          $(".toggle > p").hide();
          //$("h4").prepend("<a class='toggle'>").append("</a>");

            
          $(".toggle > h5").toggle(function(){
              $(this).addClass("selected");
              $(this).siblings("p").slideDown("slow");
			  $(this).css("background", "url(images/minus.gif)");
			  $(this).css("background-repeat", "no-repeat", "background-position", "0 0");
                return false;
           },function(){
              $(this).removeClass("selected");
              $(this).siblings("p").slideUp("slow");
              $(this).css("background", "url(images/plus.gif)");
			  $(this).css("background-repeat", "no-repeat", "background-position", "0 0");
                return false;
           });

	});






/*
// old jquery I was using for the toggle menu on the Home page
$(document).ready(function(){

    //hide message_body after the first one 
    $(".message_list .message_body:gt(-1)").hide();

    //toggle message_body
    $(".message_head").click(function(){
        $(this).next(".message_body").slideToggle(300);  
        
        return false;

    });

});
*/
