/*
 * Script:	sitewise.js
 * Version: 	2.0
 * Author:	marissa
 * Date:	March 21, 2003
 * Purpose:	The JavaScript file will be included in the html pages of
 *		www.morganstanley.com/im to define the content groups used
 *		by Akamai SiteWise.
 */


var wtl_imgarray = new Array;
var wtl_ptr = 0;
function wtl_Tag6(wtl_TagID,wtl_SID,wtl_URL,wtl_Title,CONTENTGROUP)
{

        function wtl_createImage(wtl_src)
        {
                wtl_imgarray[wtl_ptr] = new Image;
                wtl_imgarray[wtl_ptr].src = wtl_src;
                wtl_ptr++;
        }

        function D8( d)
        {
                var fwd=1, seed= new Date('01/01/2000'), key= "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
                var s= key.charAt( d.getFullYear()-2000)+key.charAt( d.getMonth()+1)+key.charAt( d.getDate());
                s+= key.charAt( d.getHours())+key.charAt( d.getMinutes())+key.charAt( d.getSeconds());
                while( seed.getDay()!=fwd) seed= new Date(seed.getTime() + 86400000);
                var w= Math.floor( (d.getTime()-(seed.getTime()+86400000)) / 604800000 );
                s+= key.charAt( (w-(w%16))/16 );
                s+= key.charAt( w%16);
                return s;
        }

        function A( B, C)
        {
                W+="&"+B+"="+escape(C);
        }

        var t = new Date();
        var W="http"+(document.URL.indexOf('https:')==0?'s':'')+"://statse.webtrendslive.com/S" + wtl_SID + "/button6.asp?tagver=" + wtl_TagVer + "&si=" + wtl_TagID + "&offset=" + wtl_Offset + "&fw=" + wtl_FWD;
        A( "server", typeof(SERVER)== "string" ? SERVER : "");
        A( "order", typeof(ORDER)== "string" ? ORDER : "");
        A( "Group", typeof(CONTENTGROUP)== "string" ? CONTENTGROUP : "");
        A( "invoice", typeof(INVOICE)== "string" ? INVOICE : "");
        A( "cartview", typeof(CARTVIEW)== "string" ? CARTVIEW : "");
        A( "cartadd", typeof(CARTADD)== "string" ? CARTADD : "");
        A( "cartremove", typeof(CARTREMOVE)== "string" ? CARTREMOVE : "");
        A( "checkout", typeof(CHECKOUT)== "string" ? CHECKOUT : "");
        A( "cartbuy", typeof(CARTBUY)== "string" ? CARTBUY : "");
        A( "adcampaign", typeof(ADCAMPAIGN)== "string" ? ADCAMPAIGN : "");
        A( "tz", t.getTimezoneOffset());
        A( "ch", t.getHours());
        A( "cl", D8(t));
        A( "ti", wtl_Title);
        A( "url", wtl_URL);
        A( "rf", window.document.referrer);
        A( "js", "Yes");
        A( "ul", navigator.appName=="Netscape" ? navigator.language : navigator.userLanguage);
        if(typeof(screen)=="object")
        {
        A( "sr", screen.width+"x"+screen.height);
        A( "cd", screen.colorDepth);
        A( "jo", navigator.javaEnabled() ? "Yes" : "No");
        }

        if( W.length>2048 && navigator.userAgent.indexOf('MSIE')>=0)
                W= W.substring( 0, 2043)+"&tu=1";

        wtl_createImage(W);

}

var url = document.URL;
var imgroup = '';
var im1 = new Array();
var im2 = new Array();


