/* WDIG Analytics - Omniture Tagging
Site Name: disneylatino.com
File Name: disneylatino.com.js
Created Date: 2010/3/19 - 10:14:30
*/

function OmniReport(urlPath) {
    var country = [];
    var unit = [];
    var policy = [];
    var property_code = [];
    var account = [];
    var category = [];
    var region = [];
    var siteSection = [];
    var rootSiteSection = [];
    var regexMap = [];
    var matched = 0;
    var buMatched = 0;

    
    property_code["/"] = "none";
    account["/"] = "wdgintlatino";
    category["/"] = "dcore";
    region["/"] = "latam";
    country["/"] = "d2";
    rootSiteSection["/"] = "";
    regexMap["/"] = ["", ""];

    property_code["/disneychannel/"] = "dch";
    account["/disneychannel/"] = "wdgintlatino";
    category["/disneychannel/"] = "dtv";
    region["/disneychannel/"] = "latam";
    country["/disneychannel/"] = "d2";
    rootSiteSection["/disneychannel/"] = "";
    regexMap["/disneychannel/"] = ["", ""];

    property_code["/disneyonline/"] = "none";
    account["/disneyonline/"] = "wdgintlatino";
    category["/disneyonline/"] = "dcore";
    region["/disneyonline/"] = "latam";
    country["/disneyonline/"] = "d2";
    rootSiteSection["/disneyonline/"] = "";
    regexMap["/disneyonline/"] = ["", ""];

    property_code["/disneyvacaciones/"] = "dis_park";
    account["/disneyvacaciones/"] = "wdgintlatino";
    category["/disneyvacaciones/"] = "dtravel";
    region["/disneyvacaciones/"] = "latam";
    country["/disneyvacaciones/"] = "d2";
    rootSiteSection["/disneyvacaciones/"] = "";
    regexMap["/disneyvacaciones/"] = ["", ""];

    property_code["/disneyvideodvd/"] = "dvd";
    account["/disneyvideodvd/"] = "wdgintlatino";
    category["/disneyvideodvd/"] = "dcore";
    region["/disneyvideodvd/"] = "latam";
    country["/disneyvideodvd/"] = "d2";
    rootSiteSection["/disneyvideodvd/"] = "";
    regexMap["/disneyvideodvd/"] = [/(^.*)/, "peliculas:dvd:$1"];

    property_code["/disneyxd/"] = "";
    account["/disneyxd/"] = "wdgintlatino";
    category["/disneyxd/"] = "dtv";
    region["/disneyxd/"] = "latam";
    country["/disneyxd/"] = "d2";
    rootSiteSection["/disneyxd/"] = "";
    regexMap["/disneyxd/"] = ["", ""];

    property_code["/filmesdisney/"] = "mov";
    account["/filmesdisney/"] = "wdgintlatino";
    category["/filmesdisney/"] = "dcore";
    region["/filmesdisney/"] = "latam";
    country["/filmesdisney/"] = "d2";
    rootSiteSection["/filmesdisney/"] = "";
    regexMap["/filmesdisney/"] = ["", ""];

    property_code["/juegos/"] = "none";
    account["/juegos/"] = "wdgintlatino";
    category["/juegos/"] = "dcore";
    region["/juegos/"] = "latam";
    country["/juegos/"] = "d2";
    rootSiteSection["/juegos/"] = "";
    regexMap["/juegos/"] = ["", ""];

    property_code["/playhousedisney/"] = "pla";
    account["/playhousedisney/"] = "wdgintlatino";
    category["/playhousedisney/"] = "dtv";
    region["/playhousedisney/"] = "latam";
    country["/playhousedisney/"] = "d2";
    rootSiteSection["/playhousedisney/"] = "";
    regexMap["/playhousedisney/"] = ["", ""];

    property_code["/playhousedisneychannel/"] = "pla";
    account["/playhousedisneychannel/"] = "wdgintlatino";
    category["/playhousedisneychannel/"] = "dtv";
    region["/playhousedisneychannel/"] = "latam";
    country["/playhousedisneychannel/"] = "d2";
    rootSiteSection["/playhousedisneychannel/"] = "";
    regexMap["/playhousedisneychannel/"] = ["", ""];

    property_code["/shows/"] = "";
    account["/shows/"] = "wdgintlatino";
    category["/shows/"] = "dcore";
    region["/shows/"] = "latam";
    country["/shows/"] = "d2";
    rootSiteSection["/shows/"] = "";
    regexMap["/shows/"] = ["", ""];

    property_code["/videoclip/"] = "none";
    account["/videoclip/"] = "wdgintlatino";
    category["/videoclip/"] = "dcore";
    region["/videoclip/"] = "latam";
    country["/videoclip/"] = "d2";
    rootSiteSection["/videoclip/"] = "";
    regexMap["/videoclip/"] = ["", ""];

    unit["/"] = "dol";
    unit["/disneychannel/"] = "tdc";
    unit["/disneyvacaciones/"] = "wdpro";
    unit["/disneyvideodvd/"] = "dol";
    unit["/disneyxd/"] = "disneyxd";
    unit["/filmesdisney/"] = "dol";
    unit["/parques/"] = "wdpro";
    unit["/playhousedisney/"] = "pd";
    unit["/playhousedisneychannel/"] = "pd";
    this.account = account[urlPath];
    this.region = region[urlPath];
    this.country = country[urlPath];
    this.category = category[urlPath];
    this.unit = unit[urlPath];
    this.policy = policy[urlPath];
    this.rootSiteSection = rootSiteSection[urlPath];
    this.regexMap = regexMap[urlPath];
    this.property_code = property_code[urlPath];

    urlarray = urlPath.split("/");
    while ( matched === 0 && urlarray.length > 1) {
    if (typeof(country[urlPath]) === "undefined" || country[urlPath] === "")
        { /* If no exact match is found try to match the parent directory */
          urlarray.pop();
          urlPath = urlarray.join("/");
          urlPath = urlPath + "/";
        } else {
          matched = 1;
        }
    }

    this.property_code = property_code[urlPath];
    this.country = country[urlPath];
    this.rootSiteSection = rootSiteSection[urlPath];
    this.category = category[urlPath];
    this.region = region[urlPath];
    this.account = account[urlPath];
    if (siteSection) {this.siteSection = siteSection[urlPath]; }
    if (rootSiteSection) {this.rootSiteSection = rootSiteSection[urlPath]; }
    if (regexMap) {this.regexMap = regexMap[urlPath]; }

    // Search BU mappings
    var i = digWAObj.origArray.length;
    while ( buMatched === 0 && i >= 0) {
        var tryString = "/";
        for (var x = 0; x <= i-1; x++) {
            tryString = tryString + digWAObj.origArray[x] + "/";
        }
        if (typeof(unit[tryString]) === "undefined" || unit[tryString] === "") {
        } else {
            buMatched = 1;
        }
        i = i-1;
    }
    this.unit = unit[tryString];
    this.dirMatched = i;

    // Search for appropriate tracking policy
    debug("checking origarray: " +digWAObj.origArray)
    for(var i = digWAObj.origArray.length; matched === 0 && i >= 0; i--)
    {
	    var tryString = "/";
	    for (var x = 0; x < i; x++)
		    tryString = tryString + digWAObj.origArray[x] + "/";
	    if (typeof(policy[tryString]) !== "undefined" && policy[tryString] !== "") 
		    matched = 1;
    }
    this.policy = policy[tryString];
    this.policyMatched = i;

}

report = new OmniReport(digWAObj.urlPath, digWAObj.urlLength);
if (digWAObj.account) { s_account = digWAObj.account; } else { s_account = report.account; }// account
digWAObj.linkInternalFilters="javascript:,disneylatino.com";
report.charSet="UTF-8";
report.hbxDetagged = "1";
