/* -------------------------------------- */
/* Global Varuables                       */
/* -------------------------------------- */

// Change these settings as needed
var pictureDelay        = 5 * 1000,       // Seconds
    quoteDelay          = 5 * 1000;       // Seconds

// Web path to the front page images
var picturePath = "vistaPics/";
var pics = Array( 'AH1.jpg', 'AH2.jpg', 'AH3.jpg', 'AH4.jpg', 'AH5.jpg', 'AH6.jpg', 'AH7.jpg', 'AH8.jpg', 'AH9.jpg', 'AH10.jpg', 'AH11.jpg', 'AH12.jpg'); 



////////////////////////////////////////////////////////////////////////////
//  Front page photos
////////////////////////////////////////////////////////////////////////////


// Supplemental front page photo captions
var vistaCaptions = {
"20740.jpg" : "this is how a caption looks",
"Image24.jpg" : "this is how another caption looks",
"zFox_places_and_things41.jpg" : "this is how still another caption looks",
"wall_Israeli_flag.jpg" : "Israel"
}
	//no comma at end



///////////////////////////////////////////////////////////////////////////
// Front page Verses
///////////////////////////////////////////////////////////////////////////

var currentQuote = -1;

    quotes = new Array (
'My mouth speaks boldly against my enemies, because I rejoice in your ' +
   'salvation. 1 Samuel 2:1',
'There is no one holy like the Lord. Indeed, there is no one besides You, nor ' +
   'is there any rock like our God. 1 Samuel 2:2',
'He raises the poor from the dust. He lifts the needy from the ash heap to ' +
   'make them sit with nobles, and inherit a seat of honor. 1 Samuel 2:8',
'But you, take courage! Do not let your hands be weak, for your work shall be ' +
   'rewarded. 2 Chronicles 15:7',
'Indeed, none of those who wait for You will be ashamed. Psalms 25:3',
'Who is the man who fears the Lord? He will instruct him in the way he should ' +
   'choose. Psalms 25:12',
'The secret of the Lord is for those who fear Him, and He will make them know ' +
   'His covenant. My eyes are continually toward the Lord, for He will pluck my ' +
   'feet out of the net. Psalm 25:14,15',
'The Lord is my light and my salvation. Whom shall I fear? The Lord is the ' +
   'defense of my life. Whom shall I dread? When evildoers came upon me to ' +
   'devour my flesh, my adversaries and my enemies, they stumbled and fell. ' +
   'Though a host encamp against me, my heart will not fear. Though war arise ' +
   'against me, in spite of this I shall be confident. Psalm 27:1-3',
'For in the day of trouble He will conceal me in His tabernacle, in the ' +
   'secret place of His tent He will hide me. He will lift me up on a rock. ' +
   'Psalm 27:5',
'I would have despaired unless I had believed that I would see the goodness ' +
   'of the Lord in the land of the living. Wait for the Lord. Be strong, and let ' +
   'your heart take courage. Yes, wait for the Lord. Psalm 27:13,14',
'The Lord is my strength and my shield. My heart trusts in Him, and I am ' +
   'helped. Therefore my heart exults, and with my song I will thank Him. The ' +
   'Lord is their strength, and He is a saving defense to His anointed. ' +
   'Psalm 28:7-8',
'The Lord sat as king at the flood. Yes, the Lord sits as King forever. The ' +
   'Lord will give strength to His people. The Lord will bless His people with ' +
   'peace. Psalm 29:10-11',
'Weeping may last for the night, but a shout of joy comes in the morning. ' +
   'Psalm 30:5',
'You have turned my mourning into dancing. You have loosed my sackcloth and ' +
   'girded me with gladness, that my soul may sing praise to You, and not be ' +
   'silent. O Lord my God, I will give thanks to You forever. Psalm 30:11-12',
"For You are my rock and my fortress. For Your name's sake You will lead me" +
   'and guide me. You will pull me out of the net which they have secretly laid ' +
   'for me. For You are my strength. Into Your hand I commit my spirit. You have ' +
   'ransomed me, O Lord, God of truth. Psalm 31:4-5',
'I hate those who regard vain idols. But, I trust in the Lord. I will rejoice ' +
   'and be glad in Your loving kindness, because You have seen my affliction. ' +
   'You have known the troubles of my soul, and You have not given me over into ' +
   'the hand of the enemy. You have set my feet in a large place. Psalm 31:6-8',
'But as for me, I trust in You, O Lord. I say, "You are my God." My times are ' +
   'in Your hand. Psalm 31:14-15',
'How great is Your goodness, which You have stored up for those who fear You, ' +
   'which You have wrought for those who take refuge in You, before the sons of ' +
   'men. Psalm 31:19',
'You hide them in the secret place of Your presence from the conspiracies of ' +
   'man. You keep them secretly in a shelter from the strife of tongues. ' +
   'Psalm 31:20',
'Blessed be the Lord, for He has made marvelous His lovingkindness to me in a ' +
   'besieged city. As for me, I said in my alarm, "I am cut off from before Your ' +
   'eyes." Nevertheless, You heard the voice of my supplications when I cried to ' +
   'You. Psalm 31:21-22',
'O, love the Lord, all you His godly ones! The Lord preserves the faithful, ' +
   'and fully recompenses the proud doer. Be strong and let your heart take ' +
   'courage, all you who hope in the Lord. Psalm 31:23-24',
'How blessed is he whose transgression is forgiven, whose sin is covered! How ' +
   'blessed is the man to whom the Lord does not impute iniquity, and in whose ' +
   'spirit there is no deceit! Psalm 32:1-2',
'You are my hiding place. You preserve me from trouble and surround me with ' +
   'songs of deliverance. Psalm 32:7',
'I will instruct you and teach you in the way which you should go. I will ' +
   'counsel you with My eye upon you. Do not be as the horse or as the mule ' +
   'which have no understanding. Psalm 32:8-9',
'Many are the sorrows of the wicked. But, he who trusts in the Lord, loving ' +
   'kindness shall surround him. Psalm 32:10',
'Yet a little while and the wicked man will be no more, and you will look ' +
   'carefully for his place, and he will not be there. But, the humble will ' +
   'inherit the land, and will delight themselves in abundant prosperity. ' +
   'Psalm 37:10-11',
'Better is the little of the righteous than the abundance of many wicked. For ' +
   'the arms of the wicked will be broken, but the Lord sustains the righteous. ' +
   'Psalm 37:16-17',
'The Lord knows the days of the blameless, and their inheritance will be ' +
   'forever. They will not be ashamed in the time of evil, and in the days of ' +
   'famine they will have abundance. Psalm 37:18-19',
'The steps of a man are established by the Lord, and He delights in his way. ' +
   'When he falls, he will not be hurled headlong, because the Lord is the One ' +
   'who holds his hand. Psalm 37:23-24',
'I have been young, and now I am old, yet I have not seen the righteous ' +
   'forsaken, or his descendants begging bread. Psalm 37:25',
'Depart from evil and do good, so you will abide forever. For the Lord loves ' +
   'justice, and does not forsake His godly ones. They are preserved forever. ' +
   'Psalm 37:27-28',
'The righteous will inherit the land, and dwell in it forever. Psalm 37:29',
'The wicked spies upon the righteous, and seeks to kill him. The Lord will ' +
   'not leave him in his hand, or let him be condemned when he is judged. Wait ' +
   'for the Lord, and keep His way, and He will exalt you to inherit the land. ' +
   'When the wicked are cut off, you will see it. Psalm 37:32-34',
'Mark the blameless man, and behold the upright. For the man of peace will ' +
   'have a posterity. Psalm 37:37',
'But the salvation of the righteous is from the Lord. He is their strength in ' +
   'time of trouble. And the Lord helps them and delivers them. He delivers them ' +
   'from the wicked, and saves them, because they take refuge in Him. ' +
   'Psalm 37:39-40',
'I waited patiently for the Lord, and He inclined to me and heard my cry. He ' +
   'brought me up out of the pit of destruction, out of the miry clay, and set ' +
   'my feet upon a rock making my footsteps firm. And He put a new song in my ' +
   'mouth, a song of praise to our God. Many will see and fear, and will trust ' +
   'in the Lord. Psalm 40:1-3',
'How blessed is the man who has made the Lord his trust, and has not turned ' +
   'to the proud, nor to those who lapse into falsehood. Many, O Lord my God, ' +
   'are the wonders which You have done, and Your thoughts toward us. There is ' +
   'none to compare with You. If I would declare and speak of them, they would ' +
   'be too numerous to count. Psalm 40:4-5',
'You, O Lord, will not withhold Your compassion from me. Your lovingkindness ' +
   'and Your truth will continually preserve me. For evils beyond number have ' +
   'surrounded me. My iniquities have overtaken me, so that I am not able to ' +
   'see. They are more numerous than the hairs of my head, and my heart has ' +
   'failed me. Psalm 40:11-12',
'How blessed is he who considers the helpless. The Lord will deliver him in a ' +
   'day of trouble. The Lord will protect him and keep him alive, and he will be ' +
   'called blessed upon the earth, and do not give him over to the desire of his ' +
   'enemies. The Lord will sustain him upon his sickbed. In his illness, You ' +
   'restore him to health. Psalm 41:1-3',
'As for me, You uphold me in my integrity, and You set me in Your presence ' +
   'forever. Psalm 41:12',
'As the deer pants for the waterbrooks, so my soul thirsts for You, O God. My ' +
   'soul thirsts for God, for the living God. When will I come and appear before ' +
   'God? My tears have been my food day and night, while they say to me all day ' +
   'long, "Where is your God?" Why are you in despair, O my soul? And why have ' +
   'you become disturbed within me? Hope in God, for I will again praise Him for ' +
   'the help of His presence. Psalm 42:1-2,5',
'The Lord will command His lovingkindness in the daytime, and His song will ' +
   'be with me in the night, a prayer to the God of my life. Psalm 42:8',
'For by their own sword they did not possess the land, and their own arm did ' +
   'not save them. But Your right hand, and Your arm, and the light of Your ' +
   'presence, for You favor them. Psalm 44:3',
'For, I will not trust in my bow, nor will my sword save me. But You have ' +
   'saved us from our adversaries, and You have put to shame those who hate us. ' +
   'In God we have boasted all day long, and we will give thanks to Your name ' +
   'forever. Psalm 44:6-8',
'God is our refuge and strength, a very present help in trouble. Therefore we ' +
   'will not fear, though the earth should change, and though the mountains slip ' +
   'into the heart of the sea, though its waters roar and foam, though the ' +
   'mountains quake at its swelling pride. Psalm 46:1-3',
'There is a river whose streams make glad the City of God, the holy dwelling ' +
   'places of the Most High. God is in the midst of her. She will not be moved. ' +
   'God will help her when morning dawns. The nations made an uproar. The ' +
   'kingdoms tottered. He raise His voice. The earth melted. The Lord of hosts ' +
   'is with us. The God of Jacob is our stronghold. Psalm 46:4-7',
'Cease striving and know that I am God. I will be exalted among the nations. ' +
   'I will be exalted in the earth. The Lord of Hosts is with us. The God of ' +
   'Jacob is our stronghold. Psalm 46:10-11',
'O clap your hands, all peoples. Shout to God with the voice of joy. For the ' +
   'Lord most high is to be feared, a great King over all the earth. He subdues ' +
   'peoples under us, and nations under our feet. He chooses our inheritance for ' +
   'us, the glory of Jacob whom He loves. Psalm 47:1-4',
'Great is the Lord, and greatly to be praised in the city of our God, His ' +
   'holy mountain. Beautiful in elevation, the joy of the whole earth is Mount ' +
   'Zion in the far north, the city of the great King. God, in her palaces, has ' +
   'made Himself known as a stronghold. Psalm 48:1-3',
'Walk about Zion, and go around her. Count her towers. Consider her ramparts. ' +
   'Go through her palaces that you may tell it to the next generation. For such ' +
   'is God, our God forever and ever. He will guide us until death. ' +
   'Psalm 48:12-14',
'Sing for joy in the Lord, o you righteous ones. Praise is becoming to the ' +
   'upright. Psalm 33:1',
'The Lord looks from heaven. He sees all the sons of men. From His dwelling ' +
   'place He looks out on all the inhabitants of the earth, He who fashions the ' +
   'heart of them all, He who understands all their works. The King is not saved ' +
   'by a mighty army. A warrior is not delivered by great strength. A horse is a ' +
   'false hope for victory, nor does it deliver any by its great strength. ' +
   'Psalm 33:13-17',
'Behold, the eye of the Lord is on those who fear Him, on those who hope for ' +
   'His loving kindness, to deliver their soul from death, and to keep them ' +
   'alive in famine. Psalm 33:18-19',
'Our soul waits for the Lord. He is our help and our shield. For our heart ' +
   'rejoices in Him, because we trust in His holy name. Let Your loving ' +
   'kindness, O Lord, be upon us, according as we have hoped in You. ' +
   'Psalm 33:20-22',
'I will bless the Lord at all times. His praise will continually be in my ' +
   'mouth. My soul will make its boast in the Lord. The humble will hear it and ' +
   'rejoice. O magnify the Lord with me, and let us exalt His name together. ' +
   'Psalm 34:1-3',
'I sought the Lord, and He answered me, and delivered me from all my fears. ' +
   'They looked to Him and were radiant, and their faces will never be ashamed. ' +
   'Psalm 34:4-5',
'This poor man cried and the Lord heard him, and saved him out of all his ' +
   'troubles. The angel of the Lord encamps around those who fear Him, and ' +
   'rescues them. Psalm 34:6-7',
'O taste and see that the Lord is good. How blessed is the man who takes ' +
   'refuge in Him! Psalm 34:8',
'Have reverence for the Lord, all His people. Those who obey Him will have ' +
   'all they need. Psalm 34:9',
'O fear the Lord, you His saints. For to those who fear Him, there is no ' +
   'want. The young lions do lack and suffer hunger, but they who seek the Lord ' +
   'will not be in want of any good thing. Psalm 34:9-10',
'Who is the man who desires life, and loves length of days that he may see ' +
   'good? Keep your tongue from evil, and your lips from speaking deceit. Depart ' +
   'from evil, and do good. Seek peace, and pursue it. Psalm 34:12-14',
'The eyes of the Lord are toward the righteous, and His ears are open to ' +
   'their cry. Psalm 34:15',
'The righteous cry, and the Lord hears and delivers them out of all their ' +
   'troubles. Psalm 34:17',
'The Lord is near to the broken hearted and saves those who are crushed in ' +
   'spirit. Psalm 34:18',
'The Lord is near to those who are discouraged. He saves those who have lost ' +
   'all hope. Psalm 34:18',
'Many are the afflictions of the righteous, but the Lord delivers him out of ' +
   'them all. Psalm 34:19',
'The Lord redeems the soul of His servants, and none of those who take refuge ' +
   'in Him will be condemned. Psalm 34:22',
'And my soul will rejoice in the Lord. It will exult in His salvation. All my ' +
   'bones will say, "Lord, who is like You, who delivers the afflicted from him ' +
   'who is too strong for him, and the afflicted and the needy from him who robs ' +
   'him?" Psalm 35:9-10',
'I will give You thanks in the great congregation. I will praise You among a ' +
   'mighty throng. Psalm 35:18',
'The Lord be magnified, Who delights in the prosperity of His servant. And my ' +
   'tongue will declare Your righteousness and Your praise all day long. ' +
   'Psalm 35:27-28',
'Your loving kindness, O Lord, extends to the heavens. Your faithfulness ' +
   'reaches to the skies. Your righteousness is like the mountains of God. Your ' +
   'judgments are like a great deep. O Lord, You preserve man and beast. ' +
   'Psalm 36:5-6',
'How precious is Your loving kindness, O God! And the children of men take ' +
   'refuge in the shadow of Your wings. They drink their fill of the abundance ' +
   'of Your house, and You give them to drink of the river of Your delights. For ' +
   'with You is the fountain of life. In Your light we see light. Psalm 36:7-9',
'Do not fret because of evildoers. Be not envious toward wrongdoers. For they ' +
   'will wither quickly like the grass, and fade like the green herb. ' +
   'Psalm 37:1-2',
'Trust in the Lord, and do good. Dwell in the land and cultivate ' +
   'faithfulness. Delight yourself in the Lord, and He will give you the desires ' +
   'of your heart. Commit your way to the Lord. Trust also in Him, and He will ' +
   'do it. And He will bring forth your righteousness as the light, and your ' +
   'judgment as the noonday. Psalm 37:4-6',
'Rest in the Lord, and wait patiently for Him. Do not fret because of him who ' +
   'prospers in his way, because of the man who carries out wicked schemes. ' +
   'Cease from anger, and forsake wrath. Do not fret. It leads only to ' +
   'evildoing. For evildoers will be cut off, but those who wait for the Lord, ' +
   'they will inherit the land. Psalm 37:7-9'
 );
 
 
 
 // Show the next picture
 
