function number_format(number, decimals, dec_point, thousands_sep) {
    // http://kevin.vanzonneveld.net
    // +   original by: Jonas Raoni Soares Silva (http://www.jsfromhell.com)
    // +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +     bugfix by: Michael White (http://getsprink.com)
    // +     bugfix by: Benjamin Lupton
    // +     bugfix by: Allan Jensen (http://www.winternet.no)
    // +    revised by: Jonas Raoni Soares Silva (http://www.jsfromhell.com)
    // +     bugfix by: Howard Yeend
    // +    revised by: Luke Smith (http://lucassmith.name)
    // +     bugfix by: Diogo Resende
    // +     bugfix by: Rival
    // +      input by: Kheang Hok Chin (http://www.distantia.ca/)
    // +   improved by: davook
    // +   improved by: Brett Zamir (http://brett-zamir.me)
    // +      input by: Jay Klehr
    // +   improved by: Brett Zamir (http://brett-zamir.me)
    // +      input by: Amir Habibi (http://www.residence-mixte.com/)
    // +     bugfix by: Brett Zamir (http://brett-zamir.me)
    // +   improved by: Theriault
    // +      input by: Amirouche
    // +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // *     example 1: number_format(1234.56);
    // *     returns 1: '1,235'
    // *     example 2: number_format(1234.56, 2, ',', ' ');
    // *     returns 2: '1 234,56'
    // *     example 3: number_format(1234.5678, 2, '.', '');
    // *     returns 3: '1234.57'
    // *     example 4: number_format(67, 2, ',', '.');
    // *     returns 4: '67,00'
    // *     example 5: number_format(1000);
    // *     returns 5: '1,000'
    // *     example 6: number_format(67.311, 2);
    // *     returns 6: '67.31'
    // *     example 7: number_format(1000.55, 1);
    // *     returns 7: '1,000.6'
    // *     example 8: number_format(67000, 5, ',', '.');
    // *     returns 8: '67.000,00000'
    // *     example 9: number_format(0.9, 0);
    // *     returns 9: '1'
    // *    example 10: number_format('1.20', 2);
    // *    returns 10: '1.20'
    // *    example 11: number_format('1.20', 4);
    // *    returns 11: '1.2000'
    // *    example 12: number_format('1.2000', 3);
    // *    returns 12: '1.200'
    // *    example 13: number_format('1 000,50', 2, '.', ' ');
    // *    returns 13: '100 050.00'
    // Strip all characters but numerical ones.
    number = (number + '').replace(/[^0-9+\-Ee.]/g, '');
    var n = !isFinite(+number) ? 0 : +number,
        prec = !isFinite(+decimals) ? 0 : Math.abs(decimals),
        sep = (typeof thousands_sep === 'undefined') ? ',' : thousands_sep,
        dec = (typeof dec_point === 'undefined') ? '.' : dec_point,
        s = '',
        toFixedFix = function (n, prec) {
            var k = Math.pow(10, prec);
            return '' + Math.round(n * k) / k;
        };
    // Fix for IE parseFloat(0.55).toFixed(0) = 0;
    s = (prec ? toFixedFix(n, prec) : '' + Math.round(n)).split('.');
    if (s[0].length > 3) {
        s[0] = s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g, sep);
    }
    if ((s[1] || '').length < prec) {
        s[1] = s[1] || '';
        s[1] += new Array(prec - s[1].length + 1).join('0');
    }
    return s.join(dec);
}

