//----------- Javascript Error Hider -----------

function HideErrors() { return true; }

//----------- Default/Variable/Browser Detect Stuff -----------

 window.onerror = HideErrors;
 window.defaultStatus = '';

//----------- Browser Detection -----------

if (parseInt(navigator.appVersion) >= 4) {
  var browserVar = navigator.platform;
	var ns = (document.layers)
	var ie = (document.all)
  var isWin = browserVar.indexOf("Win") != -1;
  var isMac = browserVar.indexOf("Mac") != -1;
}

//----------- Project Pop-Ups -----------

function popProject(urlGo) {
  var title;
  var strFeatures;
 
  title = 'GreenWorks';
    if (isMac) {
      if(ie) {
        strFeatures = "screenY='0',top='0',screenX='0',left='0',width=650,height=450,scrollbar=no,scrolling=no,toolbar=no,menubar=no,location=no,directories=no";
      } else {
        strFeatures = "screenY='0',top='0',screenX='0',left='0',width=650,height=450,scrollbar=no,scrolling=no,toolbar=no,menubar=no,location=no,directories=no";
      }
    } else {
        strFeatures = "screenY='0',top='0',screenX='0',left='0',width=650,height=450,scrollbar=no,scrolling=no,toolbar=no,menubar=no,location=no,directories=no";
    }
  objWindow = window.open(urlGo, title, strFeatures);
}

function popEmployee(urlGo) {
  var title;
  var strFeatures;
 
  title = 'GreenWorks';
    if (isMac) {
      if(ie) {
        strFeatures = "screenY=10,top=10,screenX=10,left=10,width=500,height=660,scrollbar=no,scrolling=no,toolbar=no,menubar=no,location=no,directories=no";
      } else {
        strFeatures = "screenY=10,top=10,screenX=10,left=10,width=500,height=660,scrollbar=no,scrolling=no,toolbar=no,menubar=no,location=no,directories=no";
      }
    } else {
        strFeatures = "screenY=10,top=10,screenX=10,left=10,width=500,height=650,scrollbar=no,toolbar=no,menubar=no,location=no,directories=no";
    }
  objWindow = window.open(urlGo, title, strFeatures);
}

//----------- Image Load Function -----------

function PreloadImage(path, name, type) {
  var img;
  img = new Image();
  img.src= path + name + type;
  return img;
}

//----------- Image Loading -----------

if(document.images) {
  img_profile_on = new PreloadImage('../images/','profile_on','.gif');
  img_portfolio_on = new PreloadImage('../images/','portfolio_on','.gif');
  img_awards_on = new PreloadImage('../images/','awards_on','.gif');
  img_contacts_on = new PreloadImage('../images/','contacts_on','.gif');
  img_opportunities_on = new PreloadImage('../images/','opportunities_on','.gif');
  img_links_on = new PreloadImage('../images/','links_on','.gif');

  img_profile_off = new PreloadImage('../images/','profile_off','.gif');
  img_portfolio_off = new PreloadImage('../images/','portfolio_off','.gif');
  img_awards_off = new PreloadImage('../images/','awards_off','.gif');
  img_contacts_off = new PreloadImage('../images/','contacts_off','.gif');
  img_opportunities_off = new PreloadImage('../images/','opportunities_off','.gif');
  img_links_off = new PreloadImage('../images/','links_off','.gif');

  img_profile_on_s = new PreloadImage('../images/','profile_on_s','.gif');
  img_portfolio_on_s = new PreloadImage('../images/','portfolio_on_s','.gif');
  img_awards_on_s = new PreloadImage('../images/','awards_on_s','.gif');
  img_contacts_on_s = new PreloadImage('../images/','contacts_on_s','.gif');
  img_opportunities_on_s = new PreloadImage('../images/','opportunities_on_s','.gif');
  img_links_on_s = new PreloadImage('../images/','links_on_s','.gif');
}

//----------- Image Rollover Functions -----------

function getSrc(imgName) {
	return eval(imgName + '.src');
}

function rollOver(imgName, imgSrc, imgWhere){
  if(document.images) {
    if(ns) {
      if(imgWhere) {
        document.layers[imgWhere].document.images[imgName].src = getSrc(imgSrc);
      } else {
        document.images[imgName].src = getSrc(imgSrc);      
      }
    } else if(ie) {
      document.images[imgName].src = getSrc(imgSrc);    
    }
  }
}

function menuOff() {
	if ( isLoaded==true ) {
		if ( sneak.isVisible() ) {
			sneak.hide();
		}
		if ( subProfile.isVisible() ) {
			subApproach.hide();
		}
		if ( subPortfolio.isVisible() ) {
			subWork.hide();
		}
		if ( subAwards.isVisible() ) {
			subUpdates.hide();
		}
		if ( subContacts.isVisible() ) {
			subCareers.hide();
		}
		if ( subOpportunities.isVisible() ) {
			subCareers.hide();
		}
		if ( subLinks.isVisible() ) {
			subConnections.hide();
		}
	}
}

function menuOver(who) {
	if ( isLoaded==true ) {
		menuOff();
		sneak.show();
		eval(who + '.show();');
	}
}

function show(obj){
	if(Thing.all[obj])Thing.all[obj].show()
}
function hide(obj){
	if(Thing.all[obj])Thing.all[obj].hide()
}

function projectListShow() {
	if ( isLoaded==true ) {
		descriptions.hide();
		projectList.show();
		return false;
	}
}


//----------- Page Swapping -----------

function goPage(urlGo) {
  if(ns) {
    jump(urlGo.selectedIndex);
    return true;
  }
  if (urlGo.value) {
    top.location = urlGo.value;
    return true;
  }
}

//----------- Print Page -----------

function printWindow() {
bV = parseInt(navigator.appVersion);
if (bV >= 4) window.print();
}