// JavaScript Document
function getObj(name) {
	if (document.getElementById) {
		this.obj = document.getElementById(name);
		this.style = document.getElementById(name).style;
	} else if (document.all) {
		this.obj = document.all[name];
		this.style = document.all[name].style;
	} else if (document.layers) {
		if (document.layers[name]) {
			this.obj = document.layers[name];
			this.style = document.layers[name];
		} else {
			this.obj = document.layers.testP.layers[name];
			this.style = document.layers.testP.layers[name];
		}
	}
}
function showFirst () {
	var elem = new getObj("photos");
	for (var i = 0; i <= elem.obj.childNodes.length; i++) {
		var temp = getElemId (elem.obj.childNodes[i]);
		if (temp != null) {
			if (temp.substring(0, 5) == "photo") {
				elem.obj.childNodes[i].style.display = "block";
				break;
			}
		}
	}
}
function ShowImg(a) {
	var elem = new getObj("photos");
	for (var i = 0; i <= elem.obj.childNodes.length; i++) {
		var temp = getElemId (elem.obj.childNodes[i]);
		if (temp != null) {
			if (temp.substring(0, 5) == "photo") {
				if (temp.substring(5, temp.length) == a) {
					elem.obj.childNodes[i].style.display = "block";
				} else {
					elem.obj.childNodes[i].style.display = "none";
				}
			}
		}
	}
}
function getElemId(elem) {
	if (elem != null) {
		if (elem.attributes != null) {
			for (var x = 0; x < elem.attributes.length; x++ ) {
				if (elem.attributes[x].nodeName.toLowerCase() == 'id') {
					return elem.attributes[x].nodeValue;
				}
			}
		}
	}
}
function printme() {
	this.print();
}
function openDetail(el) {
	var bbIE = !window.innerHeight; // rozliseni IE x M 
	var s = "no";
	if (!bbIE) s = "yes";
    adr=el.href;
	var wName = "anfas" + el.href.replace(/[^a-zA-Z0-9]/gi, "");
	var w = window.open(adr, wName, "width=760, height=860, scrollbars=yes, resizable=yes");
	w.focus();
	return false;
}
function openPhoto(el) {
	var bbIE = !window.innerHeight; // rozliseni IE x M 
	var s = "no";
	if (!bbIE) s = "yes";
    adr=el.href;
	var wName = "anfas" + el.href.replace(/[^a-zA-Z0-9]/gi, "");
	var w = window.open(adr, wName, "width=800, height=700, scrollbars=no, resizable=yes");
	w.focus();
	return false;
}
function OpenPhotoDetail(el) {
	var bbIE = !window.innerHeight; // rozliseni IE x M
	var s = "no";
	if (!bbIE) s = "yes";
    adr=el.href;
	var wName = "cpjphoto" + el.href.replace(/[^a-zA-Z0-9]/gi, "");
	// pokud to ma byt jen okno, pak bez parametru
	// wName zajistuje otevreni kazdeho projektu ve zvlastnim okne
	var w = window.open(adr, wName, "width=700, height=800, scrollbars=0, resizable=yes");
	w.focus();
	return false;
}
function initPrint(cssFile) {
  document.getElementById("print_btn").onclick = function() {
	
    var printStyle_all = document.getElementById("print_style");
    var printStyle_menu = printStyle_all.cloneNode(false);
		printStyle_menu.media = "print";
    printStyle_menu.href = cssFile; 
    var parentEl = printStyle_all.parentNode;    
    parentEl.replaceChild(printStyle_menu, printStyle_all);
    
    window.print();
  }
}

