function showPopup(popupname) {
	var website;
	var width = 403;
	switch(popupname) {
		case "impressum":
			var height = 630;
			var width = 520;
			website = popupname;
			break;
		case "kontakt":
			var height = 630;
			var width = 520;
			website = popupname;
			break;
		case "datenschutz":
			var height = 630;
			var width = 600;
			website = "siteutilities/"+popupname+"/index";
			break;
		case "nutritive_value_roll":
			var height = 548;
			var width = 423;
			website = popupname;
			break;
		case "nutritive_value_roll_xxl":
			var height = 548;
			var width = 423;
			website = popupname;
			break;
		case "nutritive_value_roll_korn":
			var height = 548;
			var width = 423;
			website = popupname;
			break;
		case "nutritive_value_carazza":
			var height = 548;
			var width = 423;
			website = popupname;
		case "nutritive_value_hot_peperoni":
			var height = 548;
			var width = 423;
			website = popupname;
			break;
		case "nutritive_value_roll_peperoni":
			var height = 548;
			var width = 423;
			website = popupname;
			break;
		case "nutritive_value_balls":
			var height = 548;
			var width = 423;
			website = popupname;
			break;
		// Standardgröße
		default:
			var height = 548;
			website = popupname;
		  break;
	}
	popup = window.open("/int/at/" + website + ".asp", popupname, "width=" + width + ",height=" + height + ",scrollbars=yes,resizeable=yes");
	popup.focus();
}

function executeShowPopup(popupname, url, width, height) {
	popup = window.open("/int/at/" + url, popupname, "width=" + width + ",height=" + height + ",scrollbars=yes,resizeable=yes");
	popup.focus();
}

function openInParent(url) {
	window.opener.location.href = url;
	window.close();
}

function setblurtoallas() {
    if(document.getElementsByTagName) {
        as = document.getElementsByTagName("a");
        l = as.length;
        for(i=0; i < l; i++) {
            as[i].onfocus = _blur;
        }
    }
}

function _blur() {
    this.blur();
}

function followLink(url, openNewWindow) {
	if(navigator.appName.indexOf("Explorer") == -1) {
		return;
	}
	if(openNewWindow) {
		window.open(url);
	} else {
		location.href = url;;
	}
}

function decryptCharcode(n, start, end, offset) {
	n = n + offset;
	if (offset > 0 && n > end)	{
		n = start + (n - end - 1);
	} else if (offset < 0 && n < start)	{
		n = end - (start - n - 1);
	}
	return String.fromCharCode(n);
}
	
function decryptString(enc, offset) {
	var dec = "";
	var len = enc.length;
	for(var i=0; i < len; i++)	{
		var n = enc.charCodeAt(i);
		if (n >= 0x2B && n <= 0x39)	{
			dec += decryptCharcode(n, 0x2B, 0x3A, offset);	// 0-9 . , - + / :
		} else if (n >= 0x40 && n <= 0x5A)	{
			dec += decryptCharcode(n, 0x40, 0x5A, offset);	// A-Z @
		} else if (n >= 0x61 && n <= 0x7A)	{
			dec += decryptCharcode(n, 0x61, 0x7A, offset);	// a-z
		} else {
			dec += enc.charAt(i);
		}
	}
	return dec;
}

function writeDecryptedLink(s) {
	//document.write('<a href="mailto:' + decryptString(s, -2) + '" class="hyperlink">' + decryptString(s, -2) + '</a>');
	document.write(decryptString(s, -2));
}

function showDatenschutzQuestion(q) {
	for (var i = 1; i <= 10; ++i) {
		document.getElementById('q' + i).style.visibility = "hidden";
	}
	document.getElementById('q' + q).style.visibility = "visible";
}
