// JScript-Datei
function toggleMain(obj)
{
    lfo         = obj.firstChild;
    lfo_class   = lfo.style.background;
    test        = lfo_class.indexOf("_hi");
    //alert(lfo_class);
    if (test == -1) {
        lfo.style.background = "url(http://www.stgallenkirch.at/Design/images/mainNav_hileft_gold.gif)";
        lfo.style.backgroundrepeat = "no-repeat";
        rfo = lfo.nextSibling;
        rfo = rfo.nextSibling;
        rfo.style.background = "url(http://www.stgallenkirch.at/Design/images/mainNav_hiright_gold.gif)";
        rfo.style.backgroundrepeat = "no-repeat";
    } else {
        lfo.style.background = "url(http://www.stgallenkirch.at/Design/images/mainNav_loleft_gold.gif)";
        lfo.style.backgroundrepeat = "no-repeat";
        rfo = lfo.nextSibling;
        rfo = rfo.nextSibling;
        rfo.style.background = "url(http://www.stgallenkirch.at/Design/images/mainNav_loright_gold.gif)";
        rfo.style.backgroundrepeat = "no-repeat";
    }
}

function setBackground(pid) {
	if (document.getElementById("channel_Image")) {
		bgimage = "url(http://www.stgallenkirch.at/userfiles/channelimages/channel" + document.getElementById("channel_Image").value + ".jpg)";
		document.getElementById("sitewrapper").style.backgroundImage = bgimage;
		return(true);
	}
    if (pid != 294) {
		idx = GetIndexByID(pid);
		if (Items[idx]) {
			ImageIndex = Items[idx].xPos;
			bgimage = "url(http://www.stgallenkirch.at/userfiles/channelimages/channel" + ImageIndex + ".jpg)";
			document.getElementById("sitewrapper").style.backgroundImage = bgimage;
		}
    }
}

function GetIndexByID(ID)
{
	for (n = 0; n <= sumItems - 1; n++)
	{
		link = Items[n].ItemLink;
		var linkPID = link.split("=");
		pageID = linkPID[2];
		if (pageID == parseInt(ID)) {
			return n;
		}
	}
	return -1;
}
function submitNLForm2(lang) {
	//alert("check");
	
	var ajaxform=$('captcha').request({ onSuccess: function(response) { 
		resp = response.responseText;
		
		if (resp == "OK") {
			
			email = document.getElementById('email-addr').value;
			status1 = "checked";
			//document.NLForm.submit();
			email = email.replace(/@/g, "~");

			url = "/captcha/preregister.pl?email=" + email + "&lang=" + lang;
			
			new Ajax.Request(url, {
				method: 'get',
				onSuccess: function(transport) {
					
				switch (lang) {
					case "198":
						response_Text="<p style='padding-left:10px; padding-top:10px; color:#000;'><b>Vielen Dank!</b><br><br>Sie bekommen in Kürze eine EMail mit dem Bestätigungslink zugesendet.</p>";
						break;
					case "199":
						response_Text="<p style='padding-left:10px; padding-top:10px; color:#000;'><b>Thank You!</b><br><br>You will receive an EMail with your activation code shortly.</p>";
						break;
					case "200":
						response_Text="<p style='padding-left:10px; padding-top:10px; color:#000;'><b>Thank You!</b><br><br>You will receive an EMail with your activation code shortly.</p>";
						break;
					case "201":
						response_Text="<p style='padding-left:10px; padding-top:10px; color:#000;'><b>Thank You!</b><br><br>You will receive an EMail with your activation code shortly.</p>";
						break;
					case "201":
						response_Text="<p style='padding-left:10px; padding-top:10px; color:#000;'><b>Thank You!</b><br><br>You will receive an EMail with your activation code shortly.</p>";
						break;
					default:
						response_Text="<p style='padding-left:10px; padding-top:10px; color:#000;'><b>Thank You!</b><br><br>You will receive an EMail with your activation code shortly.</p>";
						break;
				}
		
					
					
					document.getElementById('captchaform').innerHTML = response_Text;
					
				}
			});

		} else {
			document.getElementById('codefield').value = "falscher Code";
			status1 = "failed";
		}
	
	
	} });
}
