function cm_divCreate3( id_, tOffset_, bOffset_ )
{
	var offsetDiff = ( bOffset_ - tOffset_ );

	document.write( "<DIV ID=\"" + id_ + "\" " );
	document.write( "STYLE=\"z-index:-1; position:absolute; " );
	document.write( "top:" + tOffset_ + "px;" );
	document.write( "width:1px;" );
	document.write( "height:"+ offsetDiff + "px;" );
	document.write( "overflow:visible;background:#cccccc;\">" );
	document.write( "<img " );
	document.write( " src=\"" + "<%= _grid.getResourcePath() %>clear.gif" + "\" " );

	document.write( "border=\"0\" alt=\"\" width=\"1+\" height=\" " + offsetDiff + "\"/> " );
	document.write( "</DIV>" );
	
	return "";
}

function drawLine( id_, tableMinH_, contY_, footerY_ )
{
	if ( footerY_ - contY_ < tableMinH_ - PANEL_TOP )
		cm_divCreate3( id_, contY_ + PANEL_TOP, contY_ + tableMinH_ - PANEL_TOP );

	else
		cm_divCreate3( id_, contY_ + PANEL_TOP, footerY_ );
}

function draw( isFirstMin_, isThirdMin_ )
{
	if (isFirstMin_ == null || isThirdMin_ == null)
		return;
		
	var BORDER_TOP = 15;
	var tableMinH_ = 354;
	var cont = document.getElementById( 'pos_anchor' ); 
	var contY_ = _getPageOffsetTop( cont ) + PANEL_TOP - BORDER_TOP;
	var footer = document.getElementById( 'footer1' );
	var footerY_ = _getPageOffsetTop( footer );

	if ( isFirstMin_ && isThirdMin_ )
		; // do nothing

	else if ( isThirdMin_ )
		drawLine( "img1", tableMinH_, contY_, footerY_ );

	else if ( isFirstMin_ )
		drawLine( "img2", tableMinH_, contY_, footerY_ );

	else
	{
		drawLine( "img1", tableMinH_, contY_, footerY_ );
		drawLine( "img2", tableMinH_, contY_, footerY_ );
	}
}
function getCookieVal (offset) {
  var endstr = document.cookie.indexOf (";", offset);
  if (endstr == -1)
    endstr = document.cookie.length;
  return unescape(document.cookie.substring(offset, endstr));
}
function FixCookieDate (date) {
  var base = new Date(0);
  var skew = base.getTime(); // dawn of (Unix) time - should be 0
  if (skew > 0)  // Except on the Mac - ahead of its time
    date.setTime (date.getTime() - skew);
}

