var GetElementSupported = !! document.getElementById;
function GetElement(id)
  {
    if (document.getElementById)
      return document.getElementById(id);
    else if (document.all)
      return document.all[id];
  }

function HideSelects()
  {
    var coll = document.all.tags("SELECT");
    if (coll!=null)
      for (i=0; i<coll.length; i++) 
        coll[i].style.visibility="hidden";
  }
function ShowSelects()
  {
    var coll = document.all.tags("SELECT");
    if (coll!=null)
      for (i=0; i<coll.length; i++) 
        coll[i].style.visibility="";
  }

function getCoords(obj)
  {	
    var objX1 = obj.offsetLeft;
    var objY1 = obj.offsetTop;
    var objParent = obj.offsetParent;
    while (objParent.tagName.toUpperCase() != "BODY")
      {
        objX1 = objX1 + objParent.offsetLeft;
        objY1 = objY1 + objParent.offsetTop;
        objParent = objParent.offsetParent;
      }
    var objWidth = obj.offsetWidth == 0 ? obj.clientWidth : obj.offsetWidth;
    var objHeight = obj.offsetHeight == 0 ? obj.clientHeight : obj.offsetHeight;
    var objX2 = objX1 + objWidth;
    var objY2 = objY1 + objHeight;
    return {
      X1: objX1, 
      X2: objX2,
      Y1: objY1,
      Y2: objY2,
      Width : objWidth,
      Height : objHeight
    }
  }

function toggle(i) {
	var e = GetElement(i);
	if (e)
		e.style.display = (e.style.display=="none") ? "" : "none";
}

function showFlash(id,w,h) {
	window.open("flash.aspx?id=" + id + "&W=" + w + "&H=" + h, null, "width=" + (w+30) + ",height=" + (h+30) + ",resizable=no,scroll=no");
}

function showPreviewFlash(id,w,h) {
	window.open("previewflash.aspx?id=" + id + "&W=" + w + "&H=" + h, null, "width=" + (w+30) + ",height=" + (h+30) + ",resizable=no,scroll=no");
}

function showPreviewPicbook(id,w,h) {
	window.open("previewpicbook.aspx?id=" + id + "&W=" + w + "&H=" + h, null, "width=" + (2*w+30) + ",height=" + (h+30) + ",resizable=no,scroll=no");
}