window.name="main";

// Number of touts
var ToutCount = 21;
var ToutCounter = 1;

// Set initial variables
var toutLink = 1;

var speed = 4000;
var timer = "off";

//ToutTabs = new MakeImageArray(ToutCount);
var ToutImages = new MakeImageArray(ToutCount);
var ToutText = new Array(ToutCount);
var ToutCaption = new Array(ToutCount);
//ToutLinks = new Array(ToutCount);

// This function loads the images once the rest of the page has loaded and starts the cycling function.
// When new images are put in, change the file names here

function kickstart() {

	if (document.images) 
	{
// This is the first tout.
// It retrieves it from the src attribute of the img tag.

			ToutImages[1].src = "/activities/explorations/lizards/images/slideshow/intro.jpg";
			ToutCaption[1] = '';
			ToutText[1] = '<p><b>Think About This!</b><br />The earliest squamates lived about 200 million years ago, the same time that dinosaurs were starting to flourish. These early squamates shared similar characteristics. Over time, squamates evolved many different characteristics and ways of life. For example, some squamates lost their legs; one of these legless groups is called snakes.</p>';

			ToutImages[2].src = "/activities/explorations/lizards/images/slideshow/green_iguana1.jpg";
			ToutCaption[2] = '';
			ToutText[2] = '<p><b>Green Iguana<br /></b>You&rsquo;ll find most Green Iguanas lounging in tropical vegetation along streams. That&rsquo;s where they&rsquo;ll find a typical meal of leaves and fruit. They also eat insects, which they catch with their short, thick tongues.<br /><br />Green iguanas have strong digits and claws for moving in trees or over rocks, and long legs for stretching from branch to branch.</p>';

			ToutImages[3].src = "/activities/explorations/lizards/images/slideshow/rhino_iguana.jpg";
			ToutCaption[3] = '';
			ToutText[3] = '<p><b>Rhinoceros Iguana<br /></b>Rhinoceros Iguanas are found on a few Caribbean islands where they live mostly on cactus fruits, flowers, and other plants. They have short legs and spend their time on the ground. Rhinoceros Iguanas evolved in the West Indies with few natural predators. But introduced dogs, cats, and rats have made most modern species rare and endangered. </p>';

			ToutImages[4].src = "/activities/explorations/lizards/images/slideshow/frilled_lizard1.jpg";
			ToutCaption[4] = '';
			ToutText[4] = '<p><b>Frilled Lizard<br /></b>Without warning, a predator approaches an unsuspecting  Frilled Lizard. It&rsquo;s too late to run, but the lizard still has a chance.  Suddenly, it opens its mouth and hisses loudly. At the same instant, a colorful  spiked fan of skin opens like an umbrella around the lizard&rsquo;s head. This  &ldquo;frill&rdquo; makes the lizard look much larger and more intimidating. The  unexpected response startles the predator and gives the Frilled Lizard time to  escape.</p>';

			ToutImages[5].src = "/activities/explorations/lizards/images/slideshow/frilled_lizard2.jpg";
			ToutCaption[5] = '';
			ToutText[5] = '<p><b>Frilled Lizard<br /></b>This amazing ability gives the Frilled Lizard its name, but  it&rsquo;s not the lizard&rsquo;s only defense. Even though the frill is brightly colored,  the lizard&rsquo;s pointy scales are usually green or brown to blend in with the  forest background. On the ground, it sprints on its hind legs. Its long tail helps  it balance while on two legs. The Frilled Lizard also has strong claws to help  it climb through trees and over rocky surfaces. Frilled Lizards are prey to  larger reptiles including other lizards and snakes, birds of prey like ospreys and owls, and a few mammals like dingoes and feral cats.</p>';

			ToutImages[6].src = "/activities/explorations/lizards/images/slideshow/frilled_lizard3.jpg";
			ToutCaption[6] = '';
			ToutText[6] = '<p><b>Frilled Lizard<br /></b>Frilled Lizards spend lots of time in trees, but they&rsquo;ll  climb down to look for dinner. It&rsquo;s the only squamate that routinely runs on  its hind legs to capture prey. They catch mostly insects and spiders with their  short, thick tongues.</p>';

			ToutImages[7].src = "/activities/explorations/lizards/images/slideshow/veiled-chameleon2.jpg";
			ToutCaption[7] = '';
			ToutText[7] = '<p><b>Veiled Chameleon<br /></b>It&rsquo;s hard to spot a chameleon as it sits motionless among  the leaves. Its long tail curls around the slender branch as it holds itself  steady. The lizard keeps one eye focused on a predator on the ground, while the  other follows an insect buzzing nearby. In a flash, the chameleon&rsquo;s tongue  shoots out, stretching longer than its body. The tongue&rsquo;s sticky tip snaps up  the insect and the lizard whips it back into its mouth. The hunt is over in  less than a second.</p>';

			ToutImages[8].src = "/activities/explorations/lizards/images/slideshow/veiled-chameleon1.jpg";
			ToutCaption[8] = '';
			ToutText[8] = '<p><b>Veiled Chameleon<br /></b>Its tongue may be lightning fast, but the chameleon itself  is a slow mover. The chameleon walks from branch to branch with its thin legs and mitten-like feet, which have a strong opposable grip like human hands. It can  wrap its long curled tail around branches for extra support.</p>';

			ToutImages[9].src = "/activities/explorations/lizards/images/slideshow/veiled-chameleon3.jpg";
			ToutCaption[9] = '';
			ToutText[9] = '<p><b>Veiled Chameleon<br /></b>Chameleons are stealthy insect-eating  predators. But they&rsquo;re often prey too. Raptors, owls, monkeys, and snakes all  eat chameleons. One of the most amazing ways they avoid predators is their  remarkable capacity for color change, which helps them blend in with their surroundings.  They do this using a complex system involving hormones, nerves, and specialized  pigment cells in their skin. They take advantage of their ability to camouflage  by staying completely still to avoid being noticed. They also use color change  to communicate with each other.</p>';

			ToutImages[10].src = "/activities/explorations/lizards/images/slideshow/crested_gecko1.jpg";
			ToutCaption[10] = '';
			ToutText[10] = '<p><b>Crested Giant Gecko<br /></b>Ever seen a lizard walk upside down on the ceiling, or up a  glass window? For people living in the tropics, this isn&rsquo;t such an unusual  sight. They often see these lizards called geckos come out at night. The  secret to the gecko&rsquo;s amazing climbing ability is in their toes. </p>';

			ToutImages[11].src = "/activities/explorations/lizards/images/slideshow/crested_gecko1a.jpg";
			ToutCaption[11] = '';
			ToutText[11] = '<p><b>Crested Giant Gecko<br /></b>Like other geckos, they have specialized toe pads covered with millions of microscopic  hair-like projections. These &ldquo;hairs&rdquo; create a remarkably strong attractive  force that allows the entire weight of the gecko to be supported by just one  toe.</p>';

			ToutImages[12].src = "/activities/explorations/lizards/images/slideshow/crested_gecko2.jpg";
			ToutCaption[12] = '';
			ToutText[12] = '<p><b>Crested Giant Gecko</b><br />Climbing is one way that geckos avoid predators. Like many squamates, their scales have colors or patterns to help them blend into the background. Geckos are also hard to spot because they&rsquo;re nocturnal, or active at night. They can do something few squamates can do &mdash; they make chirping or clicking sounds. Like many squamates, if a gecko is caught it can distract a potential predator by constricting its muscles  to break off its tail. The tail twitches on the ground for a few minutes, giving its previous owner a chance to escape. Eventually, a new tail can regenerate in its place.</p>';

			ToutImages[13].src = "/activities/explorations/lizards/images/slideshow/crested_gecko3.jpg";
			ToutCaption[13] = '';
			ToutText[13] = '<p><b>Crested Giant Gecko</b><br />When geckos are the hunters, they usually catch insects and  spiders with their teeth. Crested Giant Geckos also eat fruit. These night  creatures have big eyes with large, vertical pupils that open wide to capture  available light. </p>';

			ToutImages[14].src = "/activities/explorations/lizards/images/slideshow/water_monitor.jpg";
			ToutCaption[14] = '';
			ToutText[14] = '<p><b>Water Monitor</b><br />Monitors are meat-eating squamates  that hunt birds, other reptiles, mammals, fish, and even eggs. Like snakes and many other squamates, they can track prey by flicking their long, forked tongues to pick up molecular clues in their environment. This helps the monitor identify the prey and follow its trail. Monitors capture prey with  powerful jaws and sharp teeth &mdash; and can even swallow their victims whole.</p>';

			ToutImages[15].src = "/activities/explorations/lizards/images/slideshow/komodo_dragon1.jpg";
			ToutCaption[15] = '';
			ToutText[15] = '<p><b>Komodo Dragon</b><br />Imagine a 10-foot long lizard with sharp teeth and a long,  powerful tail that attacks wild pigs and deer with mighty jaws. This ferocious  creature is real. It&rsquo;s the Komodo Dragon, the world&rsquo;s largest living lizard. Komodo  Dragons belong to a group of lizards called monitors. Not all living monitors are as huge  and forceful as the Komodo Dragon, but they do share some common features.  Monitors have strong legs and long, muscular tails. Despite their stocky  bodies, they&rsquo;re surprisingly fast runners and most monitors are also good  swimmers.</p>';

			ToutImages[16].src = "/activities/explorations/lizards/images/slideshow/komodo_dragon2.jpg";
			ToutCaption[16] = '';
			ToutText[16] = '<p><b>Komodo Dragon</b><br />The largest monitor lizard, the Komodo Dragon, generally has no predators  &mdash; except  other Komodo Dragons. They might lash out with their strong claws and sharp  teeth, or use their powerful tail as a weapon. Sometimes they inflate their  bodies and hiss to intimidate an attacker. They might also stand on their hind  legs to look more threatening. Most of the time, monitors simply rely on their  impressive speed to escape a predator.</p>';

			ToutImages[17].src = "/activities/explorations/lizards/images/slideshow/emerald_boa1.jpg";
			ToutCaption[17] = '';
			ToutText[17] = '<p><b>Emerald Tree Boa<br /></b>A long, slender tree boa drapes over a branch in a dark,  tropical forest. Even in the pitch black, the Emerald Tree Boa knows  when its prey is nearby. Like other squamates, it can track its prey with the  help of its long, forked tongue. The snake also has pits along its lips that allow it to "see" the heat given off by prey.</p>';

			ToutImages[18].src = "/activities/explorations/lizards/images/slideshow/emerald_boa2.jpg";
			ToutCaption[18] = '';
			ToutText[18] = '<p><b>Emerald Tree Boa<br /></b>The tree boa slowly hangs down above a rat. The  snake has long teeth that point backwards into the mouth and are helpful in  holding onto prey. It&rsquo;s a constrictor, which means it will squeeze its prey to  death. In a flash, the boa wraps its body around the rat. Each time the rat  exhales, the snake tightens it grip until the rat can breathe no more. The  snake eats its victim whole. Like all snakes, it has an extremely flexible skull  and elastic ligaments in the lower jaw.</p>';

			ToutImages[19].src = "/activities/explorations/lizards/images/slideshow/emerald_boa3.jpg";
			ToutCaption[19] = '';
			ToutText[19] = '<p><b>Emerald Tree Boa<br /></b>After its meal, the tree boa glides away. Like all snakes,  its movement depends on a series of strong muscles attached to its many ribs.  It uses its belly scales to anchor one part of the body on a surface while it  pushes another part of its body forward.<br /><br />Tree boas are effective predators, but they&rsquo;re also prey.  The same heat-sensing pits and long tongues that help them track prey also help  them detect predators. Their bright green color allows them to blend in with  the surrounding vegetation.</p>';

			ToutImages[20].src = "/activities/explorations/lizards/images/slideshow/spitting_cobra1.jpg";
			ToutCaption[20] = '';
			ToutText[20] = '<p><b>Red Spitting Cobra<br /></b>Suddenly, a slender, dark red snake rises out of the grass  to confront a leopard. Its neck is flattened and spread out in a &ldquo;hood&rdquo; that  makes it look big and impressive. The snake bares its fangs and sprays a stream  of venom into the leopard&rsquo;s eyes. The poison blinds the leopard for a  moment and the snake slithers away. The leopard may be much larger and faster  than the snake, but it can&rsquo;t compete with the venomous &ldquo;spit&rdquo; of the Red Spitting Cobra.</p>';

			ToutImages[21].src = "/activities/explorations/lizards/images/slideshow/spitting_cobra2.jpg";
			ToutCaption[21] = '';
			ToutText[21] = '<p><b>Red Spitting Cobra<br /></b>This snake has short, hollow fangs in the front of its  mouth. Each fang has a narrow opening that releases the venom under great  pressure. A spitting cobra can shoot venom up to several feet away with amazing  accuracy. It&rsquo;s a powerful weapon, but the spitting cobra only &ldquo;spits&rdquo; to defend  itself. When it attacks prey, it bites the victim and injects venom into its  flesh.<br /><br />Red Spitting Cobras live on the ground. They hunt ectothermic animals like frogs. Like other snakes, they track their  prey by picking up scents with their long forked tongues, and they can eat prey larger than their heads. Their elastic jaws can  stretch wide open and swallow an animal whole.</p>';


		/*ToutImages[12].src = "/products/classmags/images/covers144x158/SN1_SP_09_05_Puppies.jpg";
		ToutLinks[12] = "/products/classmags/sn1.htm";*/
		


	} //end if document.images
	document.images["toutImage"].src = ToutImages[1].src;
	document.getElementById("toutText").innerHTML = '<div class="caption" style="text-align:right"><i>' + ToutCaption[1] + '</i></div>' + ToutText[1];

} // end function kickstart


