MouseX = 0;
MouseY = 0;
activeTip = 0;
lines = 0;
init_tooltip = 0; 

onload = hidetip; 
onunload = hidetip; 
document.write ('<div id="tooltip" style="position:absolute; top:-100px;left-100px">&nbsp;</div>'); 

function MousePosition(e) {

	if (init_tooltip == 0) return;

	if (document.all) {
		MouseX=event.x + document.body.scrollLeft;
		MouseY=event.y + document.body.scrollTop;
	}	else {
		MouseX=e.pageX;
		MouseY=e.pageY;
	}

	with (document.getElementById ('tooltip')) {
		style.top = MouseY +  10  - getBoxHeight() + 'px';
		style.left = MouseX +  10 + 'px';
	}
}


function getBoxHeight () {
	// line-height + padding-top + padding-bottom
	for (i=0,h=0; i < lines; i++)
	h += 12;
	return (h + 6);
}


function showtip (which) {

// alert(which); 

	if (init_tooltip == 0) {
		document.onmousemove = MousePosition;
		document.onmouseout = hidetip;

		t = Array();
		t[1] = 'Suchbeispiele:<br />- Lenovo T61<br />- Acer Travelmate<br />- Mac Book<br />- Dell 2GB Poweredge 1850';
		t[2] = 'Lieferzeit 1-2 Werktage!';
		t[3] = 'Klicken Sie hier, wenn Sie dieses Upgrade bestellen möchten oder<br />ein individuelles Angebot von uns wünschen.';
		t[4] = 'Sofort bestellen<br />Nur mit Login m&ouml;glich!';
		t[5] = 'Projektangebot anfordern<br />Frage zum Produkt<br />Aktuelle Preise finden Sie stets online';
		t[6] = 'Am einfachsten und sichersten ist, sie wählen das Upgrade mit der höchsten Taktfrequenz.<br />Genaueres erfahren Sie wenn Sie diesem Link folgen';
		t[7] = 'Hier könnte Hilfetext stehen.<br />Evl. sogar mehrere Zeilen<br />um genau zu erklären was zu tun ist.<br />nur fällt mir nix ein was wir erklären könnten.<br />';
		t[8] = 'Bitte geben Sie hier die Kapazität an,<br />bitte geben Sie auch an ob es sich um MB oder GB handelt';
		t[9] = 'Diese Informationen, und auch die genaue Modellbezeichung,<br />finden Sie zumeist auf dem Gehäuse oder einem Typenschild auf der Rückseite des Gerätes.';		
		t[10] = 'Adventsaktion vom 2.-23.12.2010:<br />Die Kosten für Verpackung, Transportversicherung und Versand werden von CompuRAM getragen,<br />für alle Bestellungen, die bis einschl. 23.12.2010 bei CompuRAM eintreffen.<br />Die frachtfreie Lieferung gilt innerhalb Deutschland und erfolgt per UPS Standard.';		
		t[11] = 'Wenn die Lieferung per Express erfolgen<br />soll oder Sie andere Versandhinweise haben<br />teilen Sie uns dies bitte unter Anmerkungen mit.';		
		l = Array();
		l[1] = 1;
		l[2] = 0;
		l[3] = 0;
		l[4] = 0;
		l[5] = 0;
		l[6] = 0;

		lines = l[which];
		with (document.getElementById ('tooltip')) {

			style.display = "inline";
			innerHTML = t[which];

			if (which!=1) {
				style.width = "auto";
				style.whiteSpace  = "nowrap";
			}
		}
	}
	activeTip = 1;
	init_tooltip = 1;
}

function hidetip () {
	init_tooltip=0;
	if (activeTip == 1) {
		document.getElementById('tooltip').style.display = "none";
		activeTip = 0;
		document.onmousemove = null;
		document.onmouseout = null;
	}
}

function showfixedtip (which, elmname) {

	if (init_tooltip == 0) {
		t = Array();
		t[1] = 'Suchbeispiele:<br />- Lenovo T61<br />- Acer Travelmate<br />- Mac Book<br />- Dell 2GB Poweredge 1850';
		l = Array();
		l[1] = 1;

		lines = l[which];

		poselm = document.getElementById (elmname);
		
		with (document.getElementById ('tooltip')) {

			style.top =  ttGetOffsetTop(poselm) + 20 +  'px';
			style.left = ttGetOffsetLeft(poselm) + 'px';
			style.display = "inline";
			innerHTML = t[which];

			if (which!=1) {
				style.width = "auto";
				style.whiteSpace  = "nowrap";
			}
		}
	}
	activeTip = 1;
	init_tooltip = 1;
}

function ttGetOffsetTop(oElement) {
	var iResult= oElement.offsetTop;
	while (oElement.offsetParent) {
		oElement = oElement.offsetParent; iResult += oElement.offsetTop;
	}
	return iResult;
}

function ttGetOffsetLeft(oElement) {
	var iResult= oElement.offsetLeft;
	while (oElement.offsetParent) {
		oElement = oElement.offsetParent;iResult += oElement.offsetLeft;
	}
	return iResult;
}

function showPrdImage(imgid, garantie) {
	var elmMaster = document.getElementById("prdimgdivmaster");
	var elmgar = document.getElementById("prdimgimggar");
	var elm = document.getElementById("prdimgdiv");
	var elmimg = document.getElementById("prdimgimg");
	var img = document.getElementById(imgid);
	
	elmimg.src = img.src;
	elmimg.title = img.title;
	if (garantie)
	  elmgar.style.display='list-item';
	else
	  elmgar.style.display='none';
	elm.style.top=(findPosY(img) - elmMaster.offsetTop) + "px";
	elm.style.display='block';
	showPrdImage_timer(10);
	return false; 
}
function showPrdImage_timer(i) {
  var elm = document.getElementById("prdimgdiv");
  if (i > 0) {
	elm.style.width=356 * (11-i)/10  + "px";
	i--;
	var timeout = window.setTimeout("showPrdImage_timer(" + i + ")", 10);
  } else {
	elm.style.width="356px";
  }
}
function hidePrdImage() {
	var elm = document.getElementById("prdimgdiv");
	elm.style.display='none';
	return false; 
}
 function findPosY(obj)
  {
    var curtop = 0;
    if(obj.offsetParent)
        while(1)
        {
          curtop += obj.offsetTop;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.y)
        curtop += obj.y;
    return curtop;
 }

