/* Javascript for the portfolio pages */

/**************** UI client images **************************/
UI1 = new Image;
UI1.src = "/images/port_anaspec.jpg";

UI2 = new Image;
UI2.src = "/images/port_amat.jpg";

UI3 = new Image;
UI3.src = "/images/port_childrens_progress.jpg";

UI4 = new Image;
UI4.src = "/images/port_digitaldirect.jpg";

UI5 = new Image;
UI5.src = "/images/port_hedgestreet.jpg";

UI6 = new Image;
UI6.src = "/images/port_innopath.jpg";

UI7 = new Image;
UI7.src = "/images/port_iui.jpg";

UI8 = new Image;
UI8.src = "/images/port_miami.jpg";

UI9 = new Image;
UI9.src = "/images/port_microsoft.jpg";

UI10 = new Image;
UI10.src = "/images/port_monosphere.jpg";
/*************************************************************/

/********************* AppDev client images ******************/
AD1 = new Image;
AD1.src = "/images/port_ariba.jpg";

AD2 = new Image;
AD2.src = "/images/port_goldmail.jpg";

AD3 = new Image;
AD3.src = "/images/port_barrington.jpg";

AD4 = new Image;
AD4.src = "/images/port_hershey.jpg";

AD5 = new Image;
AD5.src = "/images/port_hp.jpg";

AD6 = new Image;
AD6.src = "/images/port_imany.jpg";

AD7 = new Image;
AD7.src = "/images/port_opsware.jpg";

AD8 = new Image;
AD8.src = "/images/port_ourblock.jpg";

AD9 = new Image;
AD9.src = "/images/port_rapt.jpg";

AD10 = new Image;
AD10.src = "/images/port_searchparty.jpg";
/**************************************************************/

portfolioDefaultImage = new Image;
portfolioDefaultImage.src = "/images/port_default.jpg";


function changeBackground( container, index ) {
	document.getElementById('client-list').style.backgroundImage = "url(" + eval( index + ".src" ) + ")";
}
function restoreBackground( container ) {
	document.getElementById(container).style.backgroundImage = "url(/images/portfolio_microsoft.jpg)";
}

function thumbnailRollover( client, order, obj, focusedSSId ) {
    var order_map = new Array(4);
    order_map[0] = 'a';
    order_map[1] = 'b';
    order_map[2] = 'c';
    order_map[3] = 'd';

    for (var i = 0; i < 4; i++) {
      if (document.getElementById("thumbnail" + (i + 1)))
        document.getElementById("thumbnail" + (i + 1)).src = "/images/screenshots/off_" + client + "_" + order.charAt(0) + order_map[i] + ".gif";
    }

    obj.src = "/images/screenshots/on_" + client + "_" + order + ".gif";
    document.getElementById(focusedSSId).src = "/images/screenshots/" + client + "_" + order + ".gif";
}

function selectedClient( clientName ) {
  var vert_line = document.getElementById('submenu-vertical-line');
  var horiz_line = document.getElementById('submenu-vertical-line-bottom');
  var client_list = document.getElementById("client-list");
  var selected_client = document.getElementById(clientName);
  var line_height = 28;
  var listPosition = 1;
  
  for (var i = 0; i < client_list.childNodes.length; i++) {
    if (client_list.childNodes[i].id == clientName) {
      break;
    }
    if (client_list.childNodes[i].tagName == "a" || client_list.childNodes[i].tagName == "A")
      listPosition++;
  }
  
  if (selected_client) {
    selected_client.style.color = '#003399';
    vert_line.style.height = ((listPosition - 1) * line_height) + 63 + "px";
    horiz_line.style.top = ((listPosition - 1) * line_height) + 127 + "px";
    horiz_line.style.display = "inline";
  }
   
  //positionClientLogo();
}

function positionClientLogo() {
  if (document.getElementById("client-logo").complete) {
    var clientLogo = document.getElementById("client-logo");
    
    //clientLogo.style.left = (226 - (clientLogo.width / 2)) + "px";   
    
    clientLogo.style.display = "block";
  }
}
