

function js_pricebubble () {
	
	this.createDomElements = function () {

		if (!$('jspriceinformation')) {
			return (false);
		}

		//	create the bubble element
		var b = getElementsBySelector ('body')[0];
		var d = minikit.createDOM ('DIV', 
								   {'id': 'jsbubble',
									'class': 'priceexplanationbubble',
									'style': 'display: none;width: 360px; height: 100px;'});

		var d1 = minikit.createDOM ('DIV', {'style': 'background-color:white; border: 1px solid #828282; border-bottom: 0; padding: 5px;'});
		var d2 = minikit.createDOM ('DIV', {'style': 'background: url(/images/pricebubble_bottom.gif); height: 24px;'});
		d2.innerHTML = "&nbsp;";
		//	try to find the span with the text to display
		var t = $('jspriceinformation');
		var t1 = t.cloneNode (true);
		t1.id = "_"+t.id;
		t1.style.marginBottom = "10px";
		d1.appendChild (t1);

		d.appendChild (d1);
		d.appendChild (d2);

		b.appendChild (d);
		var a = minikit.createDOM ('a', {'href': '#'});
		a.innerHTML = 'Schließen';
		d1.appendChild (a);

		connect (a, 'onclick', function (evt) {
			evt.stop ();
			$('jsbubble').style.display = "none";
		});

		connect (d, 'onclick', function () {
			$('jsbubble').style.display = "none";
		});
		return (true);
	};


	this.connectStars = function () {
		
		if (!this.createDomElements ()) {
			//	error creating all the stuff we need
			return (false);
		}

		
		var els = getElementsBySelector ('span.redstar');
		forEach (els, function (e) {		
			connect (e, 'onmouseover', function (evt) {
				var pos = minikit.getElementPosition (evt.src ());
				var dim = minikit.getElementDimensions ($('jsbubble'));
				$('jsbubble').style.top = parseInt(pos.y-dim.h - 10)+"px";
				$('jsbubble').style.left = (pos.x-204)+"px";
				$('jsbubble').style.position = 'absolute';
				$('jsbubble').style.display = "block";
			});
		});
		
		/*
		forEach (els, function (e) {
			connect (e, 'onmouseout', function () {
				$('jsbubble').style.display = "none";
			});
		});
		*/

	};

}


var js_pbubble = new js_pricebubble ();

addLoadEvent (function () {
	js_pbubble.connectStars ();
});