﻿IE4 = navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) >= 4;        
NS4 = navigator.appName.substring(0,8) == "Netscape" && parseInt(navigator.appVersion) >= 4;
        

function checkBrowser(){
        if(IE4 || NS4){
                return true;
        }
        return false;
}

// movableObj() -- Creates a new movable object

function movableObj(startX, startY, endX, endY, delay, speed, refId){
        this.sX = startX; this.sY = startY;     this.eX = endX;
        this.eY = endY; this.de = delay; this.sp = speed;
        this.ref = refId;
        xL = endX - startX;
        yL = endY - startY;
        with (Math){
                if(abs(xL) > abs(yL)){
                        this.xS = (xL > 0)?1:-1;
                        this.yS = (yL > 0)?abs(yL / xL):-abs(yL / xL);
                        this.howManySteps = abs(xL / speed);
                } else if(abs(yL) > abs(xL)){
                        this.yS = (yL > 0)?1:-1;
                        this.xS = (xL > 0)?abs(xL / yL):-abs(xL / yL);
                        this.howManySteps = abs(yL / speed);
                } else {
                        this.yS = (yL > 0)?1:-1;
                        this.xS = (xL > 0)?1:-1;
                        this.howManySteps = abs(xL / speed);
                }
        }
        this.startMovement = startMovement;
}

// startMovement() -- starts the movement

function startMovement(){

                if(IE4){
                        ref = document.all(this.ref).style;
                } else {
                        ref = document[this.ref];
                }
                doDynamicMovement(this.sX, this.sY, this.eX, this.eY, this.de, this.xS, this.yS, ref, this.sp, this.howManySteps);
         ref.visibility='visible';
         }

// doDynamicMovement() -- does the Dynamic Movement

function doDynamicMovement(curX, curY, eX, eY, sp, xS, yS, ref, speed, hS){
        if(Math.floor(hS - 1) != 0){
                hS--;
                curX += xS * speed;
                curY += yS * speed; 
                ref.width = Math.round(curX);
                ref.height = Math.round(curY);
        document.title = curX;
                setTimeout("doDynamicMovement(" + curX + ", " + curY + ", " + eX + ", " + eY + ", " + sp + ", " + xS + ", " + yS + ", ref, " + speed + ", " + hS + ")", sp);
        } else {
                setPos(eX, eY, ref);    
        }
}

// setPos() -- sets the end position accurately when doDynamicMovement has done its job

function setPos(x, y, ref){
        ref.width = x;
        ref.height = y;
        if (x < 10)
         ref.visibility='hidden';
}

dynaText = new movableObj(1,1,300,200,60,40,"wow");
dynaText1 = new movableObj(300,200,1,1,60,40,"wow");
mapOpen = new movableObj(1,1,600,400,100,70,"MapImg");
function ShowMap(ref){
    r = document.getElementById('MapImg');
    r.style.visibility='hidden';    
    r = document.getElementById('loading');
    r.style.visibility = 'visible';
    r = document.getElementById('Map');
    r.style.position = 'Absolute';
    r.style.left = '0px';
    r.style.top = '-50px';
    r.style.height = '100%';
    r.style.width = '100%';
    r.style.zIndex = '1000';
    r.style.visibility = 'visible';
    r.style.filter='Alpha(Opacity=100)'; /* for IE */

}
