function topnav_focus(item_to_mark) {

	document.getElementById("topnav_a_" + item_to_mark).style.color= "#3d8f5c";

	document.getElementById("topnav_li_" + item_to_mark).style.borderBottom = "solid 1px #3d8f5c";
	document.getElementById("topnav_li_" + item_to_mark).style.cursor = "pointer";


//	return false;
}




function topnav_blur(item_to_unmark) {

	document.getElementById("topnav_a_" + item_to_unmark).style.color= "#1b4d3e";

	document.getElementById("topnav_li_" + item_to_unmark).style.borderBottom = "solid 1px #cccccc";
	document.getElementById("topnav_li_" + item_to_unmark).style.cursor = "auto";


//	return false;
}




function topnav_loco_focus(item_to_mark) {

	document.getElementById("topnav_a_" + item_to_mark).style.color= "#5fbf7c";

	document.getElementById("topnav_li_" + item_to_mark).style.borderBottom = "solid 1px #5fbf7c";
	document.getElementById("topnav_li_" + item_to_mark).style.cursor = "pointer";


//	return false;
}




function topnav_loco_blur(item_to_unmark) {

	document.getElementById("topnav_a_" + item_to_unmark).style.color= "#3d8f5c";

	document.getElementById("topnav_li_" + item_to_unmark).style.borderBottom = "solid 1px #3d8f5c";
	document.getElementById("topnav_li_" + item_to_unmark).style.cursor = "auto";


//	return false;
}




function loadpage(seite, sprache) {

	var lingua_to_use = (sprache != "")? "?lingua=" + sprache : "";


	window.open(seite + '.php' + lingua_to_use, '_self');
}





function hover_it(object, style) {

	styles = Array();

	styles[0] = Array();
	styles[1] = Array();
	styles[2] = Array();

	styles[0][0] = "#AC3030";
	styles[0][1] = "#666666";
	styles[0][2] = "#5fbf7c";
	styles[0][3] = "#cc9900";
	styles[0][4] = "#a0a0cc";

	styles[1][0] = "#ffffff";
	styles[1][1] = "#ffffff";
	styles[1][2] = "#e3dfdc";
	styles[1][3] = "#e3dfdc";
	styles[1][4] = "#e3dfdc";

	styles[2][0] = "0";
	styles[2][1] = "0";
	styles[2][2] = "1px solid #444444";
	styles[2][3] = "1px solid #444444";
	styles[2][4] = "1px solid #444444";


	document.getElementById(object).style.color = styles[0][style];
	document.getElementById(object).style.background = styles[1][style];
	document.getElementById(object).style.border = styles[2][style];


	return true;
}




function blur_it(object, style) {

	styles = Array();

	styles[0] = Array();
	styles[1] = Array();
	styles[2] = Array();

	styles[0][0] = "#666666";
	styles[0][1] = "#AC3030";
	styles[0][2] = "#000000";
	styles[0][3] = "#000000";
	styles[0][4] = "#000000";

	styles[1][0] = "#ffffff";
	styles[1][1] = "#ffffff";
	styles[1][2] = "#e3dfdc";
	styles[1][3] = "#e3dfdc";
	styles[1][4] = "#e3dfdc";

	styles[2][0] = "0";
	styles[2][1] = "0";
	styles[2][2] = "1px solid #444444";
	styles[2][3] = "1px solid #444444";
	styles[2][4] = "1px solid #444444";


	document.getElementById(object).style.color = styles[0][style];
	document.getElementById(object).style.background = styles[1][style];
	document.getElementById(object).style.border = styles[2][style];


	return true;
}




