siteList = [];
siteList["animal_shelter"]="Animal Shelter	The Elwood City Animal Shelter is a great place to get a pet. Perky (Pal's mom) is from here, as is Nemo, Francine's cat. If you ever move to Elwood City and would like a pet, you know where to go!";
siteList["arthur_house"]="Arthur's House	The only home Arthur, D.W., Baby Kate, and Pal have ever known! Located at 562 Main Street, the Read house is also the home of the Annual Read Family Reunion. D.W. and Kate share a room, but Arthur has his very own. Mr. Read makes his catering creations - like wedding cakes and cranberry puree crumble - in the garage.";
siteList["baseball_field"]="School Baseball Field	Where the gang plays softball. This is where Francine decided that her nice clean clothes should not keep her from playing her best. This is also where Brain hit a home run, proving that Friday the 13th wasn't an unlucky day after all.";
siteList["binky_house"]="Binky's House	Binky lives here with his mom and dad. He loves sports, so there's lots of equipment lying around, including his dance shoes. Binky also plays clarinet, and thinks his bedroom has perfect acoustics for practicing. The one thing in his bedroom you might not expect? A nightlight. It helps him sleep, and he doesn't care who knows it!";
siteList["brain_house"]="Brain's House	Brain's house LOOKS like a regular house, but who knows? Knowing Brain, there may be an entire secret laboratory behind the clothes in his closet. Why does Brain love his house so much? Because it's halfway between two of his favorite places: his school and the library! Just perfect for the boy voted \"Most Likely to Build a Giant Robot.\"";
siteList["buster_condo"]="Buster's Condo	Here's where Buster lives with his mom, Bitzi. (Buster's dad Bo, a pilot, does not live with them since he and Bitzi got divorced.) Buster keeps his famous food collection in his room. The living room is the site of Bionic Bunny TV show watching, and sleepovers with Arthur.";
siteList["community_garden"]="Community Garden	The Community Garden is a great place to learn, and it definitely helps bring people together. This is where Buster learned all about growing his own vegetables from Fritz Langley, the keeper of the garden. If you have any questions about carrots, beans, or tomatoes, just ask Buster!";
siteList["crosswire_motors"]="Crosswire Motors	Here's where Muffy's dad makes all that money. Need a new car? A used car? Then come on down to Crosswire Motors! And you can see where Coach Crosswire gets his ideas for soccer drills like the \"Shock Absorber.\"";
siteList["elwood_city_dump"]="The Elwood City Dump	Francine's dad's workplace! Arthur cut his knee here when he snuck in, and Francine got a bike from her dad that he pieced together from recycled parts found here. Francine gained a new respect for her dad's job after a school field trip when all the kids had lots of fun on a playground that Mr. Frensky built!";
siteList["fern_house"]="Fern's House	A huge mystery fan, Fern wishes her house had more hidden doorways - or even just one, actually. But there's plenty of room for all of her mystery books, so she loves it anyway. And who knows? Maybe one day she'll find that secret passage after all!";
siteList["francine_apartment"]="Francine's Apartment	Francine lives with her dad, her mom, and her sister Catherine. Francine shares a bedroom with Catherine (which can be hard sometimes), but she LOVES the fact that there's space for her to practice drums up on the roof! (Her neighbors? Not so much.) The only improvement Francine can think of: an indoor sports arena!";
siteList["george_house"]="George's House	This is where George lives with his mom and dad... and Wally. Okay, technically Wally is a ventriloquist's dummy (a giraffe, to be exact) but he does have a big personality!";
siteList["grandma_thora_house"]="Grandma Thora's House	Grandma Thora's house is often full of the smell of fresh-baked treats. Unfortunately, in her case, the \"treats\" taste terrible! (She's not a very good cook.) But she means well, and aside from the cooking thing is a loving grandmother who helps her grandkids whenever and however she can. (She also plays a mean game of marbles!)";
siteList["hospital"]="Hospital	Arthur, D.W., and Baby Kate were all born here. This is where Arthur got his tetanus shot after his accident at the dump, where Buster gets his asthma medication, where Binky's peanut allergy was confirmed, and where D.W. had her ear operation. Whenever anyone in Elwood City needs help, the hospital is there. ";
siteList["ice_cream_shop"]="Ice Cream Shop	Even though the Sugar Bowl is THE place to be, there's another important dessert place in town: the Ice Cream Shop! It's run by Brain's family, and he often chips in, scooping ice cream and coming up with new flavors, like Calamari Crunch. As Brain says (Buster, too, come to think of it), a town can never have too many ice cream places! ";
siteList["jacks_joke_shop"]="Jack's Joke Shop	Elwood City would just not be Elwood City without Jack's Joke Shop. Buster, who can't resist a good prank, is one of Jack's best customers. Buster worked there for a while, and the owner began selling \"Buster's Clusters,\" the horrible-tasting chocolates handmade by Buster himself! ";
siteList["lakewood_elementary"]="Lakewood Elementary School	Arthur's school! Arthur, Buster, Francine, Sue Ellen, Binky (repeating third grade), Brain, Muffy, Fern, Jenna, and George are all in Mr. Ratburn's class. Prunella is in the fourth grade. ";
siteList["library"]="Library	Having fun isn't hard when you've got your library card! A place to check out the latest \"Henry Screever\" or \"Scare Your Pants Off\" book, the Elwood City Public Library has something for everyone. Ms. Paige Turner, the librarian, is there to help kids find what they need. (But even she couldn't help Francine and Arthur who got locked in one night.)";
siteList["loring_cinema"]="Loring Cinema	When the latest Dark Bunny movie premieres, there's only one place to go: Loring Cinema. Sure the popcorn is expensive, and it's sometimes hard to find a seat, but there's no place else to enjoy 50-foot-tall superheroes doing superhero things!";
siteList["marina_house"]="Marina's House	Marina lives here with her mom, and she loves her house. Marina is blind, so she and her mom make sure the floor is kept neat, and that things are always put back where they belong. Otherwise it's like anyone else's house, with plenty of room for Marina and Prunella to practice yoga or play \"Henry Screever\" characters together.";
siteList["mill_creek_mall"]="Mill Creek Mall	This is the gang's local mall. They don't hang out here (that's what the Sugar Bowl is for) but they DO buy their clothes and school supplies here - not to mention Woogles! This is also where Arthur admired a new piano, and where D.W. thinks babies come from.";
siteList["mr_ratburn_house"]="Mr. Ratburn's House	Do teachers exist outside of school? Apparently! Here's where Mr. Ratburn lives... except for the time snow collapsed his roof and he moved in with Arthur. As you walk by Mr. Ratburn's house, you can almost smell the tough quiz questions being written!";
siteList["muffy_house"]="Muffy's House	Muffy's house has 20 rooms, a huge yard, a pool, and a butler. But even though it's bigger than her friends' houses, Muffy doesn't like to talk about it. (Oh, who are we kidding. Muffy LOVES to talk about it!)";
siteList["playground"]="School Playground	Recess! Here's where the gang takes a break from the pressures of Mr. Ratburn's classroom. Muffy faced off against the Tough Customers here. It's also the scene of the famous \"Who needs boys?! Who needs girls?!\" tug-of-war contest.";
siteList["prunella_house"]="Prunella's House	Prunella lives here with her mom and her older sister Rubella. Prunella - who enjoys things like crystal balls, yoga, pyramids, and tarot cards - thinks her house has perfect \"feng shui.\" That means Prunella likes the way everything in the house is set up: very relaxing!";
siteList["science_museum"]="Science Museum/ Exploratorium	One of Mr. Ratburn's \"Top Five Learning Locations in Elwood City,\" the Science Museum & Exploratorium is a fun day trip. This is where Binky fell asleep and dreamed about traveling into the future. And Arthur brought D.W. here so she'd stop teaching other kids bad science (like the \"H\" in H2O standing for \"hose\")";
siteList["sue_ellen_house"]="Sue Ellen's House	She's lived all over the world, but Sue Ellen's parents have now settled here in Elwood City! Her house is decorated with all sorts of things from their travels: art, African masks, and other items from the four corners of the earth. Sue Ellen sometimes misses traveling, but Elwood City is very welcoming, and she's happy to call it home.";
siteList["sugar_bowl"]="The Sugar Bowl	The home of great desserts and great company. If Buster's having troubles, he comes here to drown his sorrows in milkshakes - which go perfectly with the Harry Mills Meatball Experience. The gang always meets here, just to hang out, or for important discussions like who has the best story-writing idea to send to the \"Andy and Company Show.\"";
siteList["tibble_house"]="The Tibbles' House	This is where Timmy and Tommy Tibble live with their grandmother. Even though the twins spend a lot of time here, the house is still standing! (The Tibbles are very destructive, as you know...)";
siteList["tree_house"]="The Tree House	More private than the Sugar Bowl, the tree house gets a lot of use as a gathering spot. Want to read comics in peace? Planning to start a secret club? Or, most importantly, need to get away from D.W.? Then climb the wooden slats to your own private palace in the sky!";
siteList["zoom_out"]="Click To Zoom Out	";

