var xPos = 0, yPos = 0
var showTabRowDelay, cTTObj, cTitle, tooltipFlag, xPosOffset, yPosOffset;

if(top.frames.length > 0 && self.name!="fileMngPreview"){top.location.href=self.location;}

// --------------------------------- Standard --------------------------------- //

document.onmousedown = getPos;
document.onmousemove = setShowDivPos;

function getPos(e){
	if(document.all){
		xPos = (document.compatMode=='CSS1Compat') ? window.event.clientX + document.documentElement.scrollLeft : window.event.clientX + document.body.scrollLeft;
		yPos = (document.compatMode=='CSS1Compat') ? window.event.clientY + document.documentElement.scrollTop : window.event.clientY + document.body.scrollTop;
	}else{	/* pageXY = Fensterrelativ / screenXY = Bildschirmabsolut */
		xPos = e.pageX;
		yPos = e.pageY;
	}
	document.body.scrollTop ? goPos = document.body.scrollTop : goPos = window.pageYOffset;
	if(goPos==null) goPos=0;
}

function setShowDivPos(e){
if(tooltipFlag){
	getPos(e);
	var sD = document.getElementById("tooltipDiv");
	sD.style.left = (xPos + xPosOffset) + "px";
	sD.style.top = (yPos + yPosOffset) + "px";
}}

function topInfo(cont,target,w,h)
{var topInf = window.open(cont,target,'width='+w+',height='+h+',dependent=yes,resizable=yes,scrollbars=yes,menubar=yes,status=yes'); topInf.focus(); return false;}

// -------------------------- Korrektur padding mainDiv ----------------------- //

var setDivBalanceDisabled = false;	// wird beim editieren deaktiviert //

function setDivBalance(){	// nur wenn Style aktiv //
if(document.getElementById('checkCSS').offsetHeight > 0) return false;
var emH = document.getElementById('emHeightHlp').offsetHeight;
var xx = document.getElementById('mainNaviArea').offsetHeight - document.getElementById('content').offsetHeight;
var xy = document.getElementById('addContArea').offsetHeight - document.getElementById('content').offsetHeight;
if(xy>xx) xx=xy;
if(xx>0){
if(setDivBalanceDisabled){
document.getElementById('toolbarMessage').style.visibility = "visible;"
}else{
document.getElementById('contFlexFoot').style.height = Math.round(xx/emH*40000)/10000 + 'em';
}}}

// -------------------------------- Schnellkontakt ---------------------------- //

function cFocus(x,txt){
document.getElementById("headForm").className = "formFocus";
x.className = x.className.replace(/On/, "") + "On";
if(x.value==txt)x.value = "";
}

function cBlur(x,txt){
if(x.value==""){
	x.value = txt; 
	x.className = x.className.replace(/On/, "");
	document.getElementById("headForm").className = "formStd";}
}

function checkCallback(){
var cN = document.callbackForm.callbackName.value;
var cT = document.callbackForm.callbackNumb.value;
if(cN == "" || cT == "" || cN == "Ihr Name" || cT == "Telefon-Nummer")
{alert("Bitte geben Sie Name und Telefon-Nummer ein"); return false;} else {return true;}
}

// -------------------------------- Login-Formular ---------------------------- //

function loginFocus(x,txt){
x.className = x.className.replace(/On/, "") + "On";
if(x.value==txt)x.value = "";
if(txt=="Passwort")x.type="password";
}

function loginBlur(x,txt){
if(x.value==""){
	x.value = txt; 
	x.className = x.className.replace(/On/, "");
	if(txt=="Passwort")x.type="text";
	}
}

// ----------------------------------- Tooltip --------------------------------

function hideTooltip(){
	clearTimeout(showTabRowDelay);
	document.getElementById("tooltipDiv").style.display = "none";
	tooltipFlag = false;
}

function uncoverTooltip(){
	document.getElementById("tooltipDiv").style.display = "block";
}

function showTT(obj,x){
	if(x!="") var ttNode = document.getElementById(x).firstChild;
	var ttTxt; 
	ttNode ? ttTxt = ttNode.nodeValue : ttTxt = obj.title;
	
	cTTObj = obj; cTitle = obj.title; obj.title = ""; 
	var sD = document.getElementById("tooltipDiv");
	var sDf = sD.firstChild;
	while (sDf!=null){
		sD.removeChild(sDf); 
		sDf = sD.firstChild;}
	if(ttTxt!=null && ttTxt!=""){
		var newEntry = document.createTextNode(ttTxt);
		sD.appendChild(newEntry);
		tooltipFlag = true; xPosOffset = 15; yPosOffset = 20;
		showTabRowDelay = setTimeout("uncoverTooltip()",500);}
}

function hideTT(){
	if(cTTObj!=null) {cTTObj.title = cTitle; cTTObj = null; cTitle = "";}
	hideTooltip(); 
}

function showTabRow(xy){ 
	clearTimeout(showTabRowDelay);
	var sD = document.getElementById("tooltipDiv");
	var sDf = sD.firstChild;
	var xNode = xy.firstChild;
	while (sDf!=null){
		sD.removeChild(sDf);
		sDf = sD.firstChild;}
	var counter = 0; 
	while (xNode!=null){
		if(xNode.nodeType==1 && xNode.childNodes[0].nodeValue!=null){
			counter+=1; 
			var xNV = xNode.childNodes[0].nodeValue
			var newEntry = document.createTextNode(counter + ": " + xNV);
			var newBr = document.createElement("br");
			// ggf. Bild einfuegen
			xNV = xNV.replace(/\s/,"");
			if(xNV.search(/.jpg$/) != -1 || xNV.search(/.jpeg$/) != -1){
				xNV = xNV.replace(/^images\//,"");
				var newImg = document.createElement("img");
			var newImgAlt = document.createAttribute("class");
			newImgAlt.nodeValue = "showTabRowImgPreview";
			newImg.setAttributeNode(newImgAlt);
			var newImgSrc = document.createAttribute("src");
			newImgSrc.nodeValue = "images/minSize/" + xNV;
			newImg.setAttributeNode(newImgSrc);
			sD.appendChild(newImg);
			}
			sD.appendChild(newEntry);
			sD.appendChild(newBr); 
		}
		xNode = xNode.nextSibling; }
	/* var x = 0, p = 40;
		if(document.all){p = p + document.body.scrollTop;}
		else if(document.getElementById){p = p + window.pageYOffset;}
		if(p<80) p = 80; 
		sD.style.top = p + "px";
		sD.style.right = "20px"; */
	tooltipFlag = true; xPosOffset = 30; yPosOffset = -10;
	showTabRowDelay = setTimeout("uncoverTooltip()",500);
}

function hideTabRowShowDiv(){
	hideTooltip();
}

