$(document).ready(function(){


if ( $("head").attr("data-page") == "resources")
 { var image = { image: '/images/1-15.jpg', title : '15'}; }
  else
 { var image = { image: '/images/1.jpg', title : 'river'}; }


jQuery(function($){
$.supersized({
//Functionality
slideshow : 0, //Slideshow on/off
start_slide : 0, //Start slide
transition : 0, //0-None, 1-Fade, 2-Slide Top, 3-Slide Right, 4-Slide Bottom, 5-Slide Left, 6-Carousel Right, 7-Carousel Left
transition_speed : 500, //Speed of transition
new_window : 1, //Image links open in new window/tab
keyboard_nav : 1, //Keyboard navigation on/off
performance : 2, //0-Normal, 1-Hybrid speed/quality, 2-Optimizes image quality, 3-Optimizes transition speed // (Only works for Firefox/IE, not Webkit)
//Size & Position
min_width : 100, //Min width allowed (in pixels)
min_height : 100, //Min height allowed (in pixels)
vertical_center : 0, //Vertically center background
navigation : 0, //Slideshow controls on/off
thumbnail_navigation : 1, //Thumbnail navigation
slide_captions : 1, //Slide caption (Pull from "title" in slides array)
slides : [ //Slideshow Images

image
//{ image: '/images/bg/1.jpg', title : 'river'}

]
});
}); 





$("#spectra li").click(function(e) {
	//$("#spectrumbox").html( $( ".spectrum#" + $(e.target).attr('id') ).html()     );
$("#spectrumbox").html( $( ".spectrum#" + $(e.target).attr('data-target') ).html()     );

	$("#spectrumbox").css({  "background-color":"#fff", 
							 "border":"1px solid #888",
						     "filter":"progid:DXImageTransform.Microsoft.gradient(startColorstr=#FFFFFFFF, endColorstr=#FFFFFFFF)"  
						 });
});


fixAddressPosition();
$(window).resize(function(){  fixAddressPosition();  });


}); //end ready




function fixAddressPosition() {
if ( $("head").attr("data-page") == "office") return null;
 if ( $("#header_right_wrap").offset().left  <  ($("#docs_menu").offset().left + 210)   ) {
   $("#header_right_wrap").css({ "position":"fixed", "top":"auto", "bottom":"0", "border-bottom-left-radius":"0", "border-top-left-radius":"6px" });
 }  else {
   $("#header_right_wrap").get(0).style.cssText = '';
 }
}




$("#dropdown").on("click", ".close_button", function(){ 
	$("#dropdown").slideUp(350,"linear");
	$("#dropdown").data( "contents", "" ); //indicate dropdown is empty
});


$("#dropdown").data("contents",""); //prep data attribute

$("#docs_menu .docs_menu_item").click(function(e) {
 if ( $(e.target).attr('data-target') == $("#dropdown").data("contents")  ) return false;//cancel if same doc
    
 if ( $("#dropdown").data("contents") ) {//if already full, animate up/down 
	 $("#dropdown").slideUp(350, "linear", function(){	
		$("#dropdown_wrap").html( $(".doc_html#" + $(e.target).attr('data-target') ).html() );
	    $("#dropdown").slideDown(350,"linear");
     });
 } else { //if opening box 
 		$("#dropdown_wrap").html( $(".doc_html#" + $(e.target).attr('data-target') ).html() );
	    $("#dropdown").slideDown(350,"linear");
 }

 $("#dropdown").data( "contents", $(e.target).attr('data-target') ); //indicate dropdown is full



});//doc click


