/* 
 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 dashcodePartSpecs = {
    "back_button": { "creationFunction": "CreatePushButton", "customImagePosition": "PushButton.IMAGE_POSITION_LEFT", "initialHeight": 30, "initialWidth": 50, "leftImageWidth": 16, "rightImageWidth": 5 },
    "browser": { "creationFunction": "CreateBrowser" },
    "button": { "creationFunction": "CreatePushButton", "customImagePosition": "PushButton.IMAGE_POSITION_LEFT", "initialHeight": 30, "initialWidth": 60, "leftImageWidth": 16, "onclick": "buttonClick", "rightImageWidth": 5, "text": "トップ" },
    "detailDescription": { "creationFunction": "CreateText", "text": "Description" },
    "detailLocation": { "creationFunction": "CreateText", "text": "Location" },
    "detailTitle": { "creationFunction": "CreateText", "text": "Title" },
    "header": { "creationFunction": "CreateHeader", "rootTitle": "宅配追跡" },
    "list": { "creationFunction": "CreateList", "dataArray": ["ヤマト運輸", "佐川急便", "日本通運", "福山通運", "西濃運輸", "日本郵便(ゆうパック,EXPACK)","日本郵便(翌朝10時便)", "日本郵便(書留,配達記録)"], "dataSourceName": "listController", "labelElementId": "rowTitle", "listStyle": "List.EDGE_TO_EDGE", "sampleRows": 9 },
    "rowTitle": { "creationFunction": "CreateText", "text": "Item" },
    "stackLayout": { "creationFunction": "CreateStackLayout", "subviewsTransitions": [{ "direction": "right-left", "duration": "", "timing": "ease-in-out", "type": "push" }, { "direction": "right-left", "duration": "", "timing": "ease-in-out", "type": "push" }] }
};

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 resorts.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 = resorts[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 resort = resorts[rowIndex];
            detailController.setResort(resort);
            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'), resort.name);
        };
        rowElement.onclick = handler;
    }
};

var detailController = {
    // This object acts as a controller for the detail UI.
    
    setResort: function(resort) {
        this._resort = resort;
        this._representedObject = resort.name;
        
        // When the resort 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._resort.name;
        var detailLocation = document.getElementById('detailLocation');
        detailLocation.innerHTML = this._resort.location;
        var detailDescription = document.getElementById('detailDescription');
        detailDescription.innerHTML = "The snow conditions in " + this._resort.name + " are awesome!";
    }
    
};

//
// 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 resorts = [
    { name: "Alta", location: "Alta, Utah" }, 
    { name: "Aspen/Snowmass", location: "Aspen, Colorado" }, 
    { name: "Big Bear", location: "Big Bear Lake, California" }, 
    { name: "Boreal", location: "Truckee, Calfornia" }, 
    { name: "Brundage Mountain", location: "McCall, Idaho" }, 
    { name: "Heavenly", location: "Stateline, Nevada" }, 
    { name: "Kirkwood", location: "Kirkwood, California" }, 
    { name: "Mammoth Mountain", location: "Mammoth Lakes, California" }, 
    { name: "Northstar-at-Tahoe", location: "Truckee, California" }, 
    { name: "Park City Mountain", location: "Park City, Utah" }, 
    { name: "Snowbird", location: "Snowbird, Utah" }, 
    { name: "Squaw Valley USA", location: "Olympic Valley, California" }, 
    { name: "Sugar Bowl", location: "Norden, California" }, 
    { name: "Vail", location: "Vail, Colorado" }
];


function buttonClick(event)
{
    // ここにコードを挿入
    location.href = "../index.html";
}


function areaClick(event)
{
    if( event.target.innerText == "ヤマト運輸" )
        location.href = "input.html?trans_name=yamato";

    if( event.target.innerText == "佐川急便" )
        location.href = "input.html?trans_name=sagawa";

    if( event.target.innerText == "日本通運" )
        location.href = "input.html?trans_name=nitsu";

    if( event.target.innerText == "福山通運" )
        location.href = "input.html?trans_name=fukuyama";

     if( event.target.innerText == "西濃運輸" )
        location.href = "input.html?trans_name=seino";

   if( event.target.innerText == "日本郵便(ゆうパック,EXPACK)" )
        location.href = "input.html?trans_name=yubin_ex";

   if( event.target.innerText == "日本郵便(翌朝10時便)" )
        location.href = "input.html?trans_name=yubin_10";

   if( event.target.innerText == "日本郵便(書留,配達記録)" )
        location.href = "input.html?trans_name=yubin";
}
