function checkReason()	{
	var isComplaint = get("contactReason").checked;
	if (isComplaint)	{
		show("anonymousOptions");
	} else {
		hide("anonymousOptions");
		
		/**
		 * This is important for re-displaying a former anonymous form
		 */
		if (get('contactAnonymous').checked)	{
			get('contactAnonymous2').checked = true;
			checkReason(); checkAnonymous();
		}
	}
}

function checkAnonymous()	{
	var isAnonymous = get("contactAnonymous").checked;
	if (isAnonymous)	{
		hide([
			get("nawData"),
			get("replyOptions")
		]);
		show("anonymousNote");
	} else {
		show([
			get("nawData"),
			get("replyOptions")
		]);
		hide("anonymousNote");
	}
}

if (typeof window.onload != "function"){
	window.onload = (function(){try{
		get('contactVia').checked = true;
		get('contactAnonymous2').checked = true;
		get('contactReason2').checked = true;
		checkReason();
		checkAnonymous();
	}catch(e){return true;}});
}

function get( id )	{
	return document.getElementById( id );
}

function hide( obj )	{
	if (typeof obj == "string") obj = get(obj);
	if (typeof obj[0] == "object") {
		for (i=0;i<obj.length;i++) hide(obj[i]);
		return false;
	}
	return obj.style.display = "none";
}

function show( obj )	{
	if (typeof obj == "string") obj = get(obj);
	if (typeof obj[0] == "object") {
		for (i=0;i<obj.length;i++) show(obj[i]);
		return false;
	}
	return obj.style.display = "block";
}