﻿// JScript File
var GenInfoHeadings = [
    //General Info
    'Platform Orientation',
    'Geometry Support',
    'Scripting Support',
    '2D Web Integration',
    'Environment Orientation',
    'Avatar Limits',
    'Operational Status',
    'Viewer'
];
var GenInfoDescr = [
    //Adv Info - Geomestry Support
    'Defines the spatial dimension and characteristics of the chosen platform',
    'Defines the ability to import geometry from an external modelling application into the environment',
    'Defines the ability to utilise programming languages in the manipulation of geometry and platform architecture',
    'Defines the ability to access, utilise and link to assets and web pages found on the traditional 2D Internet within the platform',
    'Defines the target audience relative to content and features of the platform',
    'Defines the maximum number of concurrent users within the platform relative to land parcels or server limits.<br /><br />Grading:<br />A&nbsp;&nbsp;1001+<br />B&nbsp;&nbsp;101-1000<br />C&nbsp;&nbsp;51-100<br />D&nbsp;&nbsp;31-50<br />E&nbsp;&nbsp;16-30<br />F&nbsp;&nbsp;0-15',
    'Defines the current capacity of service offered by the platform to the user',
    'Defines the procedure for accessing the platform',
];
var AdvInfoHeadings = [
    //Advanced Info - Overview 
    'Offline Modelling',
    'Online Modelling',
    'Scripting Support',
    'Development Tools',
    'Server Options',
    'Communication',
    'Avatars',
    //Advanced Info - Modelling Support
    'Texture Layers',
	'Avatar Animation',
	'Object Animation',
	'Lighting',
	'Audio',
	'Streaming Video',
	'Particle Effects',
	'Shadows',
	'Physics',
    //Advanced Info - Customisation
    'Object/Avatar Interaction',
	'Object/Object Interaction',
	'Dynamic Property Modification',
	'Object Visibility',
	'Obtain Avatar Info',
	'Scripting Documentation',
	'GUI Customisation',
	'HTTP Requests',
	'H.U.D'
];
var AdvInfoDescr = [
    //Adv Info - Geomestry Support
    'Defines the ability to import geometry from an external modelling application into the environment',
    'Defines the ability to model geometry within the environment either as a single avatar or 	collaboratively with multiple interconnected users',
    'Defines the ability to utilise programming languages in the manipulation of geometry and platform architecture',
    'Defines the availability of tools for developing on the platform - provided by either first or third parties',
    'Defines the ability to set up the platform on a server completely independent of the developer',
    'Defines the user options for in-world communication between avatars',
    'Defines the maximum number of concurrent users within the platform relative to land parcels or server limits.<br /><br />Grading:<br />A&nbsp;&nbsp;1001+<br />B&nbsp;&nbsp;101-1000<br />C&nbsp;&nbsp;51-100<br />D&nbsp;&nbsp;31-50<br />E&nbsp;&nbsp;16-30<br />F&nbsp;&nbsp;0-15',
    //Adv Info - Modelling Support
    'Defines the ability to apply more than one simultaneous texture map to a piece of geometry',
    'Defines the integration of animations into avatar movements, either preset or customisable',
    'Defines the integration of animation onto objects; including the use of bones or inverse/reverse kinematics',
    'Defines the availability of lighting and the options available within the platform',
    'Defines the availability of audio and the options available within the platform',
    'Defines the availability of streaming media and the options and limitations available within the platform',
    'Defines the availability of particles and the options available within the platform',
    'Defines the availability of shadows and the options available within the platform',
    'Defines the availability of physics and the options available within the platform',
    //Adv Info - Customisation
    'Defines the ability for avatars to influence geometry in a pre-determined way either through scripting or as part of the platform offering',
    'Defines the ability for an object to influence another piece of geometry, i.e. object collision',
    'Defines the ability to alter an objects parameters or relative location through the use of scripting',
    'Defines the ability to turn the visibility/transparency of an object on or off within the platform',
    'Defines the ability to gather avatar-specific information (i.e. username) through avatar actions (i.e. clicking an object)',
    'Defines the availability of documentation for programming on the platform - provided by either first or third parties',
    'Defines the ability to alter the look and feel of the downloadable client application (i.e. menu and button styling, adding logos and changing desktop icons). This could be referred to as customisable skins.',
    'Defines the ability to calling web pages from within a script (that is attached to an object) and passing avatar information to the webpage',
    'Defines the ability to attach objects to the client viewport as a heads-up display' 
];
var MatrixExtraInfo = [
    //Geomestry Support
    '',
    'Online modelling is[?] supported by [X]',
    '',
    '',
    'Independent server options are[?] supported for [X]',
    '',
    '',
    //Modelling Support
    '',
    'Avatar animations [?] be integrated into [X]',
    '',
    '',
    '',
    'Streaming media is[?] supported within [X]',
    'Particle effects are[?] supported within [X]',
    'Shadows are[?] supported within [X]',
    'Physics are[?] supported within [X]',
    //Customisation
    'Object/Avatar Interaction is[?] supported within [X]',
    'Object/Object Interaction is[?] supported within [X]',
    'Dynamic Property Modification is[?] supported within [X]',
    'Object Visibility options are[?] supported within [X]',
    'It is[?] possible to obtain avatar information within [X]',
    'Scripting documentation is[?] available for [X]',
    'It is[?] possible to create a GUI for use within [X]',
    'HTTP requests are[?] supported within [X]',
    'It is[?] possible to create HUD’s for use within [X]'
];
var AdvSearchheadings = [
    //Advanced Search - Geometry Support 
    'Geometry Support',
    'Scripting Support',
    'Development Tools',
    'Server Options',
    'Communication',
    'Avatars',
    //Advanced Search - Modelling Support
    'Texture Layers',
	'Avatar Animation',
	'Object Animation',
	'Lighting',
	'Audio',
	'Streaming Media',
	'Particle Effects',
	'Shadows',
	'Physics',
    //Advanced Search - Customisation
    'Object/Avatar Interaction',
	'Object/Object Interaction',
	'Dynamic Property Modification',
	'Object Visibility',
	'Scripting Documentation',
	'GUI Customisation',
	'HTTP Requests',
	'H.U.D'
];
var AdvSearchDescr = [
    //Adv Info - Geomestry Support
    '<strong>Online Modelling</strong><br />Defines the ability to model geometry within the environment either as a single avatar or collaboratively with multiple interconnected users<br /><br /><strong>Offline Modelling</strong><br />Defines the ability to import geometry from an external modelling application into the environment',
    'Defines the ability to utilise programming languages in the manipulation of geometry and platform architecture',
    'Defines the availability of tools for developing on the platform - provided by either first or third parties',
    'Defines the ability to set up the platform on a server completely independent of the developer',
    'Defines the user options for in-world communication between avatars',
    'Defines the maximum number of concurrent users within the platform relative to land parcels or server limits.<br /><br />Grading:<br />A&nbsp;&nbsp;1001+<br />B&nbsp;&nbsp;101-1000<br />C&nbsp;&nbsp;51-100<br />D&nbsp;&nbsp;31-50<br />E&nbsp;&nbsp;16-30<br />F&nbsp;&nbsp;0-15',
    //Adv Info - Modelling Support
    'Defines the ability to apply more than one simultaneous texture map to a piece of geometry',
    'Defines the integration of animations into avatar movements, either preset or customisable',
    'Defines the integration of animation onto objects; including the use of bones or inverse/reverse kinematics',
    'Defines the availability of lighting and the options available within the platform',
    'Defines the availability of audio and the options available within the platform',
    'Defines the availability of streaming media and the options and limitations available within the platform',
    'Defines the availability of particles and the options available within the platform',
    'Defines the availability of shadows and the options available within the platform',
    'Defines the availability of physics and the options available within the platform',
    //Adv Info - Customisation
    'Defines the ability for avatars to influence geometry in a pre-determined way either through scripting 	or as part of the platform offering',
    'Defines the ability for an object to influence another piece of geometry, i.e. object collision',
    'Defines the ability to alter an objects parameters or relative location through the use of scripting',
    'Defines the ability to turn the visibility/transparency of an object on or off within the platform',
    'Defines the availability of documentation for programming on the platform - provided by either first or third parties',
    'Defines the ability to alter the look and feel of the downloadable client application (i.e. menu and button styling, adding logos and changing desktop icons). This could be referred to as customisable skins.',
    'Defines the ability to calling web pages from within a script (that is attached to an object) and passing avatar information to the webpage',
    'Defines the ability to attach objects to the client viewport as a heads-up display' 
];
function ShowPopup(img, section, idx)
{
    if(section == 0)
        ShowPopup2(AdvSearchheadings[idx], AdvSearchDescr[idx]);
    if(section == 1)
        ShowPopup2(GenInfoHeadings[idx], GenInfoDescr[idx]);
    if(section == 2)
        ShowPopup2(AdvInfoHeadings[idx], AdvInfoDescr[idx]);
    return false;
}

