/**************************************************************************/
function getLeftAndTopForCenter(w, h) {
/**************************************************************************/
  h = h - 20; var x=0, y=0, parameter="";
  if (w < screen.availWidth || h < screen.availHeight) {
    x = (screen.availWidth - w - 12) / 2;
    y = (screen.availHeight - h - 104) / 2;
    if (window.opera) y = 0; // Opera positioniert unter den Symbolleisten
    if (x<0 || y<0) { x=0; y=0; }
    else parameter = "width=" + w + ",height=" + h + ",";
  }
	var lt = new Array();
	lt[0] = x;
	lt[1] = y;
  return lt;
}

/**************************************************************************/
function popUpVideo(url) {
/**************************************************************************/

	var width=445;
	var height=360;
	
	lt = getLeftAndTopForCenter(width, height);
	
	var options = "top=" + lt[1] + ", left=" + lt[0] + ",width=" + width + ",height=" + height + ",scrollbars=yes,toolbar=no,menubar=no,resizable=yes"; 

  if(document.getElementById("tmpPopupVideo").className=="offen") {
		videoWindow.close();
		document.getElementById("tmpPopupVideo").className=="zu";
	}
	
	document.getElementById("tmpPopupVideo").className = "offen";
	videoWindow = window.open(url,"video", options);
  videoWindow.focus();
  return false;
  
}

/**************************************************************************/
function popUpTagebuch(Bild, HoehePopup) {
/**************************************************************************/

  var url     = "/tagebuch/detail.php?bild=" + Bild;
  var options = "top=0,left=0,width=460,height=" + HoehePopup + ",scrollbars=no,toolbar=no,menubar=no,resizable=yes"; 

  galleryWindow = window.open(url,"tagebuch", options);
  galleryWindow.focus();
  
  return false;

}

/**************************************************************************/
function popUpTagebuchHilfe(url) {
/**************************************************************************/

  var options = "top=0,left=0,width=480,height=400,scrollbars=yes,toolbar=no,menubar=no,resizable=yes"; 

  tagebuchHilfeWindow = window.open(url,"text", options);
  tagebuchHilfeWindow.focus();
  
  return false;

}

/**************************************************************************/
function popUpGallery(f,p,a,z,i) {
/**************************************************************************/

	/*var width=460;
	var height=500;*/
	var width=660;
	var height=700;
	
	lt = getLeftAndTopForCenter(width, height);

  var url     = "/fotos/detail.php?f=" + f + "&p=" + p + "&a=" + a + "&z=" + z + "&i=" + i;
  /* var options = "top=0,left=0,width=460,height=500,scrollbars=no,toolbar=no,menubar=no,resizable=yes"; */
  var options = "top=" + lt[1] + ", left=" + lt[0] + ",width=" + width + ",height=" + height + ",scrollbars=no,toolbar=no,menubar=no,resizable=yes"; 	

  galleryWindow = window.open(url,"gallery", options);
  galleryWindow.focus();
  
  return false;

}
/**************************************************************************/
function popUpGallery2(f,p,a,z,i) {
/**************************************************************************/

	var width=660;
	var height=700;
	
	lt = getLeftAndTopForCenter(width, height);

  var url     = "/fotos/detail.php?f=" + f + "&p=" + p + "&a=" + a + "&z=" + z + "&i=" + i;
  var options = "top=" + lt[1] + ", left=" + lt[0] + ",width=" + width + ",height=" + height + ",scrollbars=no,toolbar=no,menubar=no,resizable=yes"; 	

  galleryWindow = window.open(url,"gallery", options);
  galleryWindow.focus();
  
  return false;

}

/**************************************************************************/
function popUpShopTShirt(Artikel_ID) {
/**************************************************************************/

  var url     = "/shop/?status=detail&Artikel_ID=" + Artikel_ID;
  var options = "top=0,left=0,width=460,height=500,scrollbars=no,toolbar=no,menubar=no,resizable=yes"; 

  popUpShopTShirtWindow = window.open(url,"popUpShopTShirt", options);
  popUpShopTShirtWindow.focus();
  
  return false;

}

/**************************************************************************/
function addSmiley(smiley) {
/**************************************************************************/

  if (document.formular.Text.value == "Deine Nachricht") {
    document.formular.Text.value = "";
  }
  document.formular.Text.value += smiley;    
  return false;
  
}

/**************************************************************************/
function popUpText(url) {
/**************************************************************************/

  var options = "top=0,left=0,width=480,height=500,scrollbars=yes,toolbar=no,menubar=no,resizable=yes"; 

  textWindow = window.open(url,"text", options);
  textWindow.focus();
  
  return false;

}

/**************************************************************************/
function popUpGame(url) {
/**************************************************************************/

  var options = "top=0,left=0,width=480,height=500,scrollbars=yes,toolbar=no,menubar=no,resizable=yes"; 

  gameWindow = window.open(url,"text", options);
  gameWindow.focus();
  
  return false;

}

/**************************************************************************/
/* ###################################################################### */
/* Tooltip Anfang */
/* ###################################################################### */
/**************************************************************************/

/**************************************************************************/
function TX_getScrollPos() {
/**************************************************************************/
   if (document.body.scrollTop != undefined && navigator.appName.indexOf("Explorer") != -1 ) {
      var res = (document.compatMode != "CSS1Compat") ? document.body : document.documentElement;
      return {x : res.scrollLeft, y : res.scrollTop};
   }
   else {
      return {x : window.pageXOffset, y : window.pageYOffset};
   }

}

/**************************************************************************/
function TX_showToolTip(e, text) {
/**************************************************************************/

	var scr = TX_getScrollPos();
	var cordX = e.clientX + scr.x;
	var cordY = e.clientY + scr.y;
	var correctorY = e.clientY + document.getElementById("tooltip").offsetHeight + 20 - window.innerHeight;

	document.getElementById("tooltip").style.visibility = "hidden";
	document.getElementById("tooltip").innerHTML = text;
	document.getElementById("tooltip").style.position = "absolute";
	document.getElementById("tooltip").style.left = ( cordX + 10 ) + "px";

	if ( correctorY > 0 ) {
		document.getElementById("tooltip").style.top = ( cordY - correctorY ) + "px";
	} else {
		document.getElementById("tooltip").style.top = ( cordY + 10 ) + "px";
	}

	document.getElementById("tooltip").style.visibility = "visible";
}

/**************************************************************************/
function TX_hideToolTip() {
/**************************************************************************/
	document.getElementById("tooltip").style.visibility = "hidden";
	document.getElementById("tooltip").innerHTML = "false";	
}

/**************************************************************************/
/* ###################################################################### */
/* Tooltip Ende */
/* ###################################################################### */
/**************************************************************************/

