	var position;
	var next;
	var prev;
	
	function loadHomeRotator() {
		document.getElementById("rotatorImg").src = 'images/articles/' + images[0];
		document.getElementById("homeRotatorTitleText").innerHTML = '<a href="article.php?id=' + id[0] + '">' + titles[0] + '</a>';
		document.getElementById("homeRotatorSubBarText").innerHTML = subtitles[0];
		document.getElementById("homeRotatorSubBarWhat").innerHTML = '1 of ' + length;
		document.getElementById("homeRotatorSelector").innerHTML = '<a href="javascript:rotateHomeRotator(1);"><img src="images/rightarrow.jpg" /></a> <a href="article.php?id=' + id[0] + '">view</a> <a href="javascript:rotateHomeRotator(' + (length-1) + ');"><img src="images/leftarrow.jpg" /></a>';
	}
	
	function rotateHomeRotator(which) {
		document.getElementById("rotatorImg").src = 'images/articles/' + images[which];
		document.getElementById("homeRotatorTitleText").innerHTML = '<a href="article.php?id=' + id[which] + '">' + titles[which] + '</a>';
		document.getElementById("homeRotatorSubBarText").innerHTML = subtitles[which];
		if(which == apl) {
			prev = which - 1;
			next = 0;
		} else if (which == 0) {
			prev = apl;
			next = 1;
		} else {
			prev = which - 1;
			next = which + 1;
		}

		document.getElementById("homeRotatorSubBarWhat").innerHTML = (which + 1) + ' of ' + length;
		document.getElementById("homeRotatorSelector").innerHTML = '<a href="javascript:rotateHomeRotator(' + next + ');"><img src="images/rightarrow.jpg" /></a> <a href="article.php?id=' + id[which] + '">view</a> <a href="javascript:rotateHomeRotator(' + prev + ');"><img src="images/leftarrow.jpg" /></a>';
	}

function ajax() {
	var ro;
	var browser = navigator.appName;
	if(browser == "Microsoft Internet Explorer"){
		ro = new ActiveXObject("Microsoft.XMLHTTP");
	}else{
		ro = new XMLHttpRequest();
	}
	return ro;
}

function addComment() {			
	var recaptcha_response_field = document.getElementById("recaptcha_response_field").value;
	var recaptcha_challenge_field = document.getElementById("recaptcha_challenge_field").value;
	
	var name = document.commentsForm.name.value;
	var comments = document.commentsForm.comments.value;
	comments = comments.replace("/n","<br>");
	var articleID = document.commentsForm.articleID.value;
	
	var ajx = new ajax;
	ajx.open('get', 'script/ajax.php?action=checkCaptcha&recaptcha_response_field=' + recaptcha_response_field + '&recaptcha_challenge_field=' + recaptcha_challenge_field, true);
    ajx.onreadystatechange = function() {
		if(ajx.readyState == 4){
			response = ajx.responseText.split('|');
			if(response[0] == 'good') {
				document.commentsForm.recCheck.value = response[1];
				document.commentsForm.submit();
			} else {
				alert("Your reCaptcha is incorrect.\nPlease enter the distorted words you see into the box.");	
			}
		}
	}
    ajx.send(null);	
}