function open_doc(cime,szelesseg,magassag,ablak){
	if (typeof usrwindow != 'undefined'){
		if (!usrwindow.closed) usrwindow.close();
	}

	pozx = (screen.width) ? (screen.width-szelesseg)/2 : 0;
	pozy = (screen.height) ? (screen.height-magassag)/2 : 0;
	usrwindow = window.open(cime, ablak, 'resizable=no,scrollbars=no,hotkeys=yes,width='+szelesseg+',height='+magassag+',top='+pozy+',left='+pozx);
}

/* thumbos galeri */ 
function showGalleryThumb(o) {
	var i = 0;
	while (i < o.childNodes.length && o.childNodes[i].tagName != 'IMG') i++;
	document.getElementById('bigpicture').src = o.childNodes[i].src.replace('?options=width:120;height:77;quality:60;', '?options=width:550;height:415;quality:100;');
	document.getElementById('bigpic_caption').innerHTML = o.getAttribute('caption');
	document.getElementById('bigpic_subcaption').innerHTML = o.getAttribute('subcaption'); 

	var old = document.getElementById('selected');
	if (old != null) old.id = '';
	o.id = 'selected';
	document.getElementById('leftnyil').style.visibility = (mozillaFriendlyPreviousSibling(o) == null ? 'hidden' : 'visible');
	document.getElementById('rightnyil').style.visibility = (mozillaFriendlyNextSibling(o) == null ? 'hidden' : 'visible');
}

function mozillaFriendlyPreviousSibling(s) {
	/* needs finer implementation */
	if (s != null) {
		var n = s;
		do {
			n = n.previousSibling;
		} while (n != null && n.tagName != 'DIV');
		return n;
	}
}

function mozillaFriendlyNextSibling(s) {
	/* needs finer implementation */
	if (s != null) {
		var n = s;
		do {
			n = n.nextSibling;
		} while (n != null && n.tagName != 'DIV');
		return n;
	}
}

function showGalleryLeft() {
	var s = document.getElementById('selected');
	if (s != null) {
		var n = mozillaFriendlyPreviousSibling(s);
		if (n != null) showGalleryThumb(n);
	}	
}

function showGalleryRight() {
	var s = document.getElementById('selected');
	if (s != null) {
		var n = mozillaFriendlyNextSibling(s);	
		if (n != null) showGalleryThumb(n);
	}	
}

