/*var manuf = [];
var phones = [];
var manuf_children = [];
var manuf_ids = [];
var current_model;

function mf_change()
{
	mf = $('manufacturer');
	manuf_id = mf.options[mf.selectedIndex].value;

	if (typeof(manuf_children[manuf_id]) == 'undefined')
	{
		Form.disable('compare');
		new Ajax.Request('js/telefony-compare.php', {
			method:			'get',
			parameters:		'manuf='+manuf_id,
			onComplete:		function(request) {
				mf_load(manuf_id);
				Form.enable('compare');
			}
			});
	}
	else
	{
		mf_load(manuf_id);
	}
}

function mf_load(manuf_id)
{
	mf = $('manufacturer');
	models = $('model');

	models.options.length = 0;
	for (i = 0; i < manuf_children[manuf_id].length; i++)
	{
		phone_id = manuf_children[manuf_id][i];
		models.options[i] = new Option(phones[phone_id], phone_id);
		if (phone_id == current_model) {
			models.options[i].disabled = true;
		}
	}
}

function mf_changer_init()
{
	mf = $('manufacturer');
	mf.options.length = 0;
	for (i = 0; i < manuf_ids.length; i++)
	{
		mf.options[i] = new Option(manuf[manuf_ids[i]], manuf_ids[i]);
	}
	mf_change();
	Event.observe(mf, 'change', mf_change, false);
}

function load_image(medium_img, large_img)
{
	$('bigphone_image').src = medium_img;
	if (large_img.length !== 0)
	{
		$('magnify').href = large_img;
		Element.show($('magnify'));
	}
	else
	{
		Element.hide($('magnify'));
	}
}*/

var actual_thumb = 'thumb_nr_1';
function thumbs_show(elem)
{
	Element.hide(actual_thumb);
	Element.show(elem);
	actual_thumb = elem;
}

/**
* compare phones
**/
var compare_list = new Array();


function cmp_load_phones_list( dest, producer )
{
	dest = $(dest);
	dest.innerHTML = '<option>Trwa ładowanie...</option>';
	$(producer).disable();

	compare_list.push({'dest':dest,'producer':producer});

	new Ajax.Request('load_phones_list?producer=' + producer.value, {
			method:			'get',
			onComplete:		function(res) {
				compare_list.reverse();
				var obj = compare_list.pop();
				compare_list.reverse();
				obj.dest.innerHTML = res.responseText;
				$(obj.producer).enable();
			}
	});
}
