
var spopup_open;
var vote = 0;

		document.onclick = meevio_click;
		function meevio_get_parent(n) 
		{
			classname = n.className;
			if (n && n.nodeType == 1 && (classname.search(/softpopl/) != -1 || classname.search(/softpopr/) != -1 || n.id == 'softpop2')) return true;
			if (!n.parentNode) return false;
			return meevio_get_parent(n.parentNode);
		}
		
		function meevio_click(e) 
		{

			if (window.event) 
			{
				me = window.event.target || window.event.srcElement;
			}
			else me = e.target;
			n = meevio_get_parent(me);
			if (!n) close_popups ();

		}
		
		function close_popups () 
		{
			if (document.getElementById('softpop2')) 
			{
				document.getElementById('softpop2').parentNode.removeChild(document.getElementById('softpop2'));
			}
			if (document.getElementById('splash')) 
			{
				document.getElementById('splash').parentNode.removeChild(document.getElementById('splash'));
			}
			if (spopup_open && document.getElementById("sp-"+spopup_open)) 
			{
				document.getElementById("sp-"+spopup_open).parentNode.removeChild(document.getElementById("sp-"+spopup_open));
			}
		}
		
		// generische Funktionen
  		
		var http_request = false;
		var fxl_actions = new Array();
		var fxl_aktiv = window.setInterval("fxl_action_pool()", 500);
		var fxl_busy = false;
		
		function valuta(num) 
		{
			num="" + Math.floor(num*100.0 + 0.5)/100.0;
			var i=num.indexOf(".");
			if ( i<0 ) num+=",00";
			else 
			{
				num=num.substring(0,i) + "," + num.substring(i + 1);
				var nDec=(num.length - i) - 1;
				if ( nDec==0 ) num+="00";
				else if ( nDec==1 ) num+="0";
				else if ( nDec>2 ) num=num.substring(0,i + 3);
			}
			return num + ' €';
		}

		function htmlspecialchars(string) {
    		string = string.toString();
    		string = string.replace(/&/g, '&amp;');
    		string = string.replace(/</g, '&lt;');
    		string = string.replace(/>/g, '&gt;');
      		string = string.replace(/"/g, '&quot;');
       		string = string.replace(/'/g, '&#039;');
       		string = string.replace(/"/g, '&quot;');
    		return string;
		}
		
		function checkemail(str)
		{
			var filter=/^(\w+(?:\.\w+)*)@((?:\w+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
			if (filter.test(str)) return true;
			return false;
		}

		// JSON Funktionen
		
		function add2cart(rwkid, art, quantity) 
		{
			fxl_actions.push(new Array('action=add2cart&art='+escape(art)+'&menge='+quantity+'&rwkid='+escape(rwkid), 'add2cart'));
		}

		function sladd2cart(art, quantity) 
		{
			fxl_actions.push(new Array('action=add2cart&art='+escape(art)+'&menge='+quantity+'&rwkid='+escape(rwkid), 'add2cart'));
		}
		
		function merkzettel(rwkid, art, quantity) 
		{
			fxl_actions.push(new Array('action=add2wishlist&art='+escape(art)+'&rwkid='+escape(rwkid), 'add2wishlist'));
			window.onresize = null;
			close_popups ();
			start_splash();
			div = get_softpop2();
			sp = document.createElement('span');
			sp.id = 'softpop2_note';
			sp.setAttribute('id', 'softpop2_note');
			sp.appendChild(document.createTextNode('Das Produkt wird Ihrem Merkzettel hinzugefügt ...'));
			div.appendChild(sp);
			document.getElementsByTagName("body")[0].insertBefore(div, document.getElementsByTagName("body")[0].firstChild)
		}
		
		function recommendForm(rwkid, art) 
		{
			fxl_actions.push(new Array('action=getProduct&art='+escape(art)+'&rwkid='+escape(rwkid), 'recommendForm'));
			window.onresize = null;
		}
		
		function voteForm(rwkid, art) 
		{
			fxl_actions.push(new Array('action=voteForm&art='+escape(art)+'&rwkid='+escape(rwkid), 'voteForm'));
			window.onresize = null;
		}
		
		function checkVote (geschmack, preis, headline, message)
		{
			if (!(geschmack == 1 || geschmack == 2 || geschmack == 3 || geschmack == 4 || geschmack == 5)) 
			{
				alert('Bitte wählen Sie eine Anzahl Sterne.');
				return undefined;
			}
			else if (!headline) 
			{
				alert('Bitte geben Sie einen Titel für Ihre Bewertung an.');
				return undefined;
			}
			else if (!message) 
			{
				alert('Bitte geben Sie einen Bewertungstext ein.');
				return undefined;
			}
			return true;
		}
		
		function sendVote (rwkid, art, geschmack, preis, headline, message)
		{
			if (checkVote (geschmack, preis, headline, message))
			{
				fxl_actions.push(new Array('action=vote&art='+encodeURIComponent(art)+'&geschmack='+encodeURIComponent(geschmack)+'&preis='+encodeURIComponent(preis)+'&headline='+encodeURIComponent(headline)+'&message='+encodeURIComponent(message)+'&rwkid='+encodeURIComponent(rwkid), 'vote'));
			}
		}
		
			

		
		function fxl_action_pool() 
		{
			if (fxl_actions.length && fxl_busy == false) 
			{
				fxl_busy = true;
				my_action = fxl_actions.shift();
				fxl_make_request(my_action[0], my_action[1]);
			}
		}

		function fxl_make_request(url, fxl_action) 
		{
			//fxl_show_loading();
			http_request = false;
			if (window.XMLHttpRequest) 
			{
				http_request = new XMLHttpRequest();
			} 
			else if (window.ActiveXObject) 
			{
				try {http_request = new ActiveXObject("Msxml2.XMLHTTP");} 
				catch (e) 
				{
					try {http_request = new ActiveXObject("Microsoft.XMLHTTP");} 
					catch (e) {}
				}
			}
			if (!http_request) 
			{
				alert('Cannot create XMLHTTP instance');
				return false;
			}
			http_request.open('POST', '/json.php', true);
			http_request.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
			http_request.setRequestHeader("charset", "utf-8");
			if (fxl_action == 'add2cart') http_request.onreadystatechange = fxl_alert_add2cart;
			if (fxl_action == 'add2wishlist') http_request.onreadystatechange = fxl_alert_add2wishlist;
			else if (fxl_action == 'recommendForm') http_request.onreadystatechange = fxl_alert_recommendForm;
			else if (fxl_action == 'recommendProduct') http_request.onreadystatechange = fxl_alert_recommend;
			else if (fxl_action == 'voteForm') http_request.onreadystatechange = fxl_alert_voteForm;
			else if (fxl_action == 'vote') http_request.onreadystatechange = fxl_alert_vote;
			http_request.send(url);
		}
		

		
		function recommend(art, sender_email, sender_name, sender_vorname, recipient_email, message) 
		{
			if (!checkemail(sender_email)) 
			{
				alert('Bitte geben Sie eine gültige Absender E-Mail Adresse an.');
				return undefined;
			}
			if (!checkemail(recipient_email)) 
			{
				alert('Bitte geben Sie eine gültige Empfänger E-Mail Adresse an.');
				return undefined;
			}
			if (!sender_name) 
			{
				alert('Bitte geben Sie Ihren Namen an.');
				return undefined;
			}
			if (!sender_vorname) 
			{
				alert('Bitte geben Sie Ihren Vornamen an.');
				return undefined;
			}
			// loading setzen
			
			close_popups ();
			start_splash();
			div = get_softpop2();
			sp = document.createElement('span');
			sp.id = 'softpop2_note';
			sp.setAttribute('id', 'softpop2_note');
			sp.appendChild(document.createTextNode('Ihre Empfehlung wird versendet ...'));
			div.appendChild(sp);
			document.getElementsByTagName("body")[0].insertBefore(div, document.getElementsByTagName("body")[0].firstChild)
			
			param = 'sender_email='+encodeURIComponent(sender_email);
			param = param + '&sender_name='+encodeURIComponent(sender_name);
			param = param + '&sender_vorname='+encodeURIComponent(sender_vorname);
			param = param + '&recipient_email='+encodeURIComponent(recipient_email);
			param = param + '&message='+encodeURIComponent(message);
			
			fxl_actions.push(new Array('action=recommendProduct&art='+art+'&'+param, 'recommendProduct'));
		}
				
		function fxl_alert_recommend() 
		{
			if (http_request.readyState == 4) 
			{
				if (http_request.status == 200) 
				{
					//alert(http_request.responseText);
					eval('tmp=' + http_request.responseText);
					fxl_busy = false;
					close_popups ();
					if (navigator.appVersion.indexOf("MSIE")>-1) {
					    if (document.getElementById('softpop_content')) softpop();
					}
					start_splash();
					div = get_softpop2();
					sp = document.createElement('span');
					sp.id = 'softpop2_note';
					sp.setAttribute('id', 'softpop2_note');
					if (tmp.success) sp.appendChild(document.createTextNode('Ihre Empfehlung wurde versendet!'));
					else sp.appendChild(document.createTextNode('Es ist ein Fehler aufgetreten.'));
					div.appendChild(sp);
					document.getElementsByTagName("body")[0].insertBefore(div, document.getElementsByTagName("body")[0].firstChild)
				}
			}
		}

		function fxl_alert_vote() 
		{
			if (http_request.readyState == 4) 
			{
				if (http_request.status == 200) 
				{
					eval('tmp=' + http_request.responseText);
					fxl_busy = false;
					close_popups ();
					if (navigator.appVersion.indexOf("MSIE")>-1) {
					    if (document.getElementById('softpop_content')) softpop();
					}
					start_splash();
					div = get_softpop2();
					sp = document.createElement('span');
					sp.id = 'softpop2_note';
					sp.setAttribute('id', 'softpop2_note');
					if (tmp.success) sp.appendChild(document.createTextNode('Vielen Dank für Ihre Bewertung!'));
					else sp.appendChild(document.createTextNode('Es ist ein Fehler aufgetreten.'));
					div.appendChild(sp);
					
					document.getElementsByTagName("body")[0].insertBefore(div, document.getElementsByTagName("body")[0].firstChild);
				}
			}
		}
		
		function fxl_alert_add2wishlist()
		{
			if (http_request.readyState == 4) 
			{
				if (http_request.status == 200) 
				{
					eval('tmp=' + http_request.responseText);
					fxl_busy = false;
					close_popups();
					start_splash();
					div = get_softpop2();
					sp = document.createElement('span');
					sp.id = 'softpop2_note';
					sp.setAttribute('id', 'softpop2_note');
					if (tmp.success) sp.appendChild(document.createTextNode('Das Produkt wurde Ihrem Merkzettel hinzugefügt.'));
					else sp.appendChild(document.createTextNode('Das Produkt konnte Ihrem Merkzettel nicht hinzugefügt werden.'));
					div.appendChild(sp);
					document.getElementsByTagName("body")[0].insertBefore(div, document.getElementsByTagName("body")[0].firstChild);
					return undefined;
				}
			}
		}
		
		function start_splash() 
		{
			h = 0;
			if(typeof(window.innerHeight) == 'number') 
			{ //Non-IE
				h = window.innerHeight;
			} 
			else if(document.documentElement && document.documentElement.clientHeight) 
			{ //IE 6+ in 'standards compliant mode'
				h = document.documentElement.clientHeight;
			}
			else if(document.body && document.body.clientHeight) 
			{ //IE 4 compatible
				h = document.body.clientHeight;
			}
			if (navigator.appVersion.indexOf("MSIE")>-1) 
			{
				/* show ie 6 splash */
			} 
			else 
			{
				splash = document.createElement('splash');
				splash.setAttribute('id', 'splash');
				splash.style.backgroundImage = 'url(/img/bgsplash.gif)';
				splash.style.backgroundRepeat = 'repeat';
				splash.style.position = 'absolute';
				splash.style.top = '0px';
				splash.style.left = '0px';
				splash.style.height = h+'px';
				splash.style.width = '100%';
				splash.style.zIndex = 254;
				document.getElementsByTagName("body")[0].insertBefore(splash, document.getElementsByTagName("body")[0].firstChild);
			}
		}
		
		function get_softpop2() 
		{
			div = document.createElement('div');
			div.style.marginLeft = 'auto';
			div.style.marginRight = 'auto';
			div.style.top = '0px';
			if (navigator.appVersion.indexOf("MSIE")>-1) 
			{
				div.style.paddingBottom = '10px';
			} 
			div.className = 'softpop2';
			div.style.zIndex = 1001;
			div.setAttribute('id', 'softpop2');
			div.id = 'softpop2';
			elem = document.createElement('a');
			elem.className = 'softpop_close';
			elem.id = 'rf_softpop_close';
			elem.setAttribute('href', 'jav'+'ascript:close_popups()');
			elem.appendChild(document.createTextNode('schließen'));
			div.appendChild(elem);
			return div;
		}
		

		
		function fxl_alert_recommendForm() 
		{
			if (http_request.readyState == 4) 
			{
				if (http_request.status == 200) 
				{
					eval('tmp=' + http_request.responseText);
					fxl_busy = false;
					if (navigator.appVersion.indexOf("MSIE")>-1) {
					    if (typeof window['softpop'] == 'function') softpop();
					}					
					start_splash();
					div = get_softpop2();
					elem = document.createElement('h3');
					elem.appendChild(document.createTextNode('Artikel weiterempfehlen'));
					div.appendChild(elem);
					// Form
					elem = document.createElement('form');
					elem2 = document.createElement('div');
					elem2.className = 'softpop2_form_block_head';
					elem2.appendChild(document.createTextNode('Empfänger:'));
					elem.appendChild(elem2);
					elem2 = document.createElement('div');
					elem2.className = 'softpop2_form_block scf';
					elem3 = document.createElement('div');
					elem3.appendChild(document.createTextNode('E-Mail Adresse:'));
					elem2.appendChild(elem3);
					elem3 = document.createElement('input');
					elem3.setAttribute('type', 'text');
					elem3.setAttribute('name', 'recipient_email');
					elem3.setAttribute('id', 'rf_recipient_email');
					elem2.appendChild(elem3);
					elem.appendChild(elem2);
					elem2 = document.createElement('div');
					elem2.className = 'softpop2_form_block_head';
					elem2.appendChild(document.createTextNode('Ihre Angaben:'));
					elem.appendChild(elem2);
					elem2 = document.createElement('div');
					elem2.className = 'softpop2_form_block scf';
					elem3 = document.createElement('div');
					elem3.appendChild(document.createTextNode('Name:'));
					elem2.appendChild(elem3);
					elem3 = document.createElement('input');
					elem3.setAttribute('type', 'text');
					elem3.setAttribute('name', 'sender_name');
					elem3.setAttribute('id', 'rf_sender_name');
					elem2.appendChild(elem3);
					elem3 = document.createElement('div');
					elem3.appendChild(document.createTextNode('Vorname:'));
					elem2.appendChild(elem3);
					elem3 = document.createElement('input');
					elem3.setAttribute('type', 'text');
					elem3.setAttribute('name', 'sender_vorname');
					elem3.setAttribute('id', 'rf_sender_vorname');
					elem2.appendChild(elem3);
					elem3 = document.createElement('div');
					elem3.appendChild(document.createTextNode('E-Mail Adresse:'));
					elem2.appendChild(elem3);
					elem3 = document.createElement('input');
					elem3.setAttribute('type', 'text');
					elem3.setAttribute('name', 'sender_email');
					elem3.setAttribute('id', 'rf_sender_email');
					elem2.appendChild(elem3);
					elem.appendChild(elem2);
					elem2 = document.createElement('div');
					elem2.className = 'softpop2_form_block_head';
					elem2.appendChild(document.createTextNode('Ihre Nachricht an den Empfänger (freiwillig):'));
					elem.appendChild(elem2);
					elem2 = document.createElement('textarea');
					elem2.setAttribute('name', 'message');
					elem2.setAttribute('id', 'rf_message');
					elem2.setAttribute('rows', '10');
					elem2.setAttribute('cols', '70');
					elem.appendChild(elem2);
					elem2 = document.createElement('a');
					elem2.setAttribute('href', 'jav'+'ascript:recommend('+escape(tmp.transfer.artnr)+', document.getElementById("rf_sender_email").value, document.getElementById("rf_sender_name").value, document.getElementById("rf_sender_vorname").value, document.getElementById("rf_recipient_email").value, document.getElementById("rf_message").value)');
					elem2.className = 'softpop2_action_send';
					elem2.appendChild(document.createTextNode('absenden'));
					elem.appendChild(elem2);
					div.appendChild(elem);
					// Product Info
					elem = document.createElement('div');
					elem.className = 'softpop2_prod_info';
					img = document.createElement('img');
					img.setAttribute('src', '/img/wein/Bilder100/'+tmp.transfer.bild+'a.jpg');
					img.setAttribute('align', 'left');
					elem.appendChild(img);
					elem2 = document.createElement('div');
					elem2.className = 'softpop2_prod_info_name';
					elem2.appendChild(document.createTextNode(tmp.transfer.text1));
					elem.appendChild(elem2);
					if (tmp.transfer.preis_liste > tmp.transfer.preis) 
					{
						elem2 = document.createElement('div');
						elem2.className = 'softpop2_prod_info_lpreis';
						elem2.appendChild(document.createTextNode(valuta(tmp.transfer.preis_liste/100)));
						elem.appendChild(elem2);
					}
					elem2 = document.createElement('div');
					elem2.className = 'softpop2_prod_info_preis';
					elem2.appendChild(document.createTextNode(valuta(tmp.transfer.preis/100)));
					if (tmp.transfer.preis_liste > tmp.transfer.preis) 
					{
						elem3 = document.createElement('span');
						elem3.appendChild(document.createTextNode(' (-'+Math.round(100 - (tmp.transfer.preis * 100 / tmp.transfer.preis_liste))+'%)'));
						elem2.appendChild(elem3);
					}
					elem.appendChild(elem2);
					div.appendChild(elem);
					//document.getElementsByTagName("body")[0].insertBefore(div, document.getElementsByTagName("body")[0].firstChild);
					document.getElementById('content').appendChild(div);
				}
			}
		}
		
		function show_glas(type, glas)
		{
			for (i = 1; i < 6; i++) 
			{
				img = document.getElementById(type + 'glas'+i);
				img.setAttribute('src', '/img/star-off.gif');
			}
			if (!glas) glas = document.getElementById(type + 'rf_vote').value;
			if (glas) 
			{
				for (i = 1; i <= glas; i++) 
				{
					img = document.getElementById(type + 'glas'+i);
					img.setAttribute('src', '/img/star-on.gif');
				}
			}
		}
		
		function set_glas(type, glas)
		{
			document.getElementById(type + 'rf_vote').value = glas;
			show_glas(type, 0);
			
		}
		

		
		function fxl_alert_voteForm() 
		{
			if (http_request.readyState == 4) 
			{
				if (http_request.status == 200) 
				{
					eval('tmp=' + http_request.responseText);
					fxl_busy = false;
					if (navigator.appVersion.indexOf("MSIE")>-1) {
					    if (typeof window['softpop'] == 'function') softpop();
					}
					start_splash();
					div = get_softpop2();
					elem = document.createElement('h3');
					elem.appendChild(document.createTextNode('Wie bewerten Sie den Artikel?'));
					div.appendChild(elem);
					// Form
					elem = document.createElement('form');
					elem2 = document.createElement('div');
					/*
					elem2.className = 'softpop2_form_block_head';
					elem2.appendChild(document.createTextNode('Empfänger:'));
					elem.appendChild(elem2);
					*/

					
					elem2 = document.createElement('div');
					elem2.className = 'softpop2_form_block scf';
					elem2.style.height = '30px';
					elem3 = document.createElement('div');
					elem3.style.width='240px';
					elem3.style.marginBottom='6px';
					elem4 = document.createElement('div');
					elem4.setAttribute('id', 'rf_gglasses');
					elem4.id = 'rf_gglasses';
					elem5 = document.createElement('b');
					elem5.appendChild(document.createTextNode('Geschmack'));
					elem5.style.display = 'block';
					elem4.appendChild(elem5);
					for (i = 1; i < 6; i++) 
					{
						img = document.createElement('img');
						img.setAttribute('src', '/img/star-off.gif');
						img.setAttribute('id', 'gglas'+i);
						img.style.height = '13px';
						img.id = 'gglas'+i;
						if (i == 1) img.onclick = function () {	set_glas('g', 1); }
						else if (i == 2) img.onclick = function () { set_glas('g', 2); }
						else if (i == 3) img.onclick = function () { set_glas('g', 3); }
						else if (i == 4) img.onclick = function () { set_glas('g', 4); }
						else if (i == 5) img.onclick = function () { set_glas('g', 5); }
						if (i == 1) img.onmouseover = function () {	show_glas('g', 1); }
						else if (i == 2) img.onmouseover = function () { show_glas('g', 2); }
						else if (i == 3) img.onmouseover = function () { show_glas('g', 3); }
						else if (i == 4) img.onmouseover = function () { show_glas('g', 4); }
						else if (i == 5) img.onmouseover = function () { show_glas('g', 5); }
						img.onmouseout = function () {	show_glas('g', 0); }
						elem4.appendChild(img);
					}
					elem3.appendChild(elem4);
					elem2.appendChild(elem3);
					elem.appendChild(elem2);
					
					
					elem2 = document.createElement('div');
					elem2.className='softpop2_form_block scf';
					elem3 = document.createElement('div');
					elem3.style.width='240px';
					elem3.style.height='70px';
					elem3.style.paddingTop='10px';
					elem3.appendChild(document.createTextNode('1 gefüllter Stern=niedrigste Bewertung, 5 gefüllte Sterne=beste Bewertung'));
					elem2.appendChild(elem3);
					elem3 = document.createElement('input');
					elem3.setAttribute('type','hidden');
					elem3.setAttribute('name','vote');
					elem3.setAttribute('id','grf_vote');
					elem2.appendChild(elem3);
					elem3 = document.createElement('input');
					elem3.setAttribute('type','hidden');
					elem3.setAttribute('name','vote');
					elem3.setAttribute('id','prf_vote');
					elem2.appendChild(elem3);
					elem.appendChild(elem2);
					
					/*
					elem2 = document.createElement('div');
					elem2.className = 'softpop2_form_block scf';
					elem3 = document.createElement('div');
					elem3.style.width='240px';
					elem4 = document.createElement('b');
					elem4.appendChild(document.createTextNode('Preis'));
					elem4.style.display = 'block';
					elem3.appendChild(elem4);
					for (i = 1; i < 6; i++) 
					{
						img = document.createElement('img');
						img.setAttribute('src', '/img/glas_leer.png');
						img.setAttribute('id', 'pglas'+i);
						if (i == 1) img.onclick = function () {	set_glas('p', 1); }
						else if (i == 2) img.onclick = function () { set_glas('p', 2); }
						else if (i == 3) img.onclick = function () { set_glas('p', 3); }
						else if (i == 4) img.onclick = function () { set_glas('p', 4); }
						else if (i == 5) img.onclick = function () { set_glas('p', 5); }
						if (i == 1) img.onmouseover = function () {	show_glas('p', 1); }
						else if (i == 2) img.onmouseover = function () { show_glas('p', 2); }
						else if (i == 3) img.onmouseover = function () { show_glas('p', 3); }
						else if (i == 4) img.onmouseover = function () { show_glas('p', 4); }
						else if (i == 5) img.onmouseover = function () { show_glas('p', 5); }
						img.onmouseout = function () {	show_glas('p', 0); }
						img.id = 'pglas'+i;
						elem3.appendChild(img);
					}
					elem2.appendChild(elem3);
					elem.appendChild(elem2);
					*/
					
					br = document.createElement('br');
					br.style.clear = 'both';
					elem.appendChild(br);
					elem.appendChild(br);
					
					elem2 = document.createElement('div');
					elem2.setAttribute('id', 'rf_vote_input');
					elem2.style.position = 'relative';
					elem2.style.height = '220px';
					
					elem3 = document.createElement('div');
					elem3.style.position = 'absolute';
					elem3.style.right = '0px';
					elem3.style.top = '13px';
					elem3.style.width = '200px';
					elem3.style.textAlign = 'right';
					elem3.appendChild(document.createTextNode(tmp.transfer.customer.anzeige_name));
					if (tmp.transfer.customer.adresse.plz_ort) {
					   elem3.appendChild(document.createTextNode(', '+tmp.transfer.customer.adresse.plz_ort));
					}
					elem2.appendChild(elem3);
					
					
					elem3 = document.createElement('div');
					elem3.style.fontWeight = 'bold';
					elem3.appendChild(document.createTextNode('Bitte geben Sie einen Titel für Ihre Bewertung an:'));
					elem2.appendChild(elem3);
					elem3 = document.createElement('input');
					elem3.setAttribute('type', 'text');
					elem3.setAttribute('id', 'rf_headline');
					elem3.style.width = '270px';
					elem2.appendChild(elem3);
					
					elem3 = document.createElement('div');
					elem3.style.fontWeight = 'bold';
					elem3.style.marginTop = '6px';
					elem3.appendChild(document.createTextNode('Geben Sie hier Ihren Bewertungstext ein:'));
					elem2.appendChild(elem3);
					elem3 = document.createElement('textarea');
					elem3.className = 'form_inactive';
					elem3.setAttribute('name', 'message');
					elem3.setAttribute('id', 'rf_message');
					elem3.setAttribute('rows', '10');
					elem3.setAttribute('cols', '70');
					elem3.onclick = function () {
						if (document.getElementById('rf_message').className == 'form_inactive') {
							document.getElementById('rf_message').className = '';
							document.getElementById('rf_message').firstChild.nodeValue = '';
						}
					}
					elem3.onfocus = function () {
						if (document.getElementById('rf_message').className == 'form_inactive') {
							document.getElementById('rf_message').className = '';
							document.getElementById('rf_message').firstChild.nodeValue = '';
						}
					}
					elem3.appendChild(document.createTextNode('Die optimale Textlänge liegt bei 50 bis 300 Wörtern, bitte verzichten Sie auf Bewertungen, die nur aus einem Wort wie „Toll“ oder „Lecker“ bestehen.'));
					elem2.appendChild(elem3);
					
					elem3 = document.createElement('div');
					elem3.style.marginTop = '6px';
					elem3.appendChild(document.createTextNode('Mit Klick auf „Absenden“ akzeptiere ich die '));
					elem4 = document.createElement('a');
					elem4.onclick = howtoBewertung;
					elem4.style.cursor = 'pointer';
					elem4.style.textDecoration = 'underline';
					elem4.appendChild(document.createTextNode('Richtlinien'));
					elem3.appendChild(elem4);
					elem3.appendChild(document.createTextNode(' von meevio für Bewertungen.'));
					
					elem2.appendChild(elem3);
					
					elem2o = document.createElement('div');
					elem2o.setAttribute('id', 'rf_buttons_preview');
					elem2o.id = 'rf_buttons';
					elem3 = document.createElement('a');
					elem3.onclick = function () {
						m = (document.getElementById('rf_message').className != 'form_inactive') ? document.getElementById('rf_message').value : '';
						if (checkVote(document.getElementById('grf_vote').value, 0, document.getElementById('rf_headline').value, m)) {
							document.getElementById('rf_headline_preview').firstChild.nodeValue = document.getElementById('rf_headline').value;
							m = htmlspecialchars(m);
							document.getElementById('rf_message_preview').innerHTML = m.replace(/([^>])\n/g, '$1<br />\n');
							for (i = 1; i < 6; i++) 
							{
								document.getElementById('gglas'+i+'preview').src = document.getElementById('gglas'+i).src;
							}
							document.getElementById('rf_vote_input').style.display = 'none';
							document.getElementById('rf_vote_preview').style.display = 'block';
							document.getElementById('rf_buttons').style.display = 'none';
							document.getElementById('rf_buttons_preview').style.display = 'block';
							document.getElementById('rf_gglasses').style.display = 'none';
						}
					}
					//elem3.setAttribute('href', '#');
					elem3.className = 'softpop2_action_send';
					elem3.appendChild(document.createTextNode('Weiter'));
					elem2o.appendChild(elem3);
					elem.appendChild(elem2);
					elem.appendChild(elem2o);
					
					
					elem2 = document.createElement('div');
					elem2.setAttribute('id', 'rf_vote_preview');
					elem2.style.position = 'relative';
					elem2.style.height = '220px';
					elem2.style.overflow = 'auto';
					elem2.style.display = 'none';
					
					elem3 = document.createElement('h3');
					elem3.appendChild(document.createTextNode('So wird Ihre Bewertung anderen Kunden angezeigt:'));
					elem3.style.color = '#D30400';
					elem2.appendChild(elem3);
					
					elem3 = document.createElement('div');
					elem3.style.width = '95px';
					elem3.style.position = 'absolute';
					elem3.style.top = '20px';
					elem3.style.right = '0px';
					for (i = 1; i < 6; i++) 
					{
						img = document.createElement('img');
						img.setAttribute('src', '/img/glas_leer.png');
						img.setAttribute('id', 'gglas'+i+'preview');
						/* img.style.height = '26px'; */
						img.id = 'gglas'+i+'preview';
						elem3.appendChild(img);
					}					
					elem2.appendChild(elem3);

					elem3 = document.createElement('div');
					elem3.style.fontWeight = 'bold';
					elem3.style.width = '300px';
					elem3.setAttribute('id', 'rf_headline_preview');
					elem3.id = 'rf_headline_preview';
					elem3.appendChild(document.createTextNode('Der Vorschau-Titel'));
					elem2.appendChild(elem3);

                    var Jetzt = new Date();
                    var Tag = Jetzt.getDate();
                    var Monat = Jetzt.getMonth() +1;
                    var Jahr = Jetzt.getYear();
					
					elem3 = document.createElement('a');
					elem3.style.display = 'block';
					elem3.setAttribute('href', '#');
					elem3.appendChild(document.createTextNode('Geschrieben von '+ tmp.transfer.customer.anzeige_name+' am '+Tag+'.'+Monat+'.'+Jahr+' - Alle meine Bewertungen lesen'));
					elem2.appendChild(elem3);
					
					elem3 = document.createElement('a');
					elem3.style.display = 'block';
					elem3.setAttribute('href', '#');
					elem3.appendChild(document.createTextNode(tmp.transfer.customer.anzeige_name+' zu meinen Weinpaten hinzufügen'));
					elem2.appendChild(elem3);
					
					elem3 = document.createElement('div');
					elem3.style.marginTop = '6px';
					elem3.setAttribute('id', 'rf_message_preview');
					elem3.id = 'rf_message_preview';
					elem3.appendChild(document.createTextNode('Der Vorschau-Text'));
					elem2.appendChild(elem3);
					
					
					elem2o = document.createElement('div');
					elem2o.setAttribute('id', 'rf_buttons_preview');
					elem2o.id = 'rf_buttons_preview';
					elem2o.style.display = 'none';
					elem3 = document.createElement('a');
					elem3.setAttribute('href', 'jav'+'ascript:sendVote(\''+fxl_rwkid+'\', '+escape(tmp.transfer.product.artnr)+', document.getElementById("grf_vote").value, document.getElementById("prf_vote").value, document.getElementById("rf_headline").value, document.getElementById("rf_message").value)');
					elem3.className = 'softpop2_action_send';
					elem3.appendChild(document.createTextNode('Absenden'));
					elem2o.appendChild(elem3);
					elem3 = document.createElement('a');
					elem3.className = 'softpop2_action_back';
					elem3.style.cssFloat = 'left';
					elem3.style.styleFloat = 'left';
					elem3.onclick = function () {
						document.getElementById('rf_vote_input').style.display = 'block';
						document.getElementById('rf_vote_preview').style.display = 'none';
						document.getElementById('rf_buttons').style.display = 'block';
						document.getElementById('rf_buttons_preview').style.display = 'none';
						document.getElementById('rf_gglasses').style.display = 'block';
					}
					elem3.appendChild(document.createTextNode('Ändern'));
					elem2o.appendChild(elem3);
					elem.appendChild(elem2);
					elem.appendChild(elem2o);
					
					
					div.appendChild(elem);
					// Product Info
					elem = document.createElement('div');
					elem.className = 'softpop2_prod_info';
					img = document.createElement('img');
					img.setAttribute('src', '/img/wein/Bilder100/'+tmp.transfer.product.bild+'a.jpg');
					img.setAttribute('align', 'left');
					elem.appendChild(img);
					// <img src="/img/wein/Bilder100/'.$Datensatz['ArtikelNrBild'].'a.jpg" border="0" height="100" alt="">

					elem2 = document.createElement('div');
					elem2.className = 'softpop2_prod_info_name';
					elem2.appendChild(document.createTextNode(tmp.transfer.product.text1));
					elem.appendChild(elem2);
					
					if (tmp.transfer.product.preis_liste > tmp.transfer.product.preis) 
					{
						elem2 = document.createElement('div');
						elem2.className = 'softpop2_prod_info_lpreis';
						elem2.appendChild(document.createTextNode(valuta(tmp.transfer.product.preis_liste/100)));
						elem.appendChild(elem2);
					}
					
					elem2 = document.createElement('div');
					elem2.className = 'softpop2_prod_info_preis';
					elem2.appendChild(document.createTextNode(valuta(tmp.transfer.product.preis/100)));
					if (tmp.transfer.product.preis_liste > tmp.transfer.product.preis) 
					{
						elem3 = document.createElement('span');
						elem3.appendChild(document.createTextNode(' (-'+Math.round(100 - (tmp.transfer.product.preis * 100 / tmp.transfer.product.preis_liste))+'%)'));
						elem2.appendChild(elem3);
					}
					elem.appendChild(elem2);
					div.appendChild(elem);
					

					document.getElementById('content').appendChild(div);
					// document.getElementsByTagName("body")[0].insertBefore(div, document.getElementsByTagName("body")[0].firstChild);
				}
			}
		}
		
		
		function hide_wk () 
		{
			if (document.getElementById("wk_info_danke")) 
			{
				document.getElementById("wk_info_danke").parentNode.removeChild(document.getElementById("wk_info_danke"));
			}
			return undefined;
		}
		
		function fxl_alert_add2cart() 
		{
			if (http_request.readyState == 4) 
			{
				if (http_request.status == 200) 
				{
					eval('tmp=' + http_request.responseText);
					
					fxl_busy = false;
					//alert(tmp.success);
					if (tmp.success >= 1 && document.getElementById('wk_innen')) 
					{
						fxl_transfer = tmp.transfer;
						document.getElementById('wk_info').className = 'on';
						wk = document.getElementById('wk_innen');
						wk.setAttribute('onc'+'lick', "location.href='/bestellung/warenkorb.html'");
						wk.style.cursor = 'pointer';
						wkanzahl = document.getElementById('wk_info_anzahl');
						wksumme = document.getElementById('wk_info_summe');
						while (wkanzahl.firstChild) { wkanzahl.removeChild(wkanzahl.firstChild); }
						while (wksumme.firstChild) { wksumme.removeChild(wksumme.firstChild); }
						wksumme.appendChild(document.createTextNode(valuta(tmp.transfer.total/100)));
						wkanzahl.appendChild(document.createTextNode(tmp.transfer.items.length+' Produkte'));
						if (document.getElementById('wk_info_danke')) 
						{
							document.getElementById('wk_info_danke').parentNode.removeChild(document.getElementById('wk_info_danke'));
						}
						div = document.createElement('div');
						b = document.createElement('b');
						b.appendChild(document.createTextNode('Produkt wurde in Warenkorb gelegt'));
						br = document.createElement('br');
						b.appendChild(br);
						bsp = document.createElement('sp');
						bsp.style.color = '#D30400';
						bsp.appendChild(document.createTextNode('Ab 110,- € Versand kostenlos')); //
						// bsp.appendChild(document.createTextNode('Versand kostenlos')); //
						b.appendChild(bsp);
						b.style.display = 'block';
						b.style.height = '30px';
						b.style.padding = '4px';
						div.appendChild(b);
						artdiv = document.createElement('div');
						artdiv.style.padding = '4px';
						//artdiv.style.position = 'relative';
						artdiv.style.border = '1px solid white';
						artdiv.style.backgroundColor = 'white';
						imgdiv = document.createElement('div');
						imgdiv.style.textAlign = 'center';
						imgdiv.style.width = '70px';
						imgdiv.style.overflow = 'hidden';
						imgdiv.style.cssFloat = 'left';
						imgdiv.style.styleFloat = 'left';
						img = document.createElement('img');
						img.setAttribute('src', '/img/wein/Bilder100/'+tmp.transfer.items[tmp.transfer.items.length - 1].bild+'a.jpg');
						img.style.border = 'none';
						imgdiv.appendChild(img);
						artdiv.appendChild(imgdiv);
						infodiv = document.createElement('div');
						
						infodiv.style.cssFloat = 'right';
						infodiv.style.styleFloat = 'right';
						infodiv.style.width = '145px';
						infodiv.style.overflow = 'hidden';
						infodiv.style.border = '1px solid white';
						if (tmp.transfer.items[tmp.transfer.items.length - 1].jahrgang)
						{
							infoj = document.createElement('div');
							infoj.appendChild(document.createTextNode(tmp.transfer.items[tmp.transfer.items.length - 1].jahrgang));
							infoj.style.fontWeight = 'bold';
							infodiv.appendChild(infoj);
						}
						namediv = document.createElement('div');
						namediv.style.color = '#D30400';
						namediv.style.fontSize = '14px';
						namediv.style.fontWeight = 'bold';
						namediv.style.paddingRight = '4px';
						namediv.appendChild(document.createTextNode(tmp.transfer.items[tmp.transfer.items.length - 1].text1));
						infodiv.appendChild(namediv);
						//infodiv.appendChild(document.createTextNode(tmp.transfer.items[tmp.transfer.items.length - 1].beschreibung150));
						x = 0;
						if (tmp.transfer.items[tmp.transfer.items.length - 1].farbe_name)
						{
							infodiv.appendChild(document.createTextNode(tmp.transfer.items[tmp.transfer.items.length - 1].farbe_name));
							x = 1;
						}
						if (tmp.transfer.items[tmp.transfer.items.length - 1].land_name)
						{
							if (x) infodiv.appendChild(document.createTextNode(', '));
							infodiv.appendChild(document.createTextNode(tmp.transfer.items[tmp.transfer.items.length - 1].land_name));
							x = 1;
						}
						if (tmp.transfer.items[tmp.transfer.items.length - 1].warengruppe_name)
						{
							if (x) infodiv.appendChild(document.createTextNode(', '));
							infodiv.appendChild(document.createTextNode(tmp.transfer.items[tmp.transfer.items.length - 1].warengruppe_name));
							x = 1;
						}
						if (tmp.transfer.items[tmp.transfer.items.length - 1].inhalt)
						{
							br = document.createElement('br');
							infodiv.appendChild(br);
							if (tmp.transfer.items[tmp.transfer.items.length - 1].einheit == 'ml') 
							{
								num = tmp.transfer.items[tmp.transfer.items.length - 1].inhalt / 1000;
			 					num="" + Math.floor(num*100.0 + 0.5)/100.0;
								var i=num.indexOf(".");
								if ( i<0 ) num+=",00";
								else 
								{
									num=num.substring(0,i) + "," + num.substring(i + 1);
									var nDec=(num.length - i) - 1;
									if ( nDec==0 ) num+="00";
									else if ( nDec==1 ) num+="0";
									else if ( nDec>2 ) num=num.substring(0,i + 3);
								}
								infodiv.appendChild(document.createTextNode(num+ 'l'));
							}
							else if (tmp.transfer.items[tmp.transfer.items.length - 1].einheit == 'kg') 
							{
								infodiv.appendChild(document.createTextNode(tmp.transfer.items[tmp.transfer.items.length - 1].inhalt+ 'g'));
							}
							
						}
						br = document.createElement('br');
						br.style.clear = 'both';
						infodiv.appendChild(br);
						artdiv.appendChild(infodiv);
						div.appendChild(artdiv);
						br = document.createElement('br');
						br.style.clear = 'both';
						artdiv.appendChild(br);
						iespan = document.createElement('div');
						iespan.style.fontSize = '0px';
						iespan.style.lineHeight = '0px';
						iespan.style.visibility = 'hidden';
						iespan.appendChild(document.createTextNode('.'));
						artdiv.appendChild(iespan);
						artdiv.setAttribute('onc'+'lick', "location.href='/bestellung/warenkorb.html'");
						artdiv.style.cursor = 'pointer';
						div.appendChild(artdiv);
						footdiv = document.createElement('div');
						footdiv.style.paddingTop = '6px';
						footdivl = document.createElement('a');
						footdivl.style.color = '#668800';
						footdivl.style.paddingLeft = '4px';
						footdivl.style.cssFloat = 'left';
						footdivl.style.styleFloat = 'left';
						footdivl.style.width = '40%';
						footdivl.style.display = 'block';
						footdivl.style.textDecoration = 'none';
						footdivl.setAttribute('href', 'jav'+'ascript:hide_wk()');
						footdivl.appendChild(document.createTextNode('x schließen'));
						footdivr = document.createElement('a');
						footdivr.style.color = '#668800';
						footdivr.style.paddingRight = '4px';
						footdivr.style.cssFloat = 'right';
						footdivr.style.styleFloat = 'right';
						footdivr.style.width = '40%';
						footdivr.style.display = 'block';
						footdivr.style.textDecoration = 'none';
						footdivr.style.textAlign = 'right';
						footdivr.setAttribute('href', 'jav'+'ascript:location.href="/bestellung/warenkorb.html"');
						footdivr.appendChild(document.createTextNode('zum Warenkorb >'));
						footdiv.appendChild(footdivl);
						footdiv.appendChild(footdivr);
						div.appendChild(footdiv);
						br = document.createElement('br');
						br.style.clear = 'both';
						footdiv.appendChild(br);
						div.appendChild(footdiv);
						div.id = 'wk_info_danke';
						div.setAttribute('id', 'wk_info_danke');
						//div.style.backgroundColor = 'white';
						document.getElementById('wk_info').appendChild(div);
						window.setTimeout("hide_wk()", 10000);
						//if (document.getElementById('wk_info_danke')) document.getElementById('wk_info_danke').parentNode.removeChild(document.getElementById('wk_info_danke'))
						div = document.getElementById('wk_info');
						
						
						//refresh_display();
						if (window['softpop']) softpop();
					}
					else if (tmp.error) { alert(tmp.error); }
					// fxl_hide_loading(1);
				}
			}
		}
		
