function set_sort_filter(val){
	var exp = new Date();
	exp.setTime(exp.getTime() + (1000 * 60 * 60 * 24 * 30));
	setCookie('sort_filter',val,exp);
	window.location.reload();
}
function set_sortowanie(obj){
	val = obj.options[obj.selectedIndex].value;
	 var exp = new Date();
	exp.setTime(exp.getTime() + (1000 * 60 * 60 * 24 * 30));
	setCookie('sort_type',val,exp);
	setCookie('sort_filter',1,exp);
	window.location.reload();
}

function chk_regExp_test( obj, target )
{
	var re = new RegExp( target );
	var m = re.exec( obj.value );

	return m;
}

function chk_regExp( obj, target, sample, exectLength, wypelnianieDoKonca )
{

	if( exectLength )
		obj.maxLength = sample.length;

	var m = chk_regExp_test( obj, target );

	if( m == null )
	{
		obj.style.backgroundColor="yellow";
	}
	else
	{
		obj.style.backgroundColor = null;
	}

	//document.getElementById("ala").innerHTML = m;

	//alert(obj.selectionStart);
	if( m == null && ( wypelnianieDoKonca ) )
	{
		var cur = obj.selectionStart;
		var toAdd = sample.substring(
			cur,
			sample.length
			);

		obj.value+= toAdd;
		obj.selectionStart = cur;
	}

	//document.getElementById("alaS").innerHTML = toAdd;


}

