/* Braincache JS Core, part of project Dauphine */
/* 16.01.09 v2 Updated for prototype & scriptaculous use */

function execute_ftl_jump(pageloc) {
	if (pageloc!="") {
		parent.location='/'+pageloc;
	}
}

function filter_data(searchpattern,maxrows) {
	var a = 1;
	while ( a <= maxrows  ) {
		var dt = $("td"+a).innerHTML.toLowerCase();
		var sp = searchpattern.toLowerCase();
		var tr = "tr"+a;
		if (sp != "") {
			if (dt.match(""+sp) == null) {
				$(tr).style.display = 'none';
			} else {
				$(tr).style.display = '';
			}
		} else {
			$(tr).style.display = '';
		}
		a = a + 1;
	}
}

function pricePopulation() {
	switch(whatfor) {
		case "1": 
			var prices = new Array("10000","20000","30000","40000","50000","60000","70000","80000","90000",
								   "100000","110000","120000","130000","140000","150000","160000","170000",
								   "180000","190000","200000","250000","300000","350000","400000","450000",
								   "500000","600000","700000","800000","900000","1000000","2000000","3000000");
			break;
		case "2": 
			var prices = new Array("100","200","300","400","500","600","700","800","900","1000","2000","3000",
								   "4000","5000","6000","7000","8000","9000","10000","20000");
			break;
	}
	$('pmin').options.length = 0;
	$('pmax').options.length = 0;
	var exist = $('pmin');
	var newoX = document.createElement('option');
	newoX.text = 'Choose price'; newoX.value = "0";
	try { exist.add(newoX, null); } catch (ex) { exist.add(newoX); }
	prices.each(function(item){
		var newoX = document.createElement('option');
		newoX.text = ''+item; newoX.value = ""+item;
		try { exist.add(newoX, null); } catch (ex) { exist.add(newoX); }
	});
}

function updateminpric(sel) {
	switch(whatfor) {
		case "1": 
			var prices = new Array("10000","20000","30000","40000","50000","60000","70000","80000","90000",
								   "100000","110000","120000","130000","140000","150000","160000","170000",
								   "180000","190000","200000","250000","300000","350000","400000","450000",
								   "500000","600000","700000","800000","900000","1000000","2000000","3000000");
			break;
		case "2": 
			var prices = new Array("100","200","300","400","500","600","700","800","900","1000","2000","3000",
								   "4000","5000","6000","7000","8000","9000","10000","20000");
			break;
	}
	$('pmax').options.length = 0;
	var going = false;
	var exist = $('pmax');
	var newoX = document.createElement('option');
	newoX.text = '...'; newoX.value = "0";
	try { exist.add(newoX, null); } catch (ex) { exist.add(newoX); }
	prices.each(function(item){
		if (sel==item) { going = true; var stpr = item; }
		if (going) {
			var newoX = document.createElement('option');
			newoX.text = ''+item; newoX.value = ""+item;
			try { exist.add(newoX, null); } catch (ex) { exist.add(newoX); }
		}
	});
}