function getXmlData(file)
{
	if (file != "")
	{
		try
		{
			xmlhttp = new XMLHttpRequest();
		}
		catch (e)
		{
			try
			{
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e)
			{
				/* wahrscheinlich IE mit aktivem Scripting, aber ohne ActiveX-Controls */
				 document.frmLogin.submit();
				/* alert("Dienst nicht verfuegbar"); */
				/* return false; */
				return true;
			}
		}
		xmlhttp.onreadystatechange = handleHttpState;
		xmlhttp.open("GET", file);
		xmlhttp.send(null);
	}
}

function handleHttpState()
{
	if (xmlhttp.readyState == 4)
	{
		if (xmlhttp.status == 200)
		{
			parseData();
		}
		else
		{
			Dialog.alert("<div style='padding:10px'>Login nicht m&ouml;glich, Status: " + xmlhttp.status + ". Bitte versuchen Sie es erneut oder informieren Sie den Webmaster</div>",
      	 	  {windowParameters: {className: 'pWinLayout', width:250, showEffect: Element.show , hideEffect:Element.hide}, okLabel: "OK",
         	 ok:function(win) {return true;}});
		}
	}
}

function parseData()
{
	var xmlDocument = xmlhttp.responseXML;
	var status = xmlDocument.getElementsByTagName("login")[0].getAttribute("value");
	switch (status)
	{
		case "1": // Login erfolgreich
			//window.location.href=PageHome;
			if (ie)
			{
				try
				{
					window.external.AutoCompleteSaveForm(frmLogin);
				}
				catch(e)
				{
				}
			}
			document.forms.frmLogin.submit();
			break;
			
		case "2": // Falsche Eingabe
			 Dialog.closeInfo();
			 Dialog.alert("<div style='padding: 10px'>Ung&uuml;ltiges Login!<br />&Uuml;berpr&uuml;fen Sie bitte Ihre Zugangsdaten.</div>",
      	 	  {windowParameters: {className: 'pWinLayout', width:250, showEffect: Element.show , hideEffect:Element.hide}, okLabel: "OK",
         	 ok:function(win) {return true;}});
         	 break;
			
		case "3": // leere Felder
			 Dialog.closeInfo();
			 Dialog.alert("<div style='padding: 10px'>Geben Sie bitte Benutzernamen und Kennwort an!</div>",
      	 	  {windowParameters: {className: 'pWinLayout', width:250, showEffect: Element.show , hideEffect:Element.hide}, okLabel: "OK",
         	 ok:function(win) {return true;}});
         	 break;
			
		case "4": // Erstlogin
			if (ie)	window.external.AutoCompleteSaveForm(frmLogin);
			document.forms.frmLogin.submit();
			break;
			
		case "5": // System steht nicht zur Verfuegung
			Dialog.closeInfo();
			Dialog.alert("<div style='padding: 10px'>Aktuell steht Ihnen das Portal nicht zur Verf&uuml;gung. Wir arbeiten daran das Problem zu l&ouml;sen.<br />Sie k&ouml;nnen in K&uuml;rze wieder auf unseren Service zugreifen.</div>",
      	 	  {windowParameters: {className: 'pWinLayout', width:250, showEffect: Element.show , hideEffect:Element.hide}, okLabel: "OK",
         	 ok:function(win) {return true;}});
	}
}

function openLoginCheck(l,p)
{
	loginWait();
	var winUrl = "loginCheckLoginWin.html?login=" + l + "&passwd=" + p;
	getXmlData(winUrl);
	return false;
}

function loginWait()
{
	Dialog.info("<div style='padding: 10px 10px 10px 10px; text-align: center;'>Daten werden gepr&uuml;ft...<br /><img src='/imggen/wait.gif' style='margin-top: 5px;' /></div>", {windowParameters: {className: 'pWinLayout', width:200, height:60, showEffect: Element.show , hideEffect:Element.hide, draggable:false}});
}

m_id = 0;
var maxSlogan = 4;
var aktSlogan = 1;

function openPromoWin()
{
	var winTitle = "";
	var winPromoWin = new Window(m_id++, {className: 'pWinLayout',  width:300, height:428, zIndex: 100, resizable: false, title: winTitle, showEffect: Effect.Appear, hideEffect:Element.hide, draggable:true})
	var out = "<div style='position: relative;width: 292px; height: 424px; background: #5E5F63;color: #FFF000; border: solid 4px #B7BCC3;border-top: none;'><div style='font-size: 12px;padding: 35px 0 30px 20px;'><div style='height: 160px; position:relative;'>";
	out += "<p id='slogan1' style='position: absolute; top: 10px;font-size: 16px; font-weight: bold;'>Wir stellen unsere Produkte<br />nicht nur aus Tradition in<br />Deutschland her.<br /><br />Sondern weil es sich lohnt.</p>";
	out += "<p id='slogan2' style='display: none;position: absolute; top: 10px;font-size: 16px; font-weight: bold;'>Das Internet<br />macht die Preise transparent<br />und kaputt!</p>";
	out += "<p id='slogan3' style='display: none;position: absolute; top: 10px;font-size: 16px; font-weight: bold;'>Es gibt viele Vertriebswege<br />f&uuml;r Badprodukte.<br /><br />F&uuml;r uns kommt nur einer in Frage.</p>";
	out += "<p id='slogan4' style='display: none;position: absolute; top: 10px;font-size: 16px; font-weight: bold;'>Fachhandel und Fachhandwerk <br />sind wie wertvolle Originale.<br /><br />Bis sie F&auml;lschungen<br />anbieten.</p>";
	out += "</div><p style='font-weight: bold;'>Was denken Sie?</p><p>Wir m&ouml;chten Ihre Sicht der Dinge kennenlernen.<br />Der Login bietet Ihnen die M&ouml;glichkeit, an unseren aktuellen Diskussionen teilzunehmen.</p></div><img src='images/logoClaimGelb.gif' width='119' height='43' style='position: absolute; right: 0; bottom: 55px;'></div>";

	winPromoWin.getContent().innerHTML= out;
	winPromoWin.showCenter(false, 19, 593);

	var interval = setInterval(sloganFadeInOut, 5000);
}

function sloganFadeInOut()
{
	objAktSlogan = document.getElementById("slogan" + aktSlogan);
	nextIdx = (aktSlogan == maxSlogan)? 1 : aktSlogan+1;
	objNextSlogan = document.getElementById("slogan" + nextIdx);
	aktSlogan = nextIdx;

	Effect.Fade(objAktSlogan);
	Effect.Appear(objNextSlogan);
}

function openLoginKennwort()
{
	if (document.getElementById)
	{
		var winUrl = "loginKennwort.html";
		var winTitle = "";
		var winLoginKennwort = new Window(m_id++, {className: 'pWinLayout',  width:650, height:250, zIndex: 100, resizable: true, title: winTitle, showEffect: Element.show , hideEffect:Element.hide, draggable:true, url: winUrl})
		winLoginKennwort.showCenter("modal");
		return false;
	}
	else
	{
		return true;
	}
}

function Go()
{
	if(lbFlagGo)
	{
		setTimeout(openPromoWin,3000);
	}
}

function fInit()
{
	var e = document.getElementById('passwd');
	if (e && e.value != '')
	{
		e.focus();
		e.select();
	}
	else
	{
		var e = document.getElementById('login');
		if (e)
		{
			e.focus();
			e.select();
		}
	}
}

window.onload = fInit;
