﻿var Get$ConsumerPortal$Research$TrimsSelectionPanel = function()
{
	try{
		var cnfg = arguments[0];
		ConsumerPortal$Research$TrimsSelectionPanel = new ConsumerPortal$Research$TrimsSelectionPanel(cnfg);
	}catch(er)
	{
		var inc = 0;
		if(arguments.length > 1 && !isNaN(arguments[1]))
		{
			inc = arguments[1];
		}
		if(inc < 10)
		{
			setTimeout(function()
				{
					Get$ConsumerPortal$Research$TrimsSelectionPanel(cnfg, inc+1);
				}, 500);
		}
		else
		{
			return er;
		}
	}
}

ConsumerPortal$Research$TrimsSelectionPanel = function(obj)
{
	this.Config = obj;
}

ConsumerPortal$Research$TrimsSelectionPanel.prototype =
{
	_toggleElements: function(bln) {
		var cnfg = this.Config;
		var smrels = cnfg.ShowAllElements;
		var slsels = cnfg.ShowLessElements;
		var hrows = cnfg.HiddenRows;

		var $v = ($v ? $v :
			function(arg) 
			{
				return document.getElementById(arg);
			});

		var showeles = function(arr, dis) 
		{
			for (var i = 0; i < arr.length; i++) 
			{
				var elem = $v(arr[i]);
				if (elem && elem.style) 
				{
					elem.style.display = bln ? dis : "none";
				}
			}
		}

		var hideeles = function(arr, dis) 
		{
			for (var i = 0; i < arr.length; i++) 
			{
				var elem = $v(arr[i]);
				if (elem && elem.style) 
				{
					elem.style.display = bln ? "none" : dis;
				}
			}
		}
		
		hideeles(smrels, "inline");
		showeles(slsels, "inline");
		showeles(hrows, "block");
	},

	ShowAll: function() {
		this._toggleElements(true);
	},

	ShowLess: function() {
		this._toggleElements(false);
	}
}