//=== swapShow ===//
/*Swap between hide and show of given html elements.*/
function swapShow(firstElementName, secondElementName) {
  if (firstElementName==null || secondElementName==null) return false;
  var firstElement = document.getElementById(firstElementName)
  if (firstElement==NaN || firstElement==null) return false;
  var secondElement = document.getElementById(secondElementName)
  if (secondElement==NaN || secondElement==null) return false;

  if (firstElement.style.display=="none") {
    firstElement.style.display = "inline";
    secondElement.style.display = "none";
  } else {
    firstElement.style.display = "none";
    secondElement.style.display = "inline";
  }
  return true;
}

//=== hideShow ===//
/*Hides or shows given html element.*/
function hideShow(hideShowElementName) {
  if (hideShowElementName==null) return false;
  var hideShowElement = document.getElementById(hideShowElementName)
  if (hideShowElement==NaN || hideShowElement==null) return false;
  if (hideShowElement.style.display=="none") {
    hideShowElement.style.display = "inline";
  } else {
    hideShowElement.style.display = "none";
  }
  return true;
}

//=== show ===//
/*Shows given html element.*/
function show(htmlElementName) {
  if (htmlElementName==null) return false;
  var htmlElement = document.getElementById(htmlElementName)
  if (htmlElement==NaN || htmlElement==null) return false;
  if (htmlElement.style.display=="none") {
    htmlElement.style.display = "inline";
  }
  return true;
}

//=== hide ===//
/*Hides given html element.*/
function hide(htmlElementName) {
  if (htmlElementName==null) return false;
  var htmlElement = document.getElementById(htmlElementName)
  if (htmlElement==NaN || htmlElement==null) return false;
  if (htmlElement.style.display!="none") {
    htmlElement.style.display = "none";
  }
  return true;
}



//=== SwapImage ===//
function SwapImage(ImageName,ImageFile)
{
  Image1=new Image(75,50);
  Image1.src = ImageFile;
  document[ImageName].src = Image1.src;
  return true;
}



//=== InitPano ===//
function InitPano()
{
  win=0;
  if (navigator.appName=="Microsoft Internet Explorer") bro=1;
  else bro=0;
}

//=== LoadPano ===//
function LoadPano(bild,br,h)
{
  if ((bro)&&(win)) panowin.close();
  panowin=window.open(bild,"anzeige","width="+br+",height="+h+",status=yes,menubar=no,locationbar=no,toolbar=no,resizable=yes,scrollbars=no");
  win=1;
  panowin.moveTo(0,0);
  panowin.focus();
}

//=== ClosePano ===//
function ClosePano()
{
  if (win==1) {
    if (!panowin.closed) panowin.close();
  }
}



//=== InitOpenImage ===//
/*Set global variables.*/
function InitOpenImage()
{
  pic_location="";
  infomsg="";
  openmsg="Bild in Großformat öffnen";
  winheight=100;
  winsize=100;
  x=40;
  if (navigator.appName=="Microsoft Internet Explorer") bro=1;
  else bro=0;
}

//=== OpenImage ===//
function OpenImage(url)
{
  pic_location=url;
  if (bro==0) {    
    //if not microsoft internet explorer
    win2=window.open(pic_location,"","menubar=no, toolbar=no, scrollbars=yes, resizable=yes, dependent=yes");
    win2.moveTo(1,1);
    win2.resizeTo(screen.availWidth,screen.availHeight);
    return;
  }
  win2=window.open("","","height=1, width=1, menubar=no, toolbar=no, scrollbars=yes, resizable=yes, dependent=yes");
  if (!document.layers && !document.all){
    win2.location=pic_location;
    return;
  }
  win2.moveTo(-1,-1);
  OpenImageMove();
}

//=== OpenImageMove ===//
function OpenImageMove()
{
  if (winheight>=screen.availHeight-3) x=0;
  win2.resizeBy(40,x);
  winheight+=40;
  winsize+=40;
  if (winsize>=screen.width-40){
    win2.location=pic_location;
    winheight=100;
    winsize=100;
    x=40;
    return;
  }
  setTimeout("OpenImageMove()", 1);
}