function changeMapType(hodnota) {
	//nastaveni typy mapy v hidden polozce formulare
	var hiddenMapTypeEl = document.getElementById('advanced-map-type');
	if (hiddenMapTypeEl) {
		hiddenMapTypeEl.value = hodnota;
	}
	//vymazani polozek county a district (nejsou zakskrtnute pri prepnuti, proto by nemely byt ve formulari)
	var elForm = document.forms.advanced_more;
	for (var i=0,l=elForm['county[]'].length; i<l; i++) {
		elForm['county[]'][i].checked = false;
	}
	elForm.county_other.value='';
	/*
	var inputTextElement = document.getElementById('advanced-county');
	if (inputTextElement) {
		inputTextElement.value='';
	}
	*/
	var inputTextElement = document.getElementById('advanced-district');
	if (inputTextElement) {
		inputTextElement.value='';
	}
}
function checkCBGroupByText(arrGroupEl,strText) {
	var regSplit = new RegExp(', *');
	var arrValues = strText.split(regSplit);
	for (var i=0,l=arrGroupEl.length; i<l; i++) {
		for (var j=0,k=arrValues.length; j<k; j++) {
			if (arrGroupEl[i].value==arrValues[j]) {
				arrGroupEl[i].checked = true;
				break;
			}
		}
	}
}

function uncheckCBGroupByText(arrGroupEl,strText) {
	var regSplit = new RegExp(', *');
	var arrValues = strText.split(regSplit);
	for (var i=0,l=arrGroupEl.length; i<l; i++) {
		for (var j=0,k=arrValues.length; j<k; j++) {
			if (arrGroupEl[i].value==arrValues[j]) {
				arrGroupEl[i].checked = false;
				break;
			}
		}
	}
}

function setCBGroupByText(arrGroupEl,strText) {
	var regSplit = new RegExp(', *');
	var arrValues = strText.split(regSplit);
	var found;
	for (var i=0,l=arrGroupEl.length; i<l; i++) {
		found = false;
		for (var j=0,k=arrValues.length; j<k; j++) {
			if (arrGroupEl[i].value==arrValues[j]) {
				arrGroupEl[i].checked = true;
				found = true;
				break;
			}
		}
		if (!found) {
			arrGroupEl[i].checked = false;
		}
	}
}

function addTextToCountyOther(strText) {
	var regSplit = new RegExp(', *');
	var regCountyOther = new RegExp('Praha ([1][1-9]|[2-9][0-9])');
	var arrValues = strText.split(regSplit);
	var inputTextElement = document.advanced_more.elements['county_other'];
	for (var i=0,l=arrValues.length; i<l; i++) {
		if (regCountyOther.test(arrValues[i])) {
			var regTextInside = new RegExp('^.*'+arrValues[i]+',.*$','i');
			var regTextEnd = new RegExp('^.*'+arrValues[i]+'$','i');
			if (!regTextInside.test(inputTextElement.value) && !regTextEnd.test(inputTextElement.value)) {
				if (inputTextElement.value!='') inputTextElement.value +=',';
				inputTextElement.value += arrValues[i];
			}
		}
	}
}
function removeTextFromCountyOther(strText) {
	var regSplit = new RegExp(', *');
	var regCountyOther = new RegExp('Praha ([1][1-9]|[2-9][0-9])');
	var arrValues = strText.split(regSplit);
	var inputTextElement = document.advanced_more.elements['county_other'];
	for (var i=0,l=arrValues.length; i<l; i++) {
		if (regCountyOther.test(arrValues[i])) {
			var regTextInside = new RegExp('(^.*)'+arrValues[i]+', *(.*$)','i');
			var regTextEnd = new RegExp('(^.*), *'+arrValues[i]+'$','i');
			var regTextAlone = new RegExp('^ *'+arrValues[i]+' *$','i');
			
			if (regTextInside.test(inputTextElement.value)) {
				inputTextElement.value = inputTextElement.value.replace(regTextInside,'$1$2')
			}
			else if (regTextEnd.test(inputTextElement.value)) {
				inputTextElement.value = inputTextElement.value.replace(regTextEnd,'$1')
			}
			else if (regTextAlone.test(inputTextElement.value)) {
				inputTextElement.value='';
			}
		}
	}
}
function setTextToCountyOther(strText) {
	document.advanced_more.elements['county_other'].value='';
	addTextToCountyOther(strText);
}


