var slider_c = function()
{
	this.collector_id_s = '';
	this.snippet_id_a = new Array();
	this.previous_selector_id_s = '';
	this.next_selector_id_s = '';
	this.easing_i = 10;
	this.current_snippet_index_i = 0;
	this.slide_interval_i = 0;

	/**/

	this.getXByElement = function(element_o)
	{
		return element_o.offsetLeft;
	};

	this.getCleanNumber = function(content_s)
	{
		return new Number(content_s.replace(/[^0-9\.\+\-]/g, ''));
	};

	this.setElementVisibility = function(id_s, state_s)
	{
		var element_o = document.getElementById(id_s);
			element_o.style.visibility = state_s;
	};

	this.setSelectorVisibility = function()
	{
		this.setElementVisibility(this.previous_selector_id_s, (this.current_snippet_index_i <= 0) ? 'hidden' : 'visible');
		this.setElementVisibility(this.next_selector_id_s, (this.current_snippet_index_i >= (this.snippet_id_a.length - 1)) ? 'hidden' : 'visible');
	};

	this.setSlideToX = function(element_o, from_x_i, to_x_i)
	{
		var this_o = this;

		var offset_i = 2;
		var left_b = (to_x_i < from_x_i);
		var current_x_i = from_x_i;

		var setXUpdate = function()
		{
			var difference_i = (to_x_i + (left_b ? (offset_i * -1) : offset_i)) - current_x_i;
			var step_i = difference_i / this_o.easing_i;

			current_x_i = current_x_i + step_i;

			var arrived_b = left_b ? (current_x_i < to_x_i) : (current_x_i > to_x_i);

			if (arrived_b)
				clearInterval(this_o.slide_interval_i);

			else
				element_o.style.left = current_x_i + 'px';
		};

		clearInterval(this.slide_interval_i);
		this.slide_interval_i = setInterval(setXUpdate, 10);
	};

	/**/

	this.setCollectorById = function(id_s)
	{
		this.collector_id_s = id_s;
	};

	this.setSnippetById = function(id_s)
	{
		this.snippet_id_a[this.snippet_id_a.length] = id_s;
	};

	this.setPreviousSelectorById = function(id_s)
	{
		this.previous_selector_id_s = id_s;
	};

	this.setNextSelectorById = function(id_s)
	{
		this.next_selector_id_s = id_s;
	};

	this.setEasing = function(value_i)
	{
		this.easing_i = value_i;
	};

	/**/

	this.setSlider = function()
	{
		this.setSelectorVisibility();
	};

	/**/

	this.setSlide = function(index_i)
	{
		var valid_index_b = ((index_i >= 0) && (index_i <= (this.snippet_id_a.length - 1)));

		this.current_snippet_index_i = valid_index_b ? index_i : 0;
		this.setSelectorVisibility();

		var start_element_o = document.getElementById(this.collector_id_s);
		var start_element_x_i = this.getXByElement(start_element_o);

		var target_element_o = document.getElementById(this.snippet_id_a[this.current_snippet_index_i]);
		var target_element_x_i = this.getXByElement(target_element_o);
			target_element_x_i = start_element_x_i + target_element_x_i;

		var left_b = (start_element_x_i < target_element_x_i);
		var to_x_i = left_b ? (start_element_x_i - target_element_x_i) : (start_element_x_i + (target_element_x_i * -1));

		this.setSlideToX(start_element_o, start_element_x_i, to_x_i);
	};

	this.setPrevious = function()
	{
		var valid_index_b = (this.current_snippet_index_i > 0);
		var index_i = valid_index_b ? (this.current_snippet_index_i - 1) : 0;

		this.setSlide(index_i);
	};

	this.setNext = function()
	{
		var valid_index_b = (this.current_snippet_index_i < (this.snippet_id_a.length - 1));
		var index_i = valid_index_b ? (this.current_snippet_index_i + 1) : (this.snippet_id_a.length - 1);

		this.setSlide(index_i);
	};
};
