//SECTION CLASS---------------------------------------------------------------------------------------------

var sectionObject = new Section();			//create object off below blueprint
function Section(){						//create blueprint for section class : sections refer to project, studio, contact
}

Section.prototype.change = function(){    // use of prototype syntax allows us to glue functions onto objects-NB never spell prototype with capital p
	categoryObject.unhighlightAllLinks();
	projectObject.hide();
	activeCenterObject.hide();
	openingImageObject.display();
}

Section.prototype.unhighlightAllLinks = function(){

	// define vars for convenience
	var link1 = document.getElementById('bachsLink');
	var link2 = document.getElementById('boatsLink');
	var link3 = document.getElementById('filmsetsLink');
	var link4 = document.getElementById('residentialLink');
	link1.className = "no_page";	  
	link2.className = "no_page";
	link3.className = "no_page";
	link4.className = "no_page";
}

//CATEGORY CLASS---------------------------------------------------------------------ie residential or commercial------------------------
var categoryObject = new Category();
function Category(){
}

Category.prototype.change = function(linkId, divId){
	//alert('Category.prototype.change');
	projectObject.unhighlightAllLinks();
	this.highlightLink(linkId); // using 'this' to call another function WITHIN our class
	projectObject.display(divId);
	activeCenterObject.hide();
	openingImageObject.display();
}

Category.prototype.highlightLink = function(linkId){
	this.unhighlightAllLinks(); // using 'this' to call another function WITHIN our class
	// highlight the link we want
	var linkToHighlight = document.getElementById(linkId);
	linkToHighlight.className = "page";
}

Category.prototype.unhighlightAllLinks = function(){

	// define vars for convenience
	var link1 = document.getElementById('bachsLink');
	var link2 = document.getElementById('boatsLink');
	var link3 = document.getElementById('filmsetsLink');
	var link4 = document.getElementById('residentialLink');
	link1.className = "no_page";	  
	link2.className = "no_page";
	link3.className = "no_page";
	link4.className = "no_page";
}

//PROJECT CLASS---------------------------------------------------------------------------------------------ie benson residence
var projectObject = new Project();
function Project(){
}

Project.prototype.change = function(linkId, projectId){
	//alert('Project.prototype.change');
	this.highlightLink(linkId); // using 'this' to call another function WITHIN our class
	changeActiveSnapshotInfo(projectId); // note: calls out to gallery.js
	activeCenterObject.display();
	openingImageObject.hide();
}

Project.prototype.highlightLink = function(linkId){
	this.unhighlightAllLinks(); // using 'this' to call another function WITHIN our class
	// highlight the link we want
	var linkToHighlight = document.getElementById(linkId);
	linkToHighlight.className = "page";
}

Project.prototype.unhighlightAllLinks = function(){

	// define vars for convenience
	var link1 = document.getElementById('bensonLink');
	var link2 = document.getElementById('paradeLink');
	var link3 = document.getElementById('wedaLink');
	link1.className = "no_page";	  
	link2.className = "no_page";
	link3.className = "no_page";
}

Project.prototype.display = function(divId){
	this.hide(); // using 'this' to call another function WITHIN our class

	// display the div we want
	var divToDisplay = document.getElementById(divId);
	divToDisplay.className = "display";
}

Project.prototype.hide = function(){

	// define vars for convenience and hide
	var div1 = document.getElementById('nav_right_empty');
	var div2 = document.getElementById('nav_right_res');
	var div3 = document.getElementById('nav_right_boat');
	var div4 = document.getElementById('nav_right_bach');
	var div5 = document.getElementById('nav_right_film');
	div1.className = "hide";	  
	div2.className = "hide";
	div3.className = "hide";
	div4.className = "hide";
	div5.className = "hide";
	
  }

//// Example
//var projectObject = new Project();
//projectObject.change();

//ACTIVE CENTER CLASS---------------------------------------------------------------------------------------------

var activeCenterObject = new ActiveCenter();
function ActiveCenter(){
}

ActiveCenter.prototype.display = function(){
	//alert('ActiveCenter.prototype.displayActiveCenter');
	
	var divToDisplay = document.getElementById('gallery_image');
	var snapshotBlurb = document.getElementById('snapshotBlurb');
	
	divToDisplay.className = "display";
	snapshotBlurb.className = "display";
	
	// no need to show previous and next nav's as this is handled by the gallery
}

ActiveCenter.prototype.hide = function(){
	//alert('ActiveCenter.prototype.hideActiveCenter');
	
	var divToDisplay = document.getElementById('gallery_image');
	var snapshotBlurb = document.getElementById('snapshotBlurb');
	var nextNav = document.getElementById('next');
	var imageLabel = document.getElementById('imageLabel');
	var prevNav = document.getElementById('previous');
	
	divToDisplay.className = "hide";
	nextNav.className = "hide";
	imageLabel.className = "hide";
	prevNav.className = "hide";
	snapshotBlurb.className = "hide";
}


//OPENING IMAGE CLASS---------------------------------------------------------------------------------------------

var openingImageObject = new OpeningImage();
function OpeningImage(){			
}

OpeningImage.prototype.display = function(){
	//alert('OpeningImage.prototype.displayOpeningImage');
	var divToDisplay = document.getElementById('openingImage');
	divToDisplay.className = "display";
}

OpeningImage.prototype.hide = function(){
	//alert('OpeningImage.prototype.hideOpeningImage');
	var divToDisplay = document.getElementById('openingImage');
	divToDisplay.className = "hide";
}




































// THIS IS A PERSONAL EXAMPLE TO ILLUSTRATE USE OF PROTOTYPE

//var myArray = new Array();
//myArray[0] = 6;
//myArray[1] = 8;
//myArray[2] = 23;
//
//var length = myArray.length();
//var sum = myArray.sum();


//Array.prototype.length = function()
//{
//	//calc length
//}

//Array.prototype.sum = function()
//{
//	// Note: 'this' "means" myArray to the blueprint guys
//	
//	var total = 0;
//	
//	for (var i=0; i<this.length(); i++)
//	{
//		total = total + this[i]; // gets the value at the pigeon hole 'this[i]' and adds it to total
//		
//		//6 = 0 + this[0]; //i=0
//		//14 = 6 + this[1]; //i=1
//		//37 = 14 + this[2]; //i=2
//		
//	}
//	
//	return total;
//}

