var agt=navigator.userAgent.toLowerCase();
 var is_major = parseInt(navigator.appVersion);
 var is_minor = parseFloat(navigator.appVersion);

 var is_nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
                && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
                && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));
 var is_nav2 = (is_nav && (is_major == 2));
 var is_nav3 = (is_nav && (is_major == 3));
 var is_nav4 = (is_nav && (is_major == 4));
 var is_nav4up = (is_nav && (is_major >= 4));
 var is_navonly      = (is_nav && ((agt.indexOf(";nav") != -1) || (agt.indexOf("; nav") != -1)) );
 var is_nav6 = (is_nav && (is_major == 5));
 var is_nav6up = (is_nav && (is_major >= 5));


 var isIE4=(!document.getElementById&&document.all);
 var isIE5=(document.getElementById&&document.all);
 var isNN4= is_nav4;
 var isNN6= is_nav6up;

 function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}


var InternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
// Handle all the the FSCommand messages in a Flash movie
function flash_DoFSCommand(command, args) {
  var flashObj = InternetExplorer ? flash : document.flash;
  //
  // Place your code here...
  //
}
// Hook for Internet Explorer
if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 &&
	  navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
	document.write('<SCRIPT LANGUAGE=VBScript\> \n');
	document.write('on error resume next \n');
	document.write('Sub flash_FSCommand(ByVal command, ByVal args)\n');
	document.write('  call flash_DoFSCommand(command, args)\n');
	document.write('end sub\n');
	document.write('</SCRIPT\> \n');
}


var movieName = "testcommand";

function thisMovie(movieName)
{
//  if (navigator.appName.indexOf ("Microsoft") !=-1)   return window[movieName]
//  else                                                return document[movieName]

  if (navigator.appName.indexOf ("Microsoft") !=-1)   return window[movieName];
  else                                                return window.document[movieName];


}

function movieIsLoaded (theMovie)
{
  if (typeof(theMovie) != "undefined")  return theMovie.PercentLoaded() == 100;
  else                                 return false;
}

function go(theFrame)
{
	if (isNN4)
     	return;
	if (movieIsLoaded(thisMovie(movieName))) thisMovie(movieName).GotoFrame(theFrame)
}



	var MM_contentVersion = 6;
	var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
	if ( plugin )
     {
                var words = navigator.plugins["Shockwave Flash"].description.split(" ");
            for (var i = 0; i < words.length; ++i)
            {
                if (isNaN(parseInt(words[i])))
                continue;
                var MM_PluginVersion = words[i];
            }
        var MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion;
	}
	else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0  && (navigator.appVersion.indexOf("Win") != -1))
     {
        document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n'); //FS hide this from IE4.5 Mac by splitting the tag
        document.write('on error resume next \n');
        document.write('MM_FlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & MM_contentVersion)))\n');
        document.write('</SCR' + 'IPT\> \n');
	}



//############################## browser identification ################################################
//############################## browser identification ################################################
//############################## browser identification ################################################

 var agt=navigator.userAgent.toLowerCase();
 var is_major = parseInt(navigator.appVersion);
 var is_minor = parseFloat(navigator.appVersion);

 var is_nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
                && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
                && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));
 var is_nav2 = (is_nav && (is_major == 2));
 var is_nav3 = (is_nav && (is_major == 3));
 var is_nav4 = (is_nav && (is_major == 4));
 var is_nav4up = (is_nav && (is_major >= 4));
 var is_navonly      = (is_nav && ((agt.indexOf(";nav") != -1) || (agt.indexOf("; nav") != -1)) );
 var is_nav6 = (is_nav && (is_major == 5));
 var is_nav6up = (is_nav && (is_major >= 5));

// alert(is_nav4);

 var isIE4=(!document.getElementById&&document.all);
 var isIE5=(document.getElementById&&document.all);
 var isNN4= is_nav4;
 var isNN6= is_nav6up;


 CurrentMenu = 0;
 Closing = 0;
 Closing2 = 0;
 CanClose = 1;
 pradinis = 0;

 if (isNN4 ) pauze=700;
 else pauze = 10;

 //**************************** preload and swap functions **************************
 
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


 
//################################### menu dropdown ################################################################
//################################### menu dropdown ################################################################
//################################### menu dropdown ################################################################

function menu23_on(title, id)
{
	var ob = getas(title+ '2', id);
	ob.color= '#000000';

	var ob2 = getas(title, id);
	ob2.backgroundColor='#ffffff';

}

function menu23_off(title, id)
{
	var ob = getas(title+ '2', id);
	ob.color= '#FFFFFF';

	var ob2 = getas(title, id);
	ob2.backgroundColor='#994488';

}



function menu234_on(title, id)
{
	menu23_on(title, id);
}

