// JavaScript Document

function GetAbsPosition(object) {
var position = new Object;
position.x = 0;
position.y = 0;

if( object ) {
position.x = object.offsetLeft;
position.y = object.offsetTop;

if( object.offsetParent ) {
var parentpos = GetAbsPosition(object.offsetParent);
position.x += parentpos.x;
position.y += parentpos.y;
}
}

position.cx = object.offsetWidth;
position.cy = object.offsetHeight;

return position;
}

function checkMenu(menuItem,expand) {
	if (menuItem != 'home' ) {
position = GetAbsPosition(document.getElementById(menuItem));
document.getElementById(expand).style.left = (position.x -40) + "px";
document.getElementById(expand).style.width = (position.cx) + "px"
document.getElementById(expand).style.display = "inline";
	}
}
function setState() {
	var itemName = pages + 'Link';
	document.getElementById(itemName).className = 'menuSelected';
}

function MM_showHideLayers() { //v9.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) 
  with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function MM_changeProp(objId,x,theProp,theValue) { //v9.0
  var obj = null; with (document){ if (getElementById)
  obj = getElementById(objId); }
  if (obj){
    if (theValue == true || theValue == false)
      eval("obj.style."+theProp+"="+theValue);
    else eval("obj.style."+theProp+"='" + theValue + "'");
  }
}

function MoreLess(objId) {
  var obj = null; with (document){ if (getElementById)
  obj = getElementById(objId); }
  if (obj){
  var current = obj.innerHTML;
  if (current == "Read more") {
  obj.innerHTML="Collapse";
  } else {
  obj.innerHTML="Read more";
  }
  }
  }

  function toggleDisplay(objId2) {
  var obj2 = null; with (document){ if (getElementById)
  var divHeight = null;
  obj2 = getElementById(objId2); }
  if (obj2){
  if (obj2.style.height == '90px') {
	divHeight = 'auto';
	} else if (obj2.style.height == 'auto') {
	if (obj2.id=='tFeature') {
	divHeight = '800px';
	} else {divHeight = '90px';}
	} else {
	divHeight = 'auto';
	}
  MM_changeProp(obj2.id,'','height',divHeight,'DIV');
  }
}

function loadImage(which,type,obj) {
var rhs = 0;
var thumb = obj.id;
var sliceRow = thumb.substr(5,1);
var sliceCol = thumb.substr(6,1);
var imageLocation = which + 'placeholder';
document.getElementById(imageLocation).src = "images/photos/" + which + type;
positionThumb = GetAbsPosition(document.getElementById(obj.id));
positionRow = GetAbsPosition(document.getElementById("row" + sliceRow));
if (sliceCol >= 4) {
positionHR = GetAbsPosition(document.getElementById(which));
rhs = positionHR.cx + positionThumb.cx + 20;
}
document.getElementById(which).style.left = eval(positionThumb.x + positionThumb.cx -30 -rhs) + "px";
document.getElementById(which).style.top = eval(positionRow.y - 186) + "px";
MM_showHideLayers(which,'','show');
}
