/* Bouncing down overlay */
$(document).ready(function(){
	// click to draw contact form
	$('.openPDF').click(function(){
		// open .panel-1 then shrink back fast to 425px
		$("div.panel").animate({height: "340px"}).animate({height: "320px" }, "fast");
		
		
			// using window.setTimeout to delay .panel-2 for 100 ms
		window.setTimeout(function(){$("div.panel-contents").fadeIn("slow");});
		

	});
 
	// this function closes the panels and is loaded in the click function below
	function closePanels(){
		// extend panel-1 then send it up, to hide
		$(".panel").animate({height: "340px"}).animate({height: "0px",top:"0px"}, "fast", function(){$(this).hide();});
		// using window.setTimeout to delay .panel-2 for 100 ms

	} // end closePanels() function
 
	// on click fadeOut content then call closePanels() to send them up
	$('.closePDF').click(function(){					
		$('div.panel-contents').fadeOut("fast",closePanels());	
	});    
	

});


/* Script to launch link whilst still being strict compliant */
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;



/* Shadowbox popUps */
	Shadowbox.init({
		skipSetup: true,
		players: ["img", "qt", "wmp", "iframe"]
	});
	
	window.onload = function(){
		Shadowbox.setup(".tablePopup a");
		Shadowbox.setup(".panel-contents a");
		Shadowbox.setup(".sbpopup a");		
	};

/* Drop Down Menus */
$(document).ready(function(){
 
    $('.down-list').width($('.dropdown-menu').width()-2);
 
    $('.dropdown-menu').hover(
      function () {
        $('.menu-first', this).addClass('slide-down'); 
        $('.down-list', this).slideDown(100);
      }, 
      function () {
        obj = this;
        $('.down-list', this).slideUp(100, function(){ $('.menu-first', obj).removeClass('slide-down'); });
      }
    );
 
});

