var ns4=false;
var ns6=false;
var ie=false;

if(navigator.appName=="Microsoft Internet Explorer") ie=true;
if(document.getElementById && !ie && !ns4) ns6=true;
if(!ie && !ns6) ns4=true;

function browserstring(lname)
    {
    if(ie) return eval("document.getElementById('" + lname + "').style");
    if(ns4) return eval("document.layers['" + lname + "']");
    if(ns6) return eval("document.getElementById('" + lname + "').style");
    }

function stringToNumber(s)
    {
    return parseInt(('0' + s), 10)
    }

function eqdhtmlobj(lname,mode)
    {
    if(mode=='debug')alert("Am anfang: " + lname);
    this.name=lname;
    this.hideit=hideit;
    this.showit=showit;
    this.setleft=setleft;
    this.settop=settop;
    this.setpos=setpos;
    this.setz=setz;
    this.move=move;
    this.clipto=clipto;
    this.writeintolayer=writeintolayer;

    if(ie)
        {
        this.zIndex=document.getElementById(lname).style.zIndex;
        this.left=stringToNumber(document.getElementById(lname).offsetLeft);
        this.top=stringToNumber(document.getElementById(lname).offsetTop);
        this.width=stringToNumber(document.getElementById(lname).offsetWidth);
        this.height=stringToNumber(document.getElementById(lname).offsetHeight);
        this.setclipleft = setclipleft;
        this.setclipright=setclipright;
        this.setcliptop=setcliptop;
        this.setclipbottom=setclipbottom;
        }
    if(ns4)
        {
        this.zIndex=document.layers[lname].zIndex;
        this.left=document.layers[lname].left;
        this.top=document.layers[lname].top;
        this.width=document.layers[lname].clip.right-document.layers[lname].clip.left;
        this.height=document.layers[lname].clip.bottom-document.layers[lname].clip.top;
        this.setclipleft=setclipleft;
        this.setclipright=setclipright;
        this.setcliptop=setcliptop;
        this.setclipbottom = setclipbottom;
        }
    if(ns6)
        {
        this.zIndex=document.getElementById(lname).style.zIndex;
        this.left=stringToNumber(document.getElementById(lname).offsetLeft);
        this.top=stringToNumber(document.getElementById(lname).offsetTop);
        this.width=stringToNumber(document.getElementById(lname).offsetWidth);
        this.height=stringToNumber(document.getElementById(lname).offsetHeight);
        this.setclipleft = setclipleft;
        this.setclipright = setclipright;
        this.setcliptop = setcliptop;
        this.setclipbottom = setclipbottom;
        }
    this.cliptop=0;
    this.clipleft=0;
    this.clipbottom=0;
    this.clipright=0;
    if(mode=='debug') alert("Ende : " + lname);
    }


function writeintolayer(value)
    {
    if(ns4) document.layers[this.name].document.write(value);
    if(ie)  document.all[this.name].innerHTML=value;
    if(ns6) document.getElementById(this.name).document.write(value);
    }



function setz(value)
    {
    this.zindex=value;
    if(ns4) document.layers[this.name].zIndex=value;
    if(ie)  document.all[this.name].style.zIndex=value;
    if(ns6) document.getElementById(this.name).style.zIndex=value;
    }

function setleft(value)
    {
    this.left=value;
    if(ns4) document.layers[this.name].left=value;
    if(ie)  document.all[this.name].style.left=value;
    if(ns6) document.getElementById(this.name).style.left=value;
    }

function settop(value)
    {
    this.top=value;
    if(ns4) document.layers[this.name].top=value;
    if(ie)  document.all[this.name].style.top=value;
    if(ns6) document.getElementById(this.name).style.top=value;
    }