function addTextToInputField(idInputElement,strText) {
	if (idInputElement=='advanced-county') {
		checkCBGroupByText(document.advanced_more.elements['county[]'],strText);
		addTextToCountyOther(strText);
	} else {
		var inputTextElement = document.getElementById(idInputElement);
		if (inputTextElement) {
			var regTextInside = new RegExp('^.*'+strText+',.*$','i');
			var regTextEnd = new RegExp('^.*'+strText+'$','i');
			if (!regTextInside.test(inputTextElement.value) && !regTextEnd.test(inputTextElement.value)) {
				if (inputTextElement.value!='') inputTextElement.value +=',';
				inputTextElement.value += strText;
			}
		}
	}
}

function removeTextFromInputField(idInputElement,strText) {
	if (idInputElement=='advanced-county') {
		uncheckCBGroupByText(document.advanced_more.elements['county[]'],strText);
		removeTextFromCountyOther(strText);
	} else {
		var inputTextElement = document.getElementById(idInputElement);
		if (inputTextElement) {
			var regTextInside = new RegExp('(^.*)'+strText+', *(.*$)','i');
			var regTextEnd = new RegExp('(^.*), *'+strText+'$','i');
			var regTextAlone = new RegExp('^ *'+strText+' *$','i');
			
			if (regTextInside.test(inputTextElement.value)) {
				inputTextElement.value = inputTextElement.value.replace(regTextInside,'$1$2')
			}
			else if (regTextEnd.test(inputTextElement.value)) {
				inputTextElement.value = inputTextElement.value.replace(regTextEnd,'$1')
			}
			else if (regTextAlone.test(inputTextElement.value)) {
				inputTextElement.value='';
			}
		}
	}
}

function setTextToInputField(idInputElement,strText) {
	if (idInputElement=='advanced-county') {
		setCBGroupByText(document.advanced_more.elements['county[]'],strText);
		setTextToCountyOther(strText);
	} else {
		var inputTextElement = document.getElementById(idInputElement);
	
		if (inputTextElement) {
			inputTextElement.value = strText;
		}
	}
	
}

