

function pasirinkau() {
	var city = document.getElementById('city').selectedIndex;
	city = document.getElementById('city').options[city].value;
	var type = document.getElementById('price').selectedIndex;
	type = document.getElementById('price').options[type].value;
	//var adresas = '';
	//alert(city);
	//alert(type);
	$("#Sarasas").remove();
	var laikinas = '<div id="Sarasas">';
	laikinas = laikinas + '<table border="0" width="300" cellspacing="0" cellpadding="0"><tr>';
	laikinas = laikinas + '<td align="center" height="100" v-align="center" width="100%" background="images/bord1.gif" style="background-repeat:repeat-x; font-size: 0.6em; padding-bottom: 5px;"><img border="0" src="images/35.gif"></td>';
	laikinas = laikinas + '</tr></table>';
	laikinas = laikinas + '</div>';
	$('#litehouse').after(laikinas);
	$.getJSON("take.php",{action: 'take1', city: city, type: type}, function(j){
		var line = '<div id="Sarasas">';
		var data = '';
		//j[0].tuscia
		if (j[0].tuscia == '1') {
				//alert(j[z].kaina); ////irasyt pranesima
			line = line + '<table border="0" width="300" cellspacing="0" cellpadding="0"><tr>';
			line = line + '<td width="100%" background="images/bord1.gif" class="td_s_1">Pagal jūsų pasirinktus kriterijus nieko nerasta.</td>';
			line = line + '</tr></table>';
		} else {
			for (z = 0; z < j.length; z++) {
				line = line + '<table border="0" width="300" cellspacing="0" cellpadding="0"><tr>';
				//////////////////////////////////////
				line = line + '<td width="25%"  class="td_s_1">'+j[z].marke+'</td>';
				line = line + '<td align="cener" width="20%" class="td_s_2" ><b>'+ j[z].kaina+'</b> Lt</td>';
				var miestas = '';
				if (j[z].miestas != '') {
					miestas = j[z].miestas;
				}
				line = line + '<td align="right" width="50%" class="td_s_3"><b>'+ j[z].adresas+' '+ miestas +'</b></td>';
				//window.location.href = '#'+j[z].degaline_id
				//line = line + '<td align="right" width="5%" background="images/bord1.gif" style="background-repeat: repeat-x; font-size: 0.6em; padding-bottom: 5px; padding-top: 5px;"><a style="cursor: hand; text-decoration: none" onmouseover="this.style.cursor=\'pointer\'" onclick="naujas(\''+j[z].degaline_id+'\');"><img border="0" src="images/world.gif"><a/></td>';
				//alert(page);
				var onclick = '';
				if (typeof(page) == 'undefined') {
					onclick =  'href="http://www.alexela.lt/degaliniu-zemelapis/#' +j[z].place_id+ '.' +j[z].degaline_id+ '"';
				} else {
					onclick = 'onclick="naujas(\''+j[z].degaline_id+'\');"';
				}
				line = line + '<td align="right" width="5%" class="td_s_4"><a '+onclick+' title="Rodyti žemėlapyje" style="cursor: hand; text-decoration: none" onmouseover="this.style.cursor=\'pointer\'"><img border="0" src="images/world.gif"><a/></td>';
				line = line + '</tr></table>';
				if (data == '') {
					data = j[z].data;	
				} else if (data < j[z].data) {
					data = j[z].data;
				}
			}
			//alert(city);
			/*if ((city != 0) && (typeof(page) != 'undefined')) {
				if (miestas) {
					//alert('oK');
				}
			}*/
			line = line + '<table border="0" width="300" cellspacing="0" cellpadding="0"><tr><td align="center" background="images/bord1.gif" style="background-repeat:repeat-x; font-size: 0.6em; padding-bottom: 5px; padding-top: 5px;">Kainos atnaujintos: '+data+'</td></tr></table>';
		}
		line = line + '</div>';
		//line = line + '<div style="height: 25px; background-image: url(images/bord1.gif); background-repeat: repeat-x; font-weight: bold; padding-top: 6px;" id="deg_adresas">' + $degAddress . '</div>';
		//alert(line);
		$("#Sarasas").remove();
		$('#litehouse').after(line);
	})
	
}