// -----------------------------------------------------------------------------
// Title: /common/class_dbHelper_v4.asp
// Date: 13/11/2009
// Author: Simon Keefe
// -----------------------------------------------------------------------------


		//Sets the page to show the Emu details onload.
		function fnZoobeebiesLoad(){
			
			//Get URL String
			var CurrentURL =document.location.href;
			
			if(CurrentURL.indexOf('B43C4B53') != '-1' || CurrentURL.indexOf('CBeebies') == "-1"){
				// Show "Meet Gabe" sub heading and hide the space for details.
				document.getElementById('AnimalFacts').style.backgroundImage = "url(images/zoobeebiesNEW/GabeFactsBackground.gif)";
				document.getElementById('AnimalTitle').style.display = "none";
				document.getElementById('FactList').style.display = "none";
				document.getElementById('GabeFacts').style.display = "block"
			}
			else{
				document.getElementById('AnimalFacts').style.backgroundImage = "url(images/zoobeebiesNEW/AnimalFactsBackground.gif)";
				document.getElementById('AnimalTitle').style.display = "block";
				document.getElementById('FactList').style.display = "block";
				document.getElementById('GabeFacts').style.display = "none";
				
				//Get hash code.
				var StartOfHash = CurrentURL.indexOf("#/CBeebies/") + 11;
				var EndOfHash = StartOfHash + 8;
				
				var hash = CurrentURL.slice(StartOfHash,EndOfHash);

				fnSwitchContent("##"+hash+"##");
			}
		}

		//Switches the colour of the span the mouse is over.;
		function fnRollOff(AnimalItem){
			if (document.getElementById(AnimalItem).className != "Selected"){
				document.getElementById(AnimalItem).style.color = "#000000";
			}
		}
		
		//Switches the colour back on mouse off.
		function fnRollOver(ListItem){
			document.getElementById(ListItem).style.color = "#580f8b";
		}
		
		//Switches the content to display information about the selected animal.
		function fnSwitchContent(Animal) {
			
			//Ensures the "GabeFacts" paragraph is NOT displayed.
			document.getElementById('GabeFacts').style.display = "none";
			
			//Links the hash code to the animal.
			var FunctionVariable = Animal;
			var Animal
			if (FunctionVariable.charAt(0)=="#" && FunctionVariable.charAt(1)=="#" && FunctionVariable.charAt(10)=="#" && FunctionVariable.charAt(11)=="#"){
				//Remove hashes
				FunctionVariable= FunctionVariable.replace("#","")
				FunctionVariable= FunctionVariable.replace("#","")
				FunctionVariable= FunctionVariable.replace("#","")
				FunctionVariable= FunctionVariable.replace("#","")
				
				//Get animal identifier
				switch(FunctionVariable){
					case "7996EAB1":
						Animal = "BlueTongueLizard"
					break;
					case "D26BD840":
					  Animal = "Emu"
					break;
					case "005F8703":
					  Animal = "StickInsect"
					break;
					case "DBA87142":
					  Animal = "RedKangaroo"
					break;
					case "5F64BF7A":
					  Animal = "Goat"
					break;
					case "445E943C":
					  Animal = "Goat"
					break;
					case "17C48A0F":
					  Animal = "AfricanElephant"
					break;
					case "28BE66AE":
					  Animal = "Zebra"
					break;
					case "94DA7E47":
					  Animal = "Camel"
					break;
					case "20ABF669":
					  Animal = "Tiger"
					break;
					case "8F705552":
					  Animal = "Hippotomus"
					break;
					case "3BCBCCF0":
					  Animal = "WorkingDog"
					break;
					case "0C61AA2C":
					  Animal = "GreenTreeFrog"
					break;
					case "011DECFE":
					  Animal = "Bandicoot"
					break;
				}
			}
			
			//Ensures the title and fact list is showing.
			document.getElementById('AnimalFacts').style.backgroundImage = "url(images/zoobeebiesNEW/AnimalFactsBackground.gif)";
			document.getElementById('AnimalTitle').style.display = "block";
			document.getElementById('FactList').style.display = "block";
			
			//Change CSS Class
			var VideoLinks = document.getElementById("VideoLinks");			
			var AnimalItem = new Array
			AnimalItems = (VideoLinks.getElementsByTagName("a"));
						
			var i = 0;
			
			//Clear class names.
			while (i < AnimalItems.length){
				var IndividualAnimal = document.getElementById(AnimalItems[i].getAttribute("id"));
				IndividualAnimal = document.getElementById(IndividualAnimal.getAttribute("id"));
				if (IndividualAnimal.className == "Selected"){
					IndividualAnimal.className = ""
					document.getElementById(IndividualAnimal.getAttribute("id")).style.color = "#000000";
				}
			i++;
			}

			var j = 0;
			
			//Sets the selected class name.
			while (j < AnimalItems.length){
				var IndividualAnimal = document.getElementById(AnimalItems[j].getAttribute("id"));				
				if (IndividualAnimal.getAttribute("id") == Animal){
					IndividualAnimal.className = "Selected"
				}
				j++;
			}
			
			
/* ---------------------------------------- DATA -------------------------------------------- */
	
			var EmuData = new Array(6);
			EmuData['Title'] = "Emu";
			EmuData['Fact1'] = "run extremely fast";
			EmuData['Fact2'] = "have wings but can not fly";
			EmuData['Fact3'] = "have three toes";
			EmuData['Fact4'] = "are one of Australia's biggest birds";
			EmuData['Fact5'] = "eat fruit, leaves, grasses and insects";
			
			var GoatData = new Array(6);
			GoatData['Title'] = "Goat";
			GoatData['Fact1'] = "produce milk like cows";
			GoatData['Fact2'] = "humans drink goats milk and use it to make cheese";
			GoatData['Fact3'] = "are very good jumpers and can jump quite high";
			GoatData['Fact4'] = "baby goats are called kids";
			GoatData['Fact5'] = "eat mainly grass and leaves"; 
			
			var KoalaData = new Array(6);
			KoalaData['Title'] = "Koala";
			KoalaData['Fact1'] = "eats gum leaves";
			KoalaData['Fact2'] = "Females Koalas have a pouch where they keep their babies";
			KoalaData['Fact3'] = "live and sleep in trees. Koalas can sleep up to 20 hours a day!";
			KoalaData['Fact4'] = "have two thumbs and three fingers on each hand";
			KoalaData['Fact5'] = "has long claws which it uses to grip";
			
			var BlueTongueLizardData = new Array(6);
			BlueTongueLizardData['Title'] = "Blue Tongue Lizard";
			BlueTongueLizardData['Fact1'] = "live in the bush and in back yards";
			BlueTongueLizardData['Fact2'] = "eat snails, spiders, insects and plants";
			BlueTongueLizardData['Fact3'] = "are only active on warm days and move very slowly";
			BlueTongueLizardData['Fact4'] = "have a blue tongue that they use to taste the air";
			BlueTongueLizardData['Fact5'] = "have a fat tail that is shorter than their body"; 
			
			var RedKangarooData = new Array(6);
			RedKangarooData['Title'] = "Red Kangaroo";
			RedKangarooData['Fact1'] = "eat grass";
			RedKangarooData['Fact2'] = "female kangaroos carry their joeys in their pouch";
			RedKangarooData['Fact3'] = "are very good jumpers and move by hopping";
			RedKangarooData['Fact4'] = "live in very dry Central Australia";
			RedKangarooData['Fact5'] = "have long strong legs that work like springs helping them hop";
			
			var StickInsectData = new Array(6);
			StickInsectData['Title'] = "Stick Insect";
			StickInsectData['Fact1'] = "live mostly in forests and grasslands";
			StickInsectData['Fact2'] = "look like leaves & sticks so other animals cannot see or eat them";
			StickInsectData['Fact3'] = "have six legs";
			StickInsectData['Fact4'] = "hidden under plants most of the day";
			StickInsectData['Fact5'] = "sense with their antennae, to find leaves and other stick insects";
			
			var WorkingDogData = new Array(6);
			WorkingDogData['Title'] = "Working Dog";
			WorkingDogData['Fact1'] = "used by farmers to move the sheep from paddock to paddock";
			WorkingDogData['Fact2'] = "are very fast runners";
			WorkingDogData['Fact3'] = "need lots of exercise every day";
			WorkingDogData['Fact4'] = "eat the same food as your pet dog at home, mostly meat and dog biscuits";
			WorkingDogData['Fact5'] = "love to cool down by swimming in the creek after rounding up the sheep";
			
			var GreenTreeFrogData = new Array(6);
			GreenTreeFrogData['Title'] = "Green Tree Frog";
			GreenTreeFrogData['Fact1'] = "eat insects, like flies and moths, catching them on their sticky tongues";
			GreenTreeFrogData['Fact2'] = "breathe through their skin";
			GreenTreeFrogData['Fact3'] = "are green so they blend in with plants and are not seen by animals";
			GreenTreeFrogData['Fact4'] = "use their legs to jump and hop around";
			GreenTreeFrogData['Fact5'] = "are amphibians - can live underwater as well as live on the land";
			
			var BandicootData = new Array(6);
			BandicootData['Title'] = "Bandicoot";
			BandicootData['Fact1'] = "looks like a rat, has a little pouch like a kangaroo and a long nose";
			BandicootData['Fact2'] = "eats insects, worms and fruit";
			BandicootData['Fact3'] = "live in the bush in holes underground called burrows";
			BandicootData['Fact4'] = "they give a little hop as they run";
			BandicootData['Fact5'] = "are good at digging holes to find things to eat";
			
			var AfricanElephantData = new Array(6);
			AfricanElephantData['Title'] = "African Elephant";
			AfricanElephantData['Fact1'] = "largest animal that lives on land";
			AfricanElephantData['Fact2'] = "live together in families called herds";
			AfricanElephantData['Fact3'] = "use their trunks to smell, and to put food into their mouths";
			AfricanElephantData['Fact4'] = "use their trunks to suck up water to drink or to spray it onto themselves to wash";
			AfricanElephantData['Fact5'] = "eat grass, leaves, bark and branches";
			
			var HippopotamusData = new Array(6);
			HippopotamusData['Title'] = "Hippopotamus/Hippo";
			HippopotamusData['Fact1'] = "hippo is short for hippopotomus";
			HippopotamusData['Fact2'] = "hippos love the water. They like being in the water to keep cool";
			HippopotamusData['Fact3'] = "very good swimmers and can spend up to 16 hours a day in water";
			HippopotamusData['Fact4'] = "hippos can hold their breath for a long time and they can swim underwater";
			HippopotamusData['Fact5'] = "hippos can swim when they are born";
			
			var ZebraData = new Array(6);
			ZebraData['Title'] = "Zebra";
			ZebraData['Fact1'] = "zebras are part of the horse family, that's why they look like horses";
			ZebraData['Fact2'] = "you might think zebras look the same but every zebra has different stripes";
			ZebraData['Fact3'] = "zebras are black with white stripes";
			ZebraData['Fact4'] = "can you think of any other animals that have stripes too?";
			ZebraData['Fact5'] = "live in herds and like to eat grass";

			var TigerData = new Array(6);
			TigerData['Title'] = "Sumatran Tiger";
			TigerData['Fact1'] = "tigers look like stripey cats. That's because they are from the cat family";
			TigerData['Fact2'] = "tigers are orange with black stripes";
			TigerData['Fact3'] = "all tigers look different - each one has stripes but not in the same places";
			TigerData['Fact4'] = "tigers have stripes to help them blend in so they can't be seen";
			TigerData['Fact5'] = "tigers are really good swimmers";

			var CamelData = new Array(6);
			CamelData['Title'] = "Camel";
			CamelData['Fact1'] = "live in the desert where it's dry";
			CamelData['Fact2'] = "their humps don't contain water - it's fat which they store for energy";
			CamelData['Fact3'] = "can walk for long distances without needing a drink";
			CamelData['Fact4'] = "camels were used by people to transport things through the desert";
			CamelData['Fact5'] = "are sometimes used in races";
		
			//Find elements to change.
			var AnimalHeading = document.getElementById('AnimalTitle');
			var Fact1 = document.getElementById('Fact1');
			var Fact2 = document.getElementById('Fact2');
			var Fact3 = document.getElementById('Fact3');
			var Fact4 = document.getElementById('Fact4');
			var Fact5 = document.getElementById('Fact5');
			
			//Switch content
		    switch(Animal) {				
		        case 'Emu':
					AnimalHeading.innerHTML = EmuData['Title']
					Fact1.innerHTML = EmuData['Fact1']
					Fact2.innerHTML = EmuData['Fact2']
					Fact3.innerHTML = EmuData['Fact3']
					Fact4.innerHTML = EmuData['Fact4']
					Fact5.innerHTML = EmuData['Fact5']
				break;
				case 'Goat':
					AnimalHeading.innerHTML = GoatData['Title']
					Fact1.innerHTML = GoatData['Fact1']
					Fact2.innerHTML = GoatData['Fact2']
					Fact3.innerHTML = GoatData['Fact3']
					Fact4.innerHTML = GoatData['Fact4']
					Fact5.innerHTML = GoatData['Fact5']
				break;
				case 'Koala':
					AnimalHeading.innerHTML = KoalaData['Title']
					Fact1.innerHTML = KoalaData['Fact1']
					Fact2.innerHTML = KoalaData['Fact2']
					Fact3.innerHTML = KoalaData['Fact3']
					Fact4.innerHTML = KoalaData['Fact4']
					Fact5.innerHTML = KoalaData['Fact5']
				break;
				case 'BlueTongueLizard':
					AnimalHeading.innerHTML = BlueTongueLizardData['Title']
					Fact1.innerHTML = BlueTongueLizardData['Fact1']
					Fact2.innerHTML = BlueTongueLizardData['Fact2']
					Fact3.innerHTML = BlueTongueLizardData['Fact3']
					Fact4.innerHTML = BlueTongueLizardData['Fact4']
					Fact5.innerHTML = BlueTongueLizardData['Fact5']
					Video = "test"
				break;
				case 'RedKangaroo':
					AnimalHeading.innerHTML = RedKangarooData['Title']
					Fact1.innerHTML = RedKangarooData['Fact1']
					Fact2.innerHTML = RedKangarooData['Fact2']
					Fact3.innerHTML = RedKangarooData['Fact3']
					Fact4.innerHTML = RedKangarooData['Fact4']
					Fact5.innerHTML = RedKangarooData['Fact5']
				break;
				case 'StickInsect':
					AnimalHeading.innerHTML = StickInsectData['Title']
					Fact1.innerHTML = StickInsectData['Fact1']
					Fact2.innerHTML = StickInsectData['Fact2']
					Fact3.innerHTML = StickInsectData['Fact3']
					Fact4.innerHTML = StickInsectData['Fact4']
					Fact5.innerHTML = StickInsectData['Fact5']
				break;
				case 'WorkingDog':
					AnimalHeading.innerHTML = WorkingDogData['Title']
					Fact1.innerHTML = WorkingDogData['Fact1']
					Fact2.innerHTML = WorkingDogData['Fact2']
					Fact3.innerHTML = WorkingDogData['Fact3']
					Fact4.innerHTML = WorkingDogData['Fact4']
					Fact5.innerHTML = WorkingDogData['Fact5']
				break;
				case 'GreenTreeFrog':
					AnimalHeading.innerHTML = GreenTreeFrogData['Title']
					Fact1.innerHTML = GreenTreeFrogData['Fact1']
					Fact2.innerHTML = GreenTreeFrogData['Fact2']
					Fact3.innerHTML = GreenTreeFrogData['Fact3']
					Fact4.innerHTML = GreenTreeFrogData['Fact4']
					Fact5.innerHTML = GreenTreeFrogData['Fact5']
				break;
				case 'Bandicoot':
					AnimalHeading.innerHTML = BandicootData['Title']
					Fact1.innerHTML = BandicootData['Fact1']
					Fact2.innerHTML = BandicootData['Fact2']
					Fact3.innerHTML = BandicootData['Fact3']
					Fact4.innerHTML = BandicootData['Fact4']
					Fact5.innerHTML = BandicootData['Fact5']
				break;
				case 'AfricanElephant':
					AnimalHeading.innerHTML = AfricanElephantData['Title']
					Fact1.innerHTML = AfricanElephantData['Fact1']
					Fact2.innerHTML = AfricanElephantData['Fact2']
					Fact3.innerHTML = AfricanElephantData['Fact3']
					Fact4.innerHTML = AfricanElephantData['Fact4']
					Fact5.innerHTML = AfricanElephantData['Fact5']
				break;
				case 'Hippopotamus':
					AnimalHeading.innerHTML = HippopotamusData['Title']
					Fact1.innerHTML = HippopotamusData['Fact1']
					Fact2.innerHTML = HippopotamusData['Fact2']
					Fact3.innerHTML = HippopotamusData['Fact3']
					Fact4.innerHTML = HippopotamusData['Fact4']
					Fact5.innerHTML = HippopotamusData['Fact5']
				break;
				case 'Zebra':
					AnimalHeading.innerHTML = ZebraData['Title']
					Fact1.innerHTML = ZebraData['Fact1']
					Fact2.innerHTML = ZebraData['Fact2']
					Fact3.innerHTML = ZebraData['Fact3']
					Fact4.innerHTML = ZebraData['Fact4']
					Fact5.innerHTML = ZebraData['Fact5']
				break;
				case 'Tiger':
					AnimalHeading.innerHTML = TigerData['Title']
					Fact1.innerHTML = TigerData['Fact1']
					Fact2.innerHTML = TigerData['Fact2']
					Fact3.innerHTML = TigerData['Fact3']
					Fact4.innerHTML = TigerData['Fact4']
					Fact5.innerHTML = TigerData['Fact5']
				break;
				case 'Camel':
					AnimalHeading.innerHTML = CamelData['Title']
					Fact1.innerHTML = CamelData['Fact1']
					Fact2.innerHTML = CamelData['Fact2']
					Fact3.innerHTML = CamelData['Fact3']
					Fact4.innerHTML = CamelData['Fact4']
					Fact5.innerHTML = CamelData['Fact5']
				break;				
            }
		}


/* --------------------------------------------------------------------------------------------------------------------------------------------------------- */


		
		// ---------------------------------------------------
		// Embed Flash Video Player
		// ---------------------------------------------------
		function embedVideoPlayer(flv, img, auto) {
			//alert("pic: "+img);
			var flashvars = {};
				flashvars.videoSRC = flv;
				flashvars.screenshotSRC = img;
				flashvars.autoStart = auto;
			var params = {};
				params.menu = "false";
				params.scale = "noscale";
				params.wmode = "transparent";
			var attributes = {};
				attributes.id = "VideoPlayer";
			swfobject.embedSWF("../flash/VideoPlayerYOU.swf?noCache="+Math.floor(Math.random()*999), "VideoPlayer", "640", "360", "9.0.0", "../flash/expressInstall2.swf", flashvars, params, attributes);	
		}
