﻿var isIE6 = false;
var isIE7 = false;

if($.browser.msie && $.browser.version == '6.0')
{
    isIE6 = true;  
}
if($.browser.msie && $.browser.version == '7.0')
{
    isIE7 = true;
}

Cufon.replace('h3.cufonReplace')('h4.cufonReplace')('a.cufonReplace');

$(document).ready(function()
{
    /* Round corner */
    $('div.rounded').corner();
    
    if (isIE6 == true)
    {
        $('#header_graphic').css('margin-left', 20);
    
        $('body').addClass('ie6');
        
        $('#navigation_header li').bind('mouseover', function(e){
            $(this).addClass('locked');
        });
        $('#navigation_header li').bind('mouseout', function(e){
            $(this).removeClass('locked');
        });
        
        $('#navigation_main li').bind('mouseover', function(e){
            $(this).addClass("locked");
        });
        $('#navigation_main li').bind('mouseout', function(e){
            $(this).removeClass('locked');
        });
    }
    
    if (isIE7 == true)
    {
        $('body').addClass('ie7');
    }
    
    selectSubnav();
    forceHeight();  
});

$(window).resize(function()
{
     forceHeight();
});

function selectSubnav() 
{
    try 
    {
        if(navigationGroup == 'main')
        {
            $('#navigation_main li#' + selectionSelector).addClass('locked');
        }
        if(navigationGroup == 'header')
        {
            $('#navigation_header li#' + selectionSelector).addClass('locked');
        }
    }
    catch (err) 
    {

    }
};

function forceHeight()
{     
	var docBody = document.getElementsByTagName('body')[0];
	var viewportHeight = $(window).height();
	if( docBody.offsetHeight < viewportHeight ) {
		var bodyContainerMargin = 30;
		var footerPadding = 20;
		$('#bodyContainer').height(viewportHeight - bodyContainerMargin - footerPadding - $('#header').height() - $('#footer').height());
	}
};