/////////  //////////  /////////  ////////// 

function init() {
	var iconList = document.getElementsByClassName("icon");
	var starList = document.getElementsByClassName("star");
	var quadList = document.getElementsByClassName("quad");
		
	for (var i = 0; i<iconList.length; i++) {	
		var thisID = iconList[i].id;		
		var thisA = document.getElementById(thisID).getElementsByTagName("a")[0];
	
		thisA.onmouseover = function(){	getInfo(this, 'blurb'); return false;}
		thisA.onmouseout = function(){clearInfo('icon'); return false;}
		thisA.onclick = function(){getInfo(this); return false;}
		
	}

	for (var i = 0; i<starList.length; i++) {	
		var thisID = starList[i].id;
		var thisA = document.getElementById(thisID).getElementsByTagName("a")[0];
	
		thisA.onmouseover = function(){	getInfo(this, 'blurb'); return false;}
		thisA.onmouseout = function(){clearInfo('star'); return false;}
		thisA.onclick = function(){getInfo(this); return false;}
		
// 		document.getElementById(thisID).getElementsByTagName("a")[0].setAttribute('onmouseover', 'getInfo(parentNode.id, \'blurb\'); return false;');
// 		document.getElementById(thisID).getElementsByTagName("a")[0].setAttribute('onmouseout', 'clearInfo(); return false;');
// 		document.getElementById(thisID).getElementsByTagName("a")[0].setAttribute('onclick', 'getInfo(parentNode.id); return false;');
	}

	for (var i = 0; i<quadList.length; i++) {	
	
		var thisID = quadList[i].id;
		var thisA = document.getElementById(thisID).getElementsByTagName("a")[0];
	
		thisA.onmouseover = function(){	highlight(this, 'on'); return false;}
		thisA.onmouseout = function(){highlight(this); return false;}
		thisA.onclick = function(){highlight(this); zoomIn(this); return false;}
			
		//thisA.setAttribute('onclick', 'zoomIn(parentNode.id); return false;');
		//thisA.setAttribute('onmouseover', 'highlight(parentNode.id, \'on\'); return false;');
		//thisA.setAttribute('onmouseout', 'highlight(parentNode.id); return false;');
//		thisA.onclick = function() {alert(this.parentNode.id);}
	}
	
}

