//Errors
//window.onerror=fehler;
//function fehler(){
//return true;	
//}
function oeffnefenster (url) {
 fenster = window.open(url, "Frameset", "toolbar=no,location=no,scrollbars=no,resizable=no,width=790,height=640,left=170,top=250");
 fenster.focus();
}

function lib_bwcheck(){ 
	this.ver=navigator.appVersion
	this.agent=navigator.userAgent
	this.dom=document.getElementById?1:0
	this.opera5=(navigator.userAgent.indexOf("Opera")>-1 && document.getElementById)?1:0
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0; 
	this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
	this.ie7=(this.ver.indexOf("MSIE 7")>-1 && this.dom && !this.opera5)?1:0;
	this.ie8=(this.ver.indexOf("MSIE 8")>-1 && this.dom && !this.opera5)?1:0;
	this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
	this.ie=this.ie4||this.ie5||this.ie6||this.ie7||this.ie8
	this.mac=this.agent.indexOf("Mac")>-1
	this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie8 || this.ie7 || this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5)
	return this
}
var bw=lib_bwcheck()

//Druckansicht
  var old=false;
  var content
  var thistext
  var tagnr
  var newtext
  function druck(){
	if (document.all) {
		if(document.getElementById('content')) content=document.all.content;
		else {content=document.all.tags('div')}
		thistext=document.all.tags('title');
		}
	if (this.dom && !document.all) {
		if(document.getElementById('content')) {self.print();}
	else { 
          content = document.getElementsByTagName('div');
		  thistext = document.getElementsByTagName('title');
		  old=true;
		 }
		}
	if(document.all||old==true) {
		tagnr=content.length;
		newtext=thistext;
		var printwindow=window.open("druckansicht.htm?datei_to_get=","printpreview","width=850,height=600,scrollbars=yes");
//		var printwindow=window.open("druckansicht.htm?datei_to_get=","printpreview","width=670,height=500,scrollbars=yes");
		}
	else if (!this.dom&&!document.all){
	alert("Ihr Browser unterst&uuml;tzt diese Funktion leider nicht.");
	} 	
}



//Popup-Fenster
	var popWin=null;

	function openBrWindow(theURL,winName,features) { 
	if(popWin!=null) if(!popWin.closed) popWin.close()      
		parts=theURL.split("#");
		if(parts[0]==theURL)
		{
			parts[1]="";
		}
		else
		{
			parts[1]="#"+parts[1];
		}
		if(theURL.indexOf("?")==-1)
	 	{
			popWin = window.open(parts[0]+sidaddq+parts[1],winName,features);
		}
		else
		{
			popWin = window.open(parts[0]+sidadda+parts[1],winName,features);
		}
	}


//Image Preload & Change
    function preload(imgObj,imgSrc) {
		if (document.images) {
			eval(imgObj+' = new Image()');
			if(imgSrc.indexOf("?")==-1)
		 	{
				eval(imgObj+'.src = "'+imgSrc+'?"');
			}
			else
			{
				eval(imgObj+'.src = "'+imgSrc+'&"');
			}
		}
	}

	function changeImage(layer,imgName,imgObj) {
	if (document.layers && layer!=null)
		eval('document.'+layer+'.document.images["'+imgName+'"].src = '+imgObj+'.src');
	else
		document.images[imgName].src = eval(imgObj+".src");
	}

// show and hide Layers
function showHideLayers() { //v6.0
  var i,p,v,obj,args=showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

// find Objects
function findObj(theObj, theDoc)
{
  var p, i, foundObj;
  
  if(!theDoc) theDoc = document;
  if( (p = theObj.indexOf("?")) > 0 && parent.frames.length)
  {

    theDoc = parent.frames[theObj.substring(p+1)].document;
    theObj = theObj.substring(0,p);
  }
  if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
  for (i=0; !foundObj && i < theDoc.forms.length; i++) 
    foundObj = theDoc.forms[i][theObj];
  for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) 
    foundObj = findObj(theObj,theDoc.layers[i].document);
  if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);
  
  return foundObj;
}

// Tooltips
  // Variables to set:
Popmessages= new Array()
// Write your descriptions in here.
// To have more descriptions just add to the array.

var offsetfromcursorX=20 //Customize x offset of tooltip
var offsetfromcursorY=10 //Customize y offset of tooltip

var offsetdivfrompointerX=10 //Customize x offset of tooltip DIV relative to pointer image
var offsetdivfrompointerY=14 //Customize y offset of tooltip DIV relative to pointer image. Tip: Set it to (height_of_pointer_image-1).

document.write('<div id="dhtmltooltip"></div>') //write out tooltip DIV
document.write('<img id="dhtmlpointer" src="/images/ttpfeil.gif">') //write out pointer image