if (location.hostname.indexOf("vkm.com") == -1 && location.hostname.indexOf("pisas268") == -1 && location.hostname.indexOf("pubtest") == -1 && location.hostname.indexOf("dev.morganstanley") == -1 && location.hostname.indexOf("hqiinww16") == -1) {

 im1[0] = new RegExp("im\/index\.html");			im2[0] = "Main Page";	
 im1[1] = new RegExp("management\/index\.html");		im2[1] = "Main Page";	
 im1[2] = new RegExp("contact\/index\.html");			im2[2] = "Contact";	
 im1[3] = new RegExp("contact\/officeloc\.html");		im2[3] = "Contact,Office Locations";
 im1[4] = new RegExp("sitemap\/index\.html");			im2[4] = "Site Directory";
 im1[6] = new RegExp("\/performance\/");			im2[6] = "Performance";
 im1[7] = new RegExp("\/products\/prodsearch\.html");		im2[7] = "Product Search";
 im1[8] = new RegExp("\/publications\/index\.html");		im2[8] = "Publications";
 im1[9] = new RegExp("\/publications\/ffs\/");			im2[9] = "Publications,Fund Fact Sheets";
 im1[10] = new RegExp("\/publications\/shrpt\/");		im2[10] = "Publications,Shareholder Reports";
 im1[11] = new RegExp("\/publications\/strategy\/");		im2[11] = "Publications,Strategy Profiles";
 im1[12] = new RegExp("\/publications\/prosp\/");		im2[12] = "Publications,Prospectuses";
 im1[13] = new RegExp("\/legal\/index\.html");			im2[13] = "Legal";
 im1[14] = new RegExp("\/glossary\/index\.html");		im2[14] = "Glossary";
 im1[15] = new RegExp("\/resources\/index\.html");		im2[15] = "Client Resources";
 im1[16] = new RegExp("\/resources\/mktinsights\.html");	im2[16] = "Client Resources,Market Insights";
 im1[17] = new RegExp("\/mktinsights\/archive\/index\.html");	im2[17] = "Client Resources,Market Insights Archive";
 im1[18] = new RegExp("\/resources\/clientlink\.html");		im2[18] = "Client Resources,Client Link";
 im1[19] = new RegExp("\/resources\/news\/index\.html");	im2[19] = "Client Resources,News";
 im1[20] = new RegExp("\/resources\/strategic_review\.html");	im2[20] = "Client Resources,Strategic Review";
 im1[21] = new RegExp("\/products\/index\.html");		im2[21] = "Products Description";
 im1[22] = new RegExp("\/products\/invest_vehicles\.html");	im2[22] = "Products Description,Investment Vehicles";
 im1[23] = new RegExp("\/products\/stable\.html");		im2[23] = "Products Description,Stable Value";
 im1[24] = new RegExp("\/products\/altinvest\.html");		im2[24] = "Products Description,Alternative Investments";
 im1[25] = new RegExp("\/about\/index\.html");			im2[25] = "About";
 im1[26] = new RegExp("\/about\/history\.html");		im2[26] = "About,History";
 im1[27] = new RegExp("\/about\/global\.html");			im2[27] = "About,Global Presence";
 im1[28] = new RegExp("\/about\/our_clients\.html");		im2[28] = "About,Clients";
 im1[29] = new RegExp("\/about\/vision\.html");			im2[29] = "About,Vision";
 im1[30] = new RegExp("\/commentary\/index\.html");		im2[30] = "Commentary Tool";
 im1[31] = new RegExp("\/prices\/archive\/");			im2[31] = "Daily Price Archive";
 im1[32] = new RegExp("\/products\/\d*.*\/");			im2[32] = "5pager Pages";
 im1[33] = new RegExp("\/prices\/.*\.html");			im2[33] = "Daily Prices";
 im1[34] = new RegExp("im\/$");					im2[34] = "Main Page";	


 for (var index in im1) {
    if (im1[index].test(url)) {
	imgroup = im2[index];
	break;
    }
    else {
	imgroup = "Miscellaneous";
    }
 }

var wtl_url = document.URL;
var wtl_title = document.title;
var wtl_TagVer = 6;
var wtl_FWD = 0;
var wtl_Offset = "-500";
WTL_TAG = new Image;
WTL_TAG.ID = "WTL_TAG";


wtl_Tag6(94033,"005-01-8-2-233860-94033",wtl_url,wtl_title,"MorganStanley.com");
wtl_Tag6(93722,"005-01-8-1-233860-93722",wtl_url,wtl_title,"Investment Management");
wtl_Tag6(94041,"94041",wtl_url,wtl_title,imgroup);

}