function GetCookie (name) {
  var arg = name + "=";
  var alen = arg.length;
  var clen = document.cookie.length;
  var i = 0;
  while (i < clen) {
    var j = i + alen;
    if (document.cookie.substring(i, j) == arg)
      return getCookieVal (j);
    i = document.cookie.indexOf(" ", i) + 1;
    if (i == 0) break;
  }
  return null;
}
function SetCookie (name,value,expires,path,domain,secure) {
  document.cookie = name + "=" + escape (value) +
    ((expires) ? "; expires=" + expires.toGMTString() : "") +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    ((secure) ? "; secure" : "");
}
function DeleteCookie (name,path,domain) {
  if (GetCookie(name)) {
    document.cookie = name + "=" +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}

/////////// merged msimintl.js here ///////////////////
var domicileRoles = null;
var disclaimerArray = new Array();
var disclaimerReverseArray = new Array();
var disclaimerTextArray = new Array();
var counter=0;

function getRequestParameter( url, name ) {
	name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
	var regexS = "[\\?&]"+name+"=([^&#]*)";
	var regex = new RegExp( regexS );
	var results = regex.exec( url );
	if( results == null )
		return "";
	else
		return results[1];
}

function initializeDR(dCount){
	domicileRoles = new Array(dCount);
    if (domicileRoles == null || domicileRoles.length <= 0) 
        return;
    
    var domicileCount = dCount;
    var index;
    
    // for Roles
    for (index = 0; index < domicileRoles.length; index++) 
        domicileRoles[index] = new Array();
}

function spaces(count){
    for (var i = 0; i < count; i++) 
        document.write("&#160;");
}

function addRole(countryIndex_, roleCode_, language, role_, navUrl_){
    if (domicileRoles == null || domicileRoles.length <= 0) 
        return;
    
    if (countryIndex_ < 0 || roleCode_ == null || language == null || role_ == null) 
        return;
    
    domicileRoles[countryIndex_] = domicileRoles[countryIndex_].concat(role_);
    domicileRoles[countryIndex_] = domicileRoles[countryIndex_].concat(navUrl_);
    domicileRoles[countryIndex_] = domicileRoles[countryIndex_].concat(roleCode_);
}

function fillSelectFromArray(selectCtrl, itemArray, goodPrompt, badPrompt, defaultItem){
    var i, j;
    var prompt;
    
    // empty existing items
    for (i = selectCtrl.options.length; i >= 0; i--) {
        selectCtrl.options[i] = null;
    }
    
    prompt = (itemArray != null) ? goodPrompt : badPrompt;
    if (prompt == null || prompt == " ") {
        j = 0;
        selectCtrl.options[0] = new Option("Role");
    }
    else {
        selectCtrl.options[0] = new Option(prompt);
        j = 1;
    }
    
    if (itemArray != null) {
        // add new items
        for (i = 0; i < itemArray.length; i = i + 3) {
            if (itemArray[i] != "") {
                selectCtrl.options[j] = new Option(itemArray[i], itemArray[i + 1], false, false);
                selectCtrl.options[j].id = itemArray[i + 2];
                j++;
            }
        }
        // select first item (prompt) for sub list
        selectCtrl.options[0].selected = true;
    }
}

function setDR(){
    var val = document.DRFormName.DomicileComboBox.options[document.DRFormName.DomicileComboBox.selectedIndex].value;
    var url = document.DRFormName.DomicileComboBox.options[document.DRFormName.DomicileComboBox.selectedIndex].id;
    document.DRFormName.SelectedCountry.value = val;
    document.FR_STARTUP_HEADER.SelectedCountry.value = val;
    var checkUrl = document.DRFormName.DomicileComboBox.options[document.DRFormName.DomicileComboBox.selectedIndex].id;
    var strWww = /www/;
    var strHttp = /http/;
    
    if (url != "") {
        if (checkUrl.search(strWww) != -1) {
            var unlaunchedUrl = "http://" + checkUrl;
            window.open(unlaunchedUrl, '_self');
        }
        else {
			document.DRFormName.SelectedCountry.value = val;
			document.DRFormName.action = url;
			//document.DRFormName.u.value = getRequestParameter(url,"u");
			//document.DRFormName.msimPageTitle.value = getRequestParameter(url,"msimPageTitle");
			document.DRFormName.submit();            
		}
    }
}

function fillRoleComboBox(){
    var val = document.DRFormName.DomicileComboBox.options[document.DRFormName.DomicileComboBox.selectedIndex].value;
    var domicileComboBox = document.DRFormName.DomicileComboBox;
    var roleComboBox = document.DRFormName.RoleComboBox;
    var selRole = document.DRFormName.SelectedRole.value;
    
    if (domicileComboBox == null || roleComboBox == null) 
        return;
    
    var selectedIndex = domicileComboBox.selectedIndex;
    if (selectedIndex >= 2) {
        selectedIndex = selectedIndex - 2;
        if (domicileRoles[selectedIndex].length > 0) {
            fillSelectFromArray(roleComboBox, ((selectedIndex == -1) ? null : domicileRoles[selectedIndex]));
		}
        else {
            fillSelectFromArray(roleComboBox, ((selectedIndex == -1) ? null : domicileRoles[0] = "undefined"));
		}
    }
}

function changeLanguage(){
    if (document.FR_STARTUP_HEADER.LanguageComboBox.options[document.FR_STARTUP_HEADER.LanguageComboBox.selectedIndex].id != "") {
        var submitUrl = document.FR_STARTUP_HEADER.LanguageComboBox.options[document.FR_STARTUP_HEADER.LanguageComboBox.selectedIndex].id;
        document.FR_STARTUP_HEADER.action = submitUrl;
        document.FR_STARTUP_HEADER.submit();
    }
}

function changeSiteLanguage(){
	if(document.HorNavForm.LanguageComboBox.options[document.HorNavForm.LanguageComboBox.selectedIndex].id != "")
	{
		var submitUrl = document.HorNavForm.LanguageComboBox.options[document.HorNavForm.LanguageComboBox.selectedIndex].id;
		var refUrl = location.href;
		var params = refUrl.split("?")[1].split("&");
		for (var i=0; i < params.length; i++)
		{
			var paramName = params[i].split("=")[0];
			if (!(paramName == "msimPageTitle" || paramName == "u" || paramName == "MSIM_DA"))
			{
				submitUrl += "&" + params[i];
			}
		}
		location.href = submitUrl;
		return false;        
	}
	return true;
}

function launchSearch(url) {
  
  var encodestr = escape(document.getElementById('searchQuery').value);   
  url = url + "template.SEARCH/?msimPageTitle=search_result&interactive=false&query=" + encodestr;    
  remote = open(url, "Search", "scrollbars,resizable,width=698,height=600,left=20,top=20");
  remote.focus();
}

function go()
{
	choice = document.quickMenu.login;
	destination = choice.options[choice.selectedIndex].value;
	if (destination == '0') return;
	top.document.location.href = destination;
}

function paintRole(){
    var role = document.DRFormName.RoleComboBox.options[document.DRFormName.RoleComboBox.selectedIndex].value;
    var roleId = document.DRFormName.RoleComboBox.options[document.DRFormName.RoleComboBox.selectedIndex].id;
    
    if (role != ' ') 
    {
        document.getElementById('RoleSpan').innerHTML = ":" + '<br/>' + document.DRFormName.RoleComboBox.options[document.DRFormName.RoleComboBox.selectedIndex].text;
		document.getElementById('submitbutton').style.visibility="visible";	
    }
    else 
    {
        document.getElementById('RoleSpan').innerHTML = "";
		document.getElementById('submitbutton').style.visibility="hidden";
    }
}

function launchNewWindow(url){
    window.open(url, "", "width=500,height=400,status=1");
}

function submitPage(){
    //alert("submit page");
    var submitUrl = document.DRFormName.RoleComboBox.options[document.DRFormName.RoleComboBox.selectedIndex].value;
    var checkUrl = submitUrl;
    //alert("submit URL" + submitUrl);
    var strWww = /www/;
    if (submitUrl == " ") {
        //alert("Inside else of submitPage()");
    }
    else {
        //alert("Inside else of submitPage()");
        if (checkUrl.search(strWww) != -1) {
            var unlaunchedUrl = "http://" + checkUrl;
            //alert("Inside if of else in submitPage()");
            window.open(unlaunchedUrl, '_self');
        }
        else {
            //alert("Inside else of else in submitPage()");
            var selectedCountry = document.DRFormName.DomicileComboBox.options[document.DRFormName.DomicileComboBox.selectedIndex].value;
            var selectedRole = document.DRFormName.RoleComboBox.options[document.DRFormName.RoleComboBox.selectedIndex].text;
            var selectedRoleId = document.DRFormName.RoleComboBox.options[document.DRFormName.RoleComboBox.selectedIndex].id;
            var selRoleIndex = document.DRFormName.RoleComboBox.selectedIndex;
            openPopWindowForRoles(selectedCountry, selectedRoleId, submitUrl);
        }
    }
}

//function $(id) { return document.getElementById(id); }
function func1(portalHttpRoot) {
  var portalHttpRoot = "/msim/portal/";
  var currentWindowURL =window.location.href;
  var urlWithoutParam = currentWindowURL.split("?")[0];
  var urlWithParam = currentWindowURL.split("?")[1];
  var pStr,count,usPageTitleFlag="false",usUParamFlag="false",iiRoleFlag="false",fpRoleFlag="false";

  var paramStr = urlWithParam.split("&");

  for(count=0;count<paramStr.length;count++) {
    pStr = paramStr[count];  
    var name = pStr.split("=")[0];
    var value = pStr.split("=")[1]; 
    if(name=="msimPageTitle") {
		if (value=="role_home")
		{
			usPageTitleFlag="role_home";
		}
		else if (value=="aip_in" || value=="aip_thought_lead_in")
		{
			usPageTitleFlag="aip";	
		}
    } else if ((name=="u")&&((value=="a2050c555a53daf33d3afb1051a9e009") || (value=="a2050c555a53daf33d3afb1051a9e009#"))) {
        usUParamFlag="true";      
        fpRoleFlag="true";    
    } else if ((name=="u")&&((value=="86bb14f4dc87daf33d3afb1051a9e009") || (value=="86bb14f4dc87daf33d3afb1051a9e009#"))) {
        usUParamFlag="true";  
        iiRoleFlag="true";    
    }                       
  }

  if ((urlWithoutParam.indexOf(portalHttpRoot + "site/US")!=-1)
          && (usUParamFlag=="true")
      && (usPageTitleFlag=="role_home")
      && (fpRoleFlag=="true")) {
     //alert("redirect for us fp...");
        window.location.href=portalHttpRoot+"site/US/template.PAGE/?msimPageTitle=role_home_us_fp_ii&u=a2050c555a53daf33d3afb1051a9e009";
  } else if ((urlWithoutParam.indexOf(portalHttpRoot+"site/US")!=-1)
      && (usUParamFlag=="true")
      && (usPageTitleFlag=="role_home")
      && (iiRoleFlag=="true")) {
       //alert("redirect for us ii...");
      window.location.href=portalHttpRoot+"site/US/template.PAGE/?msimPageTitle=role_home_us_fp_ii&u=86bb14f4dc87daf33d3afb1051a9e009";
  } else if(usPageTitleFlag=="aip"){
       //alert("should not redirect...");
	   window.location.href="http://www.morganstanley.com/aip";
  }
}

function loadHTMLFragment(elemId, HTMLFragment) {
	if (document && document.getElementById &&
		 document.getElementById(elemId) &&
		 document.createElement &&
		 document.appendChild &&
		 document.getElementsByTagName) {
		var el = document.getElementById(elemId);
		el.innerHTML = "&nbsp;" + HTMLFragment;
		var d =el.getElementsByTagName('script');
		var t = d.length;
		for (var x=0;x<t;x++) {
			var newScript = document.createElement('script');
			newScript.type = "text/javascript";
			newScript.text = d[x].text;
			el.appendChild(newScript);
	    }
	    for (var y=0;y<t;y++) {
			el.removeChild(el.getElementsByTagName("script")[y]);
	    }
	}
}

function ajaxLoadingImage(portletUID) {
	$("#divLoading")[0].innerHTML = '<img src="/msim/portal/msim_custom/indicator.gif" height="12" width="12" alt="loading..."/>';
}

function ajaxSubmit(portletUID,formToSubmit) {
	/*
	disclaimerArray = new Array();
	disclaimerReverseArray = new Array();
	disclaimerTextArray = new Array();
	counter=0;
	ajaxLoadingImage(portletUID);
	formSubmit.action=eval("asyncurl" + portletUID);
	new VignettePortal.AJAXClient().sendForm(formToSubmit, eval("callbackFunction"+portletUID));
	*/
	formToSubmit.submit();
}

function dailyPricesAjaxSubmit() {
	var portletUID = "263464c8fd40c8480a8cfd103207e009";
	ajaxSubmit(portletUID,document.form_msimintl);
}

function pricesArchiveAjaxSubmit() {
	var portletUID = "3d0bd07025db45d2d73cd5103207e009";
	ajaxSubmit(portletUID,document.tab_form);
}

function sitePerfAjaxSubmit() {
	var portletUID = "325e3d37b782526dbe9ea1f53207e009";
	ajaxSubmit(portletUID,document.tab_form);
}

function init_csvCountry(countryID)
{
	document.form_csv_msimintl.csvCountry.value = countryID;
}

function init_pageID(pageID)
{
	document.form_csv_msimintl.XML_PAGE_ID.value = pageID;
}

function init_csvLanguage(languageID)
{
	document.form_csv_msimintl.csvLanguage.value = languageID;
}

function init_csvRole(role)
{
	document.form_csv_msimintl.csvRole.value = role;
}

function init_secure(secure)
{
	document.form_csv_msimintl.csvSecure.value = secure;
}

function select_asset_class(vehicleID, channelID)
{
	init_vehicle(vehicleID);
	init_channel(channelID);
	clearShareClassDropdown();
	dailyPricesAjaxSubmit();
}

function select_share_class(vehicleID, channelID)
{
	init_vehicle(vehicleID);
	init_channel(channelID);
	dailyPricesAjaxSubmit();
}

function init_vehicle(vehicleID)
{
	document.form_msimintl.veh_id.value = vehicleID;
}

function init_channel(channelID)
{
	document.form_msimintl.ch_id.value = channelID;
}

function clearShareClassDropdown()
{
	if(document.form_msimintl.sc != null)
	{
		document.form_msimintl.sc.options.length=0;
	}
}

function clearDropDowns()
{
	var scd=document.getElementsByName("sc");
	var acd=document.getElementsByName("ac");
	
	if (document.form_msimintl.sc != null && scd[0].type=="select-one")
	{
		document.form_msimintl.sc.options.length=0;
	}
	if (document.form_msimintl.ac != null && acd[0].type=="select-one")
	{
		document.form_msimintl.ac.options.length=0;
	}
}

function select_vehicle(vehicleID, channelID)
{
	init_channel(channelID);
	document.form_msimintl.veh_id.value = vehicleID;
	clearDropDowns();
	if(document.form_msimintl.ac != null)
	{
		document.form_msimintl.ac.value = "";
	}
	if(document.form_msimintl.sc != null)
	{
		document.form_msimintl.sc.value = "";
	}
	dailyPricesAjaxSubmit();
}

function select_channel(channelID)
{
	document.form_msimintl.ch_id.value = channelID;
	document.form_msimintl.veh_id.value = "";
	clearDropDowns();
	if(document.form_msimintl.ac != null)
	{
		document.form_msimintl.ac.value = "";
	}
	if(document.form_msimintl.sc != null)
	{
		document.form_msimintl.sc.value = "";
	}
	dailyPricesAjaxSubmit();
}

function site_perf_select_vehicle(vehicleID){
	document.tab_form.veh_id.value = vehicleID;
	document.tab_form.ac.value = "";
	document.tab_form.sc.value = "";
	document.tab_form.perf_date_type.value = "";
	sitePerfAjaxSubmit();
}

function site_perf_select_date_type(dt){
	document.tab_form.perf_date_type.value = dt;
	sitePerfAjaxSubmit();
}
						
function site_perf_init_channel(p_channel_id) {
	document.tab_form.channel_id.value = p_channel_id;
	document.tab_form.veh_id.value = "";
	document.tab_form.ac.value = "";
	document.tab_form.sc.value = "";
	document.tab_form.perf_date_type.value = "";
	sitePerfAjaxSubmit();
}

function site_perf_select_asset_class(p_asset_class) {
	document.tab_form.sc.value = "";
	document.tab_form.ac.value = p_asset_class;
	sitePerfAjaxSubmit();
}

function site_perf_select_share_class(p_share_class) {
	document.tab_form.sc.value = p_share_class;
	sitePerfAjaxSubmit();
}

function prices_archive_select_vehicle(vehicleID, channelID) {
	document.tab_form.vehicle_id.value = vehicleID;
    document.tab_form.channel_id.value = channelID;
    pricesArchiveAjaxSubmit();
}
						
function prices_archive_init_channel(p_channel_id) {
	document.tab_form.channel_id.value = p_channel_id;
	document.tab_form.vehicle_id.value = '';
	pricesArchiveAjaxSubmit();
}

function get_literature_init_channel(channel) {
	document.form_msimintl.veh_id.value = "";
	if(eval("document.form_msimintl"+"."+"sc")) {
		document.form_msimintl.sc[document.form_msimintl.sc.selectedIndex].value = "";
	}
	document.form_msimintl.ch_id.value = channel;
	document.form_msimintl.submit();
}

function get_literature_init_vehicle(vehicle, channel) {  
	document.form_msimintl.veh_id.value = vehicle;
	document.form_msimintl.ch_id.value = channel;
	if(eval("document.form_msimintl"+"."+"sc")) {
		document.form_msimintl.sc[document.form_msimintl.sc.selectedIndex].value = "";
	}
	document.form_msimintl.submit();
}

function get_literature_init_only_vehicle(vehicle,channel) {  
	document.form_msimintl.veh_id.value = vehicle;
	document.form_msimintl.ch_id.value = channel;
	if(eval("document.form_msimintl"+"."+"sc")) {
		document.form_msimintl.sc[document.form_msimintl.sc.selectedIndex].value = "";
	}
	document.form_msimintl.submit();
}

function popupPrintFriendlyPage(location)
{
   window.open(location, 'PrintWindow', 'width=820,height=600,resizable=yes');
}

function storeDisclaimer(disclaimerid)  
{
	disclaimerArray[disclaimerid]=counter+1;
	counter=disclaimerArray[disclaimerid];
	disclaimerReverseArray[counter]=disclaimerid;
}

function getPageDisclaimerId(disclaimerid)  
{
	var returnVal=disclaimerArray[disclaimerid];
	if(returnVal == null)
	{
		storeDisclaimer(disclaimerid);
		return getPageDisclaimerId(disclaimerid);
	}
	else
	{
		return returnVal;
	}
}

function getDiscValues(list)
{
    var retVal="";
    if(list.length !=0)
    {
	    var tkns = list.split(",");
	    var counter=0;
        while(counter < tkns.length)
        {
        	var discValue=removeSpaces(tkns[counter]);
        	if(discValue.length !=0)
			{
            	retVal = retVal + getPageDisclaimerId(tkns[counter])+",";
			}
            counter=counter+1;
        }
    }
	if(retVal.length > 0)
	{
	  retVal = retVal.substring(0, retVal.length-1);
	}
   return retVal;
}

function removeSpaces(trimkey)
{ 
	return trimkey.replace(/^\s+|\s+$/, ''); 
}

function storeDisclaimerText(disclaimerId, disclaimerText)
{	
	disclaimerTextArray[disclaimerId] = disclaimerText;
}

function printDisclaimerData()
{
	var discData = "";
	for (i=0; i<disclaimerReverseArray.length-1; i++)
	{
		discData += "<p class=\"legaltext\"><sup>"+(i+1)+"</sup>&#160;" + disclaimerTextArray[disclaimerReverseArray[i+1]] + "</p>";
	}
	return discData;
}

function getDiscalimerIndex(index) {
	return disclaimerReverseArray[index];
}

function sortArray()
{
  disclaimerArray.sort(sortNumber);
  document.write(disclaimerArray);
}

function sortNumber(a, b)
{
	return (a - b);
}

function openpopup(popurl){
    window.open(popurl,"","width=800,height=600,scrollbars,");
}
// dummy function to disable Webtrends tracking
function dcsMultiTrack() {
	return false;
}

///////////// function from msimintl.js ends here /////////////////

function acknowledgeDisclaimer()
{
	var form = document.getElementById( "DisclaimerFormID" );
	//this only for secure for first time logins
	if (envType == "MSIMSEC")
		DeleteCookie("JSESSIONID","/msim/portal");

	// Uncomment the line below to enable GET request to accept disclaimer 
	//var submitUrl = window.location + "&MSIM_DA=" + form.MSIM_DA.value; window.location.href = submitUrl;
	
	// Comment out the lines below to disable POST request to accept disclaimer
	form.action = window.location;
	form.submit();
}

function printCountryNotLaunchedLinks() {	
	document.getElementById('RoleComboDiv').innerHTML='<table border="0" width="100%" cellspacing="0" cellpadding="0" id="table68"><tr><img width="20" height="5" border="0" src="/msamg/msimintl/docs/en_IE/images/clear.gif"/></tr> <tr><img width="20" height="5" border="0" src="/msamg/msimintl/docs/en_IE/images/clear.gif"/></tr> <tr><img width="20" height="5" border="0" src="/msamg/msimintl/docs/en_IE/images/clear.gif"/></tr> 	<tr>		<td width="50%" valign="top" nowrap="true"> 		<IMG height=8 alt="" src="/msamg/msimintl/docs/en_US/images/misc/bullet_red.gif" width=9 border=0> 			<A class=ColumnLink href="http://www.morganstanleyinvestmentfunds.com">MS INVF Daily Prices</A> 				<BR> 					<IMG height=8 alt="" src="/msamg/msimintl/docs/en_US/images/misc/bullet_red.gif" width=9 border=0> 			<A class=ColumnLink href="/liquidity">Morgan Stanley Funds p.l.c.</A> 				<BR> 					<IMG height=8 alt="" src="/msamg/msimintl/docs/en_US/images/misc/bullet_red.gif" width=9 border=0> 			<A class=ColumnLink href="/im/institutional/">Institutional Investor</A> </td> 	</tr> </table>';
}

function openPopWindowForRoles(selectedCountry, selectedRoleId, submitUrl) {
	var funcRetVal = -1;
	var docPath = "/msamg/msimintl/docs/";
	var htmlPath = "/common/welcome_popup.htm";
	var iiFileToOpen = docPath + contentLocale + htmlPath; 
	var fpFileToOpen = docPath + contentLocale + htmlPath; 
	//alert (" file to open " + fileToOpen);
	//alert (" selected country " + selectedCountry);
	
	// work order 569 global landing page redesign

	if (((selectedCountry == 'GB')
		|| (selectedCountry == 'AT')
		|| (selectedCountry == 'AU')
		|| (selectedCountry == 'DE')
		|| (selectedCountry == 'IE')
		|| (selectedCountry == 'IT')
		|| (selectedCountry == 'FR')
		|| (selectedCountry == 'ES')
		|| (selectedCountry == 'HK')
		|| (selectedCountry == 'CH')
		|| (selectedCountry == 'DK')
		|| (selectedCountry == 'FI')
		|| (selectedCountry == 'PE')
		|| (selectedCountry == 'PT')
		|| (selectedCountry == 'CL')
		|| (selectedCountry == 'LU')
		|| (selectedCountry == 'NL')
		|| (selectedCountry == 'NO')
		|| (selectedCountry == 'SE')
		|| (selectedCountry == 'UN')
		|| (selectedCountry == 'GR'))
		&& (selectedRoleId == 'II')) {									
		funcRetVal = 1;	window.open(iiFileToOpen,'Information','left=0,top=0,toolbar=0,menubar=0,dependant=1,location=0,scrollbars=1,resizable=1,width=400,height=590');			
	}

		if ((selectedCountry == 'AU')&& ((selectedRoleId == 'FP_PL') || (selectedRoleId == 'FP_FA') ) ){									
		funcRetVal = 1;	window.open(iiFileToOpen,'Information','left=0,top=0,toolbar=0,menubar=0,dependant=1,location=0,scrollbars=1,resizable=1,width=400,height=590');			
	}

	if (((selectedCountry == 'DK')
		|| (selectedCountry == 'FI')
		|| (selectedCountry == 'CL')
		|| (selectedCountry == 'LU')
		|| (selectedCountry == 'PE')
		|| (selectedCountry == 'NL')
		|| (selectedCountry == 'NO')
		|| (selectedCountry == 'PT')
		|| (selectedCountry == 'UN')
		|| (selectedCountry == 'SE')
		|| (selectedCountry == 'GR'))
		&& (selectedRoleId == 'FP')) {									
		funcRetVal = 1;	window.open(fpFileToOpen,'Information','left=0,top=0,toolbar=0,menubar=0,dependant=1,location=0,scrollbars=1,resizable=1,width=400,height=590');			
	}


	if (funcRetVal == -1) {
			//document.DRFormName.action=submitUrl;
			//document.DRFormName.submit();
			window.location.href=submitUrl;
		}
}

function i18nValue(strToReplace) {
	strToReplace = strToReplace.replace(/&gt;/g,">");
	strToReplace = strToReplace.replace(/&lt;/g,"<");
	strToReplace = strToReplace.replace(/&#39;/g,"'");
	strToReplace = strToReplace.replace(/&quot;/g,"\"");
	return strToReplace;
}
	
function mailToFunction(mailToAddress) {	
document.location.href="MailTo:" + mailToAddress;
}

function hideStableProduct()
{
	var vehOptionsObj = document.getElementById("vehicleInfo");	
	if (vehOptionsObj != null)
	{
		var i;
		for (i=0; i<vehOptionsObj.length; i++)
		{
			if (vehOptionsObj.options[i].value == 'SV_static')
			{
				vehOptionsObj.remove(i);
			}
		}
	}
}


// to show the static mgmt file
function submitEPD(lang, domicile, filename, fundid) {
	var currentWindowURL =window.location.href;
	var urlDomain = currentWindowURL.split("/msim/portal/site")[0];
	var urlWithParam = currentWindowURL.split("?")[1];
	var pStr,count,uParam;
	//pStr=" ";
	var paramStr = urlWithParam.split("&");
	//alert("paramStr" + paramStr);
	
	for (count=0; count < paramStr.length; count++){
		pStr = paramStr[count];  
		var name = pStr.split("=")[0];
		var value = pStr.split("=")[1]; 
		//alert("name is:"+name);
		//alert("value is:"+value);     
			
		if(name=="u")
			uParam=value;                          
	}
	//alert("uParam" + uParam);

	if (filename.indexOf("pd.htm")!=-1){
		filename="common/product/"+fundid+"_pd.htm";
		//alert(filename);
	}

	if (filename.indexOf("lit.htm")!=-1){
		filename="common/product/"+fundid+"_lit.htm";
		//alert(filename);
	}

	if (filename.indexOf("mgmt.htm")!=-1){
		filename="common/product/"+fundid+"_mgmt.htm";
		//alert(filename);
	}

	var submitUrl=urlDomain+"/msim/portal/site/"+domicile+"/template.PAGE/?msimPageTitle=epd_vp&u="+uParam+"&msimCurrentUrl_epd_vp=/msamg/msimintl/docs/"+lang+"_"+domicile+"/"+filename+"&fund="+fundid;
	//alert(submitUrl);
	window.location.href=submitUrl;
}

// function which can be used from static tab submit to another static tab.
function submitEPDStatic(tabName) {
	//var currentWindowURL ="http://piias762.ms.com:7204/msim/portal/site/US/?fund=5156&u=a2050c555a53daf33d3afb1051a9e009&msimPageTitle=epd";
	var currentWindowURL =window.location.href;
	var urlDomain = currentWindowURL.split("/msim/portal/site")[0];
	var urlWithParam = currentWindowURL.split("?")[1];
	//alert("urlWithParam" + urlWithParam);
	//alert("urlDomain" + urlDomain);
	var pStr,count,uParam, fundid, filename, lang, domicile ;
	//pStr=" ";
	var paramStr = urlWithParam.split("&");
	//alert("paramStr" + paramStr);
		
	for (count=0; count < paramStr.length; count++){
		pStr = paramStr[count];  
		var name = pStr.split("=")[0];
		var value = pStr.split("=")[1]; 
		//alert("name is:"+name);
		//alert("value is:"+value);     
		
		if(name=="u")
			uParam=value; 
		
		if(name=="fund") {
			fundid=value; 
			if (fundid.indexOf("#") != -1) {
				fundid=fundid.substring(0, fundid.length-1);
				//alert("fundid" + fundid);
			}
		}
	}
	//alert("uParam" + uParam);			
	//alert("fundid" + fundid);

	if (tabName == "#pd.htm") {
		filename="common/product/"+fundid+"_pd.htm";
		//alert(filename);
	} else if (tabName == "#lit.htm") {
		filename="common/product/"+fundid+"_lit.htm";
		//alert(filename);
	} else if (tabName == "#mgmt.htm") {
		filename="common/product/"+fundid+"_mgmt.htm";
	}

	var cookie_value = GetCookie("MSIMWeb");
	if (cookie_value != "") {
		var locale = cookie_value.substring(0,5);
		lang = locale.substring(0,2);
		domicile = locale.substring(3,5);
		var role = cookie_value.substring(6,8);
		//alert("lang" + lang + "domicile"  + domicile);
	}
	
	var submitUrl=urlDomain+"/msim/portal/site/"+domicile+"/template.PAGE/?msimPageTitle=epd_vp&u="+uParam+"&msimCurrentUrl_epd_vp=/msamg/msimintl/docs/"+lang+"_"+domicile+"/"+filename+"&fund="+fundid;
	//alert(submitUrl);

	window.location.href=submitUrl;
}

// function to submit to dynamic ov page from static file...separate function since in static file, html parser inserts path if any parameter is used.
function submitEPDov() {
	var currentWindowURL =window.location.href;
	var urlDomain = currentWindowURL.split("/msim/portal/site")[0];
	var urlWithParam = currentWindowURL.split("?")[1];
	var pStr,count,uParam, fundid, filename, lang, domicile, strategyid, isStrategy=false ;
	var paramStr = urlWithParam.split("&");

	for (count=0; count < paramStr.length; count++){
		pStr = paramStr[count];
		var name = pStr.split("=")[0];
		var value = pStr.split("=")[1];

		if(name=="u")
			uParam=value;

		if(name=="fund") {
			fundid=value;
		
			if (fundid.indexOf("#") != -1) {
				fundid=fundid.substring(0, fundid.length-1);
				//alert("fundid" + fundid);
			}
		}
		
		if(name=="strategy") {
			strategyid=value;
			isStrategy=true;
		}
	}

	var cookie_value = GetCookie("MSIMWeb");
	if (cookie_value != "") {
		var locale = cookie_value.substring(0,5);
		lang = locale.substring(0,2);
		domicile = locale.substring(3,5);
		var role = cookie_value.substring(6,8);
	}

	if(isStrategy) {				
		var submitUrl=urlDomain+"/msim/portal/site/"+domicile+"/template.PAGE/?msimPageTitle=strategydetail&u="+uParam+"&fund="+fundid+ "&tabName=epd&strategy="+strategyid;
	} else {
		var submitUrl=urlDomain+"/msim/portal/site/"+domicile+"/template.PAGE/?msimPageTitle=epd&u="+uParam+"&fund="+fundid+ "&tabName=epd";
	}
	window.location.href=submitUrl;
	//alert("submitUrl:"+ submitUrl);
}

// function to submit to dynamic mgmt page from static file...separate function since in static file, html parser inserts path if any parameter is used.
function submitEPDmgmt() {
	var currentWindowURL =window.location.href;
	var urlDomain = currentWindowURL.split("/msim/portal/site")[0];
	var urlWithParam = currentWindowURL.split("?")[1];
	var pStr,count,uParam, fundid, filename, lang, domicile, strategyid, isStrategy=false ;
	var paramStr = urlWithParam.split("&");

	for (count=0; count < paramStr.length; count++){
		pStr = paramStr[count];
		var name = pStr.split("=")[0];
		var value = pStr.split("=")[1];

		if(name=="u")
			uParam=value;

		if(name=="fund") {
			fundid=value;
		
			if (fundid.indexOf("#") != -1) {
				fundid=fundid.substring(0, fundid.length-1);
				//alert("fundid" + fundid);
			}
		}
		
		if(name=="strategy") {
			strategyid=value;
			isStrategy=true;
		}
	}

	var cookie_value = GetCookie("MSIMWeb");
	if (cookie_value != "") {
		var locale = cookie_value.substring(0,5);
		lang = locale.substring(0,2);
		domicile = locale.substring(3,5);
		var role = cookie_value.substring(6,8);
	}

	if(isStrategy) {				
		var submitUrl=urlDomain+"/msim/portal/site/"+domicile+"/template.PAGE/?msimPageTitle=strategydetail&u="+uParam+"&fund="+fundid+ "&tabName=epd_mgmt&strategy="+strategyid;
	} else {
		var submitUrl=urlDomain+"/msim/portal/site/"+domicile+"/template.PAGE/?msimPageTitle=epd_mgmt&u="+uParam+"&fund="+fundid+ "&tabName=epd_mgmt";
	}
	window.location.href=submitUrl;
	//alert("submitUrl:"+ submitUrl);
}

// function to submit to dynamic comp page from static file..separate function since in static file, html parser inserts path if any parameter is used.
function submitEPDcomp() {
	var currentWindowURL =window.location.href;
	var urlDomain = currentWindowURL.split("/msim/portal/site")[0];
	var urlWithParam = currentWindowURL.split("?")[1];
	var pStr,count,uParam, fundid, filename, lang, domicile, strategyid, isStrategy=false ;
	var paramStr = urlWithParam.split("&");

	for (count=0; count < paramStr.length; count++){
		pStr = paramStr[count];
		var name = pStr.split("=")[0];
		var value = pStr.split("=")[1];

		if(name=="u")
			uParam=value;

		if(name=="fund") {
			fundid=value;
		
			if (fundid.indexOf("#") != -1) {
				fundid=fundid.substring(0, fundid.length-1);
				//alert("fundid" + fundid);
			}
		}
		
		if(name=="strategy") {
			strategyid=value;
			isStrategy=true;
		}
	}

	var cookie_value = GetCookie("MSIMWeb");
	if (cookie_value != "") {
		var locale = cookie_value.substring(0,5);
		lang = locale.substring(0,2);
		domicile = locale.substring(3,5);
		var role = cookie_value.substring(6,8);
	}

	if(isStrategy) {				
		var submitUrl=urlDomain+"/msim/portal/site/"+domicile+"/template.PAGE/?msimPageTitle=strategydetail&u="+uParam+"&fund="+fundid+ "&tabName=epd_comp&strategy="+strategyid;
	} else {
		var submitUrl=urlDomain+"/msim/portal/site/"+domicile+"/template.PAGE/?msimPageTitle=epd_comp&u="+uParam+"&fund="+fundid+ "&tabName=epd_comp";
	}
	window.location.href=submitUrl;
	//alert("submitUrl:"+ submitUrl);
}

// function to submit to dynamic comp page from static file..separate function since in static file, html parser inserts path if any parameter is used.
function submitEPDpd() {
	var currentWindowURL =window.location.href;
	var urlDomain = currentWindowURL.split("/msim/portal/site")[0];
	var urlWithParam = currentWindowURL.split("?")[1];
	var pStr,count,uParam, fundid, filename, lang, domicile, strategyid, isStrategy=false ;
	var paramStr = urlWithParam.split("&");

	for (count=0; count < paramStr.length; count++){
		pStr = paramStr[count];
		var name = pStr.split("=")[0];
		var value = pStr.split("=")[1];

		if(name=="u")
			uParam=value;

		if(name=="fund") {
			fundid=value;
		
			if (fundid.indexOf("#") != -1) {
				fundid=fundid.substring(0, fundid.length-1);
				//alert("fundid" + fundid);
			}
		}
		
		if(name=="strategy") {
			strategyid=value;
			isStrategy=true;
		}
	}

	var cookie_value = GetCookie("MSIMWeb");
	if (cookie_value != "") {
		var locale = cookie_value.substring(0,5);
		lang = locale.substring(0,2);
		domicile = locale.substring(3,5);
		var role = cookie_value.substring(6,8);
	}

	if(isStrategy) {				
		var submitUrl=urlDomain+"/msim/portal/site/"+domicile+"/template.PAGE/?msimPageTitle=strategydetail&u="+uParam+"&fund="+fundid+ "&tabName=epd_pd&strategy="+strategyid;
	} else {
		var submitUrl=urlDomain+"/msim/portal/site/"+domicile+"/template.PAGE/?msimPageTitle=epd_pd&u="+uParam+"&fund="+fundid+ "&tabName=epd_pd";
	}
	window.location.href=submitUrl;
	//alert("submitUrl:"+ submitUrl);
}


// function to submit to dynamic comp page from static file..separate function since in static file, html parser inserts path if any parameter is used.
function submitEPDperf() {
	var currentWindowURL =window.location.href;
	var urlDomain = currentWindowURL.split("/msim/portal/site")[0];
	var urlWithParam = currentWindowURL.split("?")[1];
	var pStr,count,uParam, fundid, filename, lang, domicile, strategyid, isStrategy=false ;
	var paramStr = urlWithParam.split("&");

	for (count=0; count < paramStr.length; count++){
		pStr = paramStr[count];
		var name = pStr.split("=")[0];
		var value = pStr.split("=")[1];

		if(name=="u")
			uParam=value;

		if(name=="fund") {
			fundid=value;
		
			if (fundid.indexOf("#") != -1) {
				fundid=fundid.substring(0, fundid.length-1);
				//alert("fundid" + fundid);
			}
		}
		
		if(name=="strategy") {
			strategyid=value;
			isStrategy=true;
		}
	}

	var cookie_value = GetCookie("MSIMWeb");
	if (cookie_value != "") {
		var locale = cookie_value.substring(0,5);
		lang = locale.substring(0,2);
		domicile = locale.substring(3,5);
		var role = cookie_value.substring(6,8);
	}

	if(isStrategy) {				
		var submitUrl=urlDomain+"/msim/portal/site/"+domicile+"/template.PAGE/?msimPageTitle=strategydetail&u="+uParam+"&fund="+fundid+ "&tabName=epd_perf&strategy="+strategyid;
	} else {
		var submitUrl=urlDomain+"/msim/portal/site/"+domicile+"/template.PAGE/?msimPageTitle=epd_perf&u="+uParam+"&fund="+fundid+ "&tabName=epd_perf";
	}
	window.location.href=submitUrl;
	//alert("submitUrl:"+ submitUrl);
}

// function to submit to dynamic comp page from static file..separate function since in static file, html parser inserts path if any parameter is used.
function submitEPDlit() {
	var currentWindowURL =window.location.href;
	var urlDomain = currentWindowURL.split("/msim/portal/site")[0];
	var urlWithParam = currentWindowURL.split("?")[1];
	var pStr,count,uParam, fundid, filename, lang, domicile, strategyid, isStrategy=false ;
	var paramStr = urlWithParam.split("&");

	for (count=0; count < paramStr.length; count++){
		pStr = paramStr[count];
		var name = pStr.split("=")[0];
		var value = pStr.split("=")[1];

		if(name=="u")
			uParam=value;

		if(name=="fund") {
			fundid=value;
		
			if (fundid.indexOf("#") != -1) {
				fundid=fundid.substring(0, fundid.length-1);
				//alert("fundid" + fundid);
			}
		}
		
		if(name=="strategy") {
			strategyid=value;
			isStrategy=true;
		}
	}

	var cookie_value = GetCookie("MSIMWeb");
	if (cookie_value != "") {
		var locale = cookie_value.substring(0,5);
		lang = locale.substring(0,2);
		domicile = locale.substring(3,5);
		var role = cookie_value.substring(6,8);
	}

	if(isStrategy) {				
		var submitUrl=urlDomain+"/msim/portal/site/"+domicile+"/template.PAGE/?msimPageTitle=strategydetail&u="+uParam+"&fund="+fundid+ "&tabName=epd_lit&strategy="+strategyid;
	} else {
		var submitUrl=urlDomain+"/msim/portal/site/"+domicile+"/template.PAGE/?msimPageTitle=epd_lit&u="+uParam+"&fund="+fundid+ "&tabName=epd_lit";
	}
	window.location.href=submitUrl;
	//alert("submitUrl:"+ submitUrl);
}


// function to submit to SOLO page from static file...separate function since in static file, html parser inserts path if any parameter is used.
function popUpSolo() {
	var currentWindowURL =window.location.href;
	var urlDomain = currentWindowURL.split("/msim/portal/site")[0];
	var urlWithParam = currentWindowURL.split("?")[1];
	var pStr,count,uParam, fundid, filename, lang, domicile ;
	var paramStr = urlWithParam.split("&");

	for (count=0; count < paramStr.length; count++){
		pStr = paramStr[count];
		var name = pStr.split("=")[0];
		var value = pStr.split("=")[1];

		if(name=="u")
			uParam=value;

		if(name=="fund") {
			fundid=value;
		
			if (fundid.indexOf("#") != -1) {
				fundid=fundid.substring(0, fundid.length-1);
				//alert("fundid" + fundid);
			}
		}
	}
	var cookie_value = GetCookie("MSIMWeb");
	if (cookie_value != "") {
		var locale = cookie_value.substring(0,5);
		lang = locale.substring(0,2);
		domicile = locale.substring(3,5);
		var role = cookie_value.substring(6,8);
	}

	var submitUrl="/msim/portal/site/"+domicile+"/template.SOLO/?javax.portlet.pst=de8ec6a7b936f4d3e87201103207e009_ws_SO&viewID=XML_VIEW&app_id=GetHoldings&fund="+fundid;
	//window.location.href=submitUrl;
	popUp(submitUrl, "Holdings");
}

// function to submit to FPP page from static file...separate function since in static file, html parser inserts path if any parameter is used.
function openfppstat(isin,product_name,mode) {
	var currentWindowURL =window.location.href;
	var urlDomain = currentWindowURL.split("/msim/portal/site")[0];

	isin=isin.substring(1, isin.length);
	var lang, domicile ;

	var cookie_value = GetCookie("MSIMWeb");
	if (cookie_value != "") {
		var locale = cookie_value.substring(0,5);
		lang = locale.substring(0,2);
		domicile = locale.substring(3,5);
		//alert("lang" + lang + "domicile"  + domicile);
	}

	var submitUrl=urlDomain+"/msim/portal/servlet/HttpsProxyServlet?targetURL=https://morganstanley.openfpp.com/framesearch/&amp;isin="+isin+"&fundName="+product_name+"&mode="+mode+"&src=/msim/portal/site/"+domicile+"/fpp&domicile="+domicile+"&language="+lang;
	//alert(submitUrl);
	remote = window.open(submitUrl, "FPP", "location=yes,scrollbars,resizable,width=770,height=800,left=20,top=20");
	remote.focus();

}

// function to display tree navigation on left hand side menu in expanded form always. This is called in thought_leadership_search_compact.jsp
function showSublevelMenu() {			
	var brobj = document.getElementById("MSIM_INDEX_PORTLET_branchNode2Child");
	if (brobj == null || brobj.style == null || brobj.style.display == null)
	{
		return;
	}
	else
	{
		brobj.style.display='block';
	}
}

//function used to open XBRL popup window
function popupWindow(url) {
	remote = window.open(url);
	remote.focus();
}

function trackExternalResources(url,dispTitle,pathStr) {		
	pageTracker._trackPageview("/externalResources/" + pathStr + "/" + dispTitle);
	remote = window.open(url);
	remote.focus();
}

function trackAndOpenPopUp(url,dispTitle,params) {		
  if (typeof(pageTracker) == "object") 
    pageTracker._trackPageview(url);
  remote = window.open(url,dispTitle,params);
  remote.focus();
}

function trackPageHit(url) {
  if (typeof(pageTracker) == "object") 
    pageTracker._trackPageview(url);
}


