function hideAll(what, context, tag) {
	var lists = new Array();
	if(context == "document") {
		var lists = getElementsByClassName(document, tag, what);
	} else {
		var lists = getElementsByClassName(document.getElementById(context), tag, what);
	}
	
	for(i = 0; i < lists.length; i++) {
		lists[i].style.display = "none";
	}
}

function openDesc(n) {
	var e = document.getElementById("desc_" + n);
	if(e.style.display == "none") {
		e.style.display = "block";
	} else {
		e.style.display = "none";
	}
}

function showSubpage(n) {
	hideAll("subpgs", "document", "div");
	
	document.getElementById("box_" + n).style.display = "block";
}

function obnov_obraz() {
	now = new Date();
    document.getElementById("webcamimg").src = "/" + PATH + "camera.php?time=" + now.getTime();
    setTimeout('obnov_obraz()', 5000);
}

function showCamera() {
	if(document.getElementById("webcamimg").src.search("camera") > -1) {
		openPhoto("../camera/webcam.jpg");
	}
}

function openPhoto(path) {
	
	var params = "path=" + chnEncode(path);
	var result = parseResult(loadResultOnly("/" + PATH + "scm/photo_size", params));
	
	window.open("http://www.cbar.cz/" + PATH + "photo.php?path=" + escape(path), "photo", "width=" + result[0] + "px, height=" + result[1] + "px, noresizable, left=100px, top=100px")
}