function addTextFromSelect(idSelectElement,idInputElement) {
	var selectElement = document.getElementById(idSelectElement);
	if (selectElement.selectedIndex>=0 && selectElement.options[selectElement.selectedIndex].value!='') {
		return addTextToInputField(idInputElement,selectElement.options[selectElement.selectedIndex].text);
	}
}
function addValueFromSelect(idSelectElement,idInputElement) {
	var selectElement = document.getElementById(idSelectElement);
	if (selectElement.selectedIndex>=0 && selectElement.options[selectElement.selectedIndex].value!='') {
		return addTextToInputField(idInputElement,selectElement.options[selectElement.selectedIndex].value);
	}
}
/*
function addCountyFromSelect() {
	var selectElement = document.getElementById('advanced-county-select');
	if (selectElement.selectedIndex>=0 && selectElement.options[selectElement.selectedIndex].value=='Cela Praha') {
		if (document.getElementById('advanced-map-type').value=='complex') {
			addTextToInputField('advanced-county','Praha 20, Praha 19, Praha 14, Praha 9, Praha 18, Praha 8, Praha 7, Praha 3, Praha 1, Praha 2, Praha 10, Praha 21, Praha 15, Praha 4, Praha 11, Praha 22, Praha 12, Praha 6, Praha 17, Praha 13, Praha 5, Praha 16');
			addTextToInputField('advanced-district','Dolní Počernice, Satalice, Vinoř, Štěrboholy, Čakovice, Ďáblice, Březiněves, Dolní Chabry, Trója, Běchovice, Klánovice, Koloděje, Dubeč, Dolní Měcholupy, Petrovice, Královice, Nedvězí, Kolovraty, Benice, Křeslice, Újezd, Šeberov, Kunratice, Libuš, Suchdol, Lysolaje, Nebušice, Přední Kopanina, Zličín, Velká Chuchle, Slivenec, Řeporyje, Lochkov, Zbraslav, Lipence');
		}
		else {
			addTextToInputField('advanced-county','Praha 4, Praha 7, Praha 10, Praha 3, Praha 1, Praha 2, Praha 5, Praha 6, Praha 8, Praha 9');
		}
	}
	else if (selectElement.selectedIndex>=0 && selectElement.options[selectElement.selectedIndex].value=='Centrum') {
		addTextToInputField('advanced-county','Praha 1, Praha 2');
	}
	else if (selectElement.selectedIndex>=0 && selectElement.options[selectElement.selectedIndex].value=='Praha zapad') {
		addTextToInputField('advanced-county','Praha Západ');
	}
	else if (selectElement.selectedIndex>=0 && selectElement.options[selectElement.selectedIndex].value=='Praha vychod') {
		addTextToInputField('advanced-county','Praha Východ');
	}
	else {
		return addTextFromSelect('advanced-county-select','advanced-county');
	}
}
*/
function addDistrictFromSelect() {
	return addTextFromSelect('advanced-district-select','advanced-district');
}
function addMetroFromSelect() {
	addTextFromSelect('advanced-metro-select','advanced-metro_text');
	addValueFromSelect('advanced-metro-select','advanced-metro');
}
function addHotspotFromSelect() {
	addTextFromSelect('advanced-hotspot-select','advanced-hotspot_text');
	addValueFromSelect('advanced-hotspot-select','advanced-hotspot');
}
/*
function addFlatLayOutFromSelect() {
	addTextFromSelect('advanced-flat-lay-out-select','advanced-flat_lay_out_text');
	addValueFromSelect('advanced-flat-lay-out-select','advanced-flat_lay_out');
}
*/
function emptyMetro() {
	var inputTextEl = document.getElementById('advanced-metro_text');
	var inputHiddenEl = document.getElementById('advanced-metro');
	inputTextEl.value = '';
	inputHiddenEl.value = '';
}
function emptyHotspot() {
	var inputTextEl = document.getElementById('advanced-hotspot_text');
	var inputHiddenEl = document.getElementById('advanced-hotspot');
	inputTextEl.value = '';
	inputHiddenEl.value = '';
}
/*
function emptyFlatLayOut() {
	var inputTextEl = document.getElementById('advanced-flat_lay_out_text');
	var inputHiddenEl = document.getElementById('advanced-flat_lay_out');
	inputTextEl.value = '';
	inputHiddenEl.value = '';
}
*/

function changeAllSubtypes() {
	for (var i=0; i<this.relatedElement.length; i++) {
		this.relatedElement[i].checked = this.checked;
	}
}
function checkAndChangeAllElement() {
	var elementsSubtypes = document.advanced_more.elements['offer_subtype[]'];
	if (!this.checked && this.relatedElement.checked) {
		this.relatedElement.checked=false;
	}
	else if (this.checked && !this.relatedElement.checked) {
		var checkStatus = true;
		for (var i=0; i<elementsSubtypes.length; i++) {
			if (!elementsSubtypes[i].checked) {
				checkStatus = false;
				break;
			}
		}
		this.relatedElement.checked = checkStatus;
	}
}
function openCloseMap() {
	var elMap = document.getElementById('mapHolder');
	if (elMap.className.indexOf('closed')>0) {
		elMap.className = elMap.className.replace(' closed','');
		this.innerHTML = TXT_advanced_close_map;
	} else {
		elMap.className += ' closed';
		this.innerHTML = TXT_advanced_open_map;
	}
	return false;
}

