// JavaScript Document
function CryptMailto() {
	shift = parseInt(document.forms[0].shiftField.value);
	var n=0;
	var r="";
	var s="mailto:"+document.forms[0].emailField.value;
	for(var i=0;i<s.length;i++) { 
		n=s.charCodeAt(i); 
		if (n>=8364) {n = 128;}
		r += String.fromCharCode(n+shift); 
	}
	document.forms[0].cyptedEmailField.value = r;
	document.forms[0].HTMLCyptedEmailField.value = "<a href=\"javascript:linkTo_UnCryptMailto('"+r+"', "+shift+");\">eMail-Link</a>";
}

function UnCryptMailto(s, shift) {
	var n=0;
	var r="";
	for(var i=0;i<s.length;i++) { 
		n=s.charCodeAt(i); 
		if (n>=8364) {n = 128;}
		r += String.fromCharCode(n-(shift)); 
	}
	return r;
}

function linkTo_UnCryptMailto(s, shift)	{
	location.href=UnCryptMailto(s, shift);
}

function openWin(url, w, h) {
	var windowName = "popupDialog";
	var properties = "dependent=yes, status=no, scrollbars=yes, height="+h+", width="+w+", left=0, top=0, location=no";
	popupWindow = window.open(url, windowName, properties);
	popupWindow.focus();
}

function init() {
	var browser=navigator.appName;
	if (browser=="Microsoft Internet Explorer") {
		if (navigator.browserLanguage=="fr") flipIn(2);
		else flipIn(1);
	} else {
		if (navigator.language.indexOf("fr") > -1) flipIn(2);
		else flipIn(1);												   
	}
	changeInterval = setInterval("changeLang()", 3000);
}

function changeLang() {
	divDEU = document.getElementById(1);
	if (divDEU.style.display == "block") {
		flipOut(1);
		flipIn(2);
	} else {
		flipOut(2);
		flipIn(1);
	}
}

function flipIn (id) {
	try {
		clearInterval(delighting);
	} catch(e) {}
	divIN = document.getElementById(id);
	divIN.style.display = "block";
	highlighting = setInterval("highlight(divIN)",35);
}

function flipOut(id) {
	clearInterval(highlighting);
	divOUT = document.getElementById(id);
    //if (divOUT.style.MozOpacity) divOUT.style.MozOpacity = 0;
	//else if (divOUT.filters) divOUT.filters.alpha.opacity = 0;
	delighting = setInterval("delight(divOUT)",35);
}

function highlight(div) {
	if (div.style.MozOpacity < 1) div.style.MozOpacity = parseFloat(div.style.MozOpacity) + 0.05;
	else if (div.filters && div.filters.alpha.opacity < 100) div.filters.alpha.opacity += 5;
	else if (window.highlighting) clearInterval(highlighting);
}

function delight(div) {
	if (div.style.MozOpacity > 0) div.style.MozOpacity = parseFloat(div.style.MozOpacity) - 0.05;
	else if (div.filters && div.filters.alpha.opacity > 0) div.filters.alpha.opacity -= 5;
	else if (window.delighting) {
			clearInterval(delighting);
			div.style.display = "none";
	}
}