
//****************************//
// ngc kids centre javascript //
//****************************//

// navigation mouseover images

button_home		= new Image();
button_wordsearch	= new Image();
button_crossword	= new Image();
button_hangman		= new Image();
button_ratp		= new Image();
button_comic		= new Image();
button_story		= new Image();

button_home.src		= "img/button_home_over.png";
button_wordsearch.src	= "img/button_wordsearch_over.png";
button_crossword.src	= "img/button_crossword_over.png";
button_hangman.src	= "img/button_hangman_over.png";
button_ratp.src		= "img/button_ratp_over.png";
button_comic.src	= "img/button_comic_over.png";
button_story.src	= "img/button_story_over.png";

//*****************************//
// anansi says string function //
//*****************************//

function anansi_says()
{
	// return random anansi says string

	// anansi says string array
	anansi =
	[
		"The National Gas Company (you can call it NGC if you like) buys, transports and sells natural gas.",
		"Natural gas is made up mainly of a gas called methane. A very small part of it is made up of other gases like pentane, butane, ethane and a few others. We found uses for those, too.",
		"Trinidad has 5 methanol plants and 8 ammonia plants! That makes this country the largest exporter of ammonia and methanol in the world! Wow!",
		"Greenhouse gases are making the Earth hotter, and that's bad for plants and animals. Using natural gas helps minimise the problem.",
		"Natural gas is cleaner, cheaper, safer and better for the environment than any other fuel. That's good news for you and me!",
		"Sometimes you can find oil and gas in the same place. Gas that is found with oil is called associated gas or wet gas. NGC removes the liquid from the gas and sells it.",
		"Your safety and the safety of the environment are the most important things to NGC!",
		"NGC's pipelines are buried at least 5 feet under the ground, for your safety.",
		"If there is a pipeline leak or rupture, do not start a car, turn on lights, use flashlights, candles or matches. Any spark can cause an explosion.",
		"Always obey safety signs. They are there to keep you from harm.",
		"Before digging on or near a Right of Way, always call NGC on 800-4GAS! That's 800-4227. Someone from NGC will come to tell you if it is safe to dig. And the service is free!",
		"A rupture can be causd by an earthquake or a landslide, or by people digging with machines. But don't be afraid if it happens. NGC always arrives as soon as possible to fix it.",
		"If there's a rupture, NGCs' customers may not always get the gas they need. And if the electricity company doesn't get enough gas, there can be blackouts. And that means no TV!",
		"NGC's lines have been in the ground for as long as 30 years, with almost no problems!",
		"In built-up areas, NGC adds something to the gas to give it a smell like rotten eggs. This way, when you smell it, you know there is a leak.",
		"Well, we hope you've had fun learning about pipeline safety! Remember; follow the rules, and you'll be just fine! Bye!"
	];

	return anansi[Math.floor(Math.random() * anansi.length)];
}

//************************//
// jump to comic function //
//************************//

function jump_to_comic(id)
{
	// double-digit string array
	nn =
	[
		"00", "01", "02", "03", "04", "05", "06", "07", "08", "09",
		"10", "11", "12", "13", "14", "15", "16", "17", "18", "19",
		"20", "21", "22", "23", "24", "25", "26", "27", "28", "29",
		"30", "31", "32", "33", "34", "35", "36", "37", "38", "39",
		"40", "41", "42", "43", "44", "45", "46", "47", "48", "49",
		"50", "51", "52", "53", "54", "55", "56", "57", "58", "59",
		"60", "61", "62", "63", "64"
	];

	location.href="comic" + nn[id + 1] + ".html#comic";
}

// functions to write scaled flash object depending on screen resolution

//******//
// menu //
//******//

function write_menu()
{
	var sw = screen.width;	// screen width
	var sh = screen.height;	// screen height
	var fw = 550;		// flash width
	var fh = 400;		// flash height

	// check screen resolution
	if (sw == 1152 && sh == 864)
	{
		fw = 1100;
		fh = 800;
	}
	else if (sw == 1280 && sh == 1024)
	{
		fw = 1100;
		fh = 800;
	}
	else if (sw == 1600 && sh == 1200)
	{
		fw = 1375;
		fh = 1000;
	}

	var s =	"<!-- text used in the movie-->" +
	/*	<!--Loading Menu
		Word Search PuzzleCrossword PuzzleHangman PuzzleRace Along the PipelineStoryComic
		NGC--> */
		"<OBJECT classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" " +
		"codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\" " +
		"WIDTH=\"" + fw + "\" " +
		"HEIGHT=\"" + fh + "\" " +
		"id=\"menu\" " +
		"ALIGN=\"middle\">" +
		"<PARAM NAME=\"movie\" VALUE=\"menu.swf\">" +
		"<PARAM NAME=\"quality\" VALUE=\"high\">" +
		"<PARAM NAME=\"bgcolor\" VALUE=\"#3D1378\">" +
		"<EMBED src=\"menu.swf\" " +
		"quality=\"high\" " +
		"bgcolor=\"#3D1378\" " +
		"WIDTH=\"" + fw + "\" " +
		"HEIGHT=\"" + fh + "\" " +
		"NAME=\"menu\" " +
		"ALIGN=\"middle\" " +
		"TYPE=\"application/x-shockwave-flash\" " +
		"PLUGINSPAGE=\"http://www.macromedia.com/go/getflashplayer\">" +
		"</EMBED>" +
		"</OBJECT>";

	document.write(s);
}