function initAdvancedSearch() {
	document.getElementById('advancedOpenMap').onclick = openCloseMap;

	//elementAddCounty = document.getElementById('advanced-county-btn');
	elementAddDistrict = document.getElementById('advanced-district-btn');
	elementAddMetro = document.getElementById('advanced-metro-btn');
	elementAddHotspot = document.getElementById('advanced-hotspot-btn');
	//elementAddFlatLayOut = document.getElementById('advanced-flat-lay-out-btn');
	elementDelMetro = document.getElementById('advanced-metro-btn-delete');
	elementDelHotspot = document.getElementById('advanced-hotspot-btn-delete');
	elementDelFlatLayOut = document.getElementById('advanced-flat-lay-out-btn-delete');
	if (!elementAddDistrict || !elementAddMetro || !elementAddHotspot || !elementDelMetro || !elementDelHotspot) return false;
	//elementAddCounty.onclick = addCountyFromSelect;
	elementAddDistrict.onclick = addDistrictFromSelect;
	elementAddMetro.onclick = addMetroFromSelect;
	elementAddHotspot.onclick = addHotspotFromSelect;
	elementDelMetro.onclick = emptyMetro;
	elementDelHotspot.onclick = emptyHotspot;
	/*
	if (elementAddFlatLayOut && elementDelFlatLayOut) {
		elementAddFlatLayOut.onclick = addFlatLayOutFromSelect;
		elementDelFlatLayOut.onclick = emptyFlatLayOut;
	}
	*/

	elementCheckAll = document.getElementById('offer_subtype_all');
	if (elementCheckAll) {
		elementCheckAll.relatedElement = document.advanced_more.elements['offer_subtype[]'];
		elementCheckAll.onclick = changeAllSubtypes;
		for (var i=0,l=document.advanced_more.elements['offer_subtype[]'].length; i<l; i++) {
			document.advanced_more.elements['offer_subtype[]'][i].onclick = checkAndChangeAllElement;
			document.advanced_more.elements['offer_subtype[]'][i].relatedElement = elementCheckAll;
		}
	}
	
	document.getElementById('county_praha').onclick = function() {
		if (this.checked) {
			if (document.getElementById('advanced-map-type').value=='complex') {
				addTextToInputField('advanced-county','Praha 20, Praha 19, Praha 14, Praha 9, Praha 18, Praha 8, Praha 7, Praha 3, Praha 1, Praha 2, Praha 10, Praha 21, Praha 15, Praha 4, Praha 11, Praha 22, Praha 12, Praha 6, Praha 17, Praha 13, Praha 5, Praha 16');
				addTextToInputField('advanced-district','Dolní Počernice, Satalice, Vinoř, Štěrboholy, Čakovice, Ďáblice, Březiněves, Dolní Chabry, Trója, Běchovice, Klánovice, Koloděje, Dubeč, Dolní Měcholupy, Petrovice, Královice, Nedvězí, Kolovraty, Benice, Křeslice, Újezd, Šeberov, Kunratice, Libuš, Suchdol, Lysolaje, Nebušice, Přední Kopanina, Zličín, Velká Chuchle, Slivenec, Řeporyje, Lochkov, Zbraslav, Lipence');
			}
			else {
				addTextToInputField('advanced-county','Praha 4, Praha 7, Praha 10, Praha 3, Praha 1, Praha 2, Praha 5, Praha 6, Praha 8, Praha 9');
			}
		} else {
			if (document.getElementById('advanced-map-type').value=='complex') {
				removeTextFromInputField('advanced-county','Praha 20, Praha 19, Praha 14, Praha 9, Praha 18, Praha 8, Praha 7, Praha 3, Praha 1, Praha 2, Praha 10, Praha 21, Praha 15, Praha 4, Praha 11, Praha 22, Praha 12, Praha 6, Praha 17, Praha 13, Praha 5, Praha 16');
				removeTextFromInputField('advanced-district','Dolní Počernice, Satalice, Vinoř, Štěrboholy, Čakovice, Ďáblice, Březiněves, Dolní Chabry, Trója, Běchovice, Klánovice, Koloděje, Dubeč, Dolní Měcholupy, Petrovice, Královice, Nedvězí, Kolovraty, Benice, Křeslice, Újezd, Šeberov, Kunratice, Libuš, Suchdol, Lysolaje, Nebušice, Přední Kopanina, Zličín, Velká Chuchle, Slivenec, Řeporyje, Lochkov, Zbraslav, Lipence');
			}
			else {
				removeTextFromInputField('advanced-county','Praha 4, Praha 7, Praha 10, Praha 3, Praha 1, Praha 2, Praha 5, Praha 6, Praha 8, Praha 9');
			}
		}
	};
	document.getElementById('county_centrum').onclick = function() {
		if (this.checked) {
			addTextToInputField('advanced-county','Praha 1, Praha 2');
		} else {
			removeTextFromInputField('advanced-county','Praha 1, Praha 2');
		}
	};
	
	
	jQuery(function(){
		// Cena slider
		if (cenaNastavena[0]==null) {
			cenaNastavena[0] = cenaRozmezi[cenaMena][0];
		}
		if (cenaNastavena[1]==null) {
			cenaNastavena[1] = cenaRozmezi[cenaMena][1];
		}
		jQuery('#cenaSlider').slider({
			range: true,
			min: cenaRozmezi[cenaMena][0],
			max: cenaRozmezi[cenaMena][1],
			step: cenaKrok[cenaMena],
			values: cenaNastavena,
			slide: function( event, ui ) {
				if (ui.values[ 0 ]>jQuery('#cenaSlider').slider('option','min')) {
					jQuery('#cenaFrom').val(ui.values[ 0 ]);
				} else {
					jQuery('#cenaFrom').val('');
				}
				if (ui.values[ 1 ]<jQuery('#cenaSlider').slider('option','max')) {
					jQuery('#cenaTo').val(ui.values[ 1 ]);
					var cenaToPopisek =  number_format(ui.values[ 1 ],0,',',' ');
				} else {
					jQuery('#cenaTo').val('');
					var cenaToPopisek =  TXT_advanced_price_unlimited;
				}
				jQuery('#cenaPopisek').html(number_format(ui.values[ 0 ],0,',',' ') + "&ndash;" + cenaToPopisek  + '&nbsp;' + window.strCurrency);
			}
		});
		if (cenaNastavena[1]<jQuery('#cenaSlider').slider('option','max')) {
			var cenaToPopisek =  number_format(cenaNastavena[1],0,',',' ');
		} else {
			var cenaToPopisek =  TXT_advanced_price_unlimited;
		}
		jQuery('#cenaPopisek').html(number_format(cenaNastavena[ 0 ],0,',',' ') + "&ndash;" + cenaToPopisek  + '&nbsp;' + window.strCurrency);
		
		// Plocha slider
		if (plochaNastavena[0]==null) {
			plochaNastavena[0] = plochaRozmezi[0];
		}
		if (plochaNastavena[1]==null) {
			plochaNastavena[1] = plochaRozmezi[1];
		}
		jQuery('#plochaSlider').slider({
			range: true,
			min: plochaRozmezi[0],
			max: plochaRozmezi[1],
			step: plochaKrok,
			values: plochaNastavena,
			slide: function( event, ui ) {
				if (ui.values[ 0 ]>jQuery('#plochaSlider').slider('option','min')) {
					jQuery('#plochaFrom').val(ui.values[ 0 ]);
				} else {
					jQuery('#plochaFrom').val('');
				}
				if (ui.values[ 1 ]<jQuery('#plochaSlider').slider('option','max')) {
					jQuery('#plochaTo').val(ui.values[ 1 ]);
					var plochaToPopisek =  number_format(ui.values[ 1 ],0,',',' ');
				} else {
					jQuery('#plochaTo').val('');
					var plochaToPopisek =  TXT_advanced_price_unlimited;
				}
				jQuery('#plochaPopisek').html(number_format(ui.values[ 0 ],0,',',' ') + "&ndash;" + plochaToPopisek  + '&nbsp;m<sup>2</sup>');
			}
		});
		if (plochaNastavena[1]<jQuery('#plochaSlider').slider('option','max')) {
			var plochaToPopisek =  number_format(plochaNastavena[1],0,',',' ');
		} else {
			var plochaToPopisek =  TXT_advanced_price_unlimited;
		}
		jQuery('#plochaPopisek').html(number_format(plochaNastavena[ 0 ],0,',',' ') + "&ndash;" + plochaToPopisek  + '&nbsp;m<sup>2</sup>');
		
	});
	
	var elCurrency = document.getElementById('currencyHolder').getElementsByTagName('input');
	for (var i=0,l=elCurrency.length; i<l; i++) {
		elCurrency[i].onclick = function() {
			if (this.checked) {
				var cenaId = this.value;
				window.cenaMena = cenaId;
				window.strCurrency = this.relatedElement.innerHTML;
				/*
				jQuery('#cenaSlider').slider('options',{
					min: window.cenaRozmezi[cenaId][0],
					max: window.cenaRozmezi[cenaId][1],
					step: window.cenaKrok[cenaId]
				});
				*/
				jQuery('#cenaSlider').slider('option','min',window.cenaRozmezi[cenaId][0]);
				jQuery('#cenaSlider').slider('option','max',window.cenaRozmezi[cenaId][1]);
				jQuery('#cenaSlider').slider('option','step',window.cenaKrok[cenaId]);
				
				jQuery('#cenaSlider').slider('values',0,window.cenaRozmezi[cenaId][0]);
				jQuery('#cenaSlider').slider('values',1,window.cenaRozmezi[cenaId][1]);
				jQuery('#cenaPopisek').html( cenaRozmezi[cenaId][ 0 ] + "&ndash;" + TXT_advanced_price_unlimited + '&nbsp;' + window.strCurrency );
			}
		}
		var node = elCurrency[i].nextSibling;
		while (!node.tagName || node.tagName.toLowerCase()!='label') {
			node = node.nextSibling
		}
		elCurrency[i].relatedElement = node;
		if (elCurrency[i].checked && node) {
			strCurrency = elCurrency[i].relatedElement.innerHTML;
		}
	}
	if (document.getElementById('priceTypeHolder')) {
		var elPriceType = document.getElementById('priceTypeHolder').getElementsByTagName('input');
		for (var i=0,l=elPriceType.length; i<l; i++) {
			elPriceType[i].onclick = function() {
				if (this.checked) {
					window.cenaRozmezi = window.commCenaRozmezi[this.value];
					window.cenaKrok = window.commCenaKrok[this.value];
					/*
					jQuery('#cenaSlider').slider('options',{
						min: window.cenaRozmezi[cenaId][0],
						max: window.cenaRozmezi[cenaId][1],
						step: window.cenaKrok[cenaId]
					});
					*/
					jQuery('#cenaSlider').slider('option','min',window.cenaRozmezi[window.cenaMena][0]);
					jQuery('#cenaSlider').slider('option','max',window.cenaRozmezi[window.cenaMena][1]);
					jQuery('#cenaSlider').slider('option','step',window.cenaKrok[window.cenaMena]);
					
					jQuery('#cenaSlider').slider('values',0,window.cenaRozmezi[window.cenaMena][0]);
					jQuery('#cenaSlider').slider('values',1,window.cenaRozmezi[window.cenaMena][1]);
					jQuery('#cenaPopisek').html( cenaRozmezi[window.cenaMena][ 0 ] + "&ndash;" + TXT_advanced_price_unlimited + '&nbsp;' + window.strCurrency );
				}
			}
			var node = elCurrency[i].nextSibling;
			while (!node.tagName || node.tagName.toLowerCase()!='label') {
				node = node.nextSibling
			}
			elCurrency[i].relatedElement = node;
			if (elCurrency[i].checked && node) {
				strCurrency = elCurrency[i].relatedElement.innerHTML
			}
		}
	}
}
var strCurrency = null;
//addEventSimple(window,'load',initAdvancedSearch);
DomLoaded.load(initAdvancedSearch);
