
var facts = Array();

// NOTE!  Some of these facts have extra spaces inserted between the words,
// do not take them out.  They are there to help break up the fact into three
// even-sized lines.

facts[facts.length] = 'A raptor is a bird that hunts and eats live   animals and kills with its feet.';

facts[facts.length] = 'In flight, vultures have a habit of bowing their wings under their body, tips almost touching.';

facts[facts.length] = 'Osprey and some Owls       dive into the water talons first, sometimes totally submerging themselves.';

facts[facts.length] = 'The enlarged cere of the Osprey can cover its nostrils when under water.';

facts[facts.length] = 'Northern Harriers exhibit sexual dimorphism (the males and females are colored  differently). The female is brown, the male grey.';

facts[facts.length] = 'Harriers are the only hawks that have owl-like facial discs.';

facts[facts.length] = 'Adult accipiters (Cooper\'s Hawk, Goshawk and      Sharp-shinned Hawk) have red eyes.';

facts[facts.length] = 'A Swainson\'s Hawk can fly through the air catching and eating insects or bats.';

facts[facts.length] = 'A Red-tailed Hawk can spy a meadow mouse from 100 feet.';

facts[facts.length] = 'A Ferruginous Hawk is fierce and strong enough to scare coyotes away from its nest.';

facts[facts.length] = 'The American Kestrel male and female exhibit different colors.';

facts[facts.length] = 'The American Kestrel can hover while looking for small mice, grasshoppers, and crickets.';

facts[facts.length] = 'American Kestrel are often seen on fences and power lines bobbing their heads vigorously.';

facts[facts.length] = 'Merlins   mimic the flight of pigeons to sneak up on unwary prey.';

facts[facts.length] = 'The dives of Peregrine Falcons have been clocked up to 242 mph.';

facts[facts.length] = 'Owl\'s eyes are fixed in their sockets so they must rotate their heads (up to 270 degrees) to look around.';

facts[facts.length] = 'Owls have binocular vision like humans.       Because their eyes point straight ahead, they can see objects   with both eyes at the same time, increasing their visual acuity.';

facts[facts.length] = 'Owl\'s facial discs help to funnel sounds into the ear openings.';

facts[facts.length] = 'Owls can hear a mouse step on a twig up to 75 feet away or detect a lemming burrowing under the snow.';

facts[facts.length] = 'The Barn Owl can hunt by sound only, usually in the dead of the night.';

facts[facts.length] = 'When threatened, the Barn Owl does an aggressive "toe dusting," moving its head back and forth over its talons.';

facts[facts.length] = 'Elf Owls are the smallest owls in the world.';

facts[facts.length] = 'The Elf Owl hides in Saguaro Cactus holes by day, shielding its conspicuous eyes with a wing.';

facts[facts.length] = 'All raptors are protected by US law because they are beneficial to man.';

facts[facts.length] = 'In 98% of raptors, the female is from 30-100% larger than the male.';

facts[facts.length] = 'The smallest bird of prey in the world is the Bornean falconet: it weighs about 1 ounce.';

facts[facts.length] = 'The largest bird of prey in the world is the Andean Condor, which weighs up to 30 pounds.';

facts[facts.length] = 'Vultures can smell a rotten carcass 5 miles away.';

facts[facts.length] = 'The bones of a Bald Eagle weigh about 8 ounces.';

facts[facts.length] = 'The Bald Eagle has been America\'s national symbol since 1782.';

facts[facts.length] = 'The largest eagle\'s nest on record was 9 1/2 feet across, 20 feet deep, and weighted over 6,000 pounds.';

facts[facts.length] = 'If a Bald Eagle could read, it could read a newspaper at a distance of 25 feet.';

facts[facts.length] = 'Golden Eagles at birth weigh about 3 ounces; in 45 days they weigh as much as 40 times that.';

facts[facts.length] = 'Some owls hunt in the daytime, for example the Snowy Owl and the Burrowing Owl.';

facts[facts.length] = 'Of the 420 species of raptors found throughout the world, more than one-third are owls.';

facts[facts.length] = 'Owls can turn their heads 270&deg;; hawks can turn theirs 170&deg;; humans only 70&deg;.';

facts[facts.length] = 'An owl\'s eyesight and hearing are anywhere from 10 to 100 times more sensitive than a human\'s.';

function showFact (factnum) {
	var line1 = '';
	var line2 = '';
	var line3 = '';
	var ix;
	var space;
	var lastchar;
	var prefix = 'Did you know... ';
	var plen = prefix.length;

	if (factnum >= 0) {
		i = factnum;
	}
	else {
		i = Math.floor(Math.random() * facts.length);
	}
	line1 = facts[i];

	i = Math.floor((plen+line1.length)/3 * 2) - plen;
	line3 = line1.substring(i);
	lastchar = line1.substring(i-1, i);
	if (lastchar == ' ') {
		line1 = line1.substring(0, i-1);
	}
	else if (lastchar == '-') {
		line1 = line1.substring(0, i);
	}
	else {
		space = line3.indexOf(' ');
		line3 = line3.substring(space+1);
		line1 = line1.substring(0, i+space);
	}

	i = Math.floor((plen+line1.length)/2) - plen;
	line2 = line1.substring(i);
	lastchar = line1.substring(i-1, i);
	if (lastchar == ' ') {
		line1 = line1.substring(0, i-1);
	}
	else if (lastchar == '-') {
		line1 = line1.substring(0, i);
	}
	else {
		space = line2.indexOf(' ');
		line2 = line2.substring(space+1);
		line1 = line1.substring(0, i+space);
	}

	document.write('<b>' + prefix + '</b>' + line1 + '<br />' + line2 + '<br />' + line3);
}


