function makeP ( text ) {
	var pElem, textNode;

	pElem = document.createElement("P");
	textNode = document.createTextNode(text);

	pElem.appendChild ( textNode );

	return pElem;
	}

function makeClassedP ( className, text ) {
	var pElem, textNode;

	pElem = document.createElement("P");
	textNode = document.createTextNode(text);

	pElem.appendChild ( textNode );
	pElem.className = className;

	return pElem;

	}

function outText ( text ) {
	document.getElementById("output").appendChild( makeP(text) );
	}

function outTaggedText ( className, text ) {
	document.getElementById("output").appendChild( makeClassedP( className, text) );
	}

function writeResult( text, passed ) {
	if (passed) {
		outTaggedText ( "pass", text );
		}
	else {
		outTaggedText ( "fail", text );
		}
	}

function shouldBe ( atext, aval, btext, bval ) {
	if (aval == bval) {
		outTaggedText ( "pass", "Correct:  " + atext + " is " + btext + "." );
		}
	else {
		outTaggedText ( "fail", "Incorrect:  " + atext + " is not " + btext + ", but it should be.  Instead, it is " + aval + "." );
		}
	}

function shouldBeCI ( atext, aval, btext, bval ) {
	// If case insensitive
	if (aval.toString().toLowerCase() == bval.toString().toLowerCase()) {
		outTaggedText ( "pass", "Correct:  " + atext + " is " + btext + "." );
	} else {
		outTaggedText ( "fail", "Incorrect:  " + atext + " is not " + btext + ", but it should be.  Instead, it is " + aval + "." );
	}
}

function shouldBeCQ ( atext, aval, btext, bval ) {
	// If case sensitivity is questionable
	if (aval == bval) {
		outTaggedText ( "pass", "Correct:  " + atext + " is " + btext + "." );
	} else {
		if (aval.toString().toLowerCase() == bval.toString().toLowerCase()) {
			outTaggedText ( "maybe", "Maybe:  " + atext + " is not " + btext + ", but it should be.  Instead, it is " + aval + "." );
		} else {
			outTaggedText ( "fail", "Incorrect:  " + atext + " is not " + btext + ", but it should be.  Instead, it is " + aval + "." );
		}
	}
}

function shouldNotBe ( atext, aval, btext, bval ) {
	if (aval == bval) {
		outTaggedText ( "fail", "Incorrect-N:  " + atext + " is " + btext + ", but it should not be." );
		}
	else {
		outTaggedText ( "pass", "Correct-N:  " + atext + " is not " + btext + ", but rather " + aval + "." );
		}
	}

function shouldNotBeCI ( atext, aval, btext, bval ) {
	// If case insensitive
	if (aval.toString().toLowerCase() == bval.toString().toLowerCase()) {
		outTaggedText ( "fail", "Incorrect-N:  " + atext + " is " + btext + ", but it should not be." );
	} else {
		outTaggedText ( "pass", "Correct-N:  " + atext + " is not " + btext + ", but rather " + aval + "." );
	}
}

function shouldNotBeCQ ( atext, aval, btext, bval ) {
	// If case sensitivity is questionable
	if (aval == bval) {
		outTaggedText ( "fail", "Incorrect-N:  " + atext + " is " + btext + ", but it should not be." );
	} else {
		if (aval.toString().toLowerCase() == bval.toString().toLowerCase()) {
			outTaggedText ( "maybe", "Maybe:  " + atext + " is not " + btext + ", but it only a difference in case.  Instead, it is " + aval + "." );
		} else {
			outTaggedText ( "pass", "Correct-N:  " + atext + " is not " + btext + ", but rather " + aval + "." );
		}
	}
}


