﻿//*************************************************************************************
// File     : shellfish_functions.js
// Version  : 1
// Requires : jquery.js (version 1.2.6+), braingnat.js (version 0.0.5+)
// Author   : Kyle Weems (ksw)
// Origin   : mindfly.com
// Created  : September 5, 2008
// Modified : September 5, 2008
// Purpose  : Functions specific to nanoos-shellfish.org
//*************************************************************************************

$(document).ready(function() { activationSequence() });
$(window).resize(function() { setContentHeight(69); });

// activationSequence()
//
// Runs various functions at page load.
function activationSequence() {
    setContentHeight(69);
    setupWeatherDataStation();
    setupDisclaimerToggle();
} // end of function activationSequence()


// setupWeatherStation()
//
// Sets the visibility of '.statestation_weather' and adds functionality to the get weather data button.
function setupWeatherDataStation() {
    if($('.statestation_weather')) {
    $('.statestation_weather').addClass('displayNone');
    $('.btnGetWeatherData').bind('click', function() { toggleWeatherDataVisibility(); }).addClass('hidden');
    }
} // end of function setupWeatherDataStation()


// setupDisclaimerToggle()
//
// Creates an event bound to the '#dataDisclaimer' span that opens/closes the '#divDataDisclaimer' message.
function setupDisclaimerToggle() {
    if ($('#dataDisclaimer')) {
        $('#dataDisclaimer').bind('click', function() {
            if ($('#dataDisclaimer').hasClass('open')) {
                $('#dataDisclaimer').html('Data Disclaimer').removeClass('open');
                $('#divDataDisclaimer').css('display', 'none');
            } else {
                $('#dataDisclaimer').html('Hide Disclaimer').addClass('open');
                $('#divDataDisclaimer').css('display', 'block');
            }
        });
    }
} // end of function setupDataToggle()


// toggleWeatherDataVisibility()
//
// Flips the '.statestation_weather' div's visiblity.
function toggleWeatherDataVisibility() {
    if ($('.statestation_weather').hasClass('displayNone')) {
        $('.statestation_weather').addClass('displayBlock').removeClass('displayNone');
        $('.btnGetWeatherData').html('Hide Weather Data').removeClass('hidden');
    } else {
        $('.statestation_weather').addClass('displayNone').removeClass('displayBlock');
        $('.btnGetWeatherData').html('Get Weather Data').addClass('hidden');
    }
} // end of function toggleWeatherDataVisibility();