function big_img(shop_id, img_src, img_title, lingua) {

	var img_window;

	var html_text = new Array();

	html_text[0] = new Array();
	html_text[0][0] = "Mausklick schlie&szlig;t dieses Fenster";
	html_text[0][1] = "Fenster schlie&szlig;en";

	html_text[1] = new Array();
	html_text[1][0] = "Click will close this window";
	html_text[1][1] = "Close this window";

	html_text[2] = new Array();
	html_text[2][0] = "Cerrar ventana";
	html_text[2][1] = "Pincha aqu&iacute; para cerrar";


	var lingua_index = 0;


	if(lingua == "en") {

		lingua_index = 1;
	}


	if(lingua == "es") {

		lingua_index = 2;
	}


	var x_position = 0.5 * eval(screen.availWidth - 340);
	var y_position = 0.5 * eval(screen.availHeight - 380);


	img_window = open("STIMMWERCK: " + img_title, "big_img_window", "height=380px, width=340px, left=" + x_position + ", top=" + y_position + ", hotkeys=yes, location=no, resizable=no, menubar=no, toolbar=no, scrollbars=no, status=yes");


	img_window.document.open();


	with (img_window.document) {

		write("<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"de-DE\" lang=\"de-DE\">\n\n<head>\n\t<title>STIMMWERCK: " + img_title + "</title>\n\t<meta http-equiv=\"content-type\" content=\"text/html; charset=iso-8859-15\" />\n\t<meta http-equiv=\"expires\" content=\"0\" />\n\t<meta name=\"robots\" content=\"noindex, nofollow\" />\n\t<meta name=\"description\" content=\"Stimmwerck\" />\n\t<meta name=\"keywords\" content=\"Stimmwerck\" />\n\t<meta name=\"author\" content=\"die datendreXler, D-26123 Oldenburg : Copyright 2010\" />\n\n\t<link rel=\"shortcut icon\" href=\"media/shortcut_icons/stimmwerck.ico\" />\n\t<style type=\"text/css\">\n\t\tbody.big_shop_img {\n\t\tfont-family: Arial, Geneva, Helvetica, \"Sans Serif\", sans-serif;\n\t\tfont-size: 0.85em;\n\t\ttext-align: center;\n\t\tcolor: linen;\n\t\tbackground-color: #ffffff;\n\t\tmargin: 0;\n\t\tpadding: 0;\n\t\t}\n\n\t\timg#big_shop_img {\n\t\twidth: 22em;\n\t\theight:22em;\n\t\t}\n\n\t\tp.big_shop_img {\n\t\tfont-size: 1em;\n\t\ttext-align: center;\n\t\tcolor: linen;\n\t\tbackground-color: #ffffff;\n\t\tmargin: 1.5em 0 0 0;\n\t\tpadding: 0;\n\t\t}\n\n\t\tp.big_shop_img_close_window {\n\t\tfont-size: 0.85em;\n\t\tfont-weight: normal;\n\t\ttext-align: center;\n\t\tcolor: #3d8f5c;\n\t\tbackground-color: #ffffff;\n\t\tmargin: 0;\n\t\tpadding: 1.5em 0 0 0;\n\t\t}\n\n\t\t.big_shop_img_close_window:hover {\n\t\tcolor: #5fbf7c;\n\t\tcursor: pointer;\n\t\t}\n\t</style>\n</head>\n\n");


		write("<body class=\"big_shop_img\">\n<p class=\"big_shop_img\">\n<img src=\"media/shop_data/" + shop_id + "/shop_images/" + img_src + "\" id=\"big_shop_img\" title=\"STIMMWERCK: " + img_title + "\" alt=\"STIMMWERCK: " + img_title + "\" />\n</p>\n\n<p class=\"big_shop_img_close_window\" onclick=\"window.close();\" title=\"" + html_text[lingua_index][0] + "\">" + html_text[lingua_index][1] + "</p>\n</body>\n\n</html>");
	}


	img_window.document.close();
}




