function DisplayPosition(Element) {
    var Location = InfoFind.HTML.Element.GetPosition(Element);
    alert("Location.Top = " + Location.Top + "\nLocation.Left = " + Location.Left + "\nLocation.Width = " + Location.Width + "\nLocation.Height = " + Location.Height);
}

function AnimationOpacity_onclick() {
    InfoFind.Animation.FadeOutAndIn('AnimationOpacity', 3);
}

function AnimationResize_onclick() {
    InfoFind.Animation.Resize('AnimationResize', 100, 10, 1);
    window.setTimeout('InfoFind.Animation.Resize(\'AnimationResize\', 100, 1000, 1);', 1000);
}

function AnimationOpacityResize_onclick() {
    InfoFind.Animation.Animate('AnimationOpacityResize', 2, 'Opacity,0,100;Resize,0,100');
}

function AnimationRollDown_onclick() {
    InfoFind.Animation.RollDown('AnimationRollDown', 1);
}

function AnimationRollUp_onclick() {
    InfoFind.Animation.RollUp('AnimationRollUp', 1);
}

function AnimationRollRight_onclick() {
    InfoFind.Animation.RollRight('AnimationRollRight', 1);
}

function AnimationRollLeft_onclick() {
    InfoFind.Animation.RollLeft('AnimationRollLeft', 1);
}

function AnimationMoveTop_onclick() {
    var Location = InfoFind.HTML.Element.GetPosition('AnimationMoveTop');
    InfoFind.Animation.MoveToTop('AnimationMoveTop', 1);
    window.setTimeout("InfoFind.HTML.Element.Move('AnimationMoveTop', " + Location.Top + ", " + Location.Left + "); InfoFind.Animation.MoveFromTop('AnimationMoveTop', 1);", 1000);
}

function AnimationMoveBottom_onclick() {
    var Location = InfoFind.HTML.Element.GetPosition('AnimationMoveBottom');
    InfoFind.Animation.MoveToBottom('AnimationMoveBottom', 1);
    window.setTimeout("InfoFind.HTML.Element.Move('AnimationMoveBottom', " + Location.Top + ", " + Location.Left + "); InfoFind.Animation.MoveFromBottom('AnimationMoveBottom', 1);", 1000);
}

function AnimationMoveLeft_onclick() {
    var Location = InfoFind.HTML.Element.GetPosition('AnimationMoveLeft');
    InfoFind.Animation.MoveToLeft('AnimationMoveLeft', 1);
    window.setTimeout("InfoFind.HTML.Element.Move('AnimationMoveLeft', " + Location.Top + ", " + Location.Left + "); InfoFind.Animation.MoveFromLeft('AnimationMoveLeft', 1);", 1000);
}

function AnimationMoveRight_onclick() {
    var Location = InfoFind.HTML.Element.GetPosition('AnimationMoveRight');
    InfoFind.Animation.MoveToRight('AnimationMoveRight', 1);
    window.setTimeout("InfoFind.HTML.Element.Move('AnimationMoveRight', " + Location.Top + ", " + Location.Left + "); InfoFind.Animation.MoveFromRight('AnimationMoveRight', 1);", 1000);
}

function AnimationMoveRandom_onclick() {
    var Location = InfoFind.HTML.Element.GetPosition('AnimationMoveRandom');
    InfoFind.Animation.Animate('AnimationMoveRandom', 1, 'MoveToRandomBorder;Opacity,100,0');
    window.setTimeout('InfoFind.Animation.Animate(\'AnimationMoveRandom\', 1, \'RollRight;Opacity,0,100;MoveTo,' + Location.Top + ',' + Location.Left + '\');', 1000);
}

function AnimationCircle_onclick() {
    InfoFind.Animation.MoveInCircle('AnimationCircle', 2, 100, 0);
}

function AnimationCircleClockwise_onclick() {
    InfoFind.Animation.MoveInCircle('AnimationCircleClockwise', 2, 100, 1);
}

function AnimationCircleDown_onclick() {
    InfoFind.Animation.MoveInCircle('AnimationCircleDown', 2, 100, 2);
}

function AnimationCircleClockwiseDown_onclick() {
    InfoFind.Animation.MoveInCircle('AnimationCircleClockwiseDown', 2, 100, 3);
}

