function moveWindow (){window.location.hash="windowtop";}

function addEvent(elm, evType, fn, useCapture) {

	if (elm.addEventListener) {

		elm.addEventListener(evType, fn, useCapture);

		return true;

	} else if (elm.attachEvent) {

		var r = elm.attachEvent('on' + evType, fn);

		return r;

	} else {

		elm['on' + evType] = fn;

	}

}

function removeEvent(obj, evType, fn, useCapture){

  if (obj.removeEventListener){

    obj.removeEventListener(evType, fn, useCapture);

    return true;

  } else if (obj.detachEvent){

    var r = obj.detachEvent("on"+evType, fn);

    return r;

  } else {

    alert("Handler could not be removed");

  }

} 

function simplePreload() {

	var args = simplePreload.arguments;

	document.imageArray = new Array( args.length );

	for(var i = 0; i < args.length; i++ ) {

		document.imageArray[i] = new Image;

		document.imageArray[i].src = args[i];

	}

}



addEvent(window, 'load', init, false);



function init() {

	// Preload Images

	simplePreload('images/header_nav_01_home.png', 'images/header_nav_01_home_active.png');

	simplePreload('images/header_nav_02_leed_certification.png', 'images/header_nav_02_leed_certification_active.png');

	simplePreload('images/header_nav_03_about_gallatin.png','images/header_nav_03_about_gallatin_active.png');

	simplePreload('images/header_nav_04_contact.png', 'images/header_nav_04_contact_active.png');



	prepareNav();	

	

	// use SWFObject to embed default swf

	var so = new SWFObject("media/2008-11-10_01_lobby.swf", "pano", "1024", "327", "9", "#282828"); 

	so.addVariable("xml_file","media/2008-11-10_01_lobby.xml");

	so.addParam("allowFullScreen","true");

	so.addParam("allowScriptAccess","sameDomain");

	so.write("flashcontent");	

	

	// set pano_nav image to _active

	$('A_lobby').src = 'images/pano_nav_01_firstfloorlobby_active.png';

	// set panodesc to display:block;

	$('panodescription-a-lobby').style.display = 'block';

	

	// Assign pano link event handlers

	pano01 = $('pano01_firstfloorlobby');

	addEvent(pano01, 'click', pano01Click, false);

	pano01sticky01 = $('pano01sticky01_');
	addEvent(pano01sticky01, 'click', pano01sticky01Click, false);
	pano01sticky02 = $('pano01sticky02_');
	addEvent(pano01sticky02, 'click', pano01sticky02Click, false);
	pano01sticky03 = $('pano01sticky03_');
	addEvent(pano01sticky03, 'click', pano01sticky03Click, false);
	pano01sticky04 = $('pano01sticky04_');
	addEvent(pano01sticky04, 'click', pano01sticky04Click, false);


	

	pano03 = $('pano03_theater');

	addEvent(pano03, 'click', pano03Click, false);

	pano03sticky01 = $('pano03sticky01_');
	addEvent(pano03sticky01, 'click', pano03sticky01Click, false);
	pano03sticky02 = $('pano03sticky02_');
	addEvent(pano03sticky02, 'click', pano03sticky02Click, false);
	pano03sticky03 = $('pano03sticky03_');
	addEvent(pano03sticky03, 'click', pano03sticky03Click, false);



	theater = $('C_theater');

	addEvent(theater, 'mouseover', theaterOver, false);

	addEvent(theater, 'mouseout', theaterOut, false);



	pano02 = $('pano02_computer');

	addEvent(pano02, 'click', pano02Click, false);

	pano02sticky01 = $('pano02sticky01_');
	addEvent(pano02sticky01, 'click', pano02sticky01Click, false);
	pano02sticky02 = $('pano02sticky02_');
	addEvent(pano02sticky02, 'click', pano02sticky02Click, false);
	pano02sticky03 = $('pano02sticky03_');
	addEvent(pano02sticky03, 'click', pano02sticky03Click, false);

	computer = $('B_computer');

	addEvent(computer, 'mouseover', computerOver, false);

	addEvent(computer, 'mouseout', computerOut, false);



	pano04 = $('pano04_artlounge');

	addEvent(pano04, 'click', pano04Click, false);

	pano04sticky01 = $('pano04sticky01_');
	addEvent(pano04sticky01, 'click', pano04sticky01Click, false);
	pano04sticky02 = $('pano04sticky02_');
	addEvent(pano04sticky02, 'click', pano04sticky02Click, false);
	pano04sticky03 = $('pano04sticky03_');
	addEvent(pano04sticky03, 'click', pano04sticky03Click, false);

	artlounge = $('D_artlounge');

	addEvent(artlounge, 'mouseover', artloungeOver, false);

	addEvent(artlounge, 'mouseout', artloungeOut, false);



}



