function externalLinks() { 
 if (!document.getElementsByTagName) 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"; 
 } 
}

// function blinklink()
// {
// if (!document.getElementById('blink').style.color)
// 	   {
// 	   document.getElementById('blink').style.color="red";
// 	   }
// if (document.getElementById('blink').style.color=="red")
// 	   {
// 	   document.getElementById('blink').style.color="black";
// 	   }
// else
// 	   {
// 	   document.getElementById('blink').style.color="red";
// 	   }
// timer=setTimeout("blinklink()",1000);
// }
// 
// function stoptimer()
// {
// clearTimeout(timer);
// }
// 
// function blinkId(id) {
// 	var i = document.getElementById(id);
// 	if(i.style.visibility=='hidden') {
// 		i.style.visibility='visible';
// 	} else {
// 		i.style.visibility='hidden';
// 	}
// 	setTimeout("blinkId('"+id+"')",1000);
// 	return true;
// }

$(document).ready(function(){
  $.preloadImages = function() {
	for (var i = 0; i<arguments.length; i++) {
	  img = new Image();
	  img.src = arguments[i];
	}
  }
  
  $.preloadImages (
	"newnav/ideazone-over.gif",
	"newnav/apparel-over.gif",
	"newnav/pompomgyrl-over.gif",
	"newnav/bic-over.gif",
	"newnav/brands-over.gif",
	"newnav/cpfp-over.gif",
	"newnav/glassware-over.gif",
	"newnav/stimulus-over.gif",
	"newnav/logowear-over.jpg",
	"newnav/banner1-over.gif",
	"newnav/banner2-over.gif",
	"newnav/banner3-over.gif",
	"newnav/banner4-over.gif"
  );
  
  $(function() {
	$('.hoverswap').hover(
	  function () {
		$(this).attr('src', $(this).attr('src').replace(/.gif/, '-over.gif'));
		$(this).attr('src', $(this).attr('src').replace(/.jpg/, '-over.jpg'));
	  },
	  function () {
		$(this).attr('src', $(this).attr('src').replace(/-over.gif/, '.gif'));
		$(this).attr('src', $(this).attr('src').replace(/-over.jpg/, '.jpg'));
	  }
	);
  });
  
  // Hide all large images except the first one
  $('#imageContainer img').hide().filter(':first').show();
  
  // Select all thumb links
  $('#thumbContainer a').hover(function(event) {
  
		  // Hide all large images except for the one with the same hash as our thumb link
		  $('#imageContainer img').hide().filter(this.hash).show();
	  },
	  function () {} // Because the hover method has a mouseout state we need to define too
  );
  
});
