//Search references this
window.name="SPMAINWINDOW";
//general css functions
function cssElement (id)
{
  if (is.nav)
  {
    if (is.nav4)
    {
      this.obj = document.layers[id];
      this.css = this.obj;
      this.doc = this.obj.document;
    }
    else if (is.nav5up)
    {
      this.obj = document.getElementById (id);
      this.css = this.obj.style;
      this.doc = document;
    }
    this.left = this.css.left;
    this.right = this.css.clip.right;
    this.top = this.css.top;
    this.bottom = this.css.clip.bottom;
  }
  else if (is.ie4up)
  {
    this.obj = document.all[id];
    this.css = this.obj.style;
    this.doc = document;
  }
  this.show = cssElementShow;
  this.hide = cssElementHide;
}

function cssElementShow ()
{
  this.css.visibility = "visible";
}

function cssElementHide ()
{
  this.css.visibility = "hidden";
}

function resetLayout()
{
 (is.nav) ? window.location.reload() : setTimeout('window.location.reload()',500);
}

//menu specific components
var activeMenu = 0;
var isLoaded = false;

function activateMenu (ref)
{
  if(isLoaded)
  {
    if (activeMenu != ref)
    {
      var hideMenu = "menu" + activeMenu;
      if (activeMenu && hideMenu.hide) hideMenu.hide();
      else if (activeMenu) return;
      thisMenu = eval("menu" + ref);
      activeMenu = ref;
      thisMenu.show()
    }
    if (window.event != null)
    { if (is.ie4up) window.event.cancelBubble = true;}
  }
}

function maintainWindow (ref)
{
  if(isLoaded)
  {
    if (activeMenu == ref)
    {
       if (window.event != null)
       {
          if (is.ie4up) window.event.cancelBubble = true;
       }
    }
  }
}

function killMenu (e)
{
  //check if a menu is active
  if (activeMenu)
  {
    thisMenu = eval("menu" + activeMenu);
    if (is.nav)
    {
      menuX1 = thisMenu.left;
      menuX2 = menuX1 + thisMenu.right;
      if (activeMenu > 1) menuX2 = menuX2 + 20;
      menuY1 = thisMenu.top;
      menuY2 = menuY1 + thisMenu.bottom;
      if (e.pageX < menuX1 || e.pageX > menuX2 || e.pageY > menuY2)
      {
        thisMenu.hide();
        activeMenu = 0;
      }
    }
    else
    {
      thisMenu.hide();
      activeMenu = 0;
    }
  }  
}

function menuInit ()
{
  menu1 = new cssElement('menu1Div')
  menu2 = new cssElement('menu2Div')
  menu3 = new cssElement('menu3Div')
  if (is.nav)
  { 
    document.captureEvents(Event.MOUSEMOVE); 
    document.onmousemove = killMenu;
  }
  else
  {
    document.onmouseover = killMenu;
  }
}

function menuWrite()
{
  var offSet = (is.mac && is.ie4) ? 9 : 0;
  var x1 = (clientWidth < 777) ? 0 : parseInt(clientWidth/2) -387 + offSet;
  var x2 = (clientWidth < 777) ? 394 : parseInt(clientWidth/2) + 5 + offSet; //GRO 394=194/+7=-193
  var x3 = (clientWidth < 777) ? 595 : parseInt(clientWidth/2) + 206 + offSet; //GRO 394=194/+7=-193
  //var y1 = (arguments.length < 1) ? 80 : arguments[0];
  var y1 = 80;
  var y2 = 275; //GRO
  var y3 = 349; //GRO
  var str = '<STYLE TYPE="text/css">\n'+
  '  #menu1Div {visibility: hidden; position: absolute; left: ' + x1 +'px; top: ' + y1 + 'px; width: 195px; height: auto;}\n'+
  '  #menu2Div {visibility: hidden; position: absolute; left: ' + x2 +'px; top: ' + y2 + 'px; width: 145px; height: auto;}\n'+
  '  #menu3Div {visibility: hidden; position: absolute; left: ' + x3 +'px; top: ' + y3 + 'px; width: 145px; height: auto;}\n'+
  '</STYLE>'; //169=387
  document.write(str);
}

function writeRatingAnalysisSections(section)
{
	var string = '';

	if (section == "Corporate")
	{
		string += '<tr>' + 
            '<td width="9">&nbsp;</td>' +
            '<td width="9">&nbsp;</td>' +
            '<td class="text2">Corporate Ratings</td>' + 
            '</tr>';
	}
	else
	{
		string += '<tr>' + 
            '<td width="9">&nbsp;</td>' +
            '<td width="9">&nbsp;</td>' +
            '<td class="text2"><a href="../Corporate/corporate_main.html">Corporate ' + 
            'Ratings</a></td>' +
            '</tr>';
	}

	if (section == "Financial")
	{
		string += '<tr>' + 
            '<td width="9">&nbsp;</td>' +
            '<td width="9">&nbsp;</td>' +
            '<td class="text2">Financial Institution Ratings</td>' + 
            '</tr>';
	}
	else
	{
		string += '<tr>' + 
            '<td width="9">&nbsp;</td>' +
            '<td width="9">&nbsp;</td>' +
            '<td class="text2"><a href="../FinancialInst/finanInst_main.html">Financial ' + 
            'Institution Ratings</a></td>' +
            '</tr>';
	}

	if (section == "Infrastructure")
	{
		string += '<tr>' + 
            '<td width="9">&nbsp;</td>' +
            '<td width="9">&nbsp;</td>' +
            '<td class="text2">Infrastructure Finance Ratings</td>' + 
            '</tr>';
	}
	else
	{
		string += '<tr>' + 
            '<td width="9">&nbsp;</td>' +
            '<td width="9">&nbsp;</td>' +
            '<td class="text2"><a href="../Infrastruct/infrastruct_main.html">Infrastructure ' + 
            'Finance Ratings</a></td>' +
            '</tr>';
	}

	if (section == "Public")
	{
		string += '<tr>' + 
            '<td width="9">&nbsp;</td>' +
            '<td width="9">&nbsp;</td>' +
            '<td class="text2">Public Finance Ratings</td>' + 
            '</tr>';
	}
	else
	{
		string += '<tr>' + 
            '<td width="9">&nbsp;</td>' +
            '<td width="9">&nbsp;</td>' +
            '<td class="text2"><a href="../Public/public_main.html">Public Finance ' + 
            'Ratings</a></td>' +
            '</tr>';
	}

	if (section == "Sovereign")
	{
		string += '<tr>' + 
            '<td width="9">&nbsp;</td>' +
            '<td width="9">&nbsp;</td>' +
            '<td class="text2">Sovereign Ratings</td>' + 
            '</tr>';
	}
	else
	{
		string += '<tr>' + 
            '<td width="9">&nbsp;</td>' +
            '<td width="9">&nbsp;</td>' +
            '<td class="text2"><a href="../Sovereign/sovereign_main.html">Sovereign ' + 
            'Ratings</a></td>' +
            '</tr>';
	}

	if (section == "Structured")
	{
		string += '<tr>' + 
            '<td width="9">&nbsp;</td>' +
            '<td width="9">&nbsp;</td>' +
            '<td class="text2">Structured Finance Ratings</td>' + 
            '</tr>';
	}
	else
	{
		string += '<tr>' + 
            '<td width="9">&nbsp;</td>' +
            '<td width="9">&nbsp;</td>' +
            '<td class="text2"><a href="../Struct/struct_main.html">Structured ' + 
            'Finance Ratings</a></td>' +
            '</tr>';
	}

	document.write(string);
}