/////////  //////////  /////////  ////////// 

function highlight(thisQuad, flip) {

	if (flip == 'on') {
		thisQuad.style.borderColor = 'red';
		thisQuad.style.borderWidth = '5px';
		thisQuad.style.borderStyle = 'solid';
		document.getElementById('info').innerHTML ="Click To Zoom In";
	}
	else {
		thisQuad.style.borderStyle = 'none';		
		clearInfo();
	}
	
}

/////////  //////////  /////////  ////////// 

function zoomIn(thisQuad){
	document.getElementById('map').style.display = 'none';
	document.getElementById('map-' + thisQuad.parentNode.id).style.display = 'block';
	
	// activate zoom out button
	document.getElementById('zoom_out').style.backgroundImage='url(images/btn_zoom_out.gif)';	
	document.getElementById('zoom_out').innerHTML = '<a href="#" onclick="zoomOut(); return false;" onmouseover="rollOver(parentNode.id, \'btn\'), getInfo(this, \'blurb\'); return false;" onmouseout="rollOut(parentNode.id, \'btn\'), clearInfo(\'zoom\'); return false;"><i>zoom out</i></a>';

	var toID = setTimeout(clearInfo, 100, 'zoom');
	
}

/////////  //////////  /////////  ////////// 

function zoomOut(){

	// show the main map
	document.getElementById('map').style.display = 'block';
	document.getElementById('pop-up').style.display = 'none';
	
	clearInfo();
	
	// hide quadrants
	for (var i = 1; i<=4; i++) {
		highlight(document.getElementById('q' + i));
		document.getElementById('map-q' + i).style.display = 'none';
	}
	
	// de-activate zoom out button
	document.getElementById('zoom_out').style.backgroundImage='url(images/btn_zoom_out_off.gif)';	
	document.getElementById('zoom_out').innerHTML = "<i>zoom out</i>";

	
}

/////////  //////////  /////////  ////////// 

function rollOver(thisID,type) {
	document.getElementById(thisID).style.backgroundImage='url(images/' + type + '_'+ thisID + '_ovr.gif)';		
}

/////////  //////////  /////////  ////////// 

function rollOut(thisID, type) {
	document.getElementById(thisID).style.backgroundImage='url(images/' + type + '_'+ thisID + '.gif)';		
}

/////////  //////////  /////////  ////////// 

function clearInfo(context) {

	if (context == 'icon' || context == 'star' || context == 'zoom') {
		document.getElementById('info').innerHTML = 'Click On Stars And Faces To Learn More!';
	}
	else {
	document.getElementById('info').innerHTML ="";
	
	}

	
}

/////////  //////////  /////////  ////////// 

function getInfo(thisSpot, context) {
	var tmp = siteList[thisSpot.parentNode.id];
	var nodes = tmp.split("\t");
	var heading = nodes[0];
	var text = nodes[1];	
	
	if (context == 'blurb') {
		document.getElementById('info').innerHTML = heading;
	}
	else {
		clearInfo();
		document.getElementById('pop-up').style.display = 'block';
		document.getElementById('content-i').innerHTML = '<img src="images/img_' + thisSpot.parentNode.id + '.jpg" alt="' + heading +'">';
		document.getElementById('content-h').innerHTML = heading;
		document.getElementById('content-p').innerHTML = text;
	}

}

/////////  //////////  /////////  ////////// 

document.getElementsByClassName = function(cl) {
	 var retnode = [];
	 var myclass = new  RegExp('\\b'+cl+'\\b');
	 var elem = this.getElementsByTagName('*');
	 for (var i = 0; i < elem.length; i++) {
	 var classes = elem[i].className;
	 if (myclass.test(classes))  retnode.push(elem[i]);
	 }
	 return retnode;
 };
 
/////////  //////////  /////////  ////////// 

window.onload = init;


 
