// JavaScript Document
// FUNCTION THAT CHECKS THE DOM 
function getObj(name){
if (document.getElementById)
{this.obj = document.getElementById(name);}
else if (document.all)
{this.obj = document.all[name];}
else if (document.layers)
{this.obj = document.layers[name];}
}

// CENTER WINDOW //
function getWindowHeight() {
var windowHeight=0;
if (typeof(window.innerHeight) == 'number') {
windowHeight = window.innerHeight;
}
else {
if (document.documentElement && document.documentElement.clientHeight) {
windowHeight = document.documentElement.clientHeight;
}
else {
if (document.body&&document.body.clientHeight) {
windowHeight = document.body.clientHeight;
}
}
}
return windowHeight;
}

function setSpacing() {
if (document.getElementById) {
var windowHeight = getWindowHeight();
if (windowHeight > 0) {
var contentElement = new getObj('holder');
var contentHeight = contentElement.obj.offsetHeight;
if (windowHeight - contentHeight > 0) {	
contentElement.obj.style.position = 'relative';
contentElement.obj.style.top = ((windowHeight / 2) - (contentHeight / 2)) + 'px';
}
else {
contentElement.obj.style.position = 'relative';
contentElement.obj.style.top = "0px";
}
}
}
}

// START SITE //

window.onload = function() {
  setSpacing();
  switch (window.location.search) {
  case "?print":
  case"?page=print":
  goPrint();
  break;
  case "?portfolio":
  case "?page=portfolio":
  goPortfolioCategory(1);
  break;
  case "?outdoor":
  case "?page=outdoor":
  case "?page=Outdoor":
  goPortfolioCategory(1);
  break;
  case "?galleries":
  case "?page=galleries":
  case "?page=Galleries":
  goPortfolioCategory(2);
  break;
  case "?3D+graphics":
  case "?page=3D/graphics":
  case "?page=3D/Graphics":
  goPortfolioCategory(3);
  break;
  case "?systems":
  case "?page=systems":
  case "?page=Systems":
  goPortfolioCategory(4);
  break;
  default:
  goHome();
  }
/*	if (window.location.search == "?print" ||window.location.search == "?page=print") {
		goPrint();
	  }
	else if (window.location.search == "?portfolio" ||window.location.search == "?page=portfolio") {
        goPortfolioCategory(2);
	}

    else {
		goHome();
	}
  //goHome();  */
}

window.onresize = function() {
  setSpacing();
}
