function show_box( id ) {
	obj = document.getElementById(id);
	sobj = document.getElementById( "a"+ id );
	if ( obj.style.display == "none" || obj.style.display == "" ) {
		obj.style.display = "block";
		sobj.innerHTML = "<<<";
	} else {
		obj.style.display = "none";
		sobj.innerHTML = ">>>";
	}
}

function show_pdf() {
	document.getElementById("pg-pdf-main").style.display = "block";
	document.getElementById("pdf_close").style.display = "block";
}

function hide_pdf() {
	document.getElementById("pg-pdf-main").style.display = "none";
	document.getElementById("pdf_close").style.display = "none";
}

onload = init;

function init() {
	changeMail();
	initpopup();
}

function changeMail() {
	oA = document.getElementsByTagName( "A" );
	for( i = 0; i < oA.length; i++ ) {
		if ( oA[ i ].getAttribute( "class" ) == "mail" ) {
			oAHref = oA[ i ].getAttribute( "href" );
			oACont = oA[ i ].innerHTML;
			if ( oA[ i ].getAttribute( "href" ).indexOf( "###kukac###" ) != -1 ) {
				oA[ i ].setAttribute( "href", "mailto:"+ oA[ i ].getAttribute( "href" ).replace( "###kukac###", String.fromCharCode(64) ) );
			}
			if ( oA[ i ].innerHTML.indexOf( "###kukac###" ) != -1 ) {
				oA[ i ].innerHTML = oA[ i ].innerHTML.replace( "###kukac###", String.fromCharCode(64) );
			}
		}
	}
}

function initpopup() {
	oImgA = document.getElementsByTagName("A");
	for( i=0; i<oImgA.length; i++) {
		if ( oImgA[i].className == "popup" ) {
			oImgA[i].onclick = function () {
				showImage(this);
				return false;
			}
		}
	}
}

function showImage( oObj ) {
//	alert( oObj.getAttribute("href"));
	pic = oObj.getAttribute("href");
	
	/*settings = 'top=0,left=0,height=100,width=100,scrollbars=no,resizable=0';

	win = window.open('','WindowImg',settings);
	win.document.open('text/html');
	win.document.write('<title>Galéria</title>');
	win.document.write('<script type="text/javascript">');
	win.document.write('onload=initpopupwindow;');
	win.document.write('function initpopupwindow() {');
	win.document.write('document.images[0].border=0;');
	win.document.write('iWidth = document.body.clientWidth;');
	win.document.write('iHeight = document.body.clientHeight;');
	win.document.write('iWidth = document.images[0].width - iWidth + 16;');
	win.document.write('iHeight = document.images[0].height - iHeight;');
	win.document.write('if (document.all && !window.opera ) { iWidth -= 17; iHeight -= 34;}');	
	win.document.write('window.resizeBy(iWidth, iHeight);');
	win.document.write('oX = (window.screen.width - document.images[0].width)/2;');
	win.document.write('oY = (window.screen.height - document.images[0].height)/2;');
	win.document.write('window.moveTo(oX,oY);');
	win.document.write('self.focus();');
	win.document.write('}');
	win.document.write('</script>');
	win.document.write('<body id="bodypopup" bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">');
	win.document.write('<a href="javascript://" onClick="window.close();"><img id="popupimg" src="'+ pic +'" onfocus="blur();" border="0"></a>');
	win.document.writeln('</body>');
	win.document.close();*/
	
	str_img = '<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0"><tr><td align="center" valign="middle"><a href="javascript://" onClick="document.getElementById(\'pg-images\').style.display=\'none\';"><img id="popupimg" src="'+ pic +'" onfocus="blur();" border="0"></a></td></tr></table>';
	document.getElementById("pg-images").innerHTML = str_img;
	document.getElementById("pg-images").style.display = "block";
}

function showsub() {
	document.getElementById("pg-left-li").style.height = "56px";
	document.getElementById("pg-left-ul").style.height = "144px";
	document.getElementById("pg-left-ulsub").style.display = "block";
}

function hidesub() {
	document.getElementById("pg-left-li").style.height = "30px";
	document.getElementById("pg-left-ul").style.height = "118px";
	document.getElementById("pg-left-ulsub").style.display = "none";
}
