/*******************************************************************************

FILE: mud_Scripts.js
REQUIRES: prototype-1.3.1.js
AUTHOR: Takashi Okamoto mud(tm) - http://www.mudcorp.com/
VERSION: 1.0 - initial public release
DATE: 12/21/2005

*******************************************************************************/

////////////////////////////////////////////////////////////////////////////////
// GLOBAL VARS

var selected = false;
var selectedSub = false;
var logo = new Image();
logo.src = "/images/logo.gif";
var logo_over = new Image();
logo_over.src = "/images/logo_over.gif";


////////////////////////////////////////////////////////////////////////////////
// FUNCTIONS

function selectMenu(id) {
	if (selected != id) {
		if (selected) {
			unselectMenu(selected);
		}
		$(id).className = "selected";
		Element.display(id+'-list');
		selected = id;
	}
	else {
		// just unselect
		unselectMenu(id);
	}
}

function unselectMenu(id) {
	// set id to unselected class
	$(id).className = "unselected";
	Element.hide(id+'-list');
	selected = false;
}

function selectSubMenu(id) {
	if (selectedSub != id) {
		if (selectedSub) {
			unselectSubMenu(selectedSub);
		}
		$(id).className = "selected";
		Element.display(id+'-list');
		selectedSub = id;
	}
	else unselectSubMenu(id);
}

function unselectSubMenu(id) {
	// set id to unselected class
	$(id).className = "unselected";
	Element.hide(id+'-list');
	selectedSub = false;
}

function title_over() {
	$('title_logo').src = logo_over.src;
}

function title_off() {
	$('title_logo').src = logo.src;
}

////////////////////////////////////////////////////////////////////////////////
// GLOBAL VARS

var imgs;
var imgsGallery = new Array();

////////////////////////////////////////////////////////////////////////////////
// MOUSE EVENTS

function setOnMouseClick() {
	var elements = document.getElementsByTagName("a");
	for (var i = 0; i < elements.length; i++) {
		switch(elements[i].className) {
			case "next":
				elements[i].onclick = function() {
					 imgs.move('next');
					 return false;
				}
				break;
			case "prev":
				elements[i].onclick = function() {
					 imgs.move('prev');
					 return false;
				}
				break;
		}
	}
}


////////////////////////////////////////////////////////////////////////////////
// INIT

function init() {
	setOnMouseClick();
	// images gallery

	imgsGallery[0] = new Object();
	imgsGallery[0].image = new Image();
	imgsGallery[0].image.src = "images/Feature/Belmont01.jpg";
	imgsGallery[0].title = "Belmont City College-Trade Training Centre (Construction To Be Completed End Of 2011)";
	imgsGallery[0].caption = "This project comprises of a new Hospitality Trade Training Centre, which incorporates a full commercial teaching kitchen environment for 16 students, associated storage, amenities, seminar room, and a restaurant for 80 patrons.";
	imgsGallery[0].caption2 = "The project draws from the landscape and turns it inside out, bringing the unifying element of the ceiling to float above all of the functional spaces within, creating an elegant gateway to the schools public interface.";
	
	imgsGallery[1] = new Object();
	imgsGallery[1].image = new Image();
	imgsGallery[1].image.src = "images/Feature/Belmont02.jpg";
	imgsGallery[1].title = "Belmont City College - Trade Training Centre (2010)";
	imgsGallery[1].caption = "This project comprises of a new Hospitality Trade Training Centre, which incorporates a full commercial teaching kitchen environment for 16 students, associated storage, amenities, seminar room, and a restaurant for 80 patrons.";
	imgsGallery[1].caption2 = "The project draws from the landscape and turns it inside out, bringing the unifying element of the ceiling to float above all of the functional spaces within, creating an elegant gateway to the schools public interface.";
	
// MudShiftContent(id, unitX, unitTotal)
	imgs = new MudShiftContent('imgs', imgsGallery);
	
	// set init
	if ($('imgs_title')) $('imgs_title').innerHTML = imgsGallery[0].title;
	if ($('imgs_caption')) $('imgs_caption').innerHTML = imgsGallery[0].caption;
	if ($('imgs_caption2')) $('imgs_caption2').innerHTML = imgsGallery[0].caption2;

}

////////////////////////////////////////////////////////////////////////////////
// EVENTS

Event.observe(window, 'load', init, false);