//************//
// wordsearch //
//************//

function write_wordsearch()
{
	var sw = screen.width;	// screen width
	var sh = screen.height;	// screen height
	var fw = 550;		// flash width
	var fh = 600;		// flash height

	// check screen resolution
	if (sw == 1152 && sh == 864)
	{
		fw = 733;
		fh = 800;
	}
	else if (sw == 1280 && sh == 1024)
	{
		fw = 939;
		fh = 1024;
	}
	else if (sw == 1600 && sh == 1200)
	{
		fw = 1100;
		fh = 1200;
	}

	var s =	"<!-- text used in the movie-->" +
	/*	"<!--Loading Word Search
		WORD SEARCHInstructions:CONGRATULATIONS, YOU WIN !!!-->" */
		"<OBJECT classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" " +
		"codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\" " +
		"WIDTH=\"" + fw + "\" " +
		"HEIGHT=\"" + fh + "\" " +
		"id=\"wordsearch\" " +
		"ALIGN=\"middle\">" +
		"<PARAM NAME=\"movie\" VALUE=\"wordsearch.swf\">" +
		"<PARAM NAME=\"quality\" VALUE=\"high\">" +
		"<PARAM NAME=\"bgcolor\" VALUE=\"#3D1378\">" +
		"<EMBED src=\"wordsearch.swf\" " +
		"quality=\"high\" " +
		"bgcolor=\"#3D1378\" " +
		"WIDTH=\"" + fw + "\" " +
		"HEIGHT=\"" + fh + "\" " +
		"NAME=\"wordsearch\" " +
		"ALIGN=\"middle\" " +
		"TYPE=\"application/x-shockwave-flash\" " +
		"PLUGINSPAGE=\"http://www.macromedia.com/go/getflashplayer\">" +
		"</EMBED>" +
		"</OBJECT>";

	document.write(s);
}

//***********//
// crossword //
//***********//

function write_crossword()
{
	var sw = screen.width;	// screen width
	var sh = screen.height;	// screen height
	var fw = 550;		// flash width
	var fh = 600;		// flash height

	// check screen resolution
	if (sw == 1152 && sh == 864)
	{
		fw = 733;
		fh = 800;
	}
	else if (sw == 1280 && sh == 1024)
	{
		fw = 939;
		fh = 1024;
	}
	else if (sw == 1600 && sh == 1200)
	{
		fw = 1100;
		fh = 1200;
	}

	var s =	"<!-- text used in the movie-->" +
	/*	"<!--Loading Crossword
		CROSSWORD PUZZLECONGRATULATIONS, YOU WIN !!!-->" */
		"<OBJECT classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" " +
		"codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\" " +
		"WIDTH=\"" + fw + "\" " +
		"HEIGHT=\"" + fh + "\" " +
		"id=\"crossword\" " +
		"ALIGN=\"middle\">" +
		"<PARAM NAME=\"movie\" VALUE=\"crossword.swf\">" +
		"<PARAM NAME=\"quality\" VALUE=\"high\">" +
		"<PARAM NAME=\"bgcolor\" VALUE=\"#3D1378\">" +
		"<EMBED src=\"crossword.swf\" " +
		"quality=\"high\" " +
		"bgcolor=\"#3D1378\" " +
		"WIDTH=\"" + fw + "\" " +
		"HEIGHT=\"" + fh + "\" " +
		"NAME=\"crossword\" " +
		"ALIGN=\"middle\" " +
		"TYPE=\"application/x-shockwave-flash\" " +
		"PLUGINSPAGE=\"http://www.macromedia.com/go/getflashplayer\">" +
		"</EMBED>" +
		"</OBJECT>";

	document.write(s);
}

//*********//
// hangman //
//*********//

