$(document).ready(function ()

{

	var ProductCount = $(".ProductListItem").length;



	$("#ProductListContent").css("width", ProductCount*200+"px");



	$("#ProductList").jScrollPane();



// Zamiana standardowego pola select formularza - Mikołaj Gruszczyński

/*

$('.TextOptionSelectField select').each(function() {

	$('option').each(function() {

		wartosc = $(this).text();

		//name = $(this).closest("div.form_select_content").attr("name");

		$(this).replaceWith('<div class="form_option"><input class="form_checkbox" type="checkbox" value="'+wartosc+'" />'+wartosc+'</div>');

  	});

	

	$('select').each(function() {

		name = $(this).attr("name");

		title = $(this).attr("title");

		wartosc = $(this).html();

		$(this).replaceWith('<input class="disabled" name="'+name+'" type="text" disabled="disabled" /><div class="form_select" name="'+name+'"><div class="form_select_name" name="'+name+'" title="'+title+'">'+title+'</div><div class="form_select_content" name="'+name+'">'+wartosc+'</div></div>');

  	});

	

	$('input').each(function() {

		name = $(this).closest("div.form_select_content").attr("name");

		$(this).attr("name",name);

	});

	

	$('select').each(function(index) {

		name = $(this).attr("name");

		title = $(this).attr("title");

		wartosc = $(this).html();

		$(this).replaceWith('<div class="form_select" name="'+name+'"><div class="form_select_name" name="'+name+'" title="'+title+'">'+title+'</div><div class="form_select_content" name="'+name+'">'+wartosc+'</div></div>');

  	});

	

	$('option').each(function(index) {

		wartosc = $(this).text();

		name = $(this).closest("div.form_select_content").attr("name");

		$(this).replaceWith('<div class="form_option"><input name="'+name+'" class="form_checkbox" type="checkbox" value="'+wartosc+'" />'+wartosc+'</div>');

  	});

});		

	

	$("div.form_select_content").css({"display":"none"});

	

	$('div.form_select_content').each(function() {

		wysokosc = $(this).height();

		maksymalna = 100;

		if(wysokosc >= maksymalna) $(this).css({"overflow":"auto","height":maksymalna});

  	});

	

	klik=0;

	$('div.form_select_name').click(function(){



		if (klik == 0)

		{

			$(this).parent().find("div.form_select_content").css({"display":"block"});

			klik = 1;

		}

		else

		{

			$(this).parent().find("div.form_select_content").css({"display":"none"});

			klik = 0;

		}

	});



	$("div.form_select").click(function () {

		id = $(this).index(".form_select");

	});



	$("div.form_select").mouseleave(function(){



		$(this).find("div.form_select_content").css({"display":"none"});

		klik = 0;

		name = $(this).attr("name");

		zmienna = "";

		$("input[name="+name+"][type=checkbox][checked=checked]").each(function() {

			zmienna += ","+$(this).val()+","; 

  		});

		$("input[type=text][name="+name+"]").val(zmienna);

	});

	

	$('div.form_option').click(function(){



		$(".form_select:eq("+id+") .form_option").removeClass("selected");

		$(".form_select:eq("+id+") .form_checkbox").removeAttr("checked");



		$(this).addClass("selected");

		$(this).find("input.form_checkbox").attr("checked","checked");



		var v = $(this).html();



		$(".form_select:eq("+id+") .form_select_name").html(v);

		$(".form_select:eq("+id+") .form_select_name input").remove();

	});


*/
});
