	
	// get the window height
	function getWindowHeight() {
		var windowHeight = 0;
		windowHeight = $(window).height();
		return windowHeight;
	}
	
	
	// set the footer size
	function setFooter() {
		
		var window_height 	= getWindowHeight();
		
		var wrapper_height	= $('#wrapper').outerHeight();
		var footer_height		= $('#footer_hldr').outerHeight();
		var total_height		= wrapper_height + footer_height;
		
		var header_height		= $('#header_hldr').outerHeight();
		var content_height	= $('#content').outerHeight() - 60; // -60px margin-top on #content
		var difference			= window_height - total_height;
		
		if (total_height < window_height) {
			$('#wrapper').css('height', (window_height-footer_height) + 'px');
			/* console.log(window_height-footer_height); */
			$('#content').css('height', (difference + content_height - footer_height) + 'px');
		} 
		else if (total_height > window_height) {
			$('#wrapper').css('height', 'auto');
			$('#content').css('height', 'auto');
		} 
		else {
		
		}

	}
	
	// place footer
	$(window).resize(function(){
		setFooter();
	});
	
	$(document).ready( function() {
		setFooter();
	});
	
	
	$(document).ready(function(){
	
			// jquery flash
			$('#portfolio_gallery').flash({
		    src: 'http://www.foxandriddle.com/wp-content/themes/FoxAndRiddle_v1/_swf/portfolio.swf',
		    width: 919,
		    height: 530 },
		    { version:9 }
		    );
		  
		  $('#home_slideshow').flash({
		    src: 'http://www.foxandriddle.com/wp-content/themes/FoxAndRiddle_v1/_swf/home.swf',
		    width: 665,
		    height: 340 },
		    { version:9 }
		    );
			
			// services nav functions
			var button = $('#services_left ul li.current_page_item a').text();
			button = '<span class="colon">::</span> ' + button + ' <span class="colon">::</span>';
			$('#services_left ul li.current_page_item a').html(button);

			// popup window
			$('a.popup').click(function(){
				window.open(this.href);
				return false;
	    });
	    
	    // blog
	    $('#blog_info, #blog_intro').click(function(){
	    	window.open('http://www.foxandriddle.com/blog/', '_self');
	    });
	    
	    $("input[type=text]").focus(function(){
	        this.select();
	    });
			
	});
	
	
	// ! tooltip
	$(document).ready(function(){
		
		var $press		= $('#press_gallery ul li a');
		var $tooltip	= $('<div id="tooltip"><div id="tooltip_top"></div><div id="tooltip_middle"><div id="source"></div><div id="excerpt"></div></div><div id="tooltip_bottom"></div></div>').appendTo('body').hide();
		
		// Position Tooltip
		var positionTooltip = function(event) {
			var tPosX = event.pageX + 10;
			var tPosY = event.pageY - 160;
			$tooltip.css({ top: tPosY, left: tPosX });
		}
		
		// Show Tooltip
		var highlight = function(event) {
			
			var title = $(this).find('.info .source').text();
			var date = $(this).find('.info .date').text();
			var excerpt = $(this).find('.info .excerpt').text();
			
			$tooltip.find('#source').html(title + ' <span class="date">| ' + date + '</span>');
			$tooltip.find('#excerpt').html('&ldquo;' + excerpt + '&rdquo; <br/><span class="full"><a href="">-click to read full article</a></span>');
			
			$tooltip.fadeIn('slow');
			positionTooltip(event);
		}
		
		// Hide Tooltip
		var unhighlight = function(event) {
			$tooltip.hide();	
		}
		
		$press
			.hover(highlight, unhighlight)
			.mousemove(positionTooltip);
	
	});
	
	
	$(document).ready(function(){
		
		// this code takes the .header image out of 
		// the div.post_content and places it into
		// the div.post_header then deletes the p tag
		// it belonged to
		var old_header			= $(this).find("#press_single_bottom .big-image").parent();
		var header_to_move 	= $(this).find("#press_single_bottom .big-image");
		var div_to_append		= $(this).find("#press_single_tr");
		
		header_to_move.clone().appendTo(div_to_append);
		old_header.remove();
		
		setFooter();
			
	});
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	


