var x, thisItem;

// zobraz / skryj
function _aktuality (i) {
	var thisItem1 = myGet('akt_' + i + '_short');
	var thisItem2 = myGet('akt_' + i);
	var thisLink = myGet('akt_' + i + '_link');
	
	if (thisItem1 && thisItem2 && thisLink) {
		thisItem1.className = 'hidden';
		thisItem2.className = 'visible';
		thisLink.className = 'hidden';
	}
}

// kurzy
function _kurz (id, pocet) {
	for (x = 1; x <= pocet; x++) {
		thisItem = myGet('kurz_' + x);
		if (thisItem) {
			thisItem.className = id == -1 ? 'visible' : 'hidden';
		}
	}
	
	if (id > 0) {
		thisItem = myGet('kurz_' + id);
		if (thisItem) {
			thisItem.className = 'visible';
		}

		thisItem = myGet('kurz_form');
		if (thisItem) {
			thisItem.className = 'visible';
		}
		
		thisItem = myGet('kurz_select');
		if (thisItem) {
			thisItem.selectedIndex = id - 1;
		}
	} else if (id == -1) {
		thisItem = myGet('kurz_form');
		if (thisItem) {
			thisItem.className = 'hidden';
		}
	}
}

// zobraz / skryj
function _show (id) {
	var thisItem = myGet(id);
	
	if (thisItem) {
		if (thisItem.className == "" || thisItem.className == "visible") {
			thisItem.className = 'hidden';
		} else {
			thisItem.className = 'visible';
		}
	}
}

// AJAX
function _load_JS (url) {
	var script = document.createElement('script');
	var thisHead = document.getElementsByTagName('head')[0];

	if (js_id > 0) {
		thisHead.removeChild(thisHead.lastChild);
	}
	
	js_id++;
	script.id = 'scriptLoader';
	script.src = url;

	if (typeof(thisHead.appendChild(script)) != "undefined") {
		return true;
	} else {
		return false;
	}
}

// hlasovani do ankety
function _anketa (id) {
	var thisForm = myGet('anketa_form');
	var thisInput = myGet('anketa_odpoved');
	
	if (thisForm && thisInput) {
		thisInput.value = id;
		thisForm.submit();
	}
}


// získání elementu
function myGet (name) {
	if (document.getElementById)
		return document.getElementById(name);
	else if (document.all)
		return document.all(name);
	else
		return null;
}