function bntAnimation_onclick() {
    ThisWebPage.Animation.OnLoad.Create();
    ThisWebPage.Animation.OnLoad.Display();
    window.setTimeout("ThisWebPage.Animation.OnLoad.CircularMove()", 3000);
    window.setTimeout("ThisWebPage.Animation.OnLoad.Hide()", 7000);
    window.setTimeout("ThisWebPage.Animation.OnLoad.Remove()", 10000);
}

var ThisWebPage = new Object();
ThisWebPage.Animation = new Object();
ThisWebPage.Animation.OnLoad = new Object();

ThisWebPage.Animation.OnLoad.ItemCount = 0;

//Note - The animation functions work in Safari 2.0, but this function does not work on tested computers.
ThisWebPage.Animation.OnLoad.Create = function() {
    //Variables
    var ItemID = 0, n = 0, m = 0, StartLeft = 0, StartTop = 0, MouseTop = 0, cnt;
    var CntSize = 200, CntSpace = CntSize / 10;
    var Height = InfoFind.HTML.Window.GetHeight();
    var Width = InfoFind.HTML.Window.GetWidth();
    //Number of Items to Create
    var ItemsHorizontal = Math.floor(Width / (CntSize + CntSpace));
    var ItemsVertical = Math.floor(Height / (CntSize + CntSpace));
    //Calculate Distance from Top/Left so everything is in the Middle.
    StartLeft = Width - (ItemsHorizontal * (CntSize + CntSpace) - CntSpace);
    StartTop = Height - (ItemsVertical * (CntSize + CntSpace) - CntSpace);
    //Recalculate the spacing to be even.
    StartLeft = (StartLeft + ((ItemsHorizontal + 1) * CntSpace)) / (ItemsHorizontal + 2);
    StartTop = (StartTop + ((ItemsVertical + 1) * CntSpace)) / (ItemsVertical + 2);
    //Get the actual Scroll Position to start from.
    MouseTop += InfoFind.HTML.Document.GetScrollPosition().Top;
    //Create the Div Elements with Opacity set to 0.
    for (n = 0; n < ItemsVertical; n++) {
        for (m = 0; m < ItemsHorizontal; m++) {
            cnt = document.createElement('div');
            cnt.id = 'LoadItem_' + ItemID;
            cnt.className = 'DataForm  Bg200';
            InfoFind.HTML.Element.Move(cnt, (n * (CntSize + StartTop)) + StartTop + MouseTop, (m * (CntSize + StartLeft)) + StartLeft, CntSize, CntSize);
            document.body.appendChild(cnt);
            InfoFind.HTML.Element.SetOpacity(cnt, 0);
            ItemID++;
        }
    }
    this.ItemCount = ItemID;
}

ThisWebPage.Animation.OnLoad.Display = function() {
    for (var n = 0; n < this.ItemCount; n++) {
        InfoFind.Animation.Animate('LoadItem_' + n, 2, 'Opacity,0,100');
    }
}

ThisWebPage.Animation.OnLoad.CircularMove = function() {
    var m = 0;
    for (var n = 0; n < this.ItemCount; n++) {
        InfoFind.Animation.MoveInCircle('LoadItem_' + n, 3, 100, m);
        if (m == 0) {
            m = 3;
        } else if (m == 1) {
            m = 2;
        } else if (m == 2) {
            m = 1;
        } else if (m == 3) {
            m = 0;
        }
    }
}

ThisWebPage.Animation.OnLoad.Hide = function() {
    var js = '';
    for (var n = 0; n < this.ItemCount; n++) {
        //Move to a Random Border and Fade
        js = 'MoveToRandomBorder;Opacity,100,0';
        //Random Animation
        switch (InfoFind.DataTypes.Random(0, 4)) {
            //Add Resize 
            case 0:
                js += ';Resize,100,' + InfoFind.DataTypes.Random(0, 200);
                break;
            //Add Roll Down 
            case 1:
                js += ';RollDown';
                break;
            //Add Roll Up 
            case 2:
                js += ';RollUp';
                break;
            //Add Roll Right 
            case 3:
                js += ';RollRight';
                break;
            //Add Roll Left 
            case 4:
                js += ';RollLeft';
                break;
        }
        //Set the Animation
        InfoFind.Animation.Animate('LoadItem_' + n, 2, js);
    }
}

ThisWebPage.Animation.OnLoad.Remove = function() {
    for (var n = 0; n < this.ItemCount; n++) {
        InfoFind.HTML.Element.Remove('LoadItem_' + n);
    }
}
