/**
 * @author		Peter Riet
 * @copyright	Copyright (c) Serve it V.O.F. 2008
 * @version		1.0.0
 */
function cBlog() {
	var _self = this;

	this.checkPlaatsReactie = function(frm) {
		var strNaam = frm.txtNaam.value.trim();
		var strReactie = frm.txtReactie.value.trim();
		var intControleX = parseInt($("#spanBlogControle1").text());
		if (isNaN(intControleX)) intControleX = 0;
		var intControleY = parseInt($("#spanBlogControle2").text());
		if (isNaN(intControleY)) intControley = 0;
		var intControle = parseInt(frm.txtControle.value, 10);
		
		if (strNaam.length == 0) {
			alert("Geef uw naam op");
			frm.txtNaam.focus();
			return false;
		}
		else if (strReactie.length == 0) {
			alert("Geef een reactie op");
			frm.txtReactie.focus();
			return false;
		}
		else if (isNaN(intControle) || intControleX + intControleY != intControle) {
			alert("De rekensom is niet goed beantwoord.\n\nTel de twee getallen bij elkaar op.\n\nHint: " + intControleX + " + " + intControleY + " = " + (intControleX + intControleY));
			frm.txtControle.select();
			frm.txtControle.focus();
			return false;
		}
		
		frm.btnSubmit.disabled = true;
		return true;
	}
	
	this.scrollNaarReactie = function(intReactieID) {
		$(window).load(function() {
			scrollNaar("reactie" + intReactieID);
		});
	}
}

var objBlog = new cBlog();
