DualSliderHelper = function(settings)
{
	var params = new Csn.Utils.Params(settings);

	this.minValue = params.GetItem("MinValue");
	this.maxValue = params.GetItem("MaxValue");
	this.dimFromName = params.GetItem("DimFromName");
	this.dimToName = params.GetItem("DimToName");
};

Object.extend(DualSliderHelper.prototype, {
    Redirect: function() {
        var curUrl = new Csn.Web.Url(document.location.href);
        curUrl = this.RemoveValue(curUrl, 'N', curUrl.GetQuery(this.dimFromName));
        curUrl = this.RemoveValue(curUrl, 'N', curUrl.GetQuery(this.dimToName));

        var nValue = curUrl.GetQuery('N');
        if (nValue == null)
            nValue = "";

        curUrl.RemoveQuery("No");
        curUrl.RemoveQuery(this.dimFromName);
        curUrl.RemoveQuery(this.dimToName);
        if (this.minValue != '0') {
            nValue = nValue + "+" + this.minValue;
            curUrl.SetQuery(this.dimFromName, this.minValue);
        }
        if (this.maxValue != '0') {
            nValue = nValue + "+" + this.maxValue;
            curUrl.SetQuery(this.dimToName, this.maxValue);
        }
        curUrl.SetQuery("N", nValue);

        window.location.href = curUrl.ToString();
    },

    RemoveValue: function(url, key, value) {
        values = url.GetQuery(key);
        if (values == null) values = '';
        values = Csn.Helper.DecodeURL(values);
        values = values.replace(/\+/g, ' ');
        values = values.split(' ');

        var newValues = '';
        for (x = 0; x < values.length; x++) {
            if (values[x] != value && values[x].length > 0) newValues += values[x] + '+';
        }
        url.SetQuery(key, newValues);
        return url;
    }
});