// Created by Evan Cook  March 20/2006
var Xpos = 0;
var Ypos = 0;
var t
var DYKdiv = document.getElementById("DidYouKnow")
var D = document.getElementById("Definitions")
var Visible = false

function PopupDef(Word, Delay) {
	var Caption = ""
	var DefText = ""

	switch (Word){
	case 'salmonid':
		Caption = "Salmonids:"
		DefText = "A family of fishes, including salmon and trout."
	  break
	case 'ADO':
		Caption = "ADO:"
		DefText = "Availible dissolved oxygen."
	  break
	case 'Aquaculture':
		Caption = "Aquaculture:"
		DefText = "The industry of raising of water animals, especially fish, for commercial purposes."
	  break
	case 'Ecosystem':
		Caption = "Ecosystem:"
		DefText = "A community of plants and animals and their environment."
	  break
	case 'Salmonids':
		Caption = "Salmonids:"
		DefText = "A family of fishes, including salmon and trout."
	  break
	case 'Hectare':
		Caption = "Hectare:"
		DefText = "A unit of area, equal to 10,000 square meters or 2.47 acres."
	  break
	case 'El Nino':
		Caption = "El Nino:"
		DefText = "A warming of the ocean surface off the western coast of South America that occurs every 4 to 12 years when upwelling of cold, nutrient-rich water does not occur. It causes die-offs of plankton and fish and affects Pacific jet stream winds, altering storm tracks and creating unusual weather patterns in various parts of the world."
	  break	  
	case 'Synthetic':
		Caption = "Synthetic:"
		DefText = "Prepared or made artificially."
	  break
	case 'Skiff':
		Caption = "Skiff:"
		DefText = "A flatbottom open boat of shallow draft, having a pointed bow and a square stern and propelled by oars, sail, or motor."
	  break
	case 'CuSO4':
		Caption = "Copper Sulfate:"
		DefText = "A chemical compound with the formula CuSO4. It is often used to treat various external diseases in commercially produced fish."
	  break
	case 'Lesions':
		Caption = "Lesions:"
		DefText = "An infected or diseased patch of skin."
	  break
	case 'Cylindrical':
		Caption = "Cylindrical:"
		DefText = "relating to or having the form or properties of a cylinder."
	  break
	case 'Polyethylene':
		Caption = "Polyethylene:"
		DefText = "a polymer of ethylene; especially : any of various partially crystalline lightweight thermoplastics (CH2CH2)x that are resistant to chemicals and moisture, have good insulating properties, and are used especially in packaging and insulation."
	  break
	case 'Certified organic':
		Caption = "Certified organic:"
		DefText = "guarantee that no chemically formulated fertilizers, growth stimulants, pesticides or antibiotics were used in the production of food, either plant or animal."
	  break
	case 'Scalpel':
		Caption = "Scalpel:"
		DefText = "a small straight thin-bladed knife used especially in surgery."
	  break
	case 'Dissect':
		Caption = "Dissect:"
		DefText = "to separate into pieces : expose the several parts of (as an animal) for scientific examination."
	  break
	case 'Dissection':
		Caption = "Dissection:"
		DefText = "the act or process of dissecting."
	  break
	case 'Swimbladder':
		Caption = "Swimbladder:"
		DefText = "a sac inside the salmon's body by which the fish can control buoyancy."
	  break
	case 'Tweezers':
		Caption = "Tweezers:"
		DefText = "any of various small metal instruments that are usually held between the thumb and forefinger, are used for plucking, holding, or manipulating, and consist of two legs joined at one end."
	  break
	case 'Oligotrophic':
		Caption = "Oligotrophic:"
		DefText = "Lacking in plant nutrients and having a large amount of dissolved oxygen throughout. Used of a pond or lake."
	  break
	case 'Spawner':
		Caption = "Spawner:"
		DefText = "a female fish at spawning time."
	  break
	case 'Anadromous':
		Caption = "Anadromous:"
		DefText = "(Greek for 'running upward') Fish that hatch in fresh water, move to salt water to feed and mature, and return to fresh water to spawn."
	  break
	case 'Temperate':
		Caption = "Temperate:"
		DefText = "Characterized by moderate temperatures, weather, or climate; neither hot nor cold."
	  break
	case 'smolt':
		Caption = "Smolt:"
		DefText = "Salmon of a certain size, generally 4-7 inches, that begin seaward migration and smoltification."
	  break
	case 'Predator':
		Caption = "Predator:"
		DefText = "organisms that lives by preying on other organisms. 2.) One that victimizes, plunders, or destroys, especially for one's own gain."
	  break
	case 'Redds':
		Caption = "Redds:"
		DefText = "Series of nests dug in gravel by one female salmon."
	  break
	case 'Milt':
		Caption = "Milt:"
		DefText = "The milky sperm the male salmon releases to fertilize the eggs."
	  break
	case 'Estuary':
		Caption = "Estuary:"
		DefText = "A site where fresh water and salt water meet."
	  break
	case 'Schools':
		Caption = "Schools:"
		DefText = "A large group of aquatic animals, especially fish, swimming together."
	  break
	case 'Alevin':
		Caption = "Alevin:"
		DefText = "Young salmon that have hatched but still have a large yolk that must be absorbed, during which they stay protected in gravel; they may live entirely on yolk or may feed (may also be called 'sac-fry')."
	  break
	case 'yolk sac':
		Caption = "Yolk sac:"
		DefText = "An external pouch containing nutrients for the growing alevin. When the yolk sac is used up, the alevin is said to be 'buttoned-up' and enters the fry stage."
	  break
	case 'Parr':
		Caption = "Parr:"
		DefText = "Stripes on the sides of salmon fry; sometimes used instead of 'fry' to refer to juvenile salmon."
	  break
	case 'Fingerling':
		Caption = "Fingerling:"
		DefText = "A young or small fish, especially a young salmon or trout."
	  break
	case 'voraciously':
		Caption = "Voraciously:"
		DefText = "Consuming or eager to consume great amounts of food; ravenous."
	  break
	case 'vulnerable':
		Caption = "Vulnerable:"
		DefText = "Susceptible to attack."
	  break
	case 'Spawning':
		Caption = "Spawning:"
		DefText = "The act of laying eggs."
	  break
	case 'fry':
		Caption = "Fry:"
		DefText = "Next life stage of salmon after alevin, and before smolt."
	  break
	}

	Visible = true
	GetMousePos()

	var DivCode = CreateDivCode(DefText, Caption)

	D.innerHTML=DivCode

	t=setTimeout("ShowDef()",Delay)
}