function setpos(x,y,lname)
    {
	x=stringToNumber(Math.round(x));
	y=stringToNumber(Math.round(y));
    if(!lname)
	{
	lname=this.name
    this.left=x;
	this.top=y;
	}
	if(ns4)
        {
        document.layers[lname].left=x;
        document.layers[lname].top=y;
        }
    if(ie)
        {
        document.all[lname].style.left=x;
        document.all[lname].style.top=y;
        }
    if(ns6)
        {
        document.getElementById(lname).style.left=x;
        document.getElementById(lname).style.top=y;
        }
    }

function hideit()
    {
    this.visibility=false;
    if(ns4) document.layers[this.name].visibility='hide';
    if(ie)  document.getElementById(this.name).style.visibility='hidden';
    if(ns6) document.getElementById(this.name).style.visibility='hidden';
    }

function showit()
    {
    this.visibility=true;
    if(ns4) document.layers[this.name].visibility='show';
    if(ie)  document.getElementById(this.name).style.visibility='visible';
    if(ns6) document.getElementById(this.name).style.visibility='visible';
    }

function move(x,y,steps,delay,i,movex,movey,lname,top,left)
    {
    if(!i)
        {
		var i=0;
		x=stringToNumber(Math.round(x));
		y=stringToNumber(Math.round(y));
		var tmpleft=stringToNumber(Math.round(this.left));
		var tmptop=stringToNumber(Math.round(this.top));
		var movex=(x - tmpleft) / steps
        var movey=(y - tmptop) / steps
        var lname=this.name;
        var left=this.left+movex;
        var top=this.top+movey;
        this.left=x;
        this.top=y;
        }
    i=i+1
    if(i<steps) //>
        {
        left=stringToNumber(left + movex);
        top=stringToNumber(top + movey);
        setpos(left,top,lname);
        setTimeout("move(" + x + "," + y + "," + steps + "," + delay + "," + i + "," + movex + "," + movey +",\'" + lname + "\',"+top+","+left+");",delay);
        } else
        {
        setpos(x,y,lname);
        }

    }

function textchange(text1,text2)
    {
	text1.move(texthideleft,texttop,textstep1,100);
	text2.move(textshowleft,texttop,textstep2,100);
    }


function clipto(where,to,steps,delay,i,div,cur,lname)
    {
    if(!i)
        {
        var i=0;
        var lname=this.name;
        if(where=='bottom')
        {
        if(to>this.clipbottom) var div=stringToNumber(Math.round((to - this.clipbottom)) / steps);
        if(to<this.clipbottom) var div=stringToNumber(Math.round((to - this.clipbottom)*(-1)) / steps)*(-1);
            var cur=this.clipbottom;
            this.clipbottom=to;
            }
        if(where=='right')
            {
            if(to>this.clipright) var div=stringToNumber(Math.round((to - this.clipright)) / steps);
            if(to<this.clipright) var div=stringToNumber(Math.round((to - this.clipright)*(-1)) / steps)*(-1);
            var cur=this.clipright;
            this.clipright=to;
            }
        if(where=='left')
            {
            if(to>this.clipleft) var div=stringToNumber(Math.round((to - this.clipleft)) / steps);
            if(to<this.clipleft) var div=stringToNumber(Math.round((to - this.clipleft)*(-1)) / steps)*(-1);
            var cur=this.clipleft;
            this.clipleft=to;
            }
        if(where=='top')
            {
            if(to>this.cliptop) var div=stringToNumber(Math.round((to - this.cliptop)) / steps);
            if(to<this.cliptop) var div=stringToNumber(Math.round((to - this.cliptop)*(-1)) / steps)*(-1);
            var cur=this.cliptop;
            this.cliptop=to;
            }
        }
    i=i+1;
    if(i<steps) //>
        {
        cur=stringToNumber(cur + div);
        if(where=='bottom') setclipbottom(cur,lname)
        if(where=='right') setclipright(cur,lname)
        if(where=='left') setclipleft(cur,lname)
        if(where=='top') setcliptop(cur,lname);
        setTimeout("clipto(\'" + where + "\'," + to + "," + steps + "," + delay + "," + i + "," + div + "," + cur + ",\'" + lname + "\');",delay);
        } else
        {
        if(where=='bottom') setclipbottom(to,lname)
        if(where=='right') setclipright(to,lname)
        if(where=='left') setclipleft(to,lname)
        if(where=='top') setcliptop(to,lname)
        }
    }

