
function openprint(mystring, titleval){ 
	var path = "";
	if(window.location.href.indexOf('index.html') == -1) path = "../../";
	var win=window.open("", "newwin", "toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=yes, width=625, height=700");
	win.moveTo(screen.availWidth/2-360,screen.availHeight/2-280);
	win.document.write('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>' + titleval + '</title><style type="text/css">body { color: #000 !important } td, th, input, textarea, button, h1, h2, h3, h4, h5, h6, div, span, p  { color: #000 !important } #print, #doc, .button { display:none } h3 { padding: 0; margin: 0 } table.print_head { width:100%; border:none } table.print_head td { font-size:10px; border:none } h1 { padding-left:0px !important; background:none !important } .navigation { display:none } #contenttext { text-align: justify; } #contenttext p { text-indent:36.0pt; margin: 0; padding: 0} .gallery td{ border: 0px; vertical-align: top; } .gallery span { line-height: 100%; 	font-size: 10pt; } .sitemaptree ul li { 	} .sitemaptree ul { 	padding-left: 15px; } #contentlinks a { 	font-size: 12px; }</style></head><body><h3>'+ titleval +'</h3><hr size="1" style="margin-bottom:15px"><div id="contenttext">' + mystring + '</div><script type="text/javascript">print()</script></body></html>');
	win.document.close();
}

function changelang(lang) {
	if ( location.href ) {
		var gotourl = '';
		var url = location.href;
		if ( lang == 'lt' ) {
			if ( url.indexOf('/en/',0) > 0 ) {
				gotourl = url.replace('/en/','/lt/');
				var hashplace = gotourl.indexOf('#');
				var urllength = gotourl.length;
				if (hashplace == urllength) {
					gotourl = gotourl.replace('#','');
					window.location.href=gotourl;
				}
				else {
					gotourl = gotourl.split("#", 1);
					window.location.href=gotourl;
				}
			}
		} else if ( lang == 'en' ) {
			if ( url.indexOf('/lt/',0) > 0 ) {
				gotourl = url.replace('/lt/','/en/');
				var hashplace = gotourl.indexOf('#');
				var urllength = gotourl.length;
				if (hashplace == urllength) {
					gotourl = gotourl.replace('#','');
					window.location.href=gotourl;
				}
				else {
					gotourl = gotourl.split("#", 1);
					window.location.href=gotourl;
				}
			}
		}	
	}
	return;
}

function backToTop() {
    var x1 = x2 = x3 = 0;
    var y1 = y2 = y3 = 0;

    if (document.documentElement) {
        x1 = document.documentElement.scrollLeft || 0;
        y1 = document.documentElement.scrollTop || 0;
    }

    if (document.body) {
        x2 = document.body.scrollLeft || 0;
        y2 = document.body.scrollTop || 0;
    }

    x3 = window.scrollX || 0;
    y3 = window.scrollY || 0;

    var x = Math.max(x1, Math.max(x2, x3));
    var y = Math.max(y1, Math.max(y2, y3));

    window.scrollTo(Math.floor(x / 2), Math.floor(y / 2));

    if (x > 0 || y > 0) {
        window.setTimeout("backToTop()", 25);
    }
}

function checkImage(loc) {
	loc = "imagePopup.html?" + loc;
	windowprops = 'menubar=0,toolbar=0,status=0,location=0';
	popupWindow = open(loc, 'Nuotrauka', windowprops);
	if (popupWindow.opener == null) popupWindow.opener = self;
}