﻿var _context = (document.location.pathname.split("/"))[1];
var re = /^Pem/;  // if starting with 'Pem', then it is context
if (re.test(_context))
   _context = "/" + _context;
else
   _context = "";

home_image = new Image();
home_image.src = _context + "/images/home_light.gif";

aboutus_image = new Image();
aboutus_image.src = _context + "/images/about_light.gif";

investment_image = new Image();
investment_image.src = _context + "/images/investments_light.gif";

team_image = new Image();
team_image.src = _context + "/images/team_light.gif";

news_image = new Image();
news_image.src = _context + "/images/news_light.gif";

offices_image = new Image();
offices_image.src = _context + "/images/offices_light.gif";

mouseover_home_image = new Image();
mouseover_home_image.src = _context + "/images/home_dark.gif";

mouseover_aboutus_image = new Image();
mouseover_aboutus_image.src = _context + "/images/about_dark.gif";

mouseover_investment_image = new Image();
mouseover_investment_image.src = _context + "/images/investments_dark.gif";

mouseover_team_image = new Image();
mouseover_team_image.src = _context + "/images/team_dark.gif";

mouseover_news_image = new Image();
mouseover_news_image.src = _context + "/images/news_dark.gif";

mouseover_offices_image = new Image();
mouseover_offices_image.src = _context + "/images/offices_dark.gif";


function swap()
{
    if (document.images)
    {
        for (var x=0; x<swap.arguments.length; x+=2) 
        {
            document[swap.arguments[x]].src = eval(swap.arguments[x+1] + ".src");
        }
    }
}

//////////////////////////////////////////////////////////////////////////////////////
//collapse or hide detailed document lists in investor/default.aspx
function collapseOrHide(id) // idth year
{ 
	   var rows = document.getElementById("main").rows;
	  var img =  document.getElementById("img" + id);
	  var tr = document.getElementById("row" + id);
	  var rowindex = tr.getAttribute("rowindex");
	  var next_tr = document.getElementById("row" + (id+1));
	  var next_rowindex = next_tr == null ? rows.length : next_tr.getAttribute("rowindex") - 1;
	
	  var displayStr;
	  if(img.src.indexOf("minus") == -1) // orginally a + sign, click it, show all underlying rows
	  {
	     displayStr = "";
	     img.src = _context + "/images/minus.jpg";
	  }
	  else // orginally a - sign, click it, hide all underlying rows
	  {
	     displayStr = "none";
	     img.src = _context + "/images/plus.jpg";
	  }
	
	  for(var i = eval(rowindex) + 1; i < next_rowindex; i++)
	  {
	    rows[i].style.display =  displayStr;      
	  }  
}