<!--  Created with the CoffeeCup HTML Editor  -->
<!--        http://www.coffeecup.com/         -->
<!--     Brewed on 10/05/2009 9:33:38 PM      -->
<!--  Copyright 2009 Quality Inn              -->

/**************************************************************************/
/* Functions for Words Show Viewer                                        */
/**************************************************************************/
var currentpage=0;
var i=0;
var name=0;
var title=1;
var color=2;
var desc=3;

var Photos = new Array();
Photos[name]=new Array();
Photos[title]=new Array();
Photos[color]=new Array();
Photos[desc]=new Array();

Photos[name][i]   = "images/vineyard3.jpg";
Photos[title][i]  = "Wineries";
Photos[color][i]  = "#4695d2";
Photos[desc][i++] = "Some of the Willamette Valley’s finest wineries are just minutes from our door. Albany is the home of many of Oregon’s most celebrated and charming wineries off the beaten path. Most are set in the picturesque hills of Linn County and cater to couples or small groups.";

Photos[name][i]   = "images/1892.jpg";
Photos[title][i]  = "History and Architecture";
Photos[color][i]  = "#66364c";
Photos[desc][i++] = "The historic setting of the area is one of a kind. Albany is well-known in historian and architect circles because of its diverse collection of historic buildings, including styles from the 1840s through the late 1920s. Throughout the year, many homes open their doors to public tours. Albany also displays its history within its many notable museums.";

Photos[name][i]   = "images/bridge.jpg";
Photos[title][i]  = "Covered Bridges";
Photos[color][i]  = "#626e81";
Photos[desc][i++] = "Albany is the home of many famous covered bridges.  There are eight of these bridges in Linn County alone, each built in the 1850s. The Covered Bridge Festival, an old-fashioned family event, is held every August and includes activities for all to enjoy.";

Photos[name][i]   = "images/balloon.jpg";
Photos[title][i]  = "Events and Festivals";
Photos[color][i]  = "#a6011a";
Photos[desc][i++] = "The Quality Inn is across the road from Timber-Linn Memorial Park, home of the annual balloon festival held in late summer, and many other events. Throughout the year, Albany hosts many notable festivals and tours for the whole family.";

Photos[name][i]   = "images/outdoor.jpg";
Photos[title][i]  = "The Great Outdoors";
Photos[color][i]  = "#6a8bb9";
Photos[desc][i++] = "Albany is located in the heart of western Oregon's Willamette Valley, at the confluence of the Calapooia and Willamette Rivers.  In the fall, visitors can enjoy excellent salmon fishing; for bird-watchers and experienced hikers, there are many beautiful trails to explore.";


// Set slideShowSpeed (milliseconds)
var slideShowSpeed = 7000

// Duration of crossfade (seconds)
var crossFadeDuration = 0

var t
maxpage=Photos[name].length - 1;
var resumepage
var paused = 0

function runSlideShow(parm){
   page=parm
   if (document.all){
      document.images.Slides.style.filter="blendTrans(duration=crossFadeDuration)"
      document.images.Slides.filters.blendTrans.Apply()      
   }
    document.images.Slides.src = Photos[name][page]

	// Replace the sequence number	
	//var seqnumtext = " Photo " + (page+1) + " of " + Photos[name].length;

	// Change the color of the photo number we're on - setting the color broke the a.hover
	//document.getElementById("seq"+(page+1)).style.color = "#ffffff";
	
	// Change color of the photo number by changing the class
	myEle = document.getElementById("seq"+(page+1));
	myEle.setAttribute("class", "photosel");
	myEle.setAttribute("className", "photosel");
	myEle.className = "photosel";
	// Change the color of the photo number we just left back to match the rest
	if (page == 0) {prev = maxpage+1;} else {prev = page};
	myEle = document.getElementById("seq"+(prev));
	myEle.setAttribute("class", "photonav");
	myEle.setAttribute("className", "photonav");
	myEle.className = "photonav";

	// Replace the description
	document.getElementById("phototitle").innerHTML = Photos[title][page];
	document.getElementById("photodesc").innerHTML = Photos[desc][page];
	document.getElementById("photocell").style.backgroundColor = Photos[color][page];
	document.getElementById("photoseq").style.backgroundColor = Photos[color][page];

   if (document.all){
      document.images.Slides.filters.blendTrans.Play()
   }
   page=page+1
   if (page > maxpage) page=0
   resumepage=page
   t = setTimeout('runSlideShow(page)', slideShowSpeed)
}

function pauseSlideShow(pagenum) {
   if (pagenum == 0) {
   	  if (paused == 1){ 
	  	 page=page+1;
   	  	 if (page > maxpage) page=0;
	 }
   }
   else {
   	  page=pagenum-1;
	  }	  
   
   if (paused==0){
   	  if (document.all){
      	 document.images.Slides.style.filter="blendTrans(duration=1)"
      	 document.images.Slides.filters.blendTrans.Stop()
      	 document.images.Slides.filters.blendTrans.Apply()
	  	 }
   		 resumepage--;
   		 window.clearTimeout(t);
   		 paused = 1;
	 }
   changepage(page);	 	      
}     
function resumeSlideShow() {
   if (paused){
      resumepage++;
	  if ( resumepage > maxpage)
	     resumepage = 0;
	  paused = 0;
   	  t = setTimeout('runSlideShow(resumepage)', 0)
   }
}     

function changepage(page)
{
    // Replace the image 
   if (document.all){
      document.images.Slides.style.filter=""
	  }  
   document.images.Slides.src = Photos[name][page]

   	// Change color of the photo number by changing the class
	myEle = document.getElementById("seq"+(page+1));
	myEle.setAttribute("class", "photosel");
	myEle.setAttribute("className", "photosel");
	myEle.className = "photosel";

	// Change the color of the photo number we just left back to match the rest
	for (i = 0; i <= maxpage; i++)
	{
	 	if (i == page) {} 
		else {
			 myEle = document.getElementById("seq"+(i+1));
			 myEle.setAttribute("class", "photonav");
			 myEle.setAttribute("className", "photonav");
			 myEle.className = "photonav";
		}
	}
	// Replace the description
	document.getElementById("phototitle").innerHTML = Photos[title][page];
	document.getElementById("photodesc").innerHTML = Photos[desc][page];
	document.getElementById("photocell").style.backgroundColor = Photos[color][page];
	document.getElementById("photoseq").style.backgroundColor = Photos[color][page];
	return; 
}	  

function Back()
{
 	if (paused==0){pauseSlideShow()}
	resumepage--;
	if ( resumepage < 0)
	   	 resumepage = maxpage;
   	changepage(resumepage);
	return;	
}

function Next()
{
 	if (paused==0){pauseSlideShow();}
	resumepage++;

	if ( resumepage > maxpage)
	     resumepage = 0;
   	changepage(resumepage);
	return;
}

function preloadImages()
{
   // create object
     imageObj = new Image();

   for (i = 0; i < maxpage; i++)
   {
   	   imageObj.src = Photos[name][i];
   }
}
