
    // Establish href and child variables - strip protocol
    var omni_href = window.location.href.toLowerCase();
    omni_href = omni_href.substring(omni_href.indexOf("://") + 3);

    var omni_path = "";
    var omni_hostname = "";

    var omni_channel = "Action Online";

    // brand to be present on the AO templates
    var omni_pageBrand = ((typeof brand) == "undefined") ? "???" : decodeBrandNameAO(brand);

    // cms_LangType to be present on the AO templates
    var omni_localeCode = ((typeof cms_LangType) == "undefined") ? "mixed" : decodeLangId(cms_LangType);

    // Dependent on AO encodings for the templates
    var omni_charSet = (omni_localeCode == "jp_JP") ? "Shift_JIS" : "UTF-8";

    // propertyID to be present on any property specific template
    var omni_propID = ((typeof propertyID) == "undefined") ? "noID" : propertyID;

    var omni_hotelBrand = "";

    var omni_pageid = "";
    var omni_section = "";
    var omni_subsection = "";
    var omni_detail1 = "";
    var omni_detail2 = "";
    var omni_detail3 = "";


    // Declare pathing naming object
    var pathNames;
    var _num = 0;

    var path_anchor = "";

    // Check for query string and Destinations page_ID content variable
    if (omni_href.indexOf("?") != -1) {
       omni_href = omni_href.substring(0, omni_href.indexOf("?"));
       omni_pageid = s.getQueryParam("page_ID");
    }

    // Check for / indicating possible directory and path in href
    if (omni_href.indexOf("/") != -1) {
       omni_hostname = omni_href.substring(0, omni_href.indexOf("/"));
       omni_path = omni_href.substring(omni_href.indexOf("/"));
    }
    else {
       omni_hostname = omni_href;
       omni_path = "";
    }

    // If we have a path - parse it and return an associative array of the elements
    // Check for anchor tag as well
    if (omni_path.length > 0) {

       if (omni_path.indexOf("#") != -1) {
          path_anchor = omni_path.substring(omni_path.indexOf("#"));
          omni_path = omni_path.substring(0, omni_path.indexOf("#"));
       }

       pathNames = pathElements(omni_path);
       _num = pathNames.ttl;
    }

    // Figure out which AO site we're on
    if (omni_hostname.indexOf("ct.specialoffers.starwoodhotels.com") != -1 && pathNames["0"] == "gendestlocalcontent.aspx") {
       omni_pageBrand = "aoDEST";
       omni_section = "aoDest";
       omni_localeCode = "tp_" + omni_localeCode;

       omni_propID = "noID";

       // Need to get subsection name from the forwarded Destination name in the URL
       omni_subsection = s.getQueryParam("destName");

       // What view are we seeing
       var content_view = s.getQueryParam("View");

       omni_detail1 = "LocalInfo";

       if (content_view.toLowerCase() == "city") {
           omni_detail2 = "Idx";
       }

       if (content_view.toLowerCase() == "buslist") {
           omni_detail2 = document.getElementById("BusListHeader").firstChild.nodeValue;
           omni_detail2 = omni_detail2.substring(omni_detail2.lastIndexOf("/") + 1);

           omni_detail3 = "Idx";
       }

       if (content_view.toLowerCase() == "busdesc") {
           omni_detail2 = document.getElementById("BusDescCategory").firstChild.nodeValue;
           omni_detail2 = omni_detail2.substring(omni_detail2.lastIndexOf("/") + 1);

           omni_detail3 = document.getElementById("BusDescHeader").firstChild.nodeValue;
       }

    }
    else if (omni_hostname.indexOf("specialoffers.starwoodhotels.com") != -1 || omni_hostname.indexOf("starwoodspecialoffers.com") != -1) {

       omni_hotelBrand = omni_pageBrand;

       omni_section = "SOP";
       // Subsection comes from the first directory
       omni_subsection = pathNames["0"];


       if (pathNames[(_num - 1).toString()].indexOf(".") == -1) {
          pathNames[_num.toString()] = "so.htm";
          _num++;
          pathNames.ttl++;
       }

       pathNames[(_num - 1).toString()] += path_anchor;

       omni_detail1 = pathNames["1"];
       omni_detail2 = pathNames["2"];
       omni_detail3 = delimit(createParams(pathNames["3"], pathNames["4"], pathNames["5"], pathNames["6"], pathNames["7"], pathNames["8"], pathNames["9"], pathNames["10"]));

    }
    else if (omni_hostname.indexOf("aba.starwoodhotels.com") != -1){

       omni_pageBrand = "aoPartner";

       omni_section = "aoPartner";
       // Subsection in this case is hard coded.
       omni_subsection = "aba";


       // check to see if any path was included and if a page with a file type, if not add so.htm to the end
       if (_num == 0) {
          pathNames["0"] = "index.htm";
          _num++;
          pathNames.ttl++;
       }

	
       if (pathNames[(_num - 1).toString()].indexOf(".") == -1) {
          pathNames[(_num).toString()] = "index.htm";
          _num++;
          pathNames.ttl++;
       }


       pathNames[(_num - 1).toString()] += path_anchor;

       omni_detail1 = pathNames["0"];
       omni_detail2 = pathNames["1"];
       omni_detail3 = delimit(createParams(pathNames["2"], pathNames["3"], pathNames["4"], pathNames["5"], pathNames["6"], pathNames["7"], pathNames["8"], pathNames["9"]));

    }    
    
    else if (omni_hostname.indexOf("partners.starwoodhotels.com") != -1){

       omni_pageBrand = "aoPartner";

       omni_section = "aoPartner";
       // Subsection comes from the first directory
       omni_subsection = pathNames["0"];


       if (pathNames[(_num - 1).toString()].indexOf(".") == -1) {
          pathNames[_num.toString()] = "index.htm";
          _num++;
          pathNames.ttl++;
       }

       pathNames[(_num - 1).toString()] += path_anchor;

       omni_detail1 = pathNames["1"];
       omni_detail2 = pathNames["2"];
       omni_detail3 = delimit(createParams(pathNames["3"], pathNames["4"], pathNames["5"], pathNames["6"], pathNames["7"], pathNames["8"], pathNames["9"], pathNames["10"]));

    }
    else if (omni_hostname.indexOf(".offers.starwoodhotels.com") != -1 ){

       omni_hotelBrand = omni_pageBrand;

       omni_section = "SOP2";
       // Need to get subsection name from hostname.
       omni_subsection = omni_hostname.substring(0, omni_hostname.indexOf("."));

       // check to see if any path was included and if a page with a file type, if not add so.htm to the end
       if (_num == 0) {
          pathNames["0"] = "so.htm";
          _num++;
          pathNames.ttl++;
       }

       if (pathNames[(_num - 1).toString()].indexOf(".") == -1) {
          pathNames[_num.toString()] = "so.htm";
          _num++;
          pathNames.ttl++;
       }

       pathNames[(_num - 1).toString()] += path_anchor;

       omni_detail1 = pathNames["0"];
       omni_detail2 = pathNames["1"];
       omni_detail3 = delimit(createParams(pathNames["2"], pathNames["3"], pathNames["4"], pathNames["5"], pathNames["6"], pathNames["7"], pathNames["8"], pathNames["9"]));

    }
    else if (omni_hostname.indexOf(".destinations.starwoodhotels.com") != -1 || omni_hostname.indexOf("starwooddestinations.com") != -1) {
       omni_pageBrand = "aoDEST";
       omni_section = "aoDest";
       omni_localeCode = "tp_" + omni_localeCode;

       omni_propID = "noID";

       // Need to get subsection name from hostname.
       omni_subsection = omni_hostname.substring(0, omni_hostname.indexOf("."));

       // do a check for a pageID page or append the default page
       if (omni_pageid.length > 0) {
          pathNames = {};
          pathNames["0"] = "pgID";
          pathNames["1"] = omni_pageid;
          if (_num < 2) {
             _num = 2;
             _pathNames.ttl = 2;
          }

       }
       else if (_num == 0) {
          pathNames = {};
          pathNames["0"] = "index.htm";
          _num++;
          pathNames.ttl++;
       }
       else if (pathNames[(_num - 1).toString()].indexOf(".") == -1) {
          pathNames[_num.toString()] = "index.htm";
          _num++;
          pathNames.ttl++;
       }

       pathNames[(_num - 1).toString()] += path_anchor;

       omni_detail1 = pathNames["0"];
       omni_detail2 = pathNames["1"];
       omni_detail3 = delimit(createParams(pathNames["2"], pathNames["3"], pathNames["4"], pathNames["5"], pathNames["6"], pathNames["7"], pathNames["8"], pathNames["9"]));

    }
    else if (omni_hostname.indexOf("whappenings.com") != -1) {
       omni_pageBrand = "tpWH";
       omni_section = "wHappenings";
       omni_localeCode = "tp_" + omni_localeCode;
       omni_subsection = (_num == 0) ? "index.htm" : pathNames["0"];
       omni_subsection += path_anchor;

    }


    function pathElements (hrefPath) {
       var _naming = new Object();
       var posit1 = 0;
       var posit2 = 0;
       var piece;

       _naming.ttl = 0; // initialize to zero

       while (posit1 < hrefPath.length - 1) {
          posit1 = hrefPath.indexOf("/", posit1);
          posit2 = hrefPath.indexOf("/", posit1 + 1);

          if (posit2 == -1) {
             posit2 = hrefPath.length;
          }

          piece = hrefPath.substring(posit1 + 1, posit2);
          if (piece.length > 0) {
             _naming[_naming.ttl.toString()] = piece;
             _naming.ttl++;
          }

          posit1 = posit2;
       }

       return _naming;
    }

    function decodeLangId (lang_id) {
       var retVal = "en_US";

       switch (lang_id) {
          case 1033:   retVal = "en_US"; break;
          case 1036:   retVal = "fr_FR"; break;
          case 1041:   retVal = "ja_JP"; break;
          case 1031:   retVal = "de_DE"; break;
          case 3082:   retVal = "es_ES"; break;
          case 1049:   retVal = "ru_RU"; break;
          case 1040:   retVal = "it_IT"; break;
          case 2052:   retVal = "zh_CN"; break;
          default :    retVal = "en_US"; break;
       }

       return retVal;
    }

    function decodeBrandNameAO (brand_name) {
       var retVal;

       switch (brand_name.toLowerCase()) {
          case "sheraton"    :   retVal = "SI"; break;
          case "westin"      :   retVal = "WI"; break;
          case "fourpoints"  :   retVal = "4P"; break;
          case "whotels"     :   retVal = "WH"; break;
          case "luxury"      :   retVal = "LC"; break;
          case "st_regis"    :   retVal = "ST"; break;
          case "md"          :   retVal = "MD"; break;
          case "gx"          :   retVal = "GX"; break;
          case "spp"         :   retVal = "MT"; break;
          case "aloft"	     :   retVal = "AL"; break;
          case "element"     :   retVal = "EL"; break;
          default            :   retVal = "XX"; break;
       }

       return retVal;
    }