function ShowDef() {
	if (Visible == true) {
		if (D.filters.alpha.opacity<100) {
			D.style.left = Xpos;
			D.style.top = Ypos;
			D.style.visibility="visible";
			D.filters.alpha.opacity+=10
			t=setTimeout("ShowDef()",10)
		} else {
			D.filters.alpha.opacity=100;
		}
	}
}

function HideDef(Delay) {t=setTimeout("ClearDef()",Delay); Visible = false}

function ClearDef() {	
	if (Visible == false) { 
		D.style.visibility="hidden";
		D.filters.alpha.opacity=0
		D.style.left = 0;
		D.style.top = 0;
	}
}

function GetMousePos(){
	Xpos = window.event.x + document.body.scrollLeft;
	Ypos = window.event.y + document.body.scrollTop;	
}

function CreateDivCode(Text, Header) {
	var DivCode = ""
	DivCode += "<table width='200' cellspacing='0' cellpadding='0' bgcolor='#79AECF' style='border=1px solid #000066'><tr><td><p><b>&nbsp;"
	DivCode += Header
	DivCode += "</b></p></td></tr><tr><td><table width='200' bgcolor='#E7EEF5' border='0' cellspacing='0' cellpadding='0'><tr><td width='20'></td><td><p>"
	DivCode += Text
	DivCode += "</p></td></tr></table></td></tr></table>"
	return DivCode;
}

