/* 
 This file was generated by Dashcode.  
 You may edit this file to customize your widget or web page 
 according to the license.txt file included in the project.
 */

var listController = {
    // This object acts as a controller for the list UI.
    // It implements the dataSource methods for the list.
    
    numberOfRows: function() {
        // The List calls this dataSource method to find out how many rows should be in the list.
        return parks.length;
    },
    
    prepareRow: function(rowElement, rowIndex, templateElements) {
        // The List calls this dataSource method for every row.  templateElements contains references to all elements inside the template that have an id. We use it to fill in the text of the rowTitle element.
        if (templateElements.rowTitle) {
            templateElements.rowTitle.innerText = parks[rowIndex].name;
        }

        // We also assign an onclick handler that will cause the browser to go to the detail page.
        var self = this;
        var handler = function() {
            var park = parks[rowIndex];
            detailController.setPark(park);
            var browser = document.getElementById('browser').object;
            // The Browser's goForward method is used to make the browser push down to a new level.  Going back to previous levels is handled automatically.
            browser.goForward(document.getElementById('detailLevel'), park.name);
        };
        rowElement.onclick = handler;
    }
};

var detailController = {
    // This object acts as a controller for the detail UI.
    
    setPark: function(park) {
        this._park = park;
        this._representedObject = park.name;
        
        // When the park is set, this controller also updates the DOM for the detail page appropriately.  As you customize the design for the detail page, you will want to extend this code to make sure that the correct information is populated into the detail UI.
        var detailTitle = document.getElementById('detailTitle');
        detailTitle.innerHTML = this._park.name;
        var detailLocation = document.getElementById('detailLocation');
        detailLocation.innerHTML = this._park.location;
        var detailDescription = document.getElementById('detailDescription');
        detailDescription.innerHTML = this._park.description;
    }
    
};

//
// Function: load()
// Called by HTML body element's onload event when the web application is ready to start
//
function load()
{
    dashcode.setupParts();
}

// Sample data.  Some applications may have static data like this, but most will want to use information fetched remotely via XMLHttpRequest.
var parks = [
     { name: "GPC", location: "Grace Presbyterian Church", description: "Grace Presbyterian is located at 6671 Yale Rd, Bartlett, TN 38134" },
      { name: "GPC", location: "Tennessee, USA", description: "Grace Presbyterian is located at 6671 Yale Rd, Bartlett, TN 38134<a href =http://www.mapquest.com/maps?city=Bartlett&state=TN&address=6671+Yale+Rd&zipcode=38134-2550&country=US&latitude=35.217004&longitude=-89.837833&geocode=ADDRESS>MAP<a/>" },
      
      { name: "Pastor", location: "GPC", description: "Reverand Larry Turner <a href = tel:901-386-3241>901-386-3241<a/> or <a href = mailto:lturner@grace-pres.org>Email</a>" },
      { name: "Sermons", location: "GPC weekly recorded  ", description:"<a href = http://grace-pres.org/sermons.html>Sermons<a/>"},
      
      { name: "Church Office", location: "GPC", description: "Linda Cole <a href = tel:901-386-3241>901-386-3241<a/> or <a href = mailto:lcole@grace-pres.org>Email</a>" },
      
    { name: "Music Director", location: "GPC", description: "Charlotte Hicks <a href = tel:901-386-3241>901-386-3241<a/> or <a href = mailto:chicks@grace-pres.org>Email</a>"},
    { name: "Youth Director", location:"GPC", description: "Matthew Edmiston<a href = tel:901-386-3241>901-386-3241<a/> or <a href = mailto:medmiston@grace-pres.org>Email</a>"},
    
    { name: "Technical Services", location:  "GPC ", description: "Bob Vawter <a href = tel: 901-386-3241>901-386-3241</a> or <a href = mailto:bvawter@bellsouth.net>Email</a>" }, 
    
              
    { name: "Website", location: "Go to our website:  ", description: "<a href = http://grace-pres.org>GPC Website<a/>" }, 
    
    { name: "DayCare", location: "GPC offers daycare:  ", description:"<a href = tel:901-386-4689>901-386-4689<a/>"}, 
   
    { name: "Prayer Line", location: "Email us with your prayer request:", description: "<a href = mailto:info@grace-pres.org> email<a/>" },
     
];







