
function showMoreAttributes(att1, att2, shhd) {

	if (shhd=='show') {
		document.getElementById(att1).style.display = 'block';
		document.getElementById(att2).style.display = 'block';
		document.getElementById('btt_podrobnejsie').style.display = 'none';
		document.getElementById('btt_skryt').style.display = 'block';
	} else if (shhd=='hide') {
		document.getElementById(att1).style.display = 'none';
		document.getElementById(att2).style.display = 'none';
		document.getElementById('btt_podrobnejsie').style.display = 'block';
		document.getElementById('btt_skryt').style.display = 'none';
	}
}

function showHidePrimary(which) {

	if(which==1) { // zobrazit detailnu charakteristiku nehnutelnosti

	if (document.getElementById('btt_podrobnejsieA').style.display == "block") {
		//zobraz podrobnosti
		document.getElementById('btt_skrytA').style.display = 'block';
		document.getElementById('btt_podrobnejsieA').style.display = 'none';

		document.getElementById('primary_attributes').style.display = 'none';
		document.getElementById('secondary_attributes').style.display = 'block';

	} else {
		//zobraz zakladny pohlad
		document.getElementById('btt_skrytA').style.display = 'none';
		document.getElementById('btt_podrobnejsieA').style.display = 'block';

		document.getElementById('secondary_attributes').style.display = 'none';
		document.getElementById('primary_attributes').style.display = 'block';
	}


} else if (which==2) {

	if (document.getElementById('btt_podrobnejsie').style.display == "block") {
		//zobraz podrobnosti
		document.getElementById('btt_skryt').style.display = 'block';
		document.getElementById('btt_podrobnejsie').style.display = 'none';
		if (document.getElementById('descFull')) {
			document.getElementById('descFull').style.display = 'block';
			document.getElementById('descPerex').style.display = 'none';
		}


	} else {
		//zobraz zakladny pohlad
		document.getElementById('btt_skryt').style.display = 'none';
		document.getElementById('btt_podrobnejsie').style.display = 'block';
		if (document.getElementById('descFull')) {
			document.getElementById('descFull').style.display = 'none';
			document.getElementById('descPerex').style.display = 'block';
		}
	}


}


}


function check(form,nazovinputu){

	flg = 0;

	var group = form.elements[nazovinputu + '[]'];

	for (i=0; i<group.length; i++){

		if (group[i].checked == true){
			$flg=1;
			break;
		} else {
			$flg=0;
		}
	}

	if ($flg==0) {
		alert('Vyberte prosím minimálne jednu položku.');
		return false;
	} else if ($flg==1) {
		return true;
	}

}


function checkB(form, nazovinputu){

	flg = 0;

	//ig 26.4.2008
	//toto hadze donemoty JS chybu
	//ja to uprimne ani neviem opravit lebo robim s getElementById() takze forwardujem na tomasa
	var group = form.elements[nazovinputu + '[0]'];

//alert(group);


	for (i=0; i<group.length; i++) {
		if (group[i].checked == true){
			$flg = 1;
			break;
		} else {
			$flg = 0;
		}
	}

	if ($flg == 0) {
		alert('Vyberte prosím minimálne jednu polozku.');
		return false;
	}
	else if ($flg==1) {
		return true;
	}

}


function checkAll(checkbox, theCommonNodeName) {

	theCommonNodeName = theCommonNodeName.toLowerCase();
	var theCommonNode = checkbox.parentNode;
	while(theCommonNode.nodeName.toLowerCase() != theCommonNodeName && theCommonNode != document) {
		theCommonNode = theCommonNode.parentNode;
	}

	if (theCommonNode.nodeName.toLowerCase() != theCommonNodeName) {
		alert("Common parent node could not be found");
		return;
	}

	var inputs = theCommonNode.getElementsByTagName("input");
	for(var i=0; inputs[i]; i++) {
		if(inputs[i].type == "checkbox") {
			inputs[i].checked = checkbox.checked;
		}
	}
}


function fieldfilter(evnt, regex) {

    var theChar="", theRegExp=/[0-9,\010]/, bFound=false;

    if(document.all) {
      evnt=window.event;
 	  theChar=String.fromCharCode(evnt.keyCode);
    if(!evnt.shiftKey) theChar=theChar.toLowerCase();
       bFound=regex.test(theChar);
       evnt.returnValue=bFound;
    } else if (document.layers) {
       theChar=String.fromCharCode(evnt.which);
       bFound=regex.test(theChar)
    } else {
       theChar = String.fromCharCode(evnt.charCode);
       bFound = (evnt.keyCode!=0) || regex.test(theChar);
       evnt.cancelBubble=!bFound;
    }
    return bFound;
}

function flashToJs(id) {

	document.getElementById(id).checked=true;
	exit;

}

function flashToJsUn(id) {

	document.getElementById(id).checked=false;
	exit;

}


function setCheckedValue(radioObj, newValue) {
	if(!radioObj)
	return;
	var radioLength = radioObj.length;
	if(radioLength == undefined) {
		radioObj.checked = (radioObj.value == newValue.toString());
		return;
	}
	for(var i = 0; i < radioLength; i++) {
		radioObj[i].checked = false;
		if(radioObj[i].value == newValue.toString()) {
			radioObj[i].checked = true;
		}
	}
}

function checkUnCheckAll(form,bool) {                            

	var el = document.getElementById(form);
	var x = el.getElementsByTagName('input');

	for (i = 0; i < x.length; i++) {
		x[i].checked = bool;
	}

}

function doCheckbox(element_id) {

	var el = document.getElementById(element_id).checked;
	
	if(el===true) {
		document.getElementById(element_id).checked=false;
	} else {
		document.getElementById(element_id).checked=true;
	}

}

function initMenu() {
	$('.menu_inf ul').hide();
	$('.menu_inf .shownav').show();
	$('.menu_inf li a').click(
		function() {
			$(this).next().slideToggle('normal');
			$(".menu_inf .shownav").removeClass("shownav");
		}
	);
	}

$(document).ready(function() {initMenu();});