function getit(lname,what)
    {
    return eval(lname + "." + what);
    }


function setclipbottom(value,lname)
    {
    if(!lname)
        {
        lname=this.name;
        this.clipbottom=value;
        }
    if(ns4) document.layers[lname].clip.bottom=getit(lname,"height") - value;
    if(ns6)
        {
        clipstr='rect(' + getit(lname,"cliptop") + ' ' + eval(getit(lname,"width") - getit(lname,"clipright")) + ' ' + eval(getit(lname,"height") - value)+ ' ' + getit(lname,"clipleft") + ')';
        document.getElementById(lname).style.clip=clipstr;
        }
    if(ie)
        {
        clipstr='rect(' + getit(lname,"cliptop") + ' ' + eval(getit(lname,"width") - getit(lname,"clipright")) + ' ' + eval(getit(lname,"height") - value)+ ' ' + getit(lname,"clipleft") + ')';
        document.getElementById(lname).style.clip=clipstr;
        }
    }


function setclipright(value,lname)
    {
    if(!lname)
        {
        lname=this.name;
        this.clipright=value;
        }
    if(ns4) document.layers[lname].clip.right=getit(lname,"width") - value;
    if(ns6)
        {
        clipstr='rect(' + getit(lname,"cliptop") + ' ' + eval(getit(lname,"width") - value) + ' ' + eval(getit(lname,"height") - getit(lname,"clipbottom")) + ' ' + getit(lname,"clipleft") + ')';
        document.getElementById(lname).style.clip=clipstr;
        }
    if(ie)
        {
        clipstr='rect(' + getit(lname,"cliptop") + ' ' + eval(getit(lname,"width") - value) + ' ' + eval(getit(lname,"height") - getit(lname,"clipbottom")) + ' ' + getit(lname,"clipleft") + ')';
        document.all[lname].style.clip=clipstr;
        }
    }

function setclipleft(value,lname)
    {
    if(!lname)
        {
        lname=this.name;
        this.clipleft=value;
        }
    if(ns4) document.layers[lname].clip.left=value;
    if(ns6)
        {
        clipstr='rect(' + getit(lname,"cliptop") + ' ' + eval(getit(lname,"width") - getit(lname,"clipright")) + ' ' + eval(getit(lname,"height") - getit(lname,"clipbottom")) + ' ' + value + ')';
        document.getElementById(lname).style.clip=clipstr;
        }
    if(ie)
        {
        clipstr='rect(' + getit(lname,"cliptop") + ' ' + eval(getit(lname,"width") - getit(lname,"clipright")) + ' ' + eval(getit(lname,"height") - getit(lname,"clipbottom")) + ' ' + value + ')';
        document.all[lname].style.clip=clipstr;
        }
    }

function setcliptop(value,lname)
    {
    if(!lname)
        {
        lname=this.name;
        this.cliptop=value;
        }
    if(ns4) document.layers[lname].clip.top=value;
    if(ns6)
        {
        clipstr='rect(' + value + ' ' + eval(getit(lname,"width") - getit(lname,"clipright")) + ' ' + eval(getit(lname,"height") - getit(lname,"clipbottom")) + ' ' + getit(lname,"clipleft") + ')';
        document.getElementById(lname).style.clip=clipstr;
        }
    if(ie)
        {
        clipstr='rect(' + value + ' ' + eval(getit(lname,"width") - getit(lname,"clipright")) + ' ' + eval(getit(lname,"height") - getit(lname,"clipbottom")) + ' ' + getit(lname,"clipleft") + ')';
        document.all[lname].style.clip=clipstr;
        }
    }

function getforminlayer(layername,formname)
{
    if(ns4) return eval("document.layers."+layername+".document."+formname);
    if(ie) return eval("document."+formname);
}