function europa(lingua) {

	var europa_window;

	var html_text = new Array();

	html_text[0] = new Array();
	html_text[0][0] = "Das Lieferziel &bdquo;Europa&rdquo;";
	html_text[0][1] = "Das Lieferziel &bdquo;Europa&rdquo; umfasst folgende Staaten:\n</p>\n<p class=\"europa\">\n&Aring;land-Inseln&nbsp;(Finnland), Albanien, Andorra, Balearen&nbsp;(Spanien), Belarus, Wei&szlig;russland, Belgien, Berg&nbsp;Athos, Bosnien&nbsp;und&nbsp;Herzegowina, Bulgarien, Campione&nbsp;d&rsquo;Italia, D&auml;nemark, Estland, F&auml;r&ouml;er&nbsp;(D&auml;nemark), Finnland, Frankreich, Gibraltar, Griechenland, Gro&szlig;britannien, Irland, Island, Isle&nbsp;of&nbsp;Man, Italien, Kanalinseln&nbsp;(Kronbesitz), Kosovo, Kroatien, Lettland, Liechtenstein, Litauen, Livigno&nbsp;(Italien), Luxemburg, Malta, Mazedonien, Moldauische&nbsp;Republik, Monaco, Montenegro, Montserrat, Niederlande, Nordirland&nbsp;(Gro&szlig;britannien), Norwegen, &Ouml;sterreich, Polen, Portugal, Rum&auml;nien, Russische&nbsp;F&ouml;deration, San&nbsp;Marino, Schweden, Schweiz, Serbische&nbsp;Republik, Slowakei, Slowenien, Spanien, Tschechische&nbsp;Republik, T&uuml;rkei, Ukraine, Ungarn, Vatikanstadt, Zypern";
	html_text[0][2] = "Mausklick schlie&szlig;t dieses Fenster";
	html_text[0][3] = "Fenster schlie&szlig;en";

	html_text[1] = new Array();
	html_text[1][0] = "The destination &bdquo;Europe&rdquo;";
	html_text[1][1] = "The destination &bdquo;Europe&rdquo; includes these countries:\n</p>\n<p class=\"europa\">\n&Aring;land Islands (Finland), Albania, Andorra, Balearic&nbsp;Islands&nbsp;(Spain), Austria, Belarus&nbsp;(Byelorussia), Belgium, Bosnia&nbsp;and&nbsp;Herzegovina, Bulgaria, Campione&nbsp;d&rsquo;Italia, Channel&nbsp;Islands, Croatia, Cyprus, Czech&nbsp;Republic, Denmark, Estonia, Faroe&nbsp;Islands&nbsp;(Denmark), Finland, France, Gibraltar, Greece, Hungary, Iceland, Ireland, Isle&nbsp;of&nbsp;Man, Italy, Kosovo, Latvia, Liechtenstein, Lithuania, Livigno&nbsp;(Italy), Luxembourg, Macedonia, Malta, Moldova, Monaco, Montenegro, Montserrat, Mount&nbsp;Athos, Netherlands, Norway, Poland, Portugal, Romania, Russian&nbsp;Federation, San&nbsp;Marino, Serbia, Slovakia, Slovenia, Spain, Sweden, Switzerland, Turkey, Ukraine, United&nbsp;Kingdom, Vatican&nbsp;City";
	html_text[1][2] = "Click will close this window";
	html_text[1][3] = "Close this window";

	html_text[2] = new Array();
	html_text[2][0] = "El destino &bdquo;Europa&rdquo;";
	html_text[2][1] = "El destino &bdquo;Europa&rdquo; engloba las estados\n</p>\n<p class=\"europa\">\nAlbania, Andorra, Armenia, Austria, Azerbaiy&aacute;n, Belar&uacute;s&nbsp;(Bielorrusia), B&eacute;lgica, Bosnia&nbsp;y&nbsp;Hercegovina, Bulgaria, Chipre, Ciudad&nbsp;del&nbsp;Vaticano, Croacia, Dinamarca, Eslovaquia, Eslovenia, Espa&ntilde;a, Estonia, Federaci&oacute;n&nbsp;Rusa, Finlandia, Francia, Georgia, Gibraltar, Grecia, Gran&nbsp;Breta&ntilde;a, Hungr&iacute;a, Irlanda, Islandia, Italia, Kazajist&aacute;n, Kosovo, Letonia, Liechtenstein, Lituania, Luxemburgo, Malta, Macedonia, Monaco, Montenegro, Noruega, Pa&iacute;ses&nbsp;Bajos, Polonia, Portugal, Rep&uacute;blica&nbsp;Checa, Rep&uacute;blica&nbsp;Moldava, Rumania, San&nbsp;Marino, Serbia, Suecia, Suiza, Turqu&iacute;a, Ucrania";
	html_text[2][2] = "Cerrar ventana";
	html_text[2][3] = "Pincha aqu&iacute; para cerrar";


	var lingua_index = 0;


	if(lingua == "en") {

		lingua_index = 1;
	}


	if(lingua == "es") {

		lingua_index = 2;
	}


	var x_position = 0.5 * eval(screen.availWidth - 400);
	var y_position = 0.5 * eval(screen.availHeight - 400);


	europa_window = open("STIMMWERCK: " + html_text[lingua_index][0], "europa_window", "height=400px, width=400px, left=" + x_position + ", top=" + y_position + ", hotkeys=yes, location=no, resizable=no, menubar=no, toolbar=no, scrollbars=no, status=yes");


	europa_window.document.open();


	with (europa_window.document) {

		write("<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"de-DE\" lang=\"de-DE\">\n\n<head>\n\t<title>STIMMWERCK: " + html_text[lingua_index][0] + "</title>\n\t<meta http-equiv=\"content-type\" content=\"text/html; charset=iso-8859-15\" />\n\t<meta http-equiv=\"expires\" content=\"0\" />\n\t<meta name=\"robots\" content=\"noindex, nofollow\" />\n\t<meta name=\"description\" content=\"Stimmwerck\" />\n\t<meta name=\"keywords\" content=\"Stimmwerck\" />\n\t<meta name=\"author\" content=\"die datendreXler, D-26123 Oldenburg : Copyright 2010\" />\n\n\t<link rel=\"shortcut icon\" href=\"media/shortcut_icons/stimmwerck.ico\" />\n\t<style type=\"text/css\">\n\t\tbody.europa {\n\t\tfont-family: Arial, Geneva, Helvetica, \"Sans Serif\", sans-serif;\n\t\tfont-size: 0.85em;\n\t\ttext-align: center;\n\t\tcolor: #000000;\n\t\tbackground-color: #ffffff;\n\t\tmargin: 1em;\n\t\tpadding: 1em 0 1em 0;\n\t\t}\n\n\t\tp.europa {\n\t\tfont-size: 0.85em;\n\t\ttext-align: center;\n\t\tcolor: #000000;\n\t\tbackground-color: #ffffff;\n\t\tmargin: 1em;\n\t\tpadding: 1em 0 1em 0;\n\t\t}\n\n\t\tp.europa_close_window {\n\t\tfont-size: 0.85em;\n\t\tfont-weight: normal;\n\t\ttext-align: center;\n\t\tcolor: #3d8f5c;\n\t\tbackground-color: #ffffff;\n\t\tpadding: 1em 0 0 0;\n\t\t}\n\n\t\t.europa_close_window:hover {\n\t\tcolor: #5fbf7c;\n\t\tcursor: pointer;\n\t\t}\n\t</style>\n</head>\n\n");


		write("<body class=\"europa\">\n<p class=\"europa\">\n" + html_text[lingua_index][1] + "\n</p>\n\n<p class=\"europa_close_window\" onclick=\"window.close();\" title=\"" + html_text[lingua_index][2] + "\">" + html_text[lingua_index][3] + "</p>\n</body>\n\n</html>");
	}


	europa_window.document.close();
}




