window.onload = loadPsalmData;

var thisPsalm1=0;
var thisPsalm2=0;
var timerID2 = null;
var timerID3 = null;

var psalms1 = new Array(
"We give thanks to you, O God - people tell of your wondrous deeds",
"Yet God, my King, is from of old, working salvation in the earth",
"God is the strength of my heart and my portion forever",
"Blessed be the Lord, who alone does wondrous things",
"I will praise you with the harp for your faithfulness, O my God",
"Be pleased, O God, to deliver me.  O Lord, make haste to help me",
"Answer me, O Lord, for your steadfast love is good",
"Lift up a song to God who rides upon a cloud - His name is the Lord",
"Let the peoples praise you, O God, let all the peoples praise you",
"Bless our God, O peoples, let the sound of His praise be heard",
"O you who answers prayer!  To you all flesh shall come",
"Let the righteous rejoice in the Lord and take refuge in Him",
"O God, you are my God - my soul thirst for you as in a dry and thirsty land",
"God alone is my rock and my salvation, my fortess; I shall never be shaken",
"Hear my cry, O God, listen to my prayer",
"With God we shall do valiantly",
"O my strength, I will watch for you; for you, O God, are my fortress",
"Surely there is a reward for the righteous",
"Be merciful to me, O God, for in you my soul takes refuge",
"O Most High, when I am afraid, I put my trust in you",
"Cast your burden on the Lord and He will sustain you",
"Hear my prayer, O God, give ear to the words of my mouth",
"Fools say in their hearts there is no God",
"I trust in the steadfast love of God forever and ever",
"Have mercy on me, O God, according to your steadfast love",
"Our God comes and does not keep silence",
"Hear this, all you peoples - the mediatation of my heart shall be understanding",
"We ponder your steadfast love, O God, in the midst of your temple",
"Clap your hands, all you peoples; shout to God with loud songs of joy",
"God is our refuge and strength, a very present help in trouble",
"Your throne, O God, endures forever and ever",
"Rise up, come to our help.  Redeem us for the sake of your steadfast love", 
"Hope in God; for I shall again praise Him, my help and my God",
"As the deer longs for water, so my soul longs for you, O God",
"Blessed be the Lord, the God of Israel, from everlasting to everlasting",
"Hear my prayer, O Lord, and give ear to my cry",
"O my God - make haste to help me, O Lord, my salvation",
"Be still before the Lord, and wait patiently for Him",
"O continue your steadfast love to those who know you - to the upright of heart",
"Great is the Lord, who delights in the welfare of His servant",
"O magnify the Lord with me, and let us exalt His name together",
"Sing to God a new song; play skillfully on the strings, with loud shouts",
"Let all who are faithful offer prayer to God",
"In you, O Lord, I take refuge",
"O Lord my God, I cried to you for help, and you have healed me",
"Ascribe to the Lord the glory of His name; worship the Lord in holy splendor",
"To you, O Lord, I call; my rock, do not refuse to hear me",
"The Lord is my light and my salvation; whom shall I fear?",
"God's steadfast love is before my eyes, and I walk in faithfulness to Him",
"Be mindful of your mercy, O Lord, and of your steadfast love",
"Lift up your heads, O gates - that the King of Glory may come in",
"The Lord is my shepherd, I shall not want",
"All the ends of the earth shall remember and turn to the Lord",
"Be exalted, O Lord - we will sing and praise your power",
"May God grant you your heart's desire, and fulfill all your plans",
"The heavens are telling the glory of God",
"I love you, O Lord, my strength - my rock, my fortress, and my deliverer",
"I call upon you, O God, incline your ear to me, hear my prayer",
"Protect me, O God, for in you I take refuge",
"Walk blamelessly, and do what is right, and speak truth from your heart",
"The Lord looks down from heaven on humankind",
"Consider and answer me, O Lord my God",
"You, O Lord, will protect us",
"The Lord is righteous - the upright shall behold His face",
"O Lord, you will do justice for the oppressed",
"I will sing praise to your name, O Most High",
"O Lord, how majestic is your name in all the earth",
"I will sing praise to the name of the Lord, the Most high",
"The Lord accepts my prayer",
"Let all who take refuge in God rejoice",
"You alone, O Lord, make me lie down in safety",
"I cry aloud to the Lord, and He answers me from His holy hill",
"Happy are those who take refuge in God",
"Happy are those whose delight is in the law of the Lord"
);