function CreateDYK(LowerBound, UpperBound) {

	var k = Math.round((Math.random() * (UpperBound - LowerBound)) + LowerBound)
	WriteToDYK(k)
}

function WriteToDYK(Index) {
	var DYKtxt = ""

	switch (Index) {
		case 0:
			DYKtxt = "The Aral Sea used to be the world's 4th largest lake."
		break
		case 1:
			DYKtxt = "In some places, the Aral Sea has retreated 100 kilometres from its original boundaries."
		break
		case 2:
			DYKtxt = "The shrinkage of the Aral Sea is considered by some scientist to be one of the worst environmental disasters of all time."
		break		
		case 3:
			DYKtxt = "The standard cage for fish farmers has a volume of 700 cubic metres."
		break
		case 4:
			DYKtxt = "Most fish farms tanks are circular, because this allows for the best water flow."
		break
		case 5:
			DYKtxt = "Good water should be saturated with 100% dissolved oxygen."
		break
		case 6:
			DYKtxt = "Aquaculture has contributed more than 3,500 jobs to British Columbia's economy."
		break
		case 7:
			DYKtxt = "Norway is the leading world producer of salmon."
		break
		case 8:
			DYKtxt = "Norway has 6,500 fish farms that employ a total of 12,000 people."
		break
		case 9:
			DYKtxt = "The main expense in fish farming is feeding the fish."
		break
		case 10:
			DYKtxt = "Before salmon are harvested, they have to be starved for 5 days to empty their gut."
		break
		case 11:
			DYKtxt = "About 90,000 fish escaped from fish farms every year from 1990-2000."
		break
		case 12:
			DYKtxt = "Farmed salmon are often genetically altered to make them more disease-resistant."
		break
		case 13:
			DYKtxt = "The majority of farmed salmon in British Columbia are imported Atlantic salmon."
		break
		case 14:
			DYKtxt = "Fish rarely escape in Uzbekistan, since the sea is landlocked."
		break
		case 15:
			DYKtxt = "The aquaculture industry in Chile is worth 1.6 billion American dollars."
		break
		case 16:
			DYKtxt = "A salmon's diet should be 5-20% fat."
		break
		case 17:
			DYKtxt = "Iron is the only mineral found to be essential to a salmon's survival."
		break
		case 18:
			DYKtxt = "Salmon need only minute amounts of vitamins."
		break
		case 19:
			DYKtxt = "A fish's diet should consist of 9-12% carbohydrates."
		break
		case 20:
			DYKtxt = "A female salmon can lay up to 5,000 eggs."
		break
		case 21:
			DYKtxt = "Only 3-4% of salmon actually survive to spawn."
		break
		case 22:
			DYKtxt = "Warm water is best for hatching salmon eggs."
		break
		case 23:
			DYKtxt = "Alevins, newly-hatched salmon, can't swim."
		break
		case 24:
			DYKtxt = "Alevins (newly-hatched salmon) feed off their egg sacs for the first stage of their life."
		break
		case 25:
			DYKtxt = "The mortality rate of smolts in captivity is 50-100%."
		break
		case 26:
			DYKtxt = "Most species of salmon die soon after spawning."
		break

		default:
			DYKtxt = "-"
		break
	}

	var DivCode2 = ""
	DivCode2 = "<table width='120' align='left'><td bgcolor='#82B1D5' style='border-top=1px solid #8ABFE0; border-bottom=1px solid #689DBE; border-left=1px solid #8ABFE0; border-right: 1px solid #578CAD'>"
	DivCode2 += "<p style='color:#FFFFFF'><b>Did you know:</b><br></p><p style='font-size:10px; color:#FFFFFF'>" + DYKtxt + "</p></td></tr></table>"

	DYKdiv.innerHTML=DivCode2
}