function go(what, root, domeniul, categoria, subcategoria, tip) 
{
	var finurl;
	
	if(domeniul != '' && categoria != '' && subcategoria != '' && what.judetul.value != 'toate')
	{
		finurl = root + tip + '/judet-' + what.judetul.value + '/' + domeniul + '/' + categoria + '/' + subcategoria;
	}
	else if(domeniul != '' && categoria != '' && subcategoria == '' && what.judetul.value != 'toate')
	{	
		finurl = root + tip + '/judet-' + what.judetul.value + '/' + domeniul + '/' + categoria;
	}
	else if(domeniul != '' && categoria != '' && subcategoria != '' && what.judetul.value == 'toate')
	{
		finurl = root + tip + '/' + domeniul + '/' + categoria + '/' + subcategoria;
	}
	else if(domeniul != '' && categoria != '' && subcategoria == '' && what.judetul.value == 'toate')
	{
		finurl = root + tip + '/' + domeniul + '/' + categoria;
	}
	else if(domeniul == '' && categoria == '' && subcategoria != '' && what.judetul.value != 'toate')
	{
		finurl = root + tip + '/judet-' + what.judetul.value + '/' + subcategoria;
	}
	else if(domeniul == '' && categoria == '' && subcategoria != '' && what.judetul.value == 'toate')
	{
		finurl = root + tip + '/' + subcategoria;
	}
	else if(domeniul != '' && categoria == '' && subcategoria == '' && what.judetul.value != 'toate')
	{
		finurl = root + tip + '/judet-' + what.judetul.value + '/' + domeniul;
	}
	else if(domeniul != '' && categoria == '' && subcategoria == '' && what.judetul.value == 'toate')
	{
		finurl = root + tip + '/' + domeniul;
	}
	
	location.href = finurl;
}

function textCounter(field, cntfield, maxlimit)
{
	if (field.value.length > maxlimit) 
		field.value = field.value.substring(0, maxlimit);
	else
		cntfield.value = maxlimit - field.value.length;
}

function poptastic(wurl)
{
	var newwindow;
	newwindow=window.open(wurl,'name','height=600,width=650,scrollbars=YES,menubar=NO,resizable=NO');
		if (window.focus) {newwindow.focus()}
}

function popimg(wurl, iwidth, iheight)
{
	var newwindow;
	
	leftVal = (screen.width - iwidth) / 2;
	topVal = (screen.height - iheight) / 2;

	newwindow=window.open(wurl,'name','height=' + iheight + ',width=' + iwidth + ',left=' + leftVal + ',top=' + topVal + ',scrollbars=NO,menubar=NO,resizable=NO');
		if (window.focus) {newwindow.focus()}
}

url=document.location.href;
xend = url.lastIndexOf("/")+1;
var base_url = url.substring(0,xend);
function ajax_do(url)
{
	if(url.substring(0,4)!='http')
	{
		url=base_url+url;
	}
	var jsel=document.createElement('script');
	jsel.type='text/javascript';
	jsel.src=url;
	document.body.appendChild (jsel);
}

function sponsorizat(parametru) {
	var tabel = document.getElementById("tabelcodsms");
	if(parametru == "Anunt gratuit") {
		tabel.style.display = "none";
	} else if(parametru == "Anunt sponsorizat") {
		tabel.style.display = "";
	}
}
