function find_div(t,cn){
	for(i=0; i<t.childNodes.length; i++){
		if(t.childNodes[i].tagName=='DIV' && t.childNodes[i].className==cn){
			return t.childNodes[i];
			break;
		}
	}
	return false;
}

var open_obj=new Object();
var curent_obj=new Object();
var allow_hide=true;

function sh_mclass(t,clas){
	if(curent_obj==t){
		allow_hide=false;
	}
	else{
		allow_hide=true;
		hide_obj(true);
		curent_obj=t;
		curent_obj.restoreClass=t.className;
		curent_obj.isset=true;
		var layer=find_div(t,'abs_pos');
		if(layer){
			layer.style.left=document.getElementById('b_table').offsetLeft+177;
			layer.style.visibility='visible';
			open_obj=layer;
			open_obj.style.opacity=1;
			open_obj.style.filter='alpha(opacity=100)';
		}
		t.className=clas;
		allow_hide=false;
		hide_obj();
	}
}
function hd_mclass(t,clas){
	allow_hide=true;
}

function hide_obj(){
	if(allow_hide){
		if(curent_obj.isset){
			curent_obj.className=curent_obj.restoreClass;
			curent_obj=false;
		}
		if(open_obj.style){
			if(arguments[0]){
				open_obj.style.visibility='hidden';
				open_obj=false;
			}
			else{
				nice_hide();
			}
		}
	}
	else{
		setTimeout("hide_obj();", 1000);
	}
}

function nice_hide(){
	if(open_obj && allow_hide){
		if(open_obj.style.opacity>0.2){
			var new_opac=Math.round(open_obj.style.opacity/0.011);
			open_obj.style.opacity=(new_opac/100);
			open_obj.style.filter='alpha(opacity='+new_opac+')';
			setTimeout("nice_hide();", 50);
		}
		else{
			open_obj.style.visibility='hidden';
			open_obj=false;
		}
	}
}

var img_preloaded=new Array();
function preload_img(){
	if(my_img){
		for(var i=0; i<my_img.length; i++){
			img_preloaded[i] = new Image();
			img_preloaded[i].src = base_root+my_img[i];
		}
	}
}

function set_pos_new(){
	setTimeout("do_bott()",300);
	}
function do_bott(){
	
    var minusas=313;//386;
	if(document.images){
	    document.images.scr_h.height=1;
	    if(document.all){
		var agt = navigator.userAgent.toLowerCase();
		if(typeof(document.body.offsetHeight)=='undefined' || (agt.indexOf("msie")==-1) && agt.indexOf("gecko")!=-1){
			hh=document.body.scrollHeight;
		}
		else{
			hh=document.body.offsetHeight+((agt.indexOf("msie") != -1 && (agt.indexOf("opera") == -1))?(-4):0);
		}
	    }
	    else{
		hh=document.body.scrollHeight;
	    }
	    document.images.scr_h.height=(((hh-minusas)>0) ? (hh-minusas):1);
	}
}


function print_v(lang){
	if(!arguments[0]){
	lang='lt';
	}
	var kontaktai=print_page_kontakts.replace(/\|/g,'<br>');
var ww=535;
var hh=600;
var tops=(screen.height-hh)/2;
var lefts=(screen.width-ww)/2;
var settings='top='+tops+', left='+lefts+', width='+ww+', height='+hh+',';
	settings+="scrollbars=1, resizable=1, status=0, toolbar=0, menubar=0, location=0";
var mypage = '';
var myname='vs_print';
var logo_headas='';
var logo_headas="<table border=0 cellpadding=10 cellspacing=0 style=\"color:#666666; font-size:10px; padding-left:5px; width:100%;\">\
<tr>\
<td valign=middle><h1>"+print_page_title+"</h1></td>\
<td valign=middle><p>"+kontaktai+"</p></td>\
</tr></table>";
logo_headas+="<table width=\"100%\" border=0 cellpadding=3 cellspacing=0><tr>\
<td id=\"titlas\" style=\"color:#000000; font-size:14px; font-weight:bold; padding-left:5px; border-bottom:1px solid #999999;\">"+print_page_info_tit+"</td></tr></table>";

var myturinys="<"+'!'+"DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">\
<html>\
<head>\
<title>"+document.title+" - "+print_tit+"</title>\
<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\
<script type=\"text/javascript\">\
msg='"+status_txt+"';\
</script>\
<script type=\"text/javascript\" src=\""+base_root+"print.js\"></script>\
<LINK href=\""+base_root+"style.css\" type=text/css rel=STYLESHEET>\
<LINK href=\""+base_root+"add_style.css\" type=text/css rel=STYLESHEET>\
<LINK href=\""+base_root+"print_style.css\" type=text/css rel=STYLESHEET>\
</head>\
<body style=\"margin:20px 20px 20px 20px;\" onload=\"get_content();\">\
<div id=\"printer\"><a href=\"javascript:to_printer();\">"+print_btn+"</a><br><br></div>\
"+logo_headas+"\
<center>\
<table  width=\"100%\" border=0 cellpadding=5 cellspacing=0><tr><td id=\"base\"></td></tr></table>\
</center>\
</body>\
</html>";
var pavas=window.open(mypage,myname,settings);
pavas.document.open();
pavas.document.write(myturinys);
pavas.document.close();
}
