// $Id: cmscheckup.js,v 1.1 2005/01/10 19:42:17 barryh Exp $
// $Source: /usr/local/cvsroot/projects/cs/vioma/content/CS/scripts/cmscheckup.js,v $
function getTotal(form) {
	var el;
	clearDiag();

	//calculate! calculate!
	var total = 0;
	var max = form.box.length;
	for (var i = 0; i < max; i++) {
		if (document.cmschecklist.box[i].checked == true) {
			total++;
		}
	}

	//now display the diagnosis
	if (total >= 0 && total < max/4) {
		el = document.getElementById('1problem');
	} else if (total >= max/4 && total < max/2) {
		el = document.getElementById('2problem');
	} else if (total >= max/2 && total < 3*max/4) {
		el = document.getElementById('3problem');
	} else if (total >= 3*max/4 && total <= max) {
		el = document.getElementById('4problem');
	}

	var num = document.getElementById(total + 'check');
	el.style.display = 'block';
	num.style.display = 'block';
}

function clearDiag() {
	var el;

	//clear old diagnosis
	for (var i = 0; i <= 15; i++) {
		el = document.getElementById(i + 'check');
		el.style.display = 'none';
	}

	for (var i = 1; i <= 4; i++) {
		el = document.getElementById(i + 'problem');
		el.style.display = 'none';
	}
}

function writeChecks(num) {
	document.writeln('<div id="Dbox" class="cmsQuiz">');
	for (var i = 0; i <= num; i++) {
		document.writeln('<div class="cmsQuizTop" id=' + i + 'check style="display:none;">');
		document.writeln('Diagnosis:');
		if (i == 0) {
			document.writeln('You have none of the symptoms.</div>');
		} else if (i == num) {
			document.writeln('You have ALL of the symptoms!</div>');
		} else {
			document.writeln('You have ' + i + ' of the symptoms.</div>');
		}
	}

	document.writeln('<div class="cmsQuizBot" id="1problem" style="display:none;">Congratulations! You appear to be effectively managing your online content.</div>');
	document.writeln('<div class="cmsQuizBot" id="2problem" style="display:none;">Your content management system could use some work. You could probably benefit from using VIOMA Content Manager to aid in content contribution, workflow processes, versioning, and other features you may not have already.</div>');
	document.writeln('<div class="cmsQuizBot" id="3problem" style="display:none;">You have a real content management problem. Start evaluating your current system.</div>');
	document.writeln('<div class="cmsQuizBot" id="4problem" style="display:none;">Your business is really suffering from a content management problem.  If e-commerce is important to you, it is vital to act quickly.</div>');
	document.writeln('</div>');
}
