/* Nathan Gilbert */
pics = new Array("../images/191W/house11_small.jpg","../images/191W/house12_small.jpg",
					  "../images/191W/house13_small.jpg", "../images/191W/house14_small.jpg",
					  "../images/191W/house15_small.jpg", "../images/191W/house16_small.jpg",
					  "../images/191W/house17_small.jpg");

picsBig = new Array("../images/191W/house11.jpg","../images/191W/house12.jpg",
					  "../images/191W/house13.jpg", "../images/191W/house14.jpg",
					  "../images/191W/house15.jpg", "../images/191W/house16.jpg",
					  "../images/191W/house17.jpg");
					
caption = new Array("Front view", "Living room", "Kitchen view", "Bedroom 1", "Back door area", "Bathroom", "Entrance");

imgCt = pics.length - 1;

currentImg = 0;

function findLinkByHref(href) {
  for (var i=0; i < document.links.length; i++) {
    if (document.links[i].href == href) return i;
  }
  
  return -1;
}

function changeLinkHref(id,newHref,oldHref) {
  if (document.links.length > 0) {    
    if (document.getElementById) {
      document.getElementById(id).href = newHref;
    }
    else if (document.all) {
      document.all[id].href = newHref;
    }
    else {
      var index = findLinkByHref(oldHref);
      if (index > -1)
        document.links[index].href = newHref;
    }
  }
}

function getNext(num) {
	
	if(num > imgCt){
		document.currentPic.src = pics[0];
		changeLinkHref('addy', picsBig[0], pics[0]);
		document.getElementById('caption').innerHTML = caption[0];
				
	}
	else {
		document.currentPic.src = pics[num];
		changeLinkHref('addy', picsBig[num], picsBig[currentImg]);
		document.getElementById('caption').innerHTML = caption[num];
	}
	
	currentImg = num;
}

function changeText(num){
	
}


