function AnimationOpacityResize_onclick() {
    InfoFind.Animation.Animate('AnimationOpacityResize', 2, 'Opacity,0,100;Resize,0,100');
}

function AnimationRollRight_onclick() {
    InfoFind.Animation.RollRight('AnimationRollRight', 1);
}

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 AnimationCircleClockwise_onclick() {
    InfoFind.Animation.MoveInCircle('AnimationCircleClockwise', 2, 100, 1);
}

function bntValidateTest_onclick() {
    if (InfoFind.DataForms.ValidateForm("Form1")) {
        alert("Valid Form - All Errors have been Fixed.");
    }
}

//Work-around for bug with IE where Section Elements Overlap after expanding the content inside.
//Doesn't happen with Firefox, Opera, Safari, and Chrome.
function RedrawItems() {
    InfoFind.HTML.Element.Redraw("Page");
}

function bntMathRounding_onclick() {
    var sHtml = "";

    sHtml += '<table class="DataTable" cellspacing="0" cellpadding="3" border="1">';
    sHtml += '<caption>Math Rounding</caption>';
    sHtml += '<thead><tr>';
    sHtml += '<th>Test</th>';
    sHtml += '<th>Result</th>';
    sHtml += '</tr></thead>';
    var Properties = ['4.225 * 100', 'RoundToDecimal(4.225 * 100)', 'RoundToNDecimal(4.225, 2)'];
    var Values = [(4.225 * 100), InfoFind.DataTypes.RoundToDecimal(4.225 * 100), InfoFind.DataTypes.RoundToNDecimal(4.225, 2)];
    for (var n = 0; n < Properties.length; n++) {
        sHtml += '<tr class="DataRow' + (n % 2 == 0 ? '1' : '2') + '">';
        sHtml += '<td>' + Properties[n] + '</td>';
        sHtml += '<td>' + Values[n] + '</td>';
        sHtml += '</tr>';
    }
    sHtml += '</table><br><br>';
    
    //Display the Results
    InfoFind.HTML.ByID('MathRoundingResults').innerHTML = sHtml;
    RedrawItems();
}

function bntLikeOperator_onclick() {
    var sHtml = '';

    //Test Different Formats - All should be true
    sHtml += '<table class="DataTable" cellspacing="0" cellpadding="3" border="1">';
    sHtml += '<caption>These should equal true:</caption>';
    sHtml += '<thead><tr>';
    sHtml += '<th>Test</th>';
    sHtml += '<th>Result</th>';
    sHtml += '</tr></thead>';
    var Text = ["aBBa", "aBBa", "aa", "aba", "a", "1", "First Middle Last", "$10.50", "1 + 1 = 2", "2 - 1 = 1", "johndoe@internet.com", "(123) 456-7890"];
    var Pattern = ["a*a", "a%a", "a*a", "a*a", "[!A-Z]", "[!A-Z]", "First *Last", "$##.##", "# + # = #*", "# - # = #*", "[a-z0-9]*@[a-z]*.*[a-z]", "(###) ###-####"];
    for (var n = 0; n < Text.length; n++) {
        sHtml += '<tr class="DataRow' + (n % 2 == 0 ? '1' : '2') + '">';
        sHtml += '<td>IsLike("' + Text[n] + '", "' + Pattern[n] + '")</td>';
        sHtml += '<td>' + InfoFind.DataTypes.IsLike(Text[n], Pattern[n]) + '</td>';
        sHtml += '</tr>';
    }
    sHtml += '</table><br><br>';
    RedrawItems();

    //Display the tables
    InfoFind.HTML.ByID('LikeOperatorResults').innerHTML = sHtml;
    RedrawItems();
}

function bntTestNumberFormats_onclick() {
    var sHtml = '';

    //Test Different Formats
    sHtml += '<table class="DataTable" cellspacing="0" cellpadding="3" border="1">';
    sHtml += '<caption>Numeric Format Test</caption>';
    sHtml += '<thead><tr>';
    sHtml += '<th>Format</th>';
    sHtml += '<th>Number</th>';
    sHtml += '<th>IsNumeric</th>';
    sHtml += '<th>StringToNumber</th>';
    sHtml += '</tr></thead>';
    var Values = ['1,234,567.89', '1 234 567,89', '1.234.567,89', '1\'234\'567,89'];
    var Formats = ['English', 'French', 'German', 'Swiss'];
    for (var n = 0; n < Values.length; n++) {
        InfoFind.DataTypes.NumberType = Formats[n];
        sHtml += '<tr class="DataRow' + (n % 2 == 0 ? '1' : '2') + '">';
        sHtml += '<td>' + InfoFind.DataTypes.NumberType + '</td>';
        sHtml += '<td>' + Values[n] + '</td>';
        sHtml += '<td>' + InfoFind.DataTypes.IsNumeric(Values[n]) + '</td>';
        sHtml += '<td>' + InfoFind.DataTypes.StringToNumber(Values[n]) + '</td>';
        sHtml += '</tr>';
    }
    sHtml += '</table><br><br>';

    InfoFind.HTML.ByID('DataTypeResults').innerHTML = sHtml;
    InfoFind.DataTypes.NumberType = 'English';
    RedrawItems();
}

function cboChangeTheme_onchange() {
    InfoFind.CSS.ChangeStyleSheet('StyleLink', InfoFind.DataForms.GetControlValue('cboChangeTheme'));
}

function bntChangeVisibility_onclick() {
    InfoFind.HTML.Element.SetVisibility("DivChangeStyle", !InfoFind.HTML.Element.GetVisibility("DivChangeStyle"));
}

function bntChangeCSS_Style_onclick() {
    if (InfoFind.HTML.Element.HasClass("DivChangeStyle", "DataForm")) {
        InfoFind.HTML.Element.RemoveClass("DivChangeStyle", "DataForm");
        InfoFind.HTML.Element.RemoveClass("DivChangeStyle", "Bg100");
    } else {
        InfoFind.HTML.Element.AddClass("DivChangeStyle", "DataForm");
        InfoFind.HTML.Element.AddClass("DivChangeStyle", "Bg100");
    }
}

function bntUpdatePageSection_onclick() {
    var URL = "../InfoFind_Web_Tools/PageUpdateTest.asp", ElementID = "divUpdatePageSection";
    //InfoFind.WebRequest.LoadingHTML = '<img src="Images/loading.gif" style="background-color: white;"></img>';
    InfoFind.WebRequest.UpdatePageElement(URL, ElementID, UpdateTable);
}

function UpdateTable() {
    InfoFind.Sorting.MakeTableSortable("ControlsTable");
    RedrawItems();
}
