
function DoRefSearch(act) {
	var loc = location.pathname;
	if (act=='none') {
		location.href = loc+"?filtergroup=alle";
	} else {
		location.href = loc+"?filtergroup="+document.getElementById("filtergroup").value+"&filterword="+document.getElementById("filterword").value;
	}
}

function DontPost(buttonName) {    
	if (event.keyCode == 13) {
		event.cancelBubble = true;
		event.returnValue = false;
	}
}

function NewsSubscribe(r, act, o) {
	var isValid = true;
	var oe = o.elements;
	HideError("1");
	HideError("2");
	HideError("3");
	var sList = GetSelectedRDvalue("rdbListe", o);
	if (oe["1"].value=="") {ShowError("1");isValid = false;}
	if (!isValidEmail(oe["2"].value)) {ShowError("2");isValid = false;}
	if (sList=="" && act=="subscribe") {ShowError("3");isValid = false;}
	if (isValid) {
		//alert("/Forms/newsletter.aspx?1="+oe["1"].value+"&2="+oe["2"].value+"&3="+oe["3"].value+"&4="+oe["4"].value+"&sli="+sList+"&act="+act+"&r="+r);
		location.href = "/Forms/newsletter.aspx?1="+oe["1"].value+"&2="+oe["2"].value+"&3="+oe["3"].value+"&4="+oe["4"].value+"&sli="+sList+"&act="+act+"&r="+r;
		return true;
	}
	return false;
}

function ContactRequest(r,o) {
	var isValid = true;
	var oe = o.elements;
	HideError("1");
	HideError("2");
	HideError("3");
	HideError("4");
	HideError("5");
	if (oe["subject"].value=="") {ShowError("1");isValid = false;}
	if (oe["firstname"].value=="") {ShowError("2");isValid = false;}
	if (oe["lastname"].value=="") {ShowError("3");isValid = false;}
	if (oe["email"].value=="" && oe["phone"].value=="") {
		ShowError("4");
		ShowError("5");
		isValid = false;
	}
	if (!oe["email"].value=="" && !isValidEmail(oe["email"].value)) {
		ShowError("4");
		isValid = false;
	}
	if (isValid) {
		o.action = "/Forms/ContactPost.aspx";
		o.submit();
		return true;
	}
	return false;
}


/*
function NewsSubscribe(r, act, o) {
	var isValid = true;
	var oe = o.elements;
	HideError("1");
	HideError("2");
	if (oe["1"].value=="") {ShowError("1");isValid = false;}
	if (!isValidEmail(oe["2"].value)) {ShowError("2");isValid = false;}
	if (isValid) {
		location.href = "/Forms/newsletter.aspx?1="+oe["1"].value+"&2="+oe["2"].value+"&3="+oe["3"].value+"&4="+oe["4"].value+"&5="+oe["5"].value+"&6="+oe["6"].value+"&7="+oe["7"].value+"&act="+act+"&r="+r;
		return true;
	}
	return false;
}
*/

function ForumPost(r, act, o) {
	var isValid = true;
	var sFormTarget = "/Forms/ForumPost.aspx";
	var frm = document.forms(0);
	frm.action = sFormTarget;
	var oe = o.elements;
	HideError2(oe["author"]);
	HideError2(oe["title"]);
	HideError2(oe["text"]);
	if (oe["author"].value=="") {ShowError2(oe["author"]);isValid = false;}
	if (oe["title"].value=="") {ShowError2(oe["title"]);isValid = false;}
	if (oe["text"].value=="") {ShowError2(oe["text"]);isValid = false;}
	if (isValid) {
		o.submit();
		return true;
	}
	return false;
}

function ShowError2(elem) {
	elem.style.border = "1px solid #FF0000";
	elem.style.backgroundColor = "#F2F2F2";
}

function HideError2(elem) {
	elem.style.border = "1px solid #7AB2CC";
	elem.style.backgroundColor = "#FFFFFF";
}

function ShowError(oID) {
	document.getElementById("error"+oID).style.display = "inline";
}

function HideError(oID) {
	document.getElementById("error"+oID).style.display = "none";
}

function isValidEmail(emailAddress) {
	var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
	return re.test(emailAddress);
}


function DoSearch(itemid) {
	location.href = "/?path="+itemid+"&search="+document.getElementById("searchfield").value;
}

function PostSearch(buttonName) {    
	if (event.keyCode == 13) {        
		event.cancelBubble = true;
		event.returnValue = false;
		var button = document.getElementById(buttonName);
		if (button != null) {
			button.click(); 
		}
	}
}

function DoPrint() {
	var loc = location.href;
	var pri = "?print=1";
	if (loc.indexOf("?")>0) {
		pri = "&print=1";
	}
	window.open(loc+pri, "", "toolbar=1,location=0,directories=0,status=0,menubar=yes,scrollbars=yes,resizable=yes,width=769,height=400");
}

function PrepPrint() {
	for (i=0; i<document.body.all.tags("A").length; i++) {
		document.body.all.tags("A")[i].href = 'JavaScript:void(0)';
		document.body.all.tags("A")[i].target = '';
	}
	for (i=0; i<document.body.all.length; i++) {
		document.body.all[i].setAttribute('onclick','');
	}
	window.print();
}


function GetSelectedRDvalue(n, f) {
	var oe = f.elements;
	for (i=0; i<oe.length; i++) {
		if (oe[i].name==n) {
			if (oe[i].checked) {
				return oe[i].value;
			}
		}
	}
	return "";
}