function write_hangman()
{
	var sw = screen.width;	// screen width
	var sh = screen.height;	// screen height
	var fw = 352;		// flash width
	var fh = 400;		// flash height

	// check screen resolution
	if (sw == 1152 && sh == 864)
	{
		fw = 704;
		fh = 800;
	}
	else if (sw == 1280 && sh == 1024)
	{
		fw = 880;
		fh = 1000;
	}
	else if (sw == 1600 && sh == 1200)
	{
		fw = 1056;
		fh = 1200;
	}

	var s =	"<!-- text used in the movie-->" +
	/*	"<!--Loading Hangman
		Loading Words
		<no hint>-->" */
		"<OBJECT classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" " +
		"codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\" " +
		"WIDTH=\"" + fw + "\" " +
		"HEIGHT=\"" + fh + "\" " +
		"id=\"hangman\" " +
		"ALIGN=\"midde\"> " +
		"<PARAM NAME=\"movie\" VALUE=\"hangman.swf\">" +
		"<PARAM NAME=\"quality\" VALUE=high>" +
		"<PARAM NAME=\"bgcolor\" VALUE=#3D1378>" +
		"<EMBED src=\"hangman.swf\" " +
		"quality=\"high\" " +
		"bgcolor=\"#3D1378\" " +
		"WIDTH=\"" + fw + "\" " +
		"HEIGHT=\"" + fh + "\" " +
		"NAME=\"hangman\" " +
		"ALIGN=\"middle\" " +
		"TYPE=\"application/x-shockwave-flash\" " +
		"PLUGINSPAGE=\"http://www.macromedia.com/go/getflashplayer\">" +
		"</EMBED>" +
		"</OBJECT>";

	document.write(s);
}

//*************************//
// race along the pipeline //
//*************************//

function write_ratp()
{
	var sw = screen.width;	// screen width
	var sh = screen.height;	// screen height
	var fw = 550;		// flash width
	var fh = 400;		// flash height

	// check screen resolution
	if (sw == 1152 && sh == 864)
	{
		fw = 1100;
		fh = 800;
	}
	else if (sw == 1280 && sh == 1024)
	{
		fw = 1100;
		fh = 800;
	}
	else if (sw == 1600 && sh == 1200)
	{
		fw = 1375;
		fh = 1000;
	}

	var s =	"<!-- text used in the movie-->" +
	/*	"<!--!WARNINGRACE ALONG THE PIPELINE
		00:00:00Instructions: Click on character for a question.-->" */
		"<OBJECT classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" " +
		"codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\" " +
		"WIDTH=\"" + fw + "\" " +
		"HEIGHT=\"" + fh + "\" " +
		"id=\"ratp\" " +
		"ALIGN=\"middle\">" +
		"<PARAM NAME=\"movie\" VALUE=\"ratp.swf\">" +
		"<PARAM NAME=\"quality\" VALUE=\"high\">" +
		"<PARAM NAME=\"bgcolor\" VALUE=\"#3D1378\">" +
		"<EMBED src=\"ratp.swf\" " +
		"quality=\"high\" " +
		"bgcolor=\"#3D1378\" " +
		"WIDTH=\"" + fw + "\" " +
		"HEIGHT=\"" + fh + "\" " +
		"NAME=\"ratp\" " +
		"ALIGN=\"middle\" " +
		"TYPE=\"application/x-shockwave-flash\" " +
		"PLUGINSPAGE=\"http://www.macromedia.com/go/getflashplayer\">" +
		"</EMBED>" +
		"</OBJECT>";

	document.write(s);
}

//*******************//
// interactive story //
//*******************//

function write_story()
{
	var sw = screen.width;	// screen width
	var sh = screen.height;	// screen height
	var fw = 300;		// flash width
	var fh = 346;		// flash height

	// check screen resolution
	if (sw == 1152 && sh == 864)
	{
		fw = 540;
		fh = 623;
	}
	else if (sw == 1280 && sh == 1024)
	{
		fw = 600;
		fh = 738;
	}
	else if (sw == 1600 && sh == 1200)
	{
		fw = 750;
		fh = 865;
	}

	var s =	"<!-- text used in the movie-->" +
	/*	"<!--Please wait while loading...-->" */
		"<OBJECT classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" " +
		"codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\" " +
		"WIDTH=\"" + fw + "\" " +
		"HEIGHT=\"" + fh + "\" " +
		"id=\"interactive_story\" " +
		"ALIGN=\"middle\">" +
		"<PARAM NAME=\"movie\" VALUE=\"interactive_story.swf\">" +
		"<PARAM NAME=\"quality\" VALUE=\"high\">" +
		"<PARAM NAME=\"bgcolor\" VALUE=\"#3D1378\">" +
		"<EMBED src=\"interactive_story.swf\" " +
		"quality=\"high\" " +
		"bgcolor=\"#3D1378\" " +
		"WIDTH=\"" + fw + "\" " +
		"HEIGHT=\"" + fh + "\" " +
		"NAME=\"interactive_story\" " +
		"ALIGN=\"middle\" " +
		"TYPE=\"application/x-shockwave-flash\" " +
		"PLUGINSPAGE=\"http://www.macromedia.com/go/getflashplayer\">" +
		"</EMBED>" +
		"</OBJECT>";

	document.write(s);
}
