﻿$(document).ready(function () {
    $('#main-background').height($(window).height());

    if ($('#content').length) {
        var contentHeight = ($(window).height() - 190) + 'px';
        $('#content').css({ 'height': contentHeight });

        $(window).load(function () {
            $('#content').jScrollPane();
        });
    }

    $(window).resize(function () {
        $('#main-background').height($(window).height());

        if ($('#content').length) {
            var contentHeight = ($(window).height() - 190) + 'px';
            $('#content').jScrollPaneRemove();
            $('#content').css({ 'height': contentHeight });
            $('#content').jScrollPane();
        }
    });

    if ($('#newlettersubmit').length) {
        $('#newlettersubmit').mouseover(function () {
            $(this).removeClass().addClass("hover");
        });
        $('#newlettersubmit').mouseout(function () {
            $(this).removeClass();
        });
    }

    if ($('#frog').length) {
        $('#frog').mouseover(function () {
            $(this).removeClass().addClass("hover");
        });
        $('#frog').mouseout(function () {
            $(this).removeClass();
        });
    }

    if ($('.open-window').length) {
        $('.open-window').click(function () {
            if ($(this).attr("id") == "twitter")
                window.open("http://twitter.com/#!/food_forward");
            else if ($(this).attr("id") == "facebook")
                window.open("http://www.facebook.com/pages/Food-Forward/318828912551");
        });
    }

    Shadowbox.init({ player: 'swf', overlayOpacity: 0.6 });
});

