var imageId, sizeX, sizeY;

if (window.opera) {
  agent = "opera";
} else if (document.all) {
  agent = "ie";
} else {
  agent = "dom";
}

function $(id) {
  if (document.getElementById(id)) {
    return document.getElementById(id);
  } else {
    return false;
  }
}

function elementFocus(element) {
  if (element && element.disabled != "true" && element.style.display != "none") {
    element.focus();
  }
}

function openWindow(windowUrl, windowName, windowWidth, windowHeight, windowConfig) {
    if (screen.width) {
        windowPositionX = (screen.width - windowWidth) / 2;
        if (windowPositionX < 0) { windowPositionX = 0; }
        windowPositionY = (screen.height - windowHeight) / 2;
        if (windowPositionY < 0) { windowPositionY = 0; }
    } else {
        windowPositionX = 0;
        windowPositionY = 0;
    }

    if (windowName == "") { 
      windowName = "windowTest";
    }

    if (windowConfig == null || "" == windowConfig) {
      windowConfig = "alwaysRaised=0,top=" + windowPositionY + ",left=" + windowPositionX
                     + ",height=" + windowHeight + ",width=" + windowWidth
                     + ",menubar=0,resizable=0,scrollbars=0,status=1";
    }
    __window = window.open(windowUrl, windowName, windowConfig);
    __window.focus();
    return __window;
}

function ViewPhoto(imageId, sizeX, sizeY) {
  url = "/Stairs/01/popup" + imageId + ".php";
  $("ImageID").value = imageId;
  openWindow("/Stairs/popup.php", "", 820, 820);
}

function expandFAQ(id) {
  if (agent == "ie" || agent == "opera") {
    tag1 = "<STRONG>";
	tag2 = "</STRONG>";
  } else {
    tag1 = "<strong>";
	tag2 = "</strong>";
  }
  if ($("descr-"+id).style.display == "" || $("descr-"+id).style.display == "none") {
    $("descr-"+id).style.display = "block";
	$("link-"+id).innerHTML = "<strong>" + $("link-"+id).innerHTML + "</strong>";
  } else {
    $("descr-"+id).style.display = "none";
	linkText1 = $("link-"+id).innerHTML.split(tag1);
	linkText2 = linkText1[1].split(tag2);
	$("link-"+id).innerHTML = linkText2[0];
  }
}