function formuoti_pranesima(klaidos) {
    if (klaidos.length==1) 
        pranesimas = "Klaida!\n"+klaidos[0]+".";
    else {
        pranesimas = "Klaidos!"; 
        for (i=1; i<=klaidos.length; i++)
           pranesimas += "\n"+i+". "+klaidos[i-1]+".";
    }
    return pranesimas;
}

function findParentTag(obj, tag){
	obj=obj.parentNode;
	while(obj.tagName.toLowerCase() != tag.toLowerCase()){
		obj=obj.parentNode;
	}
	return obj;
}
function findChildTag(t, tag){
	for(var i=0; i<t.childNodes.length; i++){
		if(t.childNodes[i].tagName.toLowerCase() == tag.toLowerCase()){
			return t.childNodes[i];
			break;
		}
	}
	return false;
}

function top_meniu(t){
	
	var container=findParentTag(t, 'div');
	if(container){
		container.className=((container.className=='on')?'':'on');
	}
	var div=findChildTag(container, 'div');
	if(div){
		div.onmouseout=function(){top_meniu(t);};
		div.onmouseover=function(){top_meniu(t);};
	}
}

//////////////////////////////////////////////////////////
function fixTopSub(){
	if(arguments.length > 0){
		var base_offset=0;
		var childs = document.getElementById(arguments[arguments.length-1]).childNodes;
		if(childs.length > 0){
			for(var k=0; k < childs.length; k++){
				if(childs[k].tagName.toLowerCase() == 'div'){
					var subdiv=findChildTag(childs[k], 'div');
					var link=findChildTag(childs[k], 'a');
					if(link){
						link.onmouseover=function(){ top_meniu(this);};
						link.onmouseout=function(){ top_meniu(this);};
					}
					if(subdiv && subdiv.className=='sub'){
						subdiv.style.left = (base_offset + childs[k].offsetLeft) + 'px';   
					}
				}
			}
		}
	}
}

function set_pos_new(){
	setTimeout("do_bott()",300);
	}
function do_bott(){
	var sc_hh=0;
	var of_hh=0;
	if(document.body.scrollHeight) sc_hh=document.body.scrollHeight;
	if(document.body.offsetHeight) of_hh=document.body.offsetHeight;
	var hh=((sc_hh>of_hh)?sc_hh:of_hh);
	hh=hh-420;
	var h_obj=null;
	if(document.getElementById('content')){
		h_obj=document.getElementById('content');
	}
	else if(document.getElementById('content_index')){
		h_obj=document.getElementById('content_index');
	}
	if(h_obj){
	if(hh>h_obj.offsetHeight){
		var agt = navigator.userAgent.toLowerCase();
		if(agt.indexOf("msie") != -1 && agt.indexOf("opera") == -1){
			hh=hh-4;
		}
		h_obj.style.height=hh+'px';
	}
	}
}

function show_active(subm, visible) 
{
	if (visible == true)
	{
		document.getElementById(subm).style.backgroundColor = '#E15718';
		
	}
	else 
	{
		document.getElementById(subm).style.backgroundColor = '#000000';
		
	}
}

function show_submenu(subm, cur, visible) {
	show_active(cur, visible); 
    document.getElementById(subm).style.visibility = visible?'visible':'hidden';
	document.getElementById(subm).style.width = document.getElementById(cur).style.width;
}

