function sprawdz()
{

if(document.jarmark.jarmark_kategoria.value=="")
{
alert("Prosze wybrać kategorie ogłoszenia");
return false;
	}

if(document.jarmark.jarmark_title.value=="")
{
alert("Wypełnij pole tytuł");
return false;
}

if(document.jarmark.jarmark_txt.value=="")
{
alert("Brak treści ogłoszenia");
return false;
}
return true;
}



function textCounter(field,counter,maxlimit,linecounter) 
{

	var fieldWidth =  parseInt(field.offsetWidth);
	var charcnt = field.value.length;        


	if (charcnt > maxlimit) { 
		field.value = field.value.substring(0, maxlimit);
	}

	else { 

	var percentage = parseInt(100 - (( maxlimit - charcnt) * 100)/maxlimit) ;
	document.getElementById(counter).style.width =  parseInt((fieldWidth*percentage)/100)+"px";
	document.getElementById(counter).innerHTML=""+percentage+"%"

	setcolor(document.getElementById(counter),percentage,"background-color");
	}
}

function setcolor(obj,percentage,prop)
{
obj.style[prop] = "rgb(80%,"+(100-percentage)+"%,"+(100-percentage)+"%)";
}



function selecturl(s) {
	var gourl = s.options[s.selectedIndex].value;	window.top.location.href = gourl;
}


function dWindow(url, width, height) 
{
var Win = window.open(url,"displayWindow",'width=' + width + ',height=' + height +  ',resizable=0,scrollbars=no,menubar=no' );
}

function dw(url, width, height) 
{
var Win = window.open(url,"displayWindow",'width=' + width + ',height=' + height +  ',resizable=0,scrollbars=yes,menubar=no' );
}