﻿var isIE6 = false;

if($.browser.msie && $.browser.version == "6.0")
{
    isIE6 = true;  
};


$(document).ready(function(){
       
    if (isIE6 == true)
    {
        $("body").addClass("ie6");
    }

    if ($("body").hasClass("home"))
    {

    } 
    else 
    {
        $("#content").corner({
          tl: { radius: 16 },
          tr: { radius: 16 },
          bl: { radius: 16 },
          br: { radius: 16 }
        });                  
    }
    
    $("div.rounded").corner({
      tl: { radius: 16 },
      tr: { radius: 16 },
      bl: { radius: 16 },
      br: { radius: 16 }
    }); 
        
 
    $("div.logo img").pngfix();
    $("div.top").pngfix();
    $("div.bottom").pngfix();
    $("#nav li").pngfix();
    $("#callout_02").pngfix();
        
    $("#nav li").bind("click", function(e){
        e.preventDefault();
        location.href = $(this).children("a").attr("href");
    });
    
    $("#nav li").bind("mouseover", function(e){
        $(this).stop();
        $(this).animate({ top: "-40px" }, { duration: 1800, easing: "easeOutElastic" } );
    });
    
    $("#nav li").bind("mouseout", function(e){
        if ($(this).attr("class") != $("body").attr("class"))
        {
            $(this).stop();
            $(this).animate({ top: "-90px" }, { duration: 400, easing: "easeInSine" });
        }
    });
    
    //LightBox    
    $("#modal").jqm({ modal:true, ajax:"@href", trigger:"a.someFlash", overlay: 60}); 
    
    
    //$("a.flash_trigger").bind("click", function(e){
      //  e.preventDefault();
        //$('#modal').jqmShow();
    //});

    $("#nav li." + $("body").attr("class")).css("top", "-40px");
    
    $("#nav li").bind("mouseover", function(e){
        $("#nav li p").trigger("hover");
    });
    
    if (isIE6 == true)
    {
        $("#nav").removeClass("transparent");
        IE6_forceResize();
    }
    else
    {
        selectSubnav();
        forceHeight();
    } 
         
});

/*
$(window).resize(function(){
    IE6_forceResize();
    forceHeight();
});
*/

function forceHeight(){
    $("#floor").height($(document).height());
};

function IE6_forceResize(){
    // mimic max-height in ie6
    if (isIE6 == true){
        if ($(window).width() > 1280){
            $("#floor").width(1280);
        }
        else
        {
            $("#floor").width($(window).width());
        } 
        if ($("#content").height() < 600){
            $("#content").height(600); 
        }           
    }
};

function selectSubnav() {
    try 
    {
        $("#sub_nav li#" + selectedSubnavItemID).addClass("locked");
    }
    catch (err) 
    {

    }
};

function initFlashModal() 
{
    $("#modal").jqmHide();
	$("#modal").empty();
    //$("#modal_help a.close_window").bind("click", function(e) {
    //    e.preventDefault();
    //});
};

