﻿/// <reference path="jquery-vsdoc.js" />
//*************************************************************************************
// File     : spoi_functions.js
// Requires : jquery.js (version 1.4.0+), braingnat.js (version 0.4.0), bggoogle.js (version 0.4.0) and a Google Map API key included in project
// Author   : Kyle Weems (ksw)
// Origin   : mindfly.com
// Created  : Feb 17, 2010
// Modified : Feb 19, 2010
//*************************************************************************************

$(document).ready(function() {
    newsletterBox();
    $('ul.gallery a').lightBox();
    BrainGnat.slideshow.ajaxLoadCrossfade('/Controls/imageList/imageList.aspx?dir=/Uploads/images/imageRotator/', '.image.wrapper', 'img', 10000, 2000, false);
    if ($('#map').length > 0) {
        BrainGnat.Google.map.load('#map');
        BrainGnat.Google.map.setCenterByAddress('4323 Salt Spring Drive Ferndale, WA 98248-9019', 13);
        BrainGnat.Google.map.addMarkerByAddress('4323 Salt Spring Drive Ferndale, WA 98248-9019');
    }
    evenThingsOut();
});

function newsletterBox() {
    $('#newsletter input[type="text"]').focus(function() {
        if ($(this).attr('value') == 'Your Email Address') {
            $(this).attr('value', '');
        }
    });
    $('#newsletter input[type="text"]').blur(function() {
        if ($(this).attr('value') == '') {
            $(this).attr('value', 'Your Email Address');
        }
    });
}

// Footer push/column equalizer
function evenThingsOut() {
    var difference = $(window).height() - ($('#header').outerHeight() + $('#footer').outerHeight());
    var longest = $('#primary').outerHeight();
    if ($('#secondary').outerHeight() > longest) {
        longest = $('#secondary').outerHeight();
    }
    if ($('#tertiary').length > 0) {
        difference = difference - $('#tertiary').outerHeight();
    }
    if (longest < difference) {
        longest = difference;
    }
    $('#primary').css('min-height', longest - ($('#primary').outerHeight() - $('#primary').height()) + 'px');
    $('#secondary').css('min-height', longest - ($('#secondary').outerHeight() - $('#secondary').height()) + 'px');
}