//document.write("TEST TEST TEST<br><br>");

function Article( inTitle, inSummary, inURL )
{
	this.title = inTitle;
	this.summary = inSummary;
	this.url = inURL;
}

var aryArticles = new Array();
var ai = 0;

aryArticles[ai++] = new Article("The Love of Beauty", "Within me is the longing for beauty, and the repulsion of non-beauty. I am convinced that I have the normal longings of all of us. We are made for beauty.","beauty.asp");
aryArticles[ai++] = new Article("Cease and Desist", "You cannot come rebelliously to God.", "cease.asp");
aryArticles[ai++] = new Article("Choose Your God", "But to come to Christ while loving and cherishing sin is totally impossible. It is like an airplane trying to fly in two directions!", "choose.asp");
aryArticles[ai++] = new Article("Knowing You're In", "Doubts never send anyone to hell, but deception always does.", "knowing.asp");
aryArticles[ai++] = new Article("Gospel Equals Power", "Becoming a Christian is not just pumping a little religion into your life so that you feel a \"lift\" when you are emotionally low.", "power.asp");
aryArticles[ai++] = new Article("A Thief in the Night", "We don't know the date or the times when destruction will come-we only know that it is destined to happen, and suddenly.", "thief.asp");
aryArticles[ai++] = new Article("Trying to Be a Christian", "Trying to be a Christian is an insult to God and is a way of despising what Christ has done on the cross.", "trying.asp");
aryArticles[ai++] = new Article("Is God Angry?", "Sometimes we think of God as a judge sitting on the bench who passively issues sentences to guilty persons. But is God like this?", "angry.asp");
aryArticles[ai++] = new Article("So What's the Problem?", "You may not feel your problem right now. A man may be condemned as guilty and yet not feel guilty, just as a person might have cancer and not feel it or even know it.", "problem.asp");
aryArticles[ai++] = new Article("You Don't Look So Good", "You're not righteous. Jesus once called some of the most religious people of His day, \"white-washed tombs filled with dead men's bones\"-not very flattering, but perfectly accurate from the Holy One's perspective.", "sogood.asp");
aryArticles[ai++] = new Article("Sooner Than You Think", "When Dale Earnhart made his last turn around the Daytona 500, did he know what was coming? Will you?", "sooner.asp");
aryArticles[ai++] = new Article("The Way to God", "There are important facts you must believe about Christ, that is true, but ultimately you must put your faith in the person Himself. He is the way and nobody, including you, will get to the Father but through Him.", "way.asp");
aryArticles[ai++] = new Article("The Most Important Thing", "This is a question worth thinking about, because finding out what is important in the end will, or at least should, tell you what is important now.", "themost.asp");
//document.write("TEST: " + aryArticles.length + "<br><br>");


function GetAllArticles()
{
	return aryArticles;
}


function GetRandomArticle()
{
	//var tmpArray = new Array();
	//var tmpi = 0;

	aryArticles.sort(function() {return 0.5 - Math.random()}) //Array elements now scrambled

	return aryArticles[0];
}

function PopulateRandomArticle()
{
	var raDiv = document.getElementById("randomArticle");

	var rbd = GetRandomArticle();

	var tmpStr = "<span class=\"subHeading\">" + rbd.title + "</span>";
	//var tmpStr = "<p><strong>" + rbd.title + "</strong></p>";
	tmpStr += "<p>" + rbd.summary + "</p>";
	tmpStr += "<p><a href=\"" + rbd.url + "\">Read the rest of this article</a> &nbsp; | &nbsp; <a href=\"javascript:PopulateRandomArticle()\">Read another</a></p>";

	raDiv.innerHTML = tmpStr;
}

