<!DOCTYPE HTML SYSTEM "-//Adobe//DWExtension layout-engine 10.0//dialog">
<!-- MENU-LOCATION=NONE -->
<html xmlns:MMString="http://www.macromedia.com/schemes/data/string/">
<head>
<!-- Copyright 2009 Adobe Systems Incorporated.  All rights reserved. -->
<title><MMString:LoadString id="Commands/LaunchWidgetBrowser/Title" /></title>
<script type="text/javascript" src="../Shared/OAWidget/OAWidgetManager.js" ></script>
<script type="text/javascript">

function getWidgetBrowserAppPath()
{
    var path = null;
    var wbXMLPath = OAWidgetManager.getAdobeCommonWidgetsDirectory() + "WidgetBrowser.xml";
    if (DWfile.exists(wbXMLPath))
    {
        var dom = dw.getDocumentDOM(wbXMLPath);
        if (dom)
        {
            var app = dom.getElementsByTagName("application").item(0);
            if (app)
                path = app.getAttribute("installPath");
        }
    }
    return path;
}

function launchWidgetBrowser()
{
    var wbPath = getWidgetBrowserAppPath();
    if (wbPath)
    {
        // The Widget Browser exists so launch it and then close this
        // dialog. This forces the user to relaunch the dialog when they
        // are done with the Widget Browser, which allows us to pick up
        // any new widgets they have added to Dreamweaver.

        try
        {
            dw.launchApp(wbPath);
        }
        catch (e) { alert("Caught JS exception: " + e); }

    }
    else
    {
        var results = confirm(dw.loadString("Commands/LaunchWidgetBrowser/WidgetBrowserDownloadMsg"));
        if (results)
            dw.browseDocument(dw.loadString("insertbar/oawidget/widgetBrowserLink"));
    }
}

</script>
</head>
<body onLoad="launchWidgetBrowser();">
</body>
</html>
