//use browser sniffing to determine if IE or Opera (ugly, but required)
var isOpera, isIE = false;
if(typeof(window.opera) != 'undefined')	{isOpera = true;}
if(!isOpera && navigator.userAgent.indexOf('Internet Explorer')){isIE = true;}
//fix both IE and Opera (adjust when they implement this method properly)
if(isOpera || isIE) {
	document.nativeGetElementById = document.getElementById;
	//redefine it!
	document.getElementById = function(id) {
		var elem = document.nativeGetElementById(id);
		if(elem){
		//verify it is a valid match!
			if(elem.attributes['id'] && elem.attributes['id'].value == id){
				//valid match!
				return elem;
				} else {
					//not a valid match!
					//the non-standard, document.all array has keys for all name'd, and id'd elements
					//start at one, because we know the first match, is wrong!
					for(var i=1;i<document.all[id].length;i++){
						if(document.all[id][i].attributes['id'] && document.all[id][i].attributes['id'].value == id){
							return document.all[id][i];
						}
					}
				}
			}
		return null;
	};
}


var aFake = "GOD";
var bFake = "hell";
var cFake = "higher";
var dFake = "trust";
var zzFake = "IN";
var zFake = "POWERS";
var fakeAnswer = bFake+aFake+dFake+zzFake+cFake+zFake;
var fakeQuestion = "-666";

if (document.getElementById) {
	// check if IDs are set properly
	if ( document.getElementById("AntiSpamProtection")
	     && document.getElementById("FormVerificationAnswer")
	     && document.getElementById("FormVerificationQuestion")
		 ) {
		// change Question ID
		document.getElementById("FormVerificationQuestion").value = fakeQuestion;
		// insert the fake answer
		document.getElementById("FormVerificationAnswer").value = fakeAnswer;
		// hide the question field
		document.getElementById("AntiSpamProtection").style.display = "none";
	}
}


if (document.getElementById) {
	// check if IDs are set properly
	if ( document.getElementById("AntiSpamProtectionSBMail")
	     && document.getElementById("FormVerificationQuestionSBMail")
	     && document.getElementById("FormVerificationAnswerSBMail")
		 ) {
		// change Question ID
		document.getElementById("FormVerificationQuestionSBMail").value = fakeQuestion;
		// insert the fake answer
		document.getElementById("FormVerificationAnswerSBMail").value = fakeAnswer;
		// hide the question field
		document.getElementById("AntiSpamProtectionSBMail").style.display = "none";
	}
}

if (document.getElementById) {
	// check if IDs are set properly
	if ( document.getElementById("AntiSpamProtectionRating")
	     && document.getElementById("FormVerificationQuestionRating")
	     && document.getElementById("FormVerificationAnswerRating")
		 ) {
		// change Question ID
		document.getElementById("FormVerificationQuestionRating").value = fakeQuestion;
		// insert the fake answer
		document.getElementById("FormVerificationAnswerRating").value = fakeAnswer;
		// hide the question field
		document.getElementById("AntiSpamProtectionRating").style.display = "none";
	}
}
