// JSON Data Getters
//-----------------------------------------------------------
function json_getProduce(sOutputDiv) {
    var sPath = "json/produce-json.php";
    var produceJSON = $.getJSON(sPath, function(data) {
        var sOutput = "<div class='yui-u first'><ul>";
        var nRecordCount = data.length;
        var nItemsPerRow = Math.ceil(nRecordCount / 3);
        var nItemCount = 0;
        $.each(data, function() {
            var sAvailability = (this.available == '1' ? "available" : "unavailable");
            sOutput += "<li class='" + sAvailability + "'>" + this.name + "</li>";
            nItemCount++;
            if (nItemCount >= nItemsPerRow) {
                sOutput += "</ul></div><div class='yui-u'>";
                nOutputCount = 0;
            }
        });
        sOutput += "</ul>";
        $(sOutputDiv).append(sOutput);
    });
}

function json_getContent(sOutputDiv, sPageName) {
    var sPath = "json/content-json.php?pageName=" + sPageName;
    var contentJSON = $.getJSON(sPath, function(data) {
        var sOutput = "";
        $.each(data, function() {
            sOutput += "<hr />";
            sOutput += "<div data-id='" + this.id + "' class='bodyTitle'>" + this.title + "</div>";
            sOutput += "<div data-id='" + this.id + "' class='bodyText'>" + this.bodyText + "</div>";
        });
        $(sOutputDiv).append(sOutput);
    });
}

function json_getGallery(sOutputDiv) {
    var sPath = "json/gallery-json.php";
    var galleryJSON = $.getJSON(sPath, function(data) {
        var sOutput = "";
        $.each(data, function() {
            
        });
    });
}