function mail(empfaenger) {

	var namen = new Array("Stimmwerck", "die datendreXler");
	var adressen = new Array("stimmwerck", "datendrexler");
	var name = "";


	for(var i = 0; i < namen.length; i++) {

		if(adressen[i] == empfaenger) {

			name = namen[i];

			break;
		}
	}


	document.write("<a style=onmouseover=\"window.status='E-Mail an "+ name + "'; return true;\"	onclick=\"window.status=''; return true; \"onmouseout=\"window.status=''; return true;\" href=\"mailto:info@" + empfaenger + ".de\" title=\"E-Mail an " + name + "\">info@" + empfaenger + ".de</a>");
}




function mail_to(empfaenger, provider) {

	empfaenger = empfaenger + "@" + provider;

	document.write("<a href=\"mailto:" + empfaenger + "\">" + empfaenger + "</a>");
}




function mail_url(first_name, last_name, url, domain) {

	var address = "mailto:";


	if( first_name.length > 0) {

		address += first_name;
	}


	if( last_name.length > 0) {

		address += "." + last_name;
	}


	location.href = address + "@" + url + "." + domain;
}




function input_test(the_input) {

	if(the_input == "newsletter_name") {

		if(document.getElementsByName("newsletter_name")[0].value == "Ihr Name") {

			document.getElementsByName("newsletter_name")[0].value = "";
		}


		else {

			document.getElementsByName("newsletter_name")[0].style.color = "#000000";
		}
	}


	if(the_input == "newsletter_e_mail") {

		if(document.getElementsByName("newsletter_e_mail")[0].value == "Ihre Mail-Adresse") {

			document.getElementsByName("newsletter_e_mail")[0].value = "";
		}


		else {

			document.getElementsByName("newsletter_e_mail")[0].style.color = "#000000";
		}
	}


	return false;
}