var currentPicture = -1;    // Current picture number
var nextPic = new Image();  // Holds reference to the next picture

function nextPicture() {
   if (!bIdle) {
		// Next picture
		currentPicture = (currentPicture + 1) % pics.length;
		var picfile = pics[currentPicture];
		
		// Set the caption, if any
		var captionObject = getObject('vistaCaption');
		if (captionObject && captionObject.firstChild.nodeValue != null) {
			var captionText=null;
			if (vistaCaptions) captionText = vistaCaptions[picfile];
			
			/* causes the following text to jump around...
			if (captionText) {
        captionObject.firstChild.nodeValue = captionText;
        captionObject.style.display = '';
        }
			else captionObject.style.display = 'none';
			*/

      captionObject.firstChild.nodeValue = captionText ? captionText : "";
		}
		
		// Load the picture
		reloadImage("vistaPics", picturePath + picfile);
		
		// Pre-load the next picture for faster display
		nextPic.src = picturePath + pics[(currentPicture + 1) % pics.length];
	}
	
}




 // Show the next quote
 // This should be called on an interval
 function nextQuote() {
	currentQuote = (currentQuote + 1) % quotes.length;  // Increment with rotate
	
	var quotesObj = getObject('cycleQuote');
	if (quotesObj != null && quotesObj.firstChild.nodeValue != null)
		quotesObj.firstChild.nodeValue = quotes[shuffledQuotes[currentQuote]];
}




 // Initialize home page
var shuffledQuotes = new Array();
function homeSetup() {
	var i;
	
	// build shuffled array of quote indices
	for (i=0; i < quotes.length; i++) shuffledQuotes[i] = i;
	shuffledQuotes.shuffle();
	
	// Show a new quote on an interval
	nextQuote();
	setInterval('nextQuote();',quoteDelay);
	
	// Show a new picture on an interval
	nextPicture(); 
	setInterval('nextPicture()',pictureDelay);
}




// Do setup after the page has laoded
addLoadHandler(homeSetup);


