// portfolio javascript routines

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
var rl = document.getElementById("ReferenceLayer");
function showRef(tf,e){
    if(tf) rl.style.visibility = 'visible';
    else   rl.style.visibility ='hidden';
}
MM_reloadPage(true);


function PortfolioWin(url,shape)
{
  if(shape=='reg') {
    var prefs = "width=580,height=560,resizable=no,scrollbars=no,toolbar=no,statusbar=no,menubar=no";
  } else if(shape=='wide') {
    var prefs = "width=620,height=540,resizable=no,scrollbars=no,toolbar=no,statusbar=no,menubar=no";
  } else if(shape=='tall') {
    var prefs = "width=585,height=640,resizable=no,scrollbars=no,toolbar=no,statusbar=no,menubar=no";
  }
  var portWin = window.open('','Portfolio',prefs);
  portWin.document.open();
  portWin.document.writeln('<html><body bgcolor="white" topMargin="5">'+
      '<img src="' +url+ '" vspace="6" hspace="6"></body></html>');
  portWin.document.close();
}


// Access the correct HTML element, regardless of the browser it's in
function getObj(name)
{
	if (document.getElementById) {
		return document.getElementById(name).style;
	}
	else if (document.all) {
		return document.all[name].style;
	} 
	else if (document.layers) {
		return MM_findObj(name);
	}
}

// Visibility and Invisibility. flag=1 => invisible, flag=0 => visible
function invis(id,flag)
{
	if (!DHTML) return;
	var x = getObj(id);
	x.visibility = (flag) ? 'hidden' : 'visible'
}

function preparePortLinks(e) {
  if(!document.getElementsByTagName) return false;
  var links = document.getElementsByTagName("a");
  for (var i=0; i<links.length; i++) {
    if(links[i].className.match("portSmWin")) {
      links[i].onclick = function() {
        PortfolioWin(this.href,'reg');
        return false;
      }
    } else if(links[i].className.match("portBigWin")) {
      links[i].onclick = function() {
        PortfolioWin(this.href,'wide');
        return false;
      }
    } else if(links[i].className.match("portTallWin")) {
      links[i].onclick = function() {
        PortfolioWin(this.href,'tall');
        return false;
      }
    }
  }
}
window.onload = preparePortLinks;