function alarm(zeile, versatz) {

	var zellen = (6 * zeile) + versatz;

	for(var i = 1; i < 7; i++) {

		document.getElementsByTagName("td")[eval(zellen + i)].className = "delete";
	}
}


function zurueck(zeile, versatz, farbe) {

	var zellen = (6 * zeile) + versatz;

	for(var i = 1; i < 7; i++) {

		document.getElementsByTagName("td")[eval(zellen + i)].className = farbe;
	}
}


function encolor(text_area) {

	document.getElementsByTagName('textarea')[text_area].style.backgroundColor='#ffff99';
}


function decolor(text_area) {

	document.getElementsByTagName('textarea')[text_area].style.backgroundColor='#ffffff';
}


function comma_for_point(zahl) {

	zahl = zahl.toString();

	var dezimalzahl = zahl.indexOf(".");


	if(dezimalzahl == -1) {

		zahl += ",00";
	}


	else {

		var ganzzahlteil = zahl.substring( 0, dezimalzahl );
		var dezimalteil = zahl.substring( eval(dezimalzahl + 1) );

		zahl = ganzzahlteil + "," + dezimalteil;

		var eine_dezimalstelle = /^\d{1}$/;
		var stellen_pruefung = eine_dezimalstelle.test(dezimalteil);


		if(stellen_pruefung == true) {

			zahl += "0";
		}
	}


	if(zahl != "0,00") {

		var vorkommastellen = zahl.indexOf(",");


		if(vorkommastellen > 3) {

			var tausenderstellen = zahl.substring(0, eval(vorkommastellen - 3) );
			var reststellen = zahl.substring( eval(vorkommastellen - 3) );

			zahl = tausenderstellen + "." + reststellen;
		}
	}


	return zahl;
}


