/*
fz_pre_loader is written by Fitzroy Nembhard, thus the name fz
Date written: 11.27.09
Do not copy or reproduce without written permission from the author
All works on fitzwork.com are licensed to Zoe Dvelopers, LLC

This script zooms out a picture (one point perspective) and changes it based on the images in the gallery. It also shows a description below the image
*/
var fz_pre_loader=new Object();
fz_pre_loader.changer=document.getElementById("img-changer");
fz_pre_loader.changer_alias=document.getElementById("img-changer-alias");
fz_pre_loader.descriptor=document.getElementById("img-desc");
fz_pre_loader.container=document.getElementById("animated-img-holder");
fz_pre_loader.image_names=["train-up","baptism","feedthem","street-dance","communion-fragments","fundance","communion-breakbread","healing","mansion","mom","park-cooking","medals","group","beauty","heavens"];
fz_pre_loader.descs=["Train up a child in the way he should go&mdash;Proverbs 22:6","Arise, and be baptized, and wash away thy sins&mdash;Acts 22:16","And Jesus said unto them, ... give ye them to eat&mdash;Matt 14:16","Praise him with the timbrel and dance! &mdash;Ps 150:4","Gather up the fragments that remain, that nothing be lost&mdash;John 6:12","There are pleasures at His right hand &mdash;Ps 16:11","And when He had given thanks, He brake it &mdash;I Cor. 11:24","The prayer of faith shall save the sick &mdash;Jam 5:15","In my father's house are many mansions &mdash;John 14:2","Lo, children are an heritage of the LORD&mdash;Ps 127:3","...they saw a fire of coals there, and fish laid thereon&mdash;John 21:9","...and put a gold chain about his neck&mdash;Gen 41:42","Blessed shall be the fruit of thy body&mdash;Deu 28:4","...they shall walk, O LORD, in the light of thy countenance.&mdash;Psalm 89:15","The heavens declare the glory of God! &mdash;Ps 19:1"];
fz_pre_loader.imgs=new Array();
fz_pre_loader.img_width=580;
fz_pre_loader.img_height=300;
fz_pre_loader.c_width=580;
fz_pre_loader.c_height=300;
//fz_pre_loader.c_image=Math.floor(Math.random()*fz_pre_loader.image_names.length);//start out with a random picture in the list
fz_pre_loader.c_image=13;
fz_pre_loader.changer_time_control=0;
fz_pre_loader.size_timer;
fz_pre_loader.pause_timer;
fz_pre_loader.paused=false;
fz_pre_loader.load_images=function(){
										for(i=0;i<fz_pre_loader.image_names.length;i++)
										{
											fz_pre_loader.imgs[i]=new Image();
											fz_pre_loader.imgs[i].src="/images/gallery/"+fz_pre_loader.image_names[i]+".jpg";
										}		
									};
fz_pre_loader.init=function(){
							fz_pre_loader.changer.src=fz_pre_loader.imgs[fz_pre_loader.c_image].src;
							fz_pre_loader.changer.oncontextmenu=function(){return false;};
							fz_pre_loader.container.oncontextmenu=function(){return false;};
							fz_pre_loader.descriptor.innerHTML=fz_pre_loader.descs[fz_pre_loader.c_image]	
							 }				
fz_pre_loader.change_images=function(){
										fz_pre_loader.size_timer=setTimeout("fz_pre_loader.change_images()",100);
										if(fz_pre_loader.c_width>0)
											fz_pre_loader.c_width-=20;
										if(fz_pre_loader.c_height>0)
											fz_pre_loader.c_height-=10;
										if(fz_pre_loader.c_image>fz_pre_loader.imgs.length-2)
											fz_pre_loader.c_image=-1;//it will go to 0 next
										
										//fz_pre_loader.descriptor.style.width=fz_pre_loader.c_width+"px";
										if(fz_pre_loader.c_height<=260)
										{
											fz_pre_loader.descriptor.style.display="none";
											//fz_pre_loader.descriptor.innerHTML="";
										}
										
											
										if(fz_pre_loader.c_height<=0)
										{
											clearTimeout(fz_pre_loader.size_timer);	
											fz_pre_loader.pause();
											fz_pre_loader.c_image++;
											fz_pre_loader.c_height=fz_pre_loader.img_height;
											fz_pre_loader.c_width=fz_pre_loader.img_width;
											fz_pre_loader.changer.src=fz_pre_loader.imgs[fz_pre_loader.c_image].src;
											fz_pre_loader.descriptor.style.display="block";
											fz_pre_loader.descriptor.innerHTML=fz_pre_loader.descs[fz_pre_loader.c_image];		
											fz_pre_loader.descriptor.style.width="574px";
											
										}
																								
										fz_pre_loader.changer.style.width=fz_pre_loader.c_width+"px";
										fz_pre_loader.changer.style.height=fz_pre_loader.c_height+"px";
										
										//the alias is the future image and should be ahead of the current image
										if(fz_pre_loader.c_image==fz_pre_loader.imgs.length-1)
											fz_pre_loader.changer_alias.src=fz_pre_loader.imgs[0].src;
										else
											fz_pre_loader.changer_alias.src=fz_pre_loader.imgs[fz_pre_loader.c_image+1].src;
									};
fz_pre_loader.pause=function(){
								fz_pre_loader.pause_timer=setTimeout("fz_pre_loader.pause()",1200);
								fz_pre_loader.changer_time_control++;
								if(fz_pre_loader.changer_time_control==6)
								{
									fz_pre_loader.size_timer=setTimeout("fz_pre_loader.change_images()",100);
									clearTimeout(fz_pre_loader.pause_timer);
									fz_pre_loader.changer_time_control=0;
										
								}
							  };