/* slideshow.js copyright 2010 by Meadowlark Media */

            /*global Image, document, setTimeout */

            var n1 = 0, pics1 = [], totalImages1 = 0, foto1="";
            var n2 = 0, pics2 = [], totalImages2 = 0, foto2="";
            var n3 = 0, pics3 = [], totalImages3 = 0, foto3="";
            var i=0;  /* i is declared globally because it is used later in recursive functions. */

            function imagePic1(pics1Url) { this.picture = new Image(); this.picture.src = pics1Url;}  
            function imagePic2(pics2Url) { this.picture = new Image(); this.picture.src = pics2Url;}  
            function imagePic3(pics3Url) { this.picture = new Image(); this.picture.src = pics3Url;}  

            function get_pics1Location(imageObj1) { return(imageObj1.picture.src);} 
            function get_pics2Location(imageObj2) { return(imageObj2.picture.src);} 
            function get_pics3Location(imageObj3) { return(imageObj3.picture.src);} 

            function getNextImage1() { n1 = (n1+1) % totalImages1; var slide = get_pics1Location(pics1[n1]); return(slide);} 
            function getNextImage2() { n2 = (n2+1) % totalImages2; var slide = get_pics2Location(pics2[n2]); return(slide);} 
            function getNextImage3() { n3 = (n3+1) % totalImages3; var slide = get_pics3Location(pics3[n3]); return(slide);} 

            pics1[n1++] = new imagePic1("images/Slideshow1/1.jpg");
            pics1[n1++] = new imagePic1("images/Slideshow1/2.jpg");
            pics1[n1++] = new imagePic1("images/Slideshow1/3.jpg");
            pics1[n1++] = new imagePic1("images/Slideshow1/4.jpg");
            pics1[n1++] = new imagePic1("images/Slideshow1/5.jpg");
            pics1[n1++] = new imagePic1("images/Slideshow1/6.jpg");
            pics1[n1++] = new imagePic1("images/Slideshow1/7.jpg");
            pics1[n1++] = new imagePic1("images/Slideshow1/8.jpg");
            pics1[n1++] = new imagePic1("images/Slideshow1/9.jpg");
            pics1[n1++] = new imagePic1("images/Slideshow1/10.jpg");
            totalImages1 =  pics1.length;

            pics2[n2++] = new imagePic2("images/Slideshow2/1.jpg");
            pics2[n2++] = new imagePic2("images/Slideshow2/2.jpg");
            pics2[n2++] = new imagePic2("images/Slideshow2/3.jpg");
            pics2[n2++] = new imagePic2("images/Slideshow2/4.jpg");
            pics2[n2++] = new imagePic2("images/Slideshow2/5.jpg");
            pics2[n2++] = new imagePic2("images/Slideshow2/6.jpg");
            pics2[n2++] = new imagePic2("images/Slideshow2/7.jpg");
            pics2[n2++] = new imagePic2("images/Slideshow2/8.jpg");
            pics2[n2++] = new imagePic2("images/Slideshow2/9.jpg");
            pics2[n2++] = new imagePic2("images/Slideshow2/10.jpg");
            totalImages2 =  pics2.length;

            pics3[n3++] = new imagePic3("images/Slideshow3/1.jpg");
            pics3[n3++] = new imagePic3("images/Slideshow3/2.jpg");
            pics3[n3++] = new imagePic3("images/Slideshow3/3.jpg");
            pics3[n3++] = new imagePic3("images/Slideshow3/4.jpg");
            pics3[n3++] = new imagePic3("images/Slideshow3/5.jpg");
            pics3[n3++] = new imagePic3("images/Slideshow3/6.jpg");
            pics3[n3++] = new imagePic3("images/Slideshow3/7.jpg");
            pics3[n3++] = new imagePic3("images/Slideshow3/8.jpg");
            totalImages3 =  pics3.length;

          /* The following opacity function works in most major browsers.
              If your browser is not included, contact MeadowlarkMedia at 503-36404607. */
            function setOpacity(foto, degree) {
                foto.style.filter = "alpha(opacity=" + (degree * 100) + ");";		/* opacity setting for IE  types           (0 thru 100%) */
                foto.style.MozOpacity = degree;				/* opacity setting for Moz and ns          (0 thru 1.0) */
                foto.style.opacity = degree;				/* opacity setting for Opera and Safari (0 thru 1.0) */
                foto.style.KhtmlOpacity = degree;				 /* opacity setting for Konqueror           (0 thru 1.0) */

            }
	
            function slidearea1(area1) {
                document[area1].src = getNextImage1();
                foto1 = document.getElementById('gallery1');
                setTimeout("slidearea1(\""+area1+"\")", 10000);
                for (i = 0; i <= 1; i += 0.02) {
                    setTimeout("setOpacity(foto1, " + i + ")", i * 4000);
                }
           }

            function slidearea2(area2) {
                document[area2].src = getNextImage2();
                foto2 = document.getElementById('gallery2');
                setTimeout("slidearea2(\""+area2+"\")", 15000);
                for (i = 0; i <= 1; i += 0.02) {
                    setTimeout("setOpacity(foto2, " + i + ")", i * 4000);
                }
           }

            function slidearea3(area3) {
                document[area3].src = getNextImage3();
                foto3 = document.getElementById('gallery3');
                setTimeout("slidearea3(\""+area3+"\")", 12000);
                for (i = 0; i <= 1; i += 0.02) {
                    setTimeout("setOpacity(foto3, " + i + ")", i * 4000);
                }
           }