function menu234_off(title, id)
{
	menu23_off(title, id);

}





function getas(title, id)
{
  if (isIE4) objektas = document.all(title + id).style;
  if (isIE5 || isNN6) objektas = document.getElementById(title + id).style;
  if (isNN4) objektas = document[title + id];
  return objektas;
}

function showlayer(id)
{
	popmenu = document.getElementById("menu3" + id).style;
  	if (popmenu == "undefined" || popmenu=="")
       	return;

  	if (Closing!=0) clearTimeout(TimeOut);
  	if (CurrentMenu!=0)
  	{
    	if (Closing2!=0)
    	{ 
			clearTimeout(TimeOut2);
		}



    	senaspopas = document.getElementById("menu3" + CurrentMenu).style;
    	senaspopas.visibility = 'hidden';
  	}
  	CurrentMenu=id;

	/*
	ob2 = document.getElementById('menu4' + id );

	
	var browserName=navigator.appName; 
	if (browserName=="Microsoft Internet Explorer")
	{ 
		var obj = ob2;
		var x = 0;

	    while (obj.offsetParent != null) 
		{
			x += obj.offsetLeft;
			obj = obj.offsetParent;
	    }
	    x += obj.offsetLeft;
		
		//alert(x);

		popmenu.left = (x + 2 )+'px';

	}
	else
	{
	
		popmenu.top = (ob2.y + 11 )+'px';
		popmenu.left = (ob2.x + 2 )+'px';

	}

	*/




  	popmenu.visibility = 'visible';
	WCH.Apply('menu3' + id);



}


function hidelayer(id)
{
//   off(id);
   tmp = getas ("menu3", id);
   tmp.visibility="hidden";
//   if(selected !=0 )   { pradinis=1; }
}

function trytohide(id)
{
  Closing=1;
  TimeOut=setTimeout("hidelayer("+id+")",pauze);
}


function changeimg(id, on)
{
	var src= '';
	if(on)
		src = 'img/menu/link' + id + '_a.gif';
	else
		src = 'img/menu/link' + id + '.gif';

	var im = document.getElementById("img" + id);
	im.src=src;

//	alert(im.src);

}

function rodom(id)   
{ 
	changeimg(id, 1);
	
	//menu234_on('menu', id);
	showlayer(id); 
}
function nerodom(id)
{
	changeimg(id, 0);

	if (isNN4 || isNN6 )  trytohide(id);
	else   hidelayer(id);
}

function rodom2(id)
{
  if (isNN4){ showlayer(id);}
  return false;
}

function nerodom2(id)
{
  if (isNN4) trytohide(id);
}

function change_color2(id,color)
{
  if (isNN4) return;
  if (selected==id ) return;
  change_color("td1_", id, color);
  change_color("td2_", id, color);
}

function change_color(title, id, color)
{
  tmp = getas(title, id );
  tmp.backgroundColor=color;
}


//############################################# menu expanded ######################################
//############################################# menu expanded ######################################
//############################################# menu expanded ######################################


//############################### spaudom meniu nuoroda ########################################
function goo(id,height)
{
 id = get_number(id);
  //isskliesim
  if (expanded[id]==0)
  {
   expanded[id]=1;
   expand_compress(id, 'expand', height);
  }
  //susklesim
  else
  {
   expanded[id]=0;
   expand_compress(id, 'compress', height);
  }
}

biski = 0;

//###################################### ar yra masyve ############################################
function in_array(value,mas)
{
  for (var i=0; i<mas.length; i++)
    if (mas[i] == value) return true;
 return false;
}

//#################################### isskliedziam reikiama ##################################

function expand_compress(id, action,height)
{
  for (var i=id+1; i<=layeriu_sk; i++)
  {
      topas = parseInt(document.all("menu_exp"+ expanded2[i]).style.top);
      if (action=='expand')
         topas +=  height * ( layers[id] ) + biski;
      else
         topas -=  height * ( layers[id] ) + biski;
      document.all("menu_exp"+ expanded2[i]).style.top=topas;

      if (layers[i]!=0)
      {
        topas = parseInt(document.all("menu_expv"+ expanded2[i]).style.top);
        if (action=='expand')
           topas +=  height * ( layers[id] ) + biski;
        else
           topas -=  height * ( layers[id] ) + biski;

        document.all("menu_expv"+ expanded2[i]).style.top=topas;
      }
  }
 if (action=='expand')
    document.all("menu_expv"+ expanded2[id]).style.visibility = "visible";
 else
    document.all("menu_expv"+ expanded2[id]).style.visibility = "hidden";
}

function get_number(id)
{
  for (i=1; i<=layeriu_sk; i++)
    if (expanded2[i]==id) return i;
  return 0;
}



