function sorterF(field)
{
	if(document.sorter.sort_order)
	{
		document.sorter.sort_order.field1 = checked;
		document.sorter.submit();
	}
}


function sorterName(field1,field2)
{
		document.sorter.sort_order[0].checked = false;
		document.sorter.sort_order[1].checked = true;
		document.sorter.sort_by.value = field2;
		document.sorter.submit();
}

function sorterStandard(field1,field2)
{
		document.sorter.sort_order[0].checked = true;
		document.sorter.sort_order[1].checked = false;
		document.sorter.sort_by.value = field2;
		document.sorter.submit();
}

function sorterB(field1,field2)
{
		document.sorter.sort_order.field1 = true;
		document.sorter.sort_by.value = field2;
		document.sorter.submit();
}
// End -->


function Set_Cookie(name, value) {

	var today = new Date();
	today.setTime(today.getTime() + 24*60*60);
	document.cookie = name + "=" + escape(value) + ";expires=" + today.toGMTString();

}

function Get_Cookie(name) {

	var start = document.cookie.indexOf( name + "=" );
	var len = start + name.length + 1;
	if ((!start ) &&
	(document.cookie.substring(0, name.length) != name))
	{
	return null;
	}
	if (start == -1) return null;
	var end = document.cookie.indexOf( ";", len );
	if ( end == -1 ) end = document.cookie.length;
	return unescape( document.cookie.substring( len, end ) );

}

function CheckCompare(id) {

	if ( Get_Cookie('compare_array') == null ) {

		ID = id;
		AKTUAL = ID + '|';

		Set_Cookie('compare_array', AKTUAL);

		// alert(Get_Cookie('compare_array'));

	} else {

		 ciacho = Get_Cookie('compare_array');

		 if ( ciacho.match(id)  ) { // w stringu istnieje podana wartosc

			ciacho = Get_Cookie('compare_array');
			AKTUAL = ciacho.replace(id + '|', '');

			Set_Cookie('compare_array', AKTUAL);

			// alert('Delete ID: ' + ID + '. Aktualne ciacho to: ' + Get_Cookie('compare_array'));

		} else {

			ID = id;
			AKTUAL = Get_Cookie('compare_array') + '' + ID + '|';

			Set_Cookie('compare_array', AKTUAL);
			// alert(Get_Cookie('compare_array'));

		}

	}

	ciacho = Get_Cookie('compare_array');
	ilosc = ciacho.split('|');
	wpis = ilosc.push('') - 2;

	document.getElementById( 'compare_dane' ).innerHTML = wpis;

}

