/* ============================================================

* Filename: main.css
* Web site: NLS main web site
* Description: Global scripting
* Version: 1.0 (May 2010)
* Author: Andrew Smith, arsmith at rocketmail.com

============================================================*/

$(document).ready (function () {
	 
	// swap image for right hand end of top navigation bar ('find' button)
	//----------------------------------------------------------------------
	$("li.prim-nav-last").hover(
  			function () {
   	 		$("#navigation").css("background-position","right 0px");
  			},
  			function () {
    		$("#navigation").css("background-position","right -40px");
  		});
	
	
	// fine-tune css for small (800 x 600px) browser windows
	//----------------------------------------------------------------------
  	function changeBgImg() {  
  		var winWidth = $(window).width(); 
		
 		if ((winWidth) < '973'){  
  			$('#main').css('width','99.5%'); 
  			$('.three-column .column3').css('margin-right','-247px')
  			$('#header').css('margin-top','4px')
  		} else {  
  			$('#main').css('width','100%'); 
  			$('.three-column .column3').css('margin-right','-243px')
  			$('#header').css('margin-top','15px')
  			}  
  	}  
   changeBgImg();//Triggers when document first loads      
   
  $(window).bind("resize", function(){//Adjusts image when browser resized  
  		changeBgImg();  
  });  
  
   
	// hide/show list navs in left-hand column
	//-----------------------------------------------------------------------
   function initMenu() {
  		$('.accordian dd').hide();
    	//$('.accordian dd:first').show();
   		$('.accordian dt').click(
   			function() {
   			 var checkElement = $(this).next();
   				if((checkElement.is('dd')) && (checkElement.is(':visible'))) {
  				 return false;
   			}
  		 if((checkElement.is('dd')) && (!checkElement.is(':visible'))) {
  		$('.accordian dd:visible').slideUp('normal');
  		checkElement.slideDown('normal');
  		 return false;
  			}
  		 }
   );
   }
   
   $(document).ready(function() {initMenu();});
   
  		
	// Initiate colorbox overlays
	//-----------------------------------------------------------------------
	//$(".overlay").colorbox();
  		
});

