function showPopup(popupname) {
	var width = 469;
	switch(popupname) {
		case "code":
			var height = 450;
			break;
		case "umfrage":
			var height = 510;
			break;
		case "unilever":
			var height = 400;
			width = 460;
			break;
		case "impressum":
			var height = 635,
			    width = width+40;
			break;
		case "datenschutz":
			var height = 610,
			    width = width+40;
			break;
		case "nutzungsbedingungen":
			var height = 610,
			    width = width+40;
			break;
		case "suche":
			var height = 600;
			break;
		/*case "wiesenhof_teilnahmebedingungen":
			var height = 480;
			break;*/
		case "datenschutzmail":
			var height = 380;
			break;
		case "gewinnspiel_teilnahmebedingungen":
		    var height = 600;
			break;
		case "tefal_teilnahmebedingungen":
			var height = 420;
			break;
		// Standardgröße
		default:
			var height = 500;
		    break;
	}
	popup = window.open("/at/"+popupname + ".asp", popupname, "width=" + width + ",height=" + height + ",scrollbars=yes,resizeable=yes");
	popup.focus();
}

function showPopupbelowpath(popupname) {
	var width = 469;
	switch(popupname) {
		case "code":
			var height = 450;
			break;
		case "umfrage":
			var height = 510;
			break;
		case "unilever":
			var height = 319;
			width = 370;
			break;
		case "impressum":
			var height = 635;
			break;
		case "datenschutz":
			var height = 610;
			break;
		case "suche":
			var height = 600;
			break;
		/*case "wiesenhof_teilnahmebedingungen":
			var height = 480;
			break;*/
		case "datenschutzmail":
			var height = 380;
			break;
		case "mitpfannizumammi_teilnahmebedingungen":
		    var height = 600;
			break;
		case "tefal_teilnahmebedingungen":
			var height = 420;
			break;
		// Standardgröße
		default:
			var height = 500;
		    break;
	}
	popup = window.open("../"+popupname + ".asp", popupname, "width=" + width + ",height=" + height + ",scrollbars=yes,resizeable=yes");
	popup.focus();
}


function executeShowPopup(popupname, url, width, height) {
	popup = window.open(url, popupname, "width=" + width + ",height=" + height + ",scrollbars=no,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>');
}
function writeDecryptedEmail(s) {
	document.write(decryptString(s, -2));
}
function setGwInformationOption(target){
	if(target=="nurgw"){
		document.getElementById("peremail").checked = false;
		document.getElementById("perpost").checked = false;
		document.getElementById("nurgw").checked = true;
	} else {
		document.getElementById("nurgw").checked = false;
	}
}


function openWindow(URL,b,h,popupname,scrollbars)
{
 var PopUpName = popupname || 'PopUp';
 var breite = b || 410;
 var hoehe = h || 450;
 var ScrollBars = scrollbars || 'no';
 var xPos = (screen.availWidth - breite) / 2;
 var yPos = (screen.availHeight - hoehe ) / 2;
 var fenster = window.open(URL,PopUpName,'width='+breite+',height='+hoehe+',scrollbars='+ScrollBars+',toolbar=no,menubar=no,screenX='+xPos+',screenY='+yPos+',left='+xPos+',top='+yPos);
 if(fenster)
 fenster.focus();
}