function prepareNav() {

	home = $('header_nav_01_home');

	addEvent(home, 'mouseover', homeOver, false);

	addEvent(home, 'mouseout', homeOut, false);

	leed = $('header_nav_02_leed_certification');

	addEvent(leed, 'mouseover', leedOver, false);

	addEvent(leed, 'mouseout', leedOut, false);

	gallatin = $('header_nav_03_about_gallatin');

	addEvent(gallatin, 'mouseover', gallatinOver, false);

	addEvent(gallatin, 'mouseout', gallatinOut, false);

	contact = $('header_nav_04_contact');

	addEvent(contact, 'mouseover', contactOver, false);

	addEvent(contact, 'mouseout', contactOut, false);

}



function bottomNavReset() {

	$('A_lobby').src = 'images/pano_nav_01_firstfloorlobby.png';

	$('C_theater').src = 'images/pano_nav_03_theater.png';

	$('B_computer').src = 'images/pano_nav_02_computer.png';

	$('D_artlounge').src = 'images/pano_nav_04_artlounge.png';

	lobby = $('A_lobby');

	addEvent(lobby, 'mouseover', lobbyOver, false);

	addEvent(lobby, 'mouseout', lobbyOut, false);

	theater = $('C_theater');

	addEvent(theater, 'mouseover', theaterOver, false);

	addEvent(theater, 'mouseout', theaterOut, false);

	computer = $('B_computer');

	addEvent(computer, 'mouseover', computerOver, false);

	addEvent(computer, 'mouseout', computerOut, false);

	artlounge = $('D_artlounge');

	addEvent(artlounge, 'mouseover', artloungeOver, false);

	addEvent(artlounge, 'mouseout', artloungeOut, false);

}



function descReset() {

	$('panodescription-a-lobby').style.display = 'none';

	$('panodescription-c-theater').style.display = 'none';

	$('panodescription-b-computer').style.display = 'none';

	$('panodescription-d-artlounge').style.display = 'none';

}





function homeOver() {

	home = $('header_nav_01_home');

	home.firstChild.src = 'images/header_nav_01_home_active.png';

}



function homeOut() {

	home = $('header_nav_01_home');

    home.firstChild.src = 'images/header_nav_01_home.png';

}



function leedOver() {

	leed = $('header_nav_02_leed_certification');

	leed.firstChild.src ='images/header_nav_02_leed_certification_active.png';

}



function leedOut() {

	leed = $('header_nav_02_leed_certification');

	leed.firstChild.src = 'images/header_nav_02_leed_certification.png';

}



function gallatinOver () {

	gallatin = $('header_nav_03_about_gallatin');

    gallatin.firstChild.src = 'images/header_nav_03_about_gallatin_active.png';

}



function gallatinOut() {

	gallatin = $('header_nav_03_about_gallatin');

    gallatin.firstChild.src = 'images/header_nav_03_about_gallatin.png';

}



function contactOver() {

	contact = $('header_nav_04_contact');

	contact.firstChild.src = 'images/header_nav_04_contact_active.png';

}



function contactOut() {

	contact = $('header_nav_04_contact');

	contact.firstChild.src = 'images/header_nav_04_contact.png';

}


function pano01Click() {

	bottomNavReset();

	lobby = $('A_lobby');

	removeEvent(lobby, 'mouseover', lobbyOver, false);

	removeEvent(lobby, 'mouseout', lobbyOut, false);

	$('A_lobby').src = 'images/pano_nav_01_firstfloorlobby_active.png';

	descReset();

	$('panodescription-a-lobby').style.display = 'block';

	window.document.pano.myidPanoExecute('pano.loadPano(panoName=media/2008-11-10_01_lobby&xml_file=media/2008-11-10_01_lobby.xml)');

}


function pano01sticky01Click() {
	
		window.document.pano.myidPanoExecute('pano.pan=-63.00,500,smooth');
		window.document.pano.myidPanoExecute('pano.tilt=-6.00,500,smooth');
		moveWindow();

}

function pano01sticky02Click() {
	
		window.document.pano.myidPanoExecute('pano.pan=16.00,500,smooth');
		window.document.pano.myidPanoExecute('pano.tilt=-2.00,500,smooth');
		moveWindow();
}

function pano01sticky03Click() {
	
		window.document.pano.myidPanoExecute('pano.pan=-39.00,500,smooth');
		window.document.pano.myidPanoExecute('pano.tilt=38.00,500,smooth');
		moveWindow();
}

function pano01sticky04Click() {
	
		window.document.pano.myidPanoExecute('pano.pan=122.00,500,smooth');
		window.document.pano.myidPanoExecute('pano.tilt=3.00,500,smooth');
		moveWindow();
}


function lobbyOver() {

	lobby = $('A_lobby');

	lobby.src = 'images/pano_nav_01_firstfloorlobby_active.png';

}



