/////////////////////////////////////
// JavaScript needed for
// the pop-up help window
//
// Author: JVS
// Date  : 09/25/01
//
////////////////////////////////////

// the helpMatrix relates arbitrary page names
// to actual help files to protect us from
// name changes and modifictions in the
// help system


function helpMatrix(url)
{
    //if you passed in a name instead of a url
    //it will jsut pass thru these string 
    //modifications unharmed
    var name
    if(url.indexOf(".") > -1)
    {
        name = getPageName(url);
        name = name.substr(0,name.indexOf("."));
    }
    else
    {
        name=url;
    }
    
    //these are page specific
    
    //for registration
    if (name == "asrRegistrationSearch")
    {
        return("help-regsearch.html");
    }

    if (name == "asrAdvancedSearch")
    {
        return("help-advancedsearch.html");
    }

    if (name == "asrResults")
    {
        return("help-searchresults.html");
    }
       
    if (name == "asrRegistration")
    {
        return("help-registrationdetail.html");
    }
  
    //for application
    if (name == "asrApplicationSearch")
    {
        return("help-appsearch.html");
    }

    if (name == "asrApplResults")
    {
        return("help-appsearchresults.html");
    }
       
    if (name == "asrApplication")
    {
        return("help-applicationdetail.html");
    } 
  
    //for towair
    if (name == "towairSearch")
    {
        return("help-towairdetermination.html");
    }
       
    if (name == "towairResult")
    {
        return("help-towairsearchresults.html");
    } 
      
    //these are links in that side and bottom nav
    if (name == "help")
    {
        return("help-index.html");
    }

    if (name == "glossary")
    {
        return("help-glossary.html");
    }
    
    if (name == "faq")
    {
        return("help-faq.html");
    }
           
    //if we fall thru all those 
    //just load the index
    return("help-index.html");
}

//loads window
function loadHelpWindow(file,helpServerUrl)
{
    var fileToLoad = helpMatrix(file);
    var location;
    
    location = helpServerUrl + "AsrHelp/" + fileToLoad;

    if (file.indexOf("http://www.fcc.gov") == -1)
    {
        newWindow=window.open(location,"Popups","toolbar=no,location=no,directories=no,status=no,scrollbars=yes,menubar=yes,resize=yes,width=550,height=450,left=150,top=100");
    }
    else
    {
        //the windows to the ffc site should be
        //full sized with all the options
        newWindow=window.open(location,"Popups");
    }
    if (newWindow.opener == null) newWindow.opener = window;
    newWindow.focus();
}//end loadHelpWindow


//opens windows for letter, applications and the like
function openBrWindow(location,name,options)
{
    newWindow=window.open(location,name,options);
    newWindow.focus();
}//end openBrWindow


