﻿
// States definition
DemoBrowser.Page.prototype.aStates = [
    {   Name: "ALL",
        DefaultState: "selected",
        onClick: function (sender, eventArgs) {
            this._changeState("selected");
            this._slRootObject.stateFilter = {check: function(item) {return true;}};
            this._slRootObject.filterResults([this._slRootObject.stateFilter, this._slRootObject.productFilter]);
            this._slRootObject.displayResults();
        }
    },
    {   Name: "NSW",
        onClick: function(sender, eventArgs) {
            this._changeState("selected");
            this._slRootObject.stateFilter = new PropertyEquals("State", this._oDataObject.Name);
            this._slRootObject.filterResults([this._slRootObject.stateFilter, this._slRootObject.productFilter]);
            this._slRootObject.displayResults();
        }
    },
    {   Name: "VIC",
        onClick: function(sender, eventArgs) {
            this._changeState("selected");
            this._slRootObject.stateFilter = new PropertyEquals("State", this._oDataObject.Name);
            this._slRootObject.filterResults([this._slRootObject.stateFilter, this._slRootObject.productFilter]);
            this._slRootObject.displayResults();
        }
    },
    {   Name: "QLD",
        onClick: function(sender, eventArgs) {
            this._changeState("selected");
            this._slRootObject.stateFilter = new PropertyEquals("State", this._oDataObject.Name);
            this._slRootObject.filterResults([this._slRootObject.stateFilter, this._slRootObject.productFilter]);
            this._slRootObject.displayResults();
        }
    },
    {   Name: "SA",
        onClick: function(sender, eventArgs) {
            this._changeState("selected");
            this._slRootObject.stateFilter = new PropertyEquals("State", this._oDataObject.Name);
            this._slRootObject.filterResults([this._slRootObject.stateFilter, this._slRootObject.productFilter]);
            this._slRootObject.displayResults();
        }
    },
    {   Name: "ACT",
        onClick: function(sender, eventArgs) {
            this._changeState("selected");
            this._slRootObject.stateFilter = new PropertyEquals("State", this._oDataObject.Name);
            this._slRootObject.filterResults([this._slRootObject.stateFilter, this._slRootObject.productFilter]);
            this._slRootObject.displayResults();
        }
    },
    {   Name: "TAS",
        onClick: function(sender, eventArgs) {
            this._changeState("selected");
            this._slRootObject.stateFilter = new PropertyEquals("State", this._oDataObject.Name);
            this._slRootObject.filterResults([this._slRootObject.stateFilter, this._slRootObject.productFilter]);
            this._slRootObject.displayResults();
        }
    },
    {   Name: "NT",
        onClick: function(sender, eventArgs) {
            this._changeState("selected");
            this._slRootObject.stateFilter = new PropertyEquals("State", this._oDataObject.Name);
            this._slRootObject.filterResults([this._slRootObject.stateFilter, this._slRootObject.productFilter]);
            this._slRootObject.displayResults();
        }
    }
];


// Products definition
DemoBrowser.Page.prototype.aProducts = [
    {   Name: "ALL",
        DefaultState: "selected",
        onClick: function (sender, eventArgs) {
            this._changeState("selected");
            this._slRootObject.productFilter = {check: function(item) {return true;}};
            this._slRootObject.filterResults([this._slRootObject.stateFilter, this._slRootObject.productFilter]);
            this._slRootObject.displayResults();
        }
    },
    {   Name: "VS2008",
        onClick: function(sender, eventArgs) {
            this._changeState("selected");
            this._slRootObject.productFilter = new PropertyEquals("Product", this._oDataObject.Name);
            this._slRootObject.filterResults([this._slRootObject.stateFilter, this._slRootObject.productFilter]);
            this._slRootObject.displayResults();
        }
    },
    {   Name: "WS2008",
        onClick: function(sender, eventArgs) {
            this._changeState("selected");
            this._slRootObject.productFilter = new PropertyEquals("Product", this._oDataObject.Name);
            this._slRootObject.filterResults([this._slRootObject.stateFilter, this._slRootObject.productFilter]);
            this._slRootObject.displayResults();
        }
    },
    {   Name: "SQL2008",
        onClick: function(sender, eventArgs) {
            this._changeState("selected");
            this._slRootObject.productFilter = new PropertyEquals("Product", this._oDataObject.Name);
            this._slRootObject.filterResults([this._slRootObject.stateFilter, this._slRootObject.productFilter]);
            this._slRootObject.displayResults();
        }
    }
];