function MakeImageArray(n) {
  	this.length = n;
  	if (document.images) 
	{
	  	for (var i = 1; i<=n; i++) {
	    	this[i] = new Image();
	  	}
  	}
  	return this;  
}

function getNextTout() {

  if (document.images){
    	toutNext = toutLink + 1;
    	ToutCounter+=1;
    	//alert(toutNext);
			if (toutNext >= ToutCount)
			{ 
				toutNext = 21;
				ToutCounter=21;
				document.getElementById("Next").style.visibility = 'hidden';
				document.getElementById("reproducible").style.display = 'block';
			}
			toutLink = toutNext;
			document.images["toutImage"].src = ToutImages[toutNext].src;
			document.getElementById("toutText").innerHTML = '<div class="caption" style="text-align:right"><i>' + ToutCaption[toutNext] + '</i></div>' + ToutText[toutNext];
			document.getElementById("Prev").style.visibility = 'visible';
  }
  return false;
}

function getPrevTout() {

  if (document.images){
    	toutPrev = toutLink - 1;
    	ToutCounter-=1;

			if (toutPrev <= 1)
			{ 
				toutPrev = 1;
				ToutCounter=1;
				document.getElementById("Prev").style.visibility = 'hidden';
			}
			toutLink = toutPrev;
			document.images["toutImage"].src = ToutImages[toutPrev].src;
			document.getElementById("toutText").innerHTML = '<div class="caption" style="text-align:right"><i>' + ToutCaption[toutPrev] + '</i></div>' + ToutText[toutPrev];
			document.getElementById("Next").style.visibility = 'visible';
			
  }
  return false;
}

function getToutLink() 
	{
	window.open(ToutLinks[toutLink], 'main');
	}
