//############################## 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));

 var isIE4=(!document.getElementById&&document.all);
 var isIE5=(document.getElementById&&document.all);
 var isNN4= is_nav4;
 var isNN6= is_nav6up;

 CurrentMenu = 0;
 Closing = 0;
 CanClose = 1;
 pradinis = 0;

 if (isNN4 ) pauze=700;
 else pauze = 10;


 //Browsercheck
ie=document.all?1:0
n=document.layers?1:0

if (isIE5 || isNN6 || isIE4) ie=1;

/*********************************************************************************
These are the variables you have to set:
*********************************************************************************/

//The speed of the timeout between each scroll.
timSpeed=50

//The height of the container (change this when it scrolls to much or to little)
contHeight=100

/*********************************************************************************
This is the object constructor function, which applies
methods and properties to the crossbrowser layer object
*********************************************************************************/
function makeScrollObj(obj,nest,topas){
        nest=(!nest) ? '':'document.'+nest+'.'

//        this.css=(n) ? eval(nest+'document.'+obj) : eval('document.all.'+obj+'.style')
        this.css=(n) ? eval(nest+'document.'+obj) : getas(obj,"")
//        this.scrollHeight=n?this.css.document.height : eval('document.all.'+obj+'.offsetHeight')
        tmp = getas2(obj,"");
        this.scrollHeight=n ? this.css.document.height : tmp.offsetHeight;
        this.css.pixelTop = topas;
        this.top = b_gettop;
        return this
}
//Getting the top for the top method
function b_gettop(){
//        alert(this.css.pixelTop);
       var gleft=(n) ? eval(this.css.top) : eval(this.css.pixelTop);
//     alert(gleft);
        return gleft;
}
//Variables
var scrollTim;
var active=0;
/*********************************************************************************
The scroll function. Checks what way to scroll and checks if the
layer is not already on top or bottom.
*********************************************************************************/
function scroll(speed,activas){
        if(scrollTim) clearTimeout(scrollTim)
        way=speed>0 ? 1 : 0
        active= activas;	

   //     alert(way + "\n" + oScroll[active].top() );


        if((!way && oScroll[active].top()>-oScroll[active].scrollHeight+contHeight) || (oScroll[active].top()<0 && way)){
                oScroll[active].css.top = oScroll[active].top()+speed
                scrollTim=setTimeout("scroll("+speed+","+activas+")",timSpeed)
        }

}
//Clears the timeout so the scroll stops, this is called onmouseout.
function noScroll(){
        clearTimeout(scrollTim)
}

/*********************************************************************************
Initilizes the page, makes a oScroll Array and calls the object constructor.
Here you can add as many scrollObjects as you want
*********************************************************************************/
function scrollInit(){
        oScroll=new Array()
        oScroll[0]=new makeScrollObj('divScroll','divCont',0)
        oScroll[0].css.visibility='visible'
        oScroll[1] = new makeScrollObj('divScroll1','divCont1',0)
        oScroll[1].css.visibility='visible'
}
/*********************************************************************************
Executes the scrollInit function on pageload.
*********************************************************************************/



function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

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 getas2(title, id)
{
  if (isIE4) objektas = document.all(title + id);
  if (isIE5 || isNN6) objektas = document.getElementById(title + id);
  if (isNN4) objektas = document[title + id];
  return objektas;
}



function rank(id)
{
  tmp = getas("menu",id);
  tmp.cursor='hand';
}



//################################### menu dropdown ################################################################
//################################### menu dropdown ################################################################
//################################### menu dropdown ################################################################


function showlayer(id)
{
  if (Closing!=0) clearTimeout(TimeOut);
  if (CurrentMenu!=0 && CurrentMenu!=id)
  {
//    off(CurrentMenu);
    tmp = getas("menu", CurrentMenu);
    tmp.visibility="hidden";
  }
  CurrentMenu=id;
//  onn(id);
  tmp = getas("menu", id);
  tmp.visibility="visible";
}

function hidelayer(id)
{
//   off(id);
   tmp = getas ("menu", id);
   tmp.visibility="hidden";
//   if(selected !=0 )   { pradinis=1; }
}

function trytohide(id)
{
  Closing=1;
  TimeOut=setTimeout("hidelayer("+id+")",pauze);
}


function rodom(id)   { showlayer(id); }
function nerodom(id)
{
 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, color2 , nu )
{
  if (isNN4) return;
  if (selected==id ) return;
  change_color("td1_", id, color);
  change_color("td2_", id, color);
  if (nu)
    change_color("td3_", id, color2);
}

function change_color(title, id, color)
{
  tmp = getas(title, id );
  tmp.backgroundColor=color;
}