function lobbyOut() {

	lobby = $('A_lobby');

	lobby.src = 'images/pano_nav_01_firstfloorlobby.png';

}



function pano03Click() {

	bottomNavReset();

	theater = $('C_theater');

	removeEvent(theater, 'mouseover', theaterOver, false);

	removeEvent(theater, 'mouseout', theaterOut, false);	

	$('C_theater').src = 'images/pano_nav_03_theater_active.png';

	descReset();

	//Effect.Appear('panodescription-c-theater');

	$('panodescription-c-theater').style.display = 'block';

	window.document.pano.myidPanoExecute('pano.loadPano(panoName=media/2008-09-07_03_theater&xml_file=media/2008-09-07_03_theater.xml)');

}


function pano03sticky01Click() {
	
		window.document.pano.myidPanoExecute('pano.pan=43.00,500,smooth');
		window.document.pano.myidPanoExecute('pano.tilt=0.00,500,smooth');
		moveWindow();
}

function pano03sticky02Click() {
	
		window.document.pano.myidPanoExecute('pano.pan=-120.00,500,smooth');
		window.document.pano.myidPanoExecute('pano.tilt=-19.00,500,smooth');
		moveWindow();
}

function pano03sticky03Click() {
	
		window.document.pano.myidPanoExecute('pano.pan=-139.00,500,smooth');
		window.document.pano.myidPanoExecute('pano.tilt=64.00,500,smooth');
		moveWindow();
}



function theaterOver() {

	theater = $('C_theater');

	theater.src = 'images/pano_nav_03_theater_active.png';

}



function theaterOut() {

	theater = $('C_theater');

	theater.src = 'images/pano_nav_03_theater.png';

}



function pano02Click() {

	bottomNavReset();

	computer = $('B_computer');

	removeEvent(computer, 'mouseover', computerOver, false);

	removeEvent(computer, 'mouseout', computerOut, false);

	$('B_computer').src = 'images/pano_nav_02_computer_active.png';

	descReset();

	$('panodescription-b-computer').style.display = 'block';

	window.document.pano.myidPanoExecute('pano.loadPano(panoName=media/2008-09-07_02_computer&xml_file=media/2008-09-07_02_computer.xml)');

}


function pano02sticky01Click() {
	
		window.document.pano.myidPanoExecute('pano.pan=52.00,500,smooth');
		window.document.pano.myidPanoExecute('pano.tilt=-19.00,500,smooth');	
		moveWindow();
}

function pano02sticky02Click() {
	
		window.document.pano.myidPanoExecute('pano.pan=-150.00,500,smooth');
		window.document.pano.myidPanoExecute('pano.tilt=-11.00,500,smooth');		
		moveWindow();
}

function pano02sticky03Click() {
	
		window.document.pano.myidPanoExecute('pano.pan=-38.00,500,smooth');
		window.document.pano.myidPanoExecute('pano.tilt=-89.00,500,smooth');	
		moveWindow();
}



function computerOver() {

	computer = $('B_computer');

	computer.src = 'images/pano_nav_02_computer_active.png';

}



function computerOut() {

	computer = $('B_computer');

	computer.src = 'images/pano_nav_02_computer.png';

}



function pano04Click() {

	bottomNavReset();

	artlounge = $('D_artlounge');

	removeEvent(artlounge, 'mouseover', artloungeOver, false);

	removeEvent(artlounge, 'mouseout', artloungeOut, false);

	$('D_artlounge').src = 'images/pano_nav_04_artlounge_active.png';

	descReset();

	$('panodescription-d-artlounge').style.display = 'block';

	window.document.pano.myidPanoExecute('pano.loadPano(panoName=media/2008-09-07_04_artlounge&xml_file=media/2008-09-07_04_artlounge.xml)');

}


function pano04sticky01Click() {
	
		window.document.pano.myidPanoExecute('pano.pan=-66.00,500,smooth');
		window.document.pano.myidPanoExecute('pano.tilt=-3.00,500,smooth');
		moveWindow();
}

function pano04sticky02Click() {
	
		window.document.pano.myidPanoExecute('pano.pan=40,500,smooth');
		window.document.pano.myidPanoExecute('pano.tilt=43,500,smooth');
		moveWindow();
}

function pano04sticky03Click() {
	
		window.document.pano.myidPanoExecute('pano.pan=-144.00,500,smooth');
		window.document.pano.myidPanoExecute('pano.tilt=-6.00,500,smooth');
		moveWindow();
}



function artloungeOver() {

	artlounge = $('D_artlounge');

	artlounge.src = 'images/pano_nav_04_artlounge_active.png';

}



function artloungeOut() {

	artlounge = $('D_artlounge');

	artlounge.src = 'images/pano_nav_04_artlounge.png';

}



