﻿var Svuf = (function () {

    function getQueryVariable(variable) {
        var query = window.location.search.substring(1);
        var vars = query.split("&");
        for (var i = 0; i < vars.length; i++) {
            var pair = vars[i].split("=");
            if (pair[0] == variable) {
                return pair[1];
            }
        }
        return null;
    }


    return {

        LoadPlantVarieties: function (type) {
            location.href = location.pathname + "?type=" + encodeURI(type);
        },

        RemovePlantFromReport: function (artno, type) {
            type = (type == "" ? null : type);
            location.href = location.pathname + "?" +
                (type != null ? "type=" + encodeURI(type) + "&" : "") +
                "exec=remove&" +
                "artno=" + encodeURI(artno);
        },

        Restart: function () {
            location.href = location.pathname + "?restart=true";
        },

        Summary: function () {
            location.href = location.pathname + "?exec=summary";
        },

        SendReport: function () {
            location.href = location.pathname + "?exec=send";
        },

        Print: function () {
            window.print();
        }

    };

})();
