function browser_class() {
	var b = navigator.appName
	this.b = (b=="Netscape")?"ns":(b=="Microsoft Internet Explorer")?"ie":b
	this.v = navigator.appVersion
	/*if (this.b=='ie') {
		var ve = this.version.indexOf("MSIE")
		this.v = parseInt(this.version.substr(ve+4))
	}else this.v = parseInt(this.version)*/
	this.opera = (navigator.userAgent.indexOf('Opera') != -1)?1:0	
	//this.ns4 = (document.layers)?1:0
	this.ns4 = (document.layers && !this.dom)?1:0;
	this.ns6 = (document.getElementById && !document.all && this.b == 'ns')?1:0
	this.ie = (document.all)?1:0
	this.ie4=(document.all && !this.dom && !this.opera)?1:0
	//this.ie4 = (document.all && !document.getElementById)?1:0
	this.ie5 = (document.all && document.getElementById)?1:0
	this.ie5mac = (navigator.userAgent.indexOf('MSIE 5') != -1 && navigator.userAgent.indexOf('Mac') != -1)
	this.ie55 = (this.ie5 &&  this.v.indexOf('MSIE 5.5')>0)?1:0
	this.ie6 = (this.ie5 &&  this.v.indexOf('MSIE 6.0')>0)?1:0
	this.dom = (document.getElementById)?1:0
	this.w3cdom = (!this.ie5mac && document.getElementsByTagName && document.createElement)?1:0
	this.newBrNotIE = (!this.ie && document.getElementById)?1:0
}

br = new browser_class()
//if (!(is.ie55 || is.ie6)) window.location.href = 'atnaujinkite.htm'


////
//
//		frame:		turi buti pilno "kelio" stringas, pvz.: 'top.frameTop'
//						arba gali buti nuoroda i freimo objekta
//
////
function findObj(id,frame) {
	var d; if (frame) d = typeof(frame)=='object' ? frame.document : eval(frame+'.document')
	else d = window.document
	if (document.getElementById) return d.getElementById(id)
	if (document.all) return d.all(id)
	return false
}

////
//
//		CSS
//
////
function classOver(obj,classOver)
{
	if (!br.dom) return;
	if (!obj.normal_class) obj.normal_class = obj.className
	obj.className = classOver
	//if (!obj.onmouseout) obj.onmouseout = classOut
}

function classOut(obj)
{
	if (!br.dom) return;
	obj.className = obj.normal_class
}

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;
}


/**
    Dynamic selects here.
*/

/* This script and many more are available free online at
The JavaScript Source!! http://javascript.internet.com
Created by: Bobby van der Sluis | http://www.bobbyvandersluis.com/ */
// Details can be found at:
// http://www.bobbyvandersluis.com/articles/unobtrusivedynamicselect.php

function dynamicSelect(id1, id2) {
     // Feature test to see if there is enough W3C DOM support
     if (document.getElementById && document.getElementsByTagName) {
          // Obtain references to both select boxes
          var sel1 = document.getElementById(id1);
          var sel2 = document.getElementById(id2);
          // Clone the dynamic select box
          var clone = sel2.cloneNode(true);
          // Obtain references to all cloned options
          var clonedOptions = clone.getElementsByTagName("option");
          // Onload init: call a generic function to display the related options in the dynamic select box
          refreshDynamicSelectOptions(sel1, sel2, clonedOptions);
          // Onchange of the main select box: call a generic function to display the related options in the dynamic select box
          sel1.onchange = function() {
               refreshDynamicSelectOptions(sel1, sel2, clonedOptions);
          };
     }
}

function refreshDynamicSelectOptions(sel1, sel2, clonedOptions) {
     // Delete all options of the dynamic select box
     while (sel2.options.length) {
          sel2.remove(0);
     }
     // Create regular expression objects for "select" and the value of the selected option of the main select box as class names
     var pattern1 = /( |^)(select)( |$)/;
     var pattern2 = new RegExp("( |^)(" + sel1.options[sel1.selectedIndex].value + ")( |$)");
     
     // Iterate through all cloned options
     for (var i = 0; i < clonedOptions.length; i++) {
          // If the classname of a cloned option either equals "select" or equals the value of the selected option of the main select box
          if (clonedOptions[i].className.match(pattern1) || clonedOptions[i].className.match(pattern2)) {
               // Clone the option from the hidden option pool and append it to the dynamic select box
               sel2.appendChild(clonedOptions[i].cloneNode(true));
          }
     }
}

// Multiple onload function created by: Simon Willison
// http://simon.incutio.com/archive/2004/05/26/addLoadEvent
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}



