YAHOO.example.Data = {
    pros: [{
        1: "Liz Lichfield",
        2: null,
        3: "Acton",
        4: "call",
        5: "661-269-0324",
        6: "A10smenace@aol.com",
        7: null
    },
    {
        1: "Beau Smith",
        2: "coach",
        3: "Apple Valley",
        4: "call",
        5: "760-403-8045",
        6: "nabisbo@hotmail.com",
        7: null
    },
    {
        1: "Larry Sunderland",
        2: "coach",
        3: "Apple Valley",
        4: "call",
        5: "760-962-1440",
        6: "sundy@fourdir.com",
        7: null
    },
    {
        1: "Earl Goldman",
        2: "pro",
        3: "Apple Valley",
        4: "call",
        5: "760-221-5706",
        6: "earltennis@gmail.com",
        7: "/local_pros/earl-goldman.html"
    },
    {
        1: "Gil Duran",
        2: "pro",
        3: "Apple Valley",
        4: "$30/hr",
        5: "760-486-6760",
        6: "durangilberta@charter.net",
        7: "/local_pros/gil-duran.html"
    },
    {
        1: "Brian Gill",
        2: "pro",
        3: "Apple Valley",
        4: "call",
        5: "760-792-5933",
        6: "bgill0713@gmail.com",
        7: null
    },
    {
        1: "Pat Jenkins",
        2: "coach",
        3: "Apple Valley / Hesperia",
        4: "call",
        5: "760-220-2599",
        6: "cougartennis@hotmail.com",
        7: null
    },
    {
        1: "Bill Mocharnuk",
        2: "pro / coach",
        3: "Apple Valley / Victorville",
        4: "call",
        5: "760-217-0258",
        6: "b-17mocharnuk@live.com",
        7: null
    },
    {
        1: "Jennifer Wiedeman",
        2: "coach",
        3: "Hesperia",
        4: "call",
        5: "760-403-3987",
        6: "Jennifer.wiedeman@hesperia.org",
        7: null
    },
    {
        1: "Jim Taper",
        2: "coach",
        3: "Hesperia",
        4: "call",
        5: "760-885-6748",
        6: "bgdgtnns@aol.com",
        7: null
    },
    {
        1: "Melissa Carlson",
        2: "coach",
        3: "Hesperia",
        4: "call",
        5: null,
        6: "Melissa.carlson@hesperia.org",
        7: null
    },
    {
        1: "Wayne Elliott",
        2: "coach",
        3: "Hesperia",
        4: "call",
        5: "760-985-5456",
        6: "wayne.elliott@hesperia.org",
        7: null
    },
    {
        1: "Lela Atkins",
        2: "pro",
        3: "Hesperia",
        4: "call",
        5: "760 244-7783",
        6: "lee10shobo@aol.com",
        7: null
    },
    {
        1: "Tim Wallace",
        2: "coach",
        3: "Hesperia / Victorville",
        4: "call",
        5: "760-403-7093",
        6: "Timwallace5@verizon.net",
        7: null
    },
    {
        1: "Kim Eaton",
        2: "fitness",
        3: "Hesperia / Victorville",
        4: "$20",
        5: "760-684-5648",
        6: "trxtrainers@msn.com",
        7: "/local_pros/trx.html"
    },
    {
        1: "Eddy Leuridan",
        2: "fitness",
        3: "Hesperia / Victorville",
        4: "$20",
        5: "760-684-5648",
        6: "trxtrainers@msn.com",
        7: "/local_pros/trx.html"
    },
    {
        1: "Stephanie Williams",
        2: "pro",
        3: "Sunset Ridge Park",
        4: "call",
        5: "760-948-7582",
        6: "embrasingtennis@gmail.com",
        7: "/local_pros/stephanie-williams.html"
    },
    {
        1: "Brett Stacy",
        2: "pro",
        3: "Victorville",
        4: "call",
        5: "760-953-9949",
        6: "Brett.stacy@bankofamerica.com",
        7: null
    },
    {
        1: "Kenny Reveteriano",
        2: "pro",
        3: "Victorville",
        4: "call",
        5: "760-954-5003",
        6: null,
        7: null
    },
    {
        1: "Mark Goodman",
        2: "pro",
        3: "Victorville",
        4: "call",
        5: "760-221-7654",
        6: "Goodyz10s@yahoo.com",
        7: null
    },
    {
        1: "Joe Madoo",
        2: null,
        3: "Victorville / Apple Valley",
        4: "call",
        5: "760-912-9855",
        6: "joemadoo@yahoo.com",
        7: null
    },
    {
        1: "Ryan Cox",
        2: "coach",
        3: "Victorville / Apple Valley",
        4: "call",
        5: "760-218-9928",
        6: "Ryry_cox@yahoo.com",
        7: null
    },
    {
        1: "Justin Harper",
        2: "coach / pro",
        3: "Victorville / Apple Valley",
        4: "call",
        5: "760-900-3671",
        6: "haolelife@yahoo.com",
        7: null
    },
    {
        1: "Barbara Jones",
        2: "pro",
        3: "Victorville / Apple Valley",
        4: "call",
        5: "760-981-3832",
        6: "Barb90732@gmail.com",
        7: null
    },
    {
        1: "Matt Bullock",
        2: "pro",
        3: "Victorville / Apple Valley",
        4: "call",
        5: "760-881-7446",
        6: "Euromatt59@hotmail.com",
        7: "http://www.hdtennis.com/matt/index.html"
    },
    {
        1: "Mike Sanchez",
        2: "pro",
        3: "Victorville / Apple Valley",
        4: "call",
        5: "760-987-5008",
        6: "Hockey92@hotmail.com",
        7: null
    },
    {
        1: "Marites Killion",
        2: "coach",
        3: "VVC",
        4: "call",
        5: "760-792-2159",
        6: "marskill@aol.com",
        7: null
    },
    {
        1: "Hope Young",
        2: "instructor",
        3: "VVC",
        4: "call",
        5: "760-242-1901",
        6: "Hope_young@avusd.org",
        7: null
    },
    {
        1: "Kishan Wicks",
        2: "pro",
        3: "your choice",
        4: "call",
        5: "760-954-4772",
        6: "wickstennis@yahoo.com",
        7: "/local_pros/kishan-wicks.html"
    }]
};
YAHOO.util.Event.addListener(window, "load", 
function() {
    this.myUrlFormatter = function(elCell, oRecord, oColumn, oData)
    {
        var name = oRecord.getData("1");
        var url = oRecord.getData("7");
        if (oRecord.getData("7") !== null) {
            elCell.innerHTML = "<a href='" + url + "'>" + name + "</a>";
        }
        else {
            elCell.innerHTML = name;
        }
    };
    YAHOO.widget.DataTable.Formatter.myUrl = this.myUrlFormatter;
    this.myEmailFormatter = function(elCell, oRecord, oColumn, oData)
    {
        var email = oRecord.getData("6");
        if (oRecord.getData("6") !== null) {
            elCell.innerHTML = "<a href='mailto:" + email + "?subject=Looking%20for%20a%20tennis%20pro'>Click me</a>";
        }
        else {
            elCell.innerHTML = "";
        }
    };
    YAHOO.widget.DataTable.Formatter.myEmail = this.myEmailFormatter;
    YAHOO.example.Basic = function() {
        var myColumnDefs = [{
            key: "1",
            label: "Name",
            formatter: YAHOO.widget.DataTable.Formatter.myUrl,
            sortable: true,
            resizeable: true
        },
        {
            key: "2",
            label: "Category",
            sortable: true,
            resizeable: true
        },
        {
            key: "3",
            label: "Location(s)",
            sortable: true,
            resizeable: true
        },
        {
            key: "4",
            label: "Cost",
            sortable: true,
            resizeable: true
        },
        {
            key: "5",
            label: "Phone",
            sortable: true,
            resizeable: true
        },
        {
            key: "6",
            label: "Email",
            formatter: YAHOO.widget.DataTable.Formatter.myEmail,
            resizeable: true
        }];
        var myDataSource = new YAHOO.util.DataSource(YAHOO.example.Data.pros);
        myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSARRAY;
        myDataSource.responseSchema = {
            fields: ["1", "2", "3", "4", "5", "6", "7"]
        };
        var myDataTable = new YAHOO.widget.DataTable("basic", myColumnDefs, myDataSource, {
            caption: "Click any column (except Email) to sort by that column"
        });
        return {
            oDS: myDataSource,
            oDT: myDataTable
        };
    } ();
});