var enabletip=false
if (bw.ie||bw.ns6)
var tipobj=document.all? document.all["dhtmltooltip"] : document.getElementById? document.getElementById("dhtmltooltip") : ""

var pointerobj=document.all? document.all["dhtmlpointer"] : document.getElementById? document.getElementById("dhtmlpointer") : ""

function ietruebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function popUp(thetext, thewidth, thecolor, xajax){
if(xajax&&!pop_glossar_aktiv)
 return false;

if (bw.ns6||bw.ie){
if (typeof thewidth!="undefined" && thewidth!="") tipobj.style.width=thewidth+"px"
if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor
//tipobj.innerHTML=thetext
tipobj.innerHTML=Popmessages[thetext]
enabletip=true
positiontip("glossar");
return false
}
}

function positiontip(e){
if(e != "glossar")
{
nondefaultpos=false
curX=(bw.ns6)?e.pageX : event.clientX+ietruebody().scrollLeft;
curY=(bw.ns6)?e.pageY : event.clientY+ietruebody().scrollTop;
//Find out how close the mouse is to the corner of the window
winwidth=bw.ie&&!window.opera? ietruebody().clientWidth : window.innerWidth-20
winheight=bw.ie&&!window.opera? ietruebody().clientHeight : window.innerHeight-20

rightedge=bw.ie&&!window.opera? winwidth-event.clientX-offsetfromcursorX : winwidth-e.clientX-offsetfromcursorX
bottomedge=bw.ie&&!window.opera? winheight-event.clientY-offsetfromcursorY : winheight-e.clientY-offsetfromcursorY
}

if (enabletip){
var nondefaultpos=true
/*
var curX=(bw.ns6)?e.pageX : event.clientX+ietruebody().scrollLeft;
var curY=(bw.ns6)?e.pageY : event.clientY+ietruebody().scrollTop;
//Find out how close the mouse is to the corner of the window
var winwidth=bw.ie&&!window.opera? ietruebody().clientWidth : window.innerWidth-20
var winheight=bw.ie&&!window.opera? ietruebody().clientHeight : window.innerHeight-20

var rightedge=bw.ie&&!window.opera? winwidth-event.clientX-offsetfromcursorX : winwidth-e.clientX-offsetfromcursorX
var bottomedge=bw.ie&&!window.opera? winheight-event.clientY-offsetfromcursorY : winheight-e.clientY-offsetfromcursorY
*/

var leftedge=(offsetfromcursorX<0)? offsetfromcursorX*(-1) : -1000

//if the horizontal distance isn't enough to accomodate the width of the context menu
if (rightedge<tipobj.offsetWidth){
//move the horizontal position of the menu to the left by it's width
tipobj.style.left=curX-tipobj.offsetWidth+"px"
nondefaultpos=true
}
else if (curX<leftedge)
tipobj.style.left="5px"
else{
//position the horizontal position of the menu where the mouse is positioned
tipobj.style.left=curX+offsetfromcursorX-offsetdivfrompointerX+"px"
pointerobj.style.left=curX+offsetfromcursorX+"px"
}

//same concept with the vertical position
if (bottomedge<tipobj.offsetHeight){
tipobj.style.top=curY-tipobj.offsetHeight-offsetfromcursorY+"px"
nondefaultpos=true
}
else{
tipobj.style.top=curY+offsetfromcursorY+offsetdivfrompointerY+"px"
pointerobj.style.top=curY+offsetfromcursorY+"px"
}
tipobj.style.visibility="visible"
if (!nondefaultpos)
pointerobj.style.visibility="visible"
else
pointerobj.style.visibility="hidden"
}
}

function popOut(){
pop_glossar_aktiv=false;

if (bw.ns6||bw.ie){
enabletip=false
tipobj.style.visibility="hidden"
pointerobj.style.visibility="hidden"
tipobj.style.left="-1000px"
tipobj.style.backgroundColor=''
tipobj.style.width=''
}
}

document.onmousemove=positiontip

pop_glossar_aktiv=false;

function pop_glossar(begriff,bereich)
{
 if(typeof(bereich)==undefined||bereich==undefined)
  bereich="";

 pop_glossar_aktiv=true;

 xajax_pop_glossar(begriff,bereich);
}

function click_glossar(begriff,bereich)
{
 if(typeof(bereich)==undefined||bereich==undefined)
  bereich="";

 openBrWindow("/pharma/glossar.php?bereich="+bereich+"&key="+begriff+"#"+begriff,"Glossar","toolbar=no,width=300,height=400,directories=no,status=no,scrollbars=yes,menubar=no");
}

//-->

