/***********************************************
* DHTML slideshow script-  © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice must stay intact for legal use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

/********************************
*								*
*    PHOTO SLIDE SHOW SCRIPT	*
*		  base code by:			*
*  http://www.dynamicdrive.com 	*
*								*
********************************/

var allphotos=new Array()
var allcaptions=new Array()
var which=0
/*Need to add back clickable photos to open new window with larger photo
*(or larger photo covering other page info, click to close)
*
*Rename photo files, eg. Reese_01.jpg, Lothamer_01.jpg
*/

//define images. You can have as many as you want:
allphotos[0]="photos/reese1.png"
allphotos[1]="photos/reese2.jpg"
allphotos[2]="photos/reese3.jpg"
allphotos[3]="photos/reese4.jpg"
allphotos[4]="photos/reese5.jpg"
allphotos[10]="photos/keizer1.jpg"
allphotos[11]="photos/keizer2.jpg"
allphotos[12]="photos/keizer3.jpg"
allphotos[13]="photos/keizer4.jpg"
allphotos[14]="photos/keizer5.jpg"
allphotos[20]="photos/nampa1.jpg"
allphotos[21]="photos/nampa2.jpg"
allphotos[22]="photos/nampa3.jpg"
allphotos[23]="photos/nampa4.jpg"
allphotos[24]="photos/nampa5.jpg"
allphotos[30]="photos/lothamer1.jpg"
allphotos[31]="photos/lothamer2.jpg"
allphotos[32]="photos/lothamer3.jpg"
allphotos[33]="photos/lothamer4.jpg"
allphotos[34]="photos/lothamer5.jpg"
allphotos[35]="photos/lothamer6.jpg"
allphotos[40]="photos/wsalem1.jpg"
allphotos[41]="photos/wsalem2.jpg"
allphotos[42]="photos/wsalem3.jpg"

//define captions.
allcaptions[0]="Front entry into the screened porch"
allcaptions[1]="Outdoor shower"
allcaptions[2]="Living room"
allcaptions[3]="Upstairs bathroom"
allcaptions[4]="Exterior before landscaping was completed"
allcaptions[10]="Keizer, OR TAI Clinic, Overlooking Staats Lake"
allcaptions[11]="Entry from Lobby"
allcaptions[12]="Reception desk from Waiting Area"
allcaptions[13]="Reception desk from Gym"
allcaptions[14]="Gym with view of Staats Lake"
allcaptions[20]="Nampa, ID TAI Clinic"
allcaptions[21]="Reception desk"
allcaptions[22]="Gym area"
allcaptions[23]="View of reception desk and office from Gym area"
allcaptions[24]="Directors office"
allcaptions[30]="SE Portland attic remodel and dormer addition"
allcaptions[31]="Some intricate framing where the dormers meet the main roof peak"
allcaptions[32]="The finished product where the dormers meet the main roof peak"
allcaptions[33]="Pendant light in one of the new dormers"
allcaptions[34]="View into the bedroom at the second dormer"
allcaptions[35]="Sitting room at the front of the house"
allcaptions[40]="Salem, OR TAI Clinic"
allcaptions[41]="View of the gym, under construction"
allcaptions[42]="View of Reception from Waiting area"

var projectphotos=allphotos.slice(0,5)
var projectcaptions=allcaptions.slice(0,5)
	
//preload photos to memory
//var preloadedimages=new Array()
//for (i=0;i<allphotos.length;i++){
//	preloadedimages[i]=new Image()
//	preloadedimages[i].src=allphotos[i]
//}

//create project specific arrays
function projectarrays(a,b){
	projectphotos=allphotos.slice(a,b)
	projectcaptions=allcaptions.slice(a,b)
	which=0
	document.images.photoslider.src=projectphotos[which]
	document.getElementById('text1').innerHTML=projectcaptions[which]
}

function backward(){
	if (which>0){
		which--
		document.images.photoslider.src=projectphotos[which]
		document.getElementById('text1').innerHTML=projectcaptions[which]
	}
	else {
		which=(projectphotos.length-1)
		document.images.photoslider.src=projectphotos[which]
		document.getElementById('text1').innerHTML=projectcaptions[which]
	}
}

function forward(){
	if (which<projectphotos.length-1){
		which++
		document.images.photoslider.src=projectphotos[which]
		document.getElementById('text1').innerHTML=projectcaptions[which]
	}
	else {
		which=0
		document.images.photoslider.src=projectphotos[which]
		document.getElementById('text1').innerHTML=projectcaptions[which]
	}	
}

/********************************
*								*
*     DROP DOWN MENU SCRIPT		*
*		  base code by:			*
*  http://javascript-array.com 	*
*								*
********************************/

var timeout = 100
var timer = 0
var menudropdown = 0

// open hidden layer
function menuopen(id)
{
	// cancel close timer
	mcancelclosetime();

	// close old layer
	if(menudropdown) menudropdown.style.visibility = 'hidden';

	// get new layer and show it
	menudropdown = document.getElementById(id);
	menudropdown.style.visibility = 'visible';

}
// close dropdown
function menuclose()
{
	if(menudropdown) menudropdown.style.visibility = 'hidden';
}

// start close timer
function mclosetime()
{
	timer = window.setTimeout(menuclose, timeout);
}

// cancel close timer
function mcancelclosetime()
{
	if(timer)
	{
		window.clearTimeout(timer);
		timer = null;
	}
}

// close layer when click-out
document.onclick = menuclose;

//window size 


function buildsize() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  myHeightlft = myHeight - 158;
  myHeightrt = myHeight - 215;
  myHeightfter = myHeight - 44;
 document.getElementById('content-lft').style.height = myHeightlft + 'px'; 
 document.getElementById('content-rt').style.height = myHeightrt + 'px'; 
  document.getElementById('baseline').style.top = myHeightfter + 'px'; 
  }

window.onresize = buildsize;

