﻿function submitOnEnter(e, c) {
    var keynum;
    var keychar;
    var numcheck;
    if (window.event) // IE
    {
        keynum = e.keyCode;
    }
    else if (e.which) // Netscape/Firefox/Opera
    {
        keynum = e.which;
    }
    if (keynum == 13) {
        if (document.getElementById(c)) {
            var btnToClick = document.getElementById(c)
            btnToClick.click();
        }
        return false;
    }
}

function popUp(URL) {
    day = new Date();
    id = day.getTime();
    eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=780,height=650,left = 349,top = 315');");
}

function modalPopUp(url) {
    $.modal("<iframe frameborder='0' src='" + url + "' style='margin: 0 0 0 10px; padding: 0; width: 655px; height: 450px;' allowtransparency='true' scrolling='no' />", {
        containerId: 'farmList'
    });
    return false;
}

// Farm List
/*$(document).ready(function() {
$("#fvMap area").click(function() {
var target = $(this).attr("href");
$.modal("<iframe frameborder='0' src='" + target + "' style='margin: 0; padding: 0; width: 655px; height: 450px;' allowtransparency='true' scrolling='no' />", {
containerId: 'farmList'
});
return false;
});
});*/

$(document).ready(function() {
    $(".gallery-scrolling").scrollable({ size: 4, items: ".gallery-images", speed: 400 });

    $(".gallery-page").scrollable({ size: 4, items: ".gallery-page-scrolling", speed: 400 });
    
    $(".recipe-link a").colorbox({ containerClass: "blue-modal", width: "728px", height: "516px", inline: true, href: function() {
        var targetRecipeEnlarge = $(this).attr('href');
        return targetRecipeEnlarge;
        } 
    });
    
    $(".story-item a").colorbox({ containerClass: "blue-modal", width: "728px", height: "516px", inline: true, href: function() {
            var targetStoryEnlarge = $(this).attr('href');
            return targetStoryEnlarge;
        } 
    });

    $(".photo-item a").colorbox({ containerClass: "gallery-modal" });

    $("a.game").colorbox({ containerClass: "gallery-modal" });
    
    $("#feedback-link").colorbox({ width: "502px", inline: true, href: "#feedback" });
});