// Customised Nav Alignment Script v2.0
// Andrew Pettican (February 2010)
// NB: This script must run as early as possible
//
// Changelog:
// v1.0 - 11/08/2008 - Initial build
// v1.0 - 20/08/2008 - Modified to obtain height from a selection of divs
// v1.0 - 29/08/2008 - Modified for Safari compatibility
// v1.0 - 08/09/2008 - Modified to bottom improve alignment
// v1.1 - 11/09/2008 - Modified to align to the bottom of a page (rather than content)
// v1.2 - 29/09/2008 - Modified to align above the footer bar
// v1.3 - 10/10/2008 - Modified to align fixed to the bottom of the page
// v1.4 - 20/10/2008 - Refactored code
// v1.5 - 15/06/2009 - Modified to apply variable margin to the bottom of #bottom_nav instead of the top
// v1.6 - 04/08/2009 - Updated to improve speed and cross browser compatibility
// v1.7 - 21/09/2009 - Minor adjustments for IE browsers
// v2.0 - 22/02/2010 - Modified to apply a top margin to bottom_nav in order to align bottom_nav to the end of the page.
//////////////////////////////////////////////////////////////////
var na_limiter_period=40;var na_content_div="content";var na_header_div="header_bar";var na_footer_div="footer_bar";var na_top_nav_div="top_nav";var na_bottom_nav_div="bottom_nav";var na_ie6_offset=1;var na_ie7_offset=0;var na_alignment=0;var na_event_limiter=null;var na_queue_doAlignment=false;var na_tn_height=0;var na_bn_height=0;var na_hb_height=0;var na_fb_height=0;jQuery(document).ready(function(){if(!operatest&&document.getElementById(na_content_div)!==null&&document.getElementById(na_header_div)!==null&&document.getElementById(na_footer_div)!==null&&document.getElementById(na_top_nav_div)!==null&&document.getElementById(na_bottom_nav_div)!==null){na_tn_height=$("#"+na_top_nav_div).height()+$("#"+na_top_nav_div).offset().top;na_bn_height=$("#"+na_bottom_nav_div).height()+parseInt($("#"+na_bottom_nav_div).css("padding-bottom"),10)+parseInt($("#"+na_bottom_nav_div).css("margin-top"),10);na_hb_height=$("#"+na_header_div).height();na_fb_height=$("#"+na_footer_div).height();do_alignment(false);$(".icon, .portfolio_close").click(function(){do_alignment(false)});$(window).resize(function(){do_alignment(false)})}});function set_alignment_timer(){na_event_limiter=setTimeout(function(){clear_alignment_timer()},na_limiter_period)}function clear_alignment_timer(){clearTimeout(na_event_limiter);na_event_limiter=null;if(na_queue_doAlignment){do_alignment();na_queue_doAlignment=false}}function do_alignment(a){if(na_event_limiter===null){if(a){set_alignment_timer()}var b=$(window).height();var c=$("#"+na_content_div).height()+parseInt($("#"+na_content_div).css("margin-top"),10)+parseInt($("#"+na_content_div).css("margin-bottom"),10);var d=Math.max(b,(c+na_fb_height));var e=d-(na_tn_height+na_bn_height+na_fb_height)+na_alignment;if(ie6){e+=na_ie6_offset}else if(ie){e+=na_ie7_offset}e=Math.max(0,e);$("#bottom_nav").css('margin-top',e+'px')}else{na_queue_doAlignment=true}}
