﻿
/**************************************************
    Utils
**************************************************/

// This is the function that is called from the web page to run any
// code that needs to be run at page load time.
function Baird_OnVendorPageLoad(segment, publicPage)  {

    // Run the baird on page load method
    Baird_OnPageLoad(segment, publicPage);

}

// This function is used when a navigation link is staying at the vendors
// web site.  Using this function will allow page url changes to be made
// without the need of going through each web page to change.  A name is
// passed in with any querystring values needed to passed and then a lookup
// is done to send the user to the correct page on the vendors web site.
function Baird_GotoVendorPage(name, qstring)  {

    // Store the location of the vendors root location.
    var location="/";

    // Will store the vendors page location when a match on the name is found.
    var url;

    // Assign qstring to an empty string if it was not set by the caller.
    if (qstring==undefined)  {
        qstring="";
    }    
    
    // Append the current account to the querystring if it exists.
    qstring=Baird_AppendCurrentAccount(qstring);
    
    // Search for the absolute URL that matches the passed in page name.
    switch (name.toLowerCase())  {
        case "branchlocatorhome":
            url=location + ""
            break;
        default:
            url=location + name + ".asp" + qstring;
            break;
    }
    
    
    // Check the name of the page to see how this page should be opened.
    switch (name.toLowerCase())  {
    
        // Open the following in a seperate window
        case "OpenInNewWindow":
            window.open(url);
            break
            
        // Open the page in the current window
        default:
            window.location.href=url;
            break;
    }
}



