// JavaScript Document

	// set external links to open in new window
	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";
	 }
	}

	window.onload = externalLinks;	


	// rotating images 
  	$(document).ready(function(){

/*
	$('#rotating_header_list').cycle({ 
			 fx:      'fade', 
			 speed:    4000, 
			 timeout:  4000,
			 delay:    -5000 
		});
*/

		// change value of search box on focus - return if nothing is entered
		 swapValues = [];
		 $(".swap_value").each(function(i){
			  swapValues[i] = $(this).val();
			  $(this).focus(function(){			  
					if ($(this).val() == swapValues[i]) {
						 $(this).val("");
					}
			  }).blur(function(){
					if ($.trim($(this).val()) == "") {
						 $(this).val(swapValues[i]);
					}
			  });
		 });

		$('#rotating_images_list').innerfade({
			speed: 'slow',
			timeout: 4800,
			type: 'sequence',
			containerheight: '236px'
		});

		$(function() {
			$('#rotating_images_list li a').lightBox();
			$('#random_header img').lightBox();
			
		});
		
	});


	// navigation drop down - needed for IE
  $(document).ready(function(){
		$("#nav-one li").hover(
			function(){ $("ul", this).fadeIn("slow"); }, 
			function() { } 
		);
		if (document.all) {
			$("#nav-one li").hoverClass ("sfHover");
		}
  });
  
	$.fn.hoverClass = function(c) {
		return this.each(function(){
			$(this).hover( 
				function() { $(this).addClass(c);  },
				function() { $(this).removeClass(c); }
			);
		});
	};	  
	// end navigation
