function getEl(id) { 
	if (document.getElementById)
		return document.getElementById(id);
	else if (document.all)
		return document.all[id];
	else
		return null;
}

function ps(id, focusThis) {
	if (el = getEl(id)) {
		if (el.style.display == "none") {
			el.style.display = "block";
			if ((fel = getEl(focusThis)) ) {
				fel.focus();
				fel.blur();
			}
		} else 
			el.style.display = "none";
	}
}

function setCookie(name, value, expire) { // zemeno od DevEdge JavaScript Guide
	document.cookie = name + "=" + escape(value) + 
		((expire == null) ? "" : ("; expires=" + expire.toGMTString()));
}


function getCookie(name) { // zemeno od DevEdge JavaScript Guide
	var search = name + "=";
	if (document.cookie.length > 0) { // if there are any cookies
		offset = document.cookie.indexOf(search);
		if (offset != -1) { // if cookie exists
			offset += search.length; // set index of beginning of value
			end = document.cookie.indexOf(";", offset); // set index of end of cookie value
			if (end == -1)
				end = document.cookie.length;
			return unescape(document.cookie.substring(offset, end));
		}
	}
}


function snimiSostojba(id) {
	var value = (getEl(id).style.display=="none")? "off" : "on";
	setCookie(id, value);
}


function sost(id) {
//	var display = (getCookie(id)=="off")? "none" : "block";
	var display = (getCookie(id)=="on")? "block" : "none";
	return display;
}


function divBegin(id) {
	var divTag	= '<div id="' + id + '" ' 
	            + 'style="display:' + sost(id) + '">';

	document.write(divTag);
}

function divEnd() { document.write("</div>") }

	
function window_onUnload() {
	snimiSostojba("zv");
	snimiSostojba("firmi");
}


window.onunload = window_onUnload;

