﻿function ToolLinks(tool) 
{
    //CheckUser();
    
    if (IsLoggedIn()) {
        OpenToolWindow(tool);
    }
    else {
        alert('You must log on first to view this page');
    }
}

function disclaimer() {

    if (IsLoggedIn()) {
        alert('The TASS Engineering Suite software program is provided to the user as is. Use of the TASS Engineering Suite or its output does not replace or change any part of the repair or alteration approval process. Users of TASS Engineering Suite must obtain approval of any repair or alteration designed or analyzed with TASS Engineering Suite with the same procedures as with any other analysis tool. A repair design from the TASS Engineering Suite should never supercede that supplied by the original equipment manufacturer (OEM). The TASS Engineering Suite should be considered an alternative design tool whenever a repair procedure is not provided or is not available from the OEM. In no instance will TASS be liable for any damages sustained by the user, or any third party, caused by or attributed to the use of the TASS Engineering Suite software. Contact TASS at EngineeringSuite@tassinc.com for any questions regarding the use of the TASS Engineering Suite.');
    }
}

function IsLoggedIn() {
    var loggedinobject = document.getElementById('loggedinDiv');
    if (loggedinobject == null) {
        return false;
    }
    else {
        return true;
    }
}

function OpenToolWindow(tool) 
{
    var toolurl;
    var tooltitle;
    var dimSpecifed = false;
    var dimString;
    var width;
    var height;
    var scrollbars = false;
    var resize = false;

    switch (tool) 
    {
        case 'materials':
            tooltitle = 'MaterialProperties';
            toolurl = 'Materials/MaterialsData.aspx';
            break;
        case 'section':
            tooltitle = 'SectionProperties';
            toolurl = 'Section/Section.aspx';
            break;
        case 'interpolation':
            tooltitle = 'Interpolation';
            toolurl = 'Interpolation/Interpolation.asp';
            dimSpecifed = true;
            width = 450;
            height = 250;
            break;
        case 'crippling':
            tooltitle = 'Crippling';
            toolurl = 'Crippling/Crippling.aspx';
            break;
        case 'ringanalysis':
            tooltitle = 'RingAnalysis';
            toolurl = 'RingAnalysis/RingAnalysis.aspx';
            break;
        case 'compressionanalysislegacy':
            tooltitle = 'CompressionAnalysis';
            toolurl = 'CompressionAnalysis/CompressionAnalysis.asp';
            dimSpecifed = true;
            width = 750;
            height = 480;
            break;
        case 'compression':
            tooltitle = 'CompressionAnalysis';
            toolurl = 'Compression/CompressionMenu.aspx';
            break;
        case 'buckling':
            tooltitle = 'BucklingofFlatPlates';
            toolurl = 'Buckling/Buckling.aspx';
            break;
        case 'boltgroup':
            tooltitle = 'BoltGroupAnalysis';
            toolurl = 'BoltGroup/BoltGroup.asp';
            dimSpecifed = true;
            width = 600;
            height = 600;
            scrollbars = true;
            resize = true;
            break;
        case 'obliquelug':
            tooltitle = 'ObliqueLugAnalysis';
            toolurl = 'ObliqueLug/ObliqueLug.asp';
            dimSpecifed = true;
            width = 520;
            height = 745;
            scrollbars = true;
            resize = true;
            break;
        case 'bushing':
            tooltitle = 'BushingAnalysis';
            toolurl = 'Bushing/Bushing.asp';
            dimSpecifed = true;
            width = 545;
            height = 740;
            scrollbars = true;
            resize = true;
            break;
        case 'tensionfitting':
            tooltitle = 'TensionFittingAnalysis';
            toolurl = 'TensionFitting/TensionFittingMain.asp';
            dimSpecifed = true;
            width = 350;
            height = 230;
            break;
        case 'honeycomb':
            tooltitle = 'HoneycombAnalysis';
            toolurl = 'Honeycomb/honeycomb_final.asp';
            dimSpecifed = true;
            width = 550;
            height = 600;
            scrollbars = true;
            resize = true;
            break;
        case 'seattrack':
            tooltitle = 'SeatTracks';
            toolurl = 'SeatTrack/SeatTrack.aspx';
            break;
        case 'fastener':
            tooltitle = 'FastenerAnalysis';
            toolurl = 'Fastener/Fastener.aspx';
            break;
        case 'lapsplice':
            tooltitle = 'LapSplice';
            toolurl = 'CrackGrowth/CrackGrowth.aspx?Case=4';
            break;
        case 'buttsplice':
            tooltitle = 'ButtSplice';
            toolurl = 'CrackGrowth/CrackGrowth.aspx?Case=5';
            break;
        case 'crackgrowth':
            tooltitle = 'FatigueandCrackGrowth';
            toolurl = 'CrackGrowth/CrackGrowthMenu.aspx';
            break;
        case 'cycles':
            tooltitle = 'EquivalentCycles';
            toolurl = 'Cycles/Cycles.aspx';
            break;
        case 'stress':
            tooltitle = 'Stress';
            toolurl = 'Stress/Stress.aspx';
            break;
        case 'fastenerloadtransfer':
            tooltitle = 'FastenerLoadTransfer';
            toolurl = 'FastenerLoadTransfer/FastenerLoadTransfer.aspx';
            break;
        case 'severityfactor':
            tooltitle = 'SeverityFactor';
            toolurl = 'SeverityFactor/SeverityFactor.aspx';
            break;
        case 'floorbeam':
            tooltitle = "FloorBeam";
            toolurl = 'FloorBeam/FloorBeam.aspx';
            break;
    }
    if (dimSpecifed) {
        dimString = 'width=' + width + ',height=' + height;
        if (scrollbars) {
            dimString = dimString + ', scrollbars=yes';
        }
        if (resize) {
            dimString = dimString + ', resizable=yes';
        }
        window.open(toolurl, tooltitle, dimString);
    }
    else {
        window.open(toolurl, tooltitle);
    }
}