var psalms2 = new Array(
"Let everything that has breath praise the Lord!  PRAISE THE LORD!",
"Sing to the Lord a new song, His praise in the assembly of the faithful",
"Praise the Lord from the heavens; praise Him, all His host",
"How good it is to sing praises to our God; for He is gracious",
"The Lord lifts up those who are bowed down; the Lord loves the righteous",
"The Lord is gracious amd merciful, slow to anger and abounding in steadfast love",
"Blessed be the Lord, my rock; my rock and my fortress, my stronghold and my deliverer",
"Hear my prayer, O Lord; give ear to my supplications in your faithfulness",
"I cry to you, O Lord; You are my refuge, my portion in the land of the living.",
"Let my prayer be counted to you as incense before God",
"You are my God; give ear to the voice of my supplications.",
"Search me, O God, and know my heart; test me and know my thoughts",
"I give thanks to you, O Lord, with my whole heart",
"Let my tongue cling to the roof of my mouth, if I do not remeber God",
"O give thanks to the God of heaven, for His steadfast love endures forever",
"Praise the Lord, for the Lord is good; sing to His name, for He is gracious",
"The Lord, maker of heaven and earth, bless you from Zion",
"In Zion the Lord ordained His blessing, life forevermore",
"Let us go to God's dwelling place; let us worship at His footstool",
"Hope in the Lord from this time on and forevermore",
"Out of the depths I cry to you, O Lord.  Lord, hear my voice",
"The blessing of the Lord be upon you.  We bless you in the name of the Lord",
"Happy is every one who fears the Lord, who walks in His ways",
"Unless the Lord builds the house, those who build it labor in vain",
"The Lord has done great things for us, and we rejoiced",
"Those who trust in the Lord are like Mount Zion, which cannot be moved",
"Our help is in the name of the Lord, who made heaven and earth",
"To you I lift up my eyes, O you who are enthroned in the heavens",
"I was glad when they said to me let us go to the house of the Lord.",
"My help comes from the Lord, who made heaven and earth",
"In my distress I cry to the Lord, that He may answer me",
"I long for your salvation, O Lord, and your Law is my delight",
"O give thanks to the Lord, for He is good",
"Praise the Lord, all you nations!  Extol Him, all you peoples",
"I love the Lord, because He has heard my voice and my supplications",
"The Lord has been mindful of us; He will bless us",
"Tremble, O earth, at the presence of the Lord . . .  who turns the rock in to a pool of water",
"Blessed be the name of the Lord from this time on and forevermore",
"Happy are those who fear the Lord, who greatly delight in His commandments",
"The fear of the Lord is the beginning of wisdom",
"The Lord is at your right hand",
"Do not be silent, O God of my praise",
"I will give thanks to you, O Lord, among the people",
"God raises up the needy out of distress, and makes their families like flocks",
"O give thanks to the Lord, for He is good; His steadfast love endures forever",
"Let the hearts of those who seek the Lord rejoice",
"May the glory of the Lord endure forever; may the Lord rejoice in His works",
"Bless the Lord, O my soul, and all that is within me, bless His holy name",
"Hear my prayer, O Lord; let my cry come to you",
"I will sing of loyalty and of justice; to you, O Lord, I will sing",
"Enter God's gates with thanksgiving, and His courts with praise",
"Extol the Lord our God; worship at His footstool.  Holy is He",
"Make a joyful noise to the Lord, all the earth, break forth into joyous song",
"Rejoice in the Lord, O you righteous, and give thanks to His holy name",
"O sing to the Lord a new song; sing to the Lord all the earth",
"Let us worship and bow down, let us kneel before the Lord, our Maker",
"The Lord has become my stronghold, and my God the rock of my refuge",
"More majestic than thunders of mighty waters, majestic on high is the Lord",
"It is good to give thanks to the Lord, to sing praises to His name",
"My refuge and my fortress; my God in whom I trust",
"Let the favor of the Lord our God be upon us",
"I will sing of your steadfast love, O Lord, forever",
"O God, let my prayer come before you; incline your ear to my cry",
"Singers and dancers alike say all my springs are in God.",
"Incline your ear, O Lord, and answer me, for I am poor and needy",
"The Lord will give what is good, and our land will yield its increase",
"How lovely is your dwelling place, O Lord of hosts",
"O God, do not keep silence; do not hold your peace or be still, O God",
"Give justice to the weak and the orphan; maintain the right of the lowly and destitute",
"Sing aloud to God our strength; shout for joy to the God of Jacob",
"Restore us, O God, let your face shine, that we may be saved",
"Help us, O God of our salvation, for the glory of your name",
"God commanded the skies above, He rained down on them manna to eat",
"I will call to mind the deeds of the Lord; I will remember your wonders of old",
"Make vows to the Lord your God, and perform them"
);

function loadPsalmData() {
	loadPsalms1();
	loadPsalms2();
}

function loadPsalms1() {
	clearTimeout(timerID2);
	thisPsalm1= Math.floor((Math.random() * psalms1.length));
	
	rotatePsalms1();
}

function rotatePsalms1() {
	thisPsalm1++;
	if(thisPsalm1==psalms1.length) {
		thisPsalm1 = 0;
	}
	document.getElementById("psalmList1").innerHTML=psalms1[thisPsalm1];

	timerID2=setTimeout("rotatePsalms1()", 8*1000);
}

function loadPsalms2() {
	clearTimeout(timerID3);
	thisPsalm2= Math.floor((Math.random() * psalms2.length));
	
	rotatePsalms2();
}

function rotatePsalms2() {
	thisPsalm2++;
	if(thisPsalm2==psalms2.length) {
		thisPsalm2 = 0;
	}
	document.getElementById("psalmList2").innerHTML=psalms2[thisPsalm2];

	timerID3=setTimeout("rotatePsalms2()", 9*1000);
}


