// JavaScript Document
$(document).ready(function(){
var json_articles = { articles: [
	{
		"article_title":"Introduction to Today's Europe: A Guide for Believers [by John W. Rood]",
		"article_link":"articles_europe_1.php",
		"article_description": "My wife, Liliane, and I have been missionaries in Europe for the last twenty years. We pioneered Eternal Word Christian Center in Brussels, Belgium in 1990 and pastor the church still today. Brussels is known as the capital of Europe, being the home of the main European Union institutions. During the last two decades, we have been first-hand witnesses of the rise of the European Union."
	},
	
	{
		"article_title":"Introduction to Today's Europe: A Guide for Believers Part II [by John W. Rood]",
		"article_link":"articles_europe_2.php",
		"article_description": "A magnificent example of understanding, combined with revelation, is found in the prophet Daniel. Daniel, the young Hebrew captive brought to Babylon, is the pivotal prophet that received revelation concerning the end times in the Old Testament."
	},
	
	{
		"article_title":"Introduction to Today's Europe: A Guide for Believers Part III [by John W. Rood]",
		"article_link":"articles_europe_3.php",
		"article_description": "This article covers the structure of the European Union, the main European Union institutions, and the 25 European Commissioners."
	},
	
	{
		"article_title": "Directions in Prayer: Declaring",
		"article_link":"articles_declaring.php",
		"article_description": "If you can flow with the Holy Ghost in prayer, you can flow with the Holy Ghost in a service, in any natural area of your life, in anything that the Lord has told you to do.  It is really the most wonderful training.  This is why the devil gets people not to pray; because if you can flow corporately in a prayer group you can flow with anyone on the earth and the Spirit of God anytime He needs you."
	},

	{
		"article_title": "Suggested Reading on Prayer and Revival",
		"article_link":"articles_prayer_revival.php",
		"article_description":"Lucy's favorite books by various authors to enrich and teach you in your prayer and faith journey."
	},
	
	{
		"article_title": "Suggested Reading on Revival",
		"article_link":"articles_revival.php",
		"article_description":"Lucy's favorite books by various authors to enrich and teach you about revival."
	},
	
	{
		"article_title": "Scriptures on Answered Prayer",
		"article_link":"articles_answered_prayer.php",
		"article_description":"Learn from the Word of God with this extensive list about prayer."
	}]
};

function generateDiv(p_cols, p_jsonObject, p_style) {
	var i;
	var numOfCols = p_cols;
	var jObject = p_jsonObject;
	var divStyle = p_style;
	var articleInfo = "";
	//var numOfCols = 4;
	//for(i=1;i<json_images.length;i++) {
	var numElements = jObject.articles.length;
	
	for(i=0;i<numElements;i++) {
		//alert(json_images.image[i].article_title);
		articleInfo += "<div class='" + divStyle + "'>";
		articleInfo += "<a href='" + jObject.articles[i].article_link + "'><h3>" + jObject.articles[i].article_title + "</a>&raquo;</h3>";
		articleInfo += "<p class='description'>" + jObject.articles[i].article_description + "</p>";
		//document.write(featureInfo);
		$("#articles").html(articleInfo);
		//create divs using document.write or something similar
		if ((i+1)% numOfCols == 0) { //modulus 
			articleInfo += "<div class='clear-rows'></div>"
			} //end modulus 
	} //end loop
} //end generateDiv function

	generateDiv(1, json_articles, "featured-articles"); //call function here with parameters
}); // document.ready