function bestellwert() {

	var aktuelle_summe = 0.00;
	var stueckzahl = 0;
	var versandkosten = 0.00;
	var versandkosten_hinweis = "Es fallen keine Versandkosten an.";


	var shop_titles = new Array();

	shop_titles[0] = "adam_von_fulda";
	shop_titles[1] = "heinrich_finck";
	shop_titles[2] = "musik_in_st_michael";
	shop_titles[3] = "gyri_gyri_gaga";
	shop_titles[4] = "leonhard_paminger";
	shop_titles[5] = "t_shirt";


	var shop_prices = new Array();

	shop_prices[0] = 13;
	shop_prices[1] = 13;
	shop_prices[2] = 15;
	shop_prices[3] = 15;
	shop_prices[4] = 15;
	shop_prices[5] = 12.5;


	for(var i = 0; i < shop_titles.length; i++) {

		var artikel = shop_titles[i];

		var anzahl = document.forms[0][artikel].value;
		var einzelpreis = shop_prices[i];


		if(anzahl != "") {

			var nur_ziffern = /^\d{1,4}$/;
			var typ_pruefung = nur_ziffern.test(anzahl);


			if(typ_pruefung == true) {

				mengenpreis = einzelpreis * anzahl;

				aktuelle_summe += parseFloat(mengenpreis);

				stueckzahl += parseInt(anzahl);
			}
		}
	}


	if(stueckzahl < 100) {

		if(aktuelle_summe > 30.00) {

			versandkosten = "4.00";
		}


		else {

			if(stueckzahl > 2) {

				versandkosten = 4.00;
			}


			else {

				versandkosten = 2.30;
			}
		}


		versandkosten_hinweis = "Die Versandkosten betragen " + comma_for_point(versandkosten) + " EUR.";
	}


	document.getElementById("aktuelle_kosten").firstChild.nodeValue = "Aktueller Bestellwert: " + comma_for_point(aktuelle_summe) + " EUR. " + versandkosten_hinweis;
}


function zwischensumme(artikel) {

	var shop_prices = new Array();

	shop_prices[0] = new Object();

	shop_prices[0]["adam_von_fulda"] = 13;
	shop_prices[0]["heinrich_finck"] = 13;
	shop_prices[0]["musik_in_st_michael"] = 15;
	shop_prices[0]["gyri_gyri_gaga"] = 15;
	shop_prices[0]["leonhard_paminger"] = 15;
	shop_prices[0]["t_shirt"] = 12.5;


	var einzelpreis = shop_prices[0][artikel];
	var anzahl = document.forms[0][artikel].value;

	if(anzahl != "") {

		var nur_ziffern = /^\d{1,4}$/;
		var typ_pruefung = nur_ziffern.test(anzahl);


		if(typ_pruefung == true) {

			mengenpreis = einzelpreis * anzahl;

			mengenpreis = mengenpreis.toString();

			var dezimalzahl = mengenpreis.indexOf(".");


			if(dezimalzahl == -1) {

				mengenpreis += ",00";
			}


			else {

				var ganzzahlteil = mengenpreis.substring( 0, dezimalzahl );
				var dezimalteil = mengenpreis.substring( eval(dezimalzahl + 1) );

				mengenpreis = ganzzahlteil + "," + dezimalteil;

				var eine_dezimalstelle = /^\d{1}$/;
				var stellen_pruefung = eine_dezimalstelle.test(dezimalteil);


				if(stellen_pruefung == true) {

					mengenpreis += "0";
				}
			}


			if(mengenpreis != "0,00") {

				var vorkommastellen = mengenpreis.indexOf(",");


				if(vorkommastellen > 3) {

					var tausenderstellen = mengenpreis.substring(0, eval(vorkommastellen - 3) );
					var reststellen = mengenpreis.substring( eval(vorkommastellen - 3) );


					mengenpreis = tausenderstellen + "." + reststellen;
				}


				document.getElementById(artikel).firstChild.nodeValue = "St\u00FCck = " + mengenpreis + " EUR";
				document.getElementById(artikel).style.color = "#ffffff";
			}
		}


		else {

			document.getElementById(artikel).firstChild.nodeValue = "Die Mengenangabe muss als Zahl erfolgen.";
			document.getElementById(artikel).style.color = "#cc9900";
		}


		bestellwert();
	}


	else {

		document.getElementById(artikel).firstChild.nodeValue = "(St\u00FCckpreis: " + comma_for_point(einzelpreis) + " EUR)";
	}
}

