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;
}

function createCookie(name,value,days) {
    if (days) {
        var date = new Date();
        date.setTime(date.getTime()+(days*24*60*60*1000));
        var expires = "; expires="+date.toGMTString();
    }
    else var expires = "";
    document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
    var nameEQ = name + "=";
    var ca = document.cookie.split(';');
    for(var i=0;i < ca.length;i++) {
        var c = ca[i];
        while (c.charAt(0)==' ') c = c.substring(1,c.length);
        if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
    }
    return null;
}

function eraseCookie(name) {
    createCookie(name,"",-1);
}

function goUri(url) {
    document.location = url;
}

function scrollToObject(target_id) {
    if ($(target_id)) {
        var el = $(document.body);
        var fx = new Fx.Scroll(el).start(0, $(target_id).getPosition().y);
    }
}

function highlight(target_id) {
    var el = $(target_id);
    if (el) {
        var fx = new Fx.Tween(el, {
            duration: 1000
        });
        fx.start('background-color', '#FFFF88', '#FFF');
    }
}


function riseError(target_id, message) {
    var t = $(target_id);
    if (t) {
        $(t).fade('show', {
            link: 'chain'
        });
        var div = new Element('div', {
            text: message,
            'class' : 'rise_error'
        });
        t.erase('html');
        div.inject(t);
        t.highlight('#FF7F7F');
    }
}

function toggle(target_id) {
    var t= $(target_id);
    if (t) {
        var myFx = new Fx.Slide(t, {
            duration: 500,
            transition: Fx.Transitions.Pow.easeOut
        });
        myFx.toggle();//.chain(myFx.toggle);
    }
}