var currentMatrixInfoIdx = -1;
var currentVWName = "";
var currentAnswer = "";
function ShowMatrixPopup(vwID, idx, vwName, answer)
{
    currentMatrixInfoIdx = idx;
    if(vwName != null)
        currentVWName = vwName;
    else
        currentVWName = "";

    if(typeof answer == "undefined")    
        currentAnswer = "";
    else
        currentAnswer = answer;
        
    AsyncService.GetAvailableOptions(vwID, idx, onGetAvailOptionsCompleted, onGetAvailOptionsTimeout);

    return false;
}

function onGetAvailOptionsCompleted(result)
{
    if(currentMatrixInfoIdx != -1)
    {
        var desc = AdvInfoDescr[currentMatrixInfoIdx];
        if(currentMatrixInfoIdx == 6)
        {
            desc = 'Defines the maximum number of concurrent users within the platform relative to land parcels or server limits.';
        }

        if(result == "")
        {
            var res = "";
            if(currentAnswer == "")
            {
                res = "We are waiting for platform developers to update feature details.";
            }
            else
            {
                res = MatrixExtraInfo[currentMatrixInfoIdx].replace("[X]", currentVWName);
                if(currentMatrixInfoIdx == 8)
                {
                    res = res.replace("[?]", (currentAnswer == "" || currentAnswer == "False") ? " cannot" : "can");
                }
                else
                {
                    res = res.replace("[?]", (currentAnswer == "" || currentAnswer == "False") ? " not" : "");
                    
                }
            }
            desc = desc + "<strong><br /><br />" + res + "</strong>";
        }
        else
        {
            if(currentAnswer == "")
                desc = desc + "<strong><br /><br />We are waiting for platform developers to update feature details.</strong>";
            else
                desc = desc + "<br /><br />" + result.replace("[X]", currentVWName);
        }
        ShowPopup2(AdvInfoHeadings[currentMatrixInfoIdx] + " : " + currentVWName, desc);
    }
}

function onGetAvailOptionsTimeout(result)
{
    alert(result);
}

function ShowPopup2(title, text)
{
    var popup = document.getElementById("PopupWrapper");
    if(popup)
    {
        if(popup.style.display != "block")
        {
            var popupTitle = document.getElementById("PopupHeaderTitle");
            var popupText = document.getElementById("PopupContent");

            popupTitle.innerHTML = title;
            popupText.innerHTML = text;
            popup.style.display = "block";
        }
    }
}

function ClosePopup()
{
    var popup = document.getElementById("PopupWrapper");
    if(popup)
    {
        if(popup.style.display == "block")
        {
            popup.style.display = "none";
        }
    }
}
