invasive_data = new Array (7);
invasive_data[0] = "r2_c3|p_n|Purple Noosestrife|This Indonesian vine was brought to the country for use as a rope source in the early 1800s. Since then it has spread among cottonwoods across the country. Eventually it kills the tree by strangling the bark and cutting off vascular flow up and down the tree. Fortunately, its seeds are viable only for a short period and it cannot sprout from its roots.|f_o|FungOff(TM) was designed for use in soil. It has done damage to numerous species of lichens that live on the surface of the cottonwood's bark and has not affected the noosestrife in the least.|-1|e_s_m|After applying ten Estonian Scud Moths to the noosestrife, at $75 per moth, they flew away.|0|f|Fire was a very poor option. Your controlled burn did extensive damage to the cottonwood.|-2|h_c|After a day's work of clipping, the entire population was destroyed.|1|c_t|After only a few days, you returned to find your cage crushed by a vine's stranglehold.|0|r_r|While you waited, the infestation of purple noosestrife did extensive damage to the cottonwood.|-2|l_r";
invasive_data[1] = "r3_c2|d_n|Desiccating Nightshade|This nonnative member of the tomato family (once grown as an ornamental plant in people's gardens) requires little sunlight and is able to grow up around the base of most shade trees. It depletes the soil of both water and nutrients, eventually killing most nearby plants and trees. This nightshade is native to the cloud forests of Central America where conditions are very moist and where natural fires are very infrequent.|f_o|FungOff(TM) was designed for use in soil and has not affected the nightshade.|0|e_s_m|After applying ten Estonian scud moths to the nightshade, at $75 per moth, they took flight never to be seen again.|0|f|Your carefully controlled fire destroyed the entire nightshade population.|2|h_c|Although at first it seemed as though you had destroyed the entire population of nightshade, a few weeks later the population had re-sprouted from its root system.|-1|c_t|The nightshade population has grown up around your cage and trap.|0|r_r|When you returned to the cottonwood a week later, the nightshade covered an greater area.|-2|l_r";
invasive_data[2] = "r2_c4|e_j|Eggspert Jay|This crafty member of the Corvid family arrived as a stowaway in 1973 aboard a ship containing hens from Jamaica. Eggspert jays feed exclusively on bird eggs; and by the elimination of native birds, a tree may lose some of its ability to spread its seeds to distant locations. Birds also add important nutrients to a tree by way of their excretions.|f_o|FungOff(TM) was designed to be used in soil against fungi. While spraying it on the jay, some ended up on the bark and destroyed special lichens that live there.|-1|e_s_m|After applying ten Estonian Scud Moths to a very annoyed jay, at $75 per moth, three of the moths were quickly consumed by the bird and the rest dispersed to unknown locations.|0|f|Fire was a very poor option. Your controlled burn did extensive damage to the cottonwood. The jay returned to the tree, without a singed feather.|-2|h_c|The jay was quite annoyed and did not lose a feather from all your snipping, and in the process you took a nasty fall out of the cottonwood.|0|c_t|After successfully nabbing the jay in the egg-baited cage and trap, you shipped the jay back to Jamaica where it now survives well in its native environment.|1|r_r|Rest and relaxation did not help your cottonwood's situation. Few native species of birds may now find refuge in the branches of your cottonwood tree because the eggspert jay is always on the prowl. Your micro-ecosystem continues to deteriorate.|-1|l_r";
invasive_data[3] = "r2_c2|m_m|Maldivian Mistletoe|Imported by early settlers for a special wintertime ritual, the seeds of this exotic mistletoe quickly escaped into the environment and infected the upper branches of cottonwood species. Even though the commercial sale of this mistletoe was prohibited by the Maldivian Mistletoe Act of 1967, seeds continue to be spread by birds continent-wide. Early research suggests that a special species of caterpillar may feed exclusively on Maldivian mistletoe.|f_o|FungOff(TM) was designed for use in the soil against fungi. By applying it to the mistletoe, the chemicals leached onto the bark and did extensive damage to lichens communities which live there. This fungicide did not affect the mistletoe in the least.|-1|e_s_m|In recent years, researchers discovered that the Estonian Scud Moth feeds exclusively on three species of mistletoe, one of which is the Maldivian species. After the moths consumed the entire population of mistletoe, they abandoned the cottonwood never to be seen again.|1|f|Fire was a very poor option. Your controlled burn did extensive damage to the cottonwood.|-2|h_c|Soon after you hacked away at the mistletoe, its shoots re-sprouted and tapped even deeper into your cottonwood tree's vascular system. The mistletoe is quite healthy. The cottonwood is not.|-1|c_t|You crushed a couple of mistletoe shoots, but otherwise you did little damage.|0|r_r|The once isolate patch of mistletoe is now growing throughout the cottonwood's canopy.|-1|l_r";
invasive_data[4] = "r3_c3|w_b_b|Wood Boredom Beetle|Originally from a small North Atlantic island, the wood boredom beetle casually lays its eggs beneath the bark of many species of woody plants and trees. The larvae subsequently eat their way through the wood until it is time for them to become adults. Interestingly, adults beetles never lay eggs in trees that have already been infected.|f_o|FungOff(TM) was designed for use in soil. It has done damage to numerous species of lichens that live on the surface of the cottonwood's bark and has not affected the beetle in the least.|-1|e_s_m|After an extremely difficult application of ten Estonian Scud Moths to the beetles, at $75 per moth, the moths dispersed to unknown locations.|0|f|Fire was a very poor option. Your controlled burn did extensive damage to the cottonwood.|-2|h_c|The beetles took shelter under the loose the bark, and the larvae continue to eat away within the wood.|-1|c_t|This trap was designed for animals. The beetles wandered in and out of your trap with lackadaisical ease.|0|r_r|Wood boredom beetles are known for their unique behavior of leaving their host tree before death to the tree occurs. The beetles have left and the tree is now healing.|1|l_r";
invasive_data[5] = "r4_c3|n_p_t_f|Norfolk Pinal Tap Fungus|In its native state, this fungus has a mycorrhizal relationship with Norfolk Pines by assisting in the transfer of nutrients and water into the tree through the rootlets. But when Norfolk Pines were imported into the region, the fungus easily migrated to cottonwood species and became highly parasitic on cottonwood root systems. Within just a few years, this fungus can infect and destroy many acres of cottonwoods.|f_o|Since FungOff(TM) was designed for use against Norfolk Pinal Tap Fungus, you have destroyed this fungus. FungOff(TM) was also designed to rapidly disintegrate, so you have done no further damage to the ecosystem.|1|e_s_m|By burying ten Estonian Scud Moths in the soil next to the highly invasive fungus, you have not only suffocated your moths. Each moth cost you $75.|0|f|Fire was a very poor option. Your controlled burn did extensive damage to the cottonwood.|-2|h_c|All your hacking with the hedge clippers has damaged extensively the cottonwood's root system.|-2|c_t|This trap was designed for animals.|0|r_r|By waiting, you have allowed a much greater area of the root system to be infected with the fungus.|-2|l_r";
invasive_data[6] = "r1_c3|a_t_s|Feral Cat|A number of small house cats have been left behind by visitors and have now populated the area. Prior to the coloniziation of the area by modern settlers there was no record of small carnivorous cats. They are now found consuming populations of native arboreal rodents. Since the rodents that inhabit this tree feed on seeds and fungi, they help spread these important ecological components. The loss of rodents is hurting your tree. Some fungi are essential to a tree's health because they extend a mycorrhizal network around a trees roots which help to trap moisture and nutrients. |f_o|FungOff(TM) was designed to be used in soil against fungi. While spraying it on the cat, some ended up on the bark and destroyed special lichens that live there. You also received a nasty scratch from a very annoyed cat.|-1|e_s_m|After an extremely difficult application of ten Estonian Scud Moths to a cat, at $75 per moth, the moths dispersed to unknown locations.|0|f|Fire was a very poor option. Your controlled burn did extensive damage to the cottonwood.|-2|h_c|You were bitten by the cat before any damage could be done by the hedge clippers.|0|c_t|You caught your cat with toy mouse lure inside your cage and trap. Excellent catch!|1|r_r|After some rest and relaxation, the feral cat population has grown ten-fold in size. Now the multitudes will be very difficult to catch.|-1|l_r";

function insertImage(which_inv) {
if (ready ==1) {
  var str1 = invasive_data[which_inv];
  var str1Array = str1.split("|");
  var which_file = "inf_" + str1Array[1];
  var file_status = document[which_file].src;
if (file_status.substring(file_status.length - 11, file_status.length) == "removed.gif"){
  	alert('This exotic species has already been removed! Please choose another.');
  }
  else {	
	
	document.window.src = "images/window_" + str1Array[0]  + ".jpg";
	the_cause = which_inv;
	inv_name = str1Array[2];
	inv_txt = str1Array[3];
	document.form1.main_txt.value = inv_name+': '+inv_txt;
	
	if (bar_state == 0) {
		MM_swapImgRestore();
		var swap_file = "images/" + str1Array[1] + "2.gif";
		MM_swapImage(str1Array[1],'',swap_file,1);
	}
	bar_state = 0;
  }
}
}

function prescribeTx(which_tx) {
if (which_tx == 'l_r' && (last_resort == 1 || status ==0)){
	window.location.href = "cottonwood.htm";
	}
if (ready ==1) {
	
	if (the_cause == null) {
		alert('You must first choose the exotic species which you wish to erradicate. Click on the species at right.');
	}
	else {
	var str1 = invasive_data[the_cause];
  	var str1Array = str1.split("|");
		if (which_tx == 'l_r' && last_resort == 0 && status > 0) {
			alert('Have you explored all other options? The \'last resort\' should not be used until all other treatments have been exhausted. Think about it, okay?');
			last_resort = 1;
		}
		else {
			var status_old = status
			
			if (which_tx == str1Array[4]) {
				var d_notes = str1Array[5];
				status += Number(str1Array[6]);
			}
			if (which_tx == str1Array[7]) {
				var d_notes = str1Array[8];
				status += Number(str1Array[9]);
			}
			if (which_tx == str1Array[10]) {
				var d_notes = str1Array[11];
				status += Number(str1Array[12]);
			}
			if (which_tx == str1Array[13]) {
				var d_notes = str1Array[14];
				status += Number(str1Array[15]);
			}
			if (which_tx == str1Array[16]) {
				var d_notes = str1Array[17];
				status += Number(str1Array[18]);
			}
			if (which_tx == str1Array[19]) {
				var d_notes = str1Array[20];
				status += Number(str1Array[21]);
			}
			if (which_tx == str1Array[22]) {
				window.location.href = "cottonwood.htm";
				return false;
			}
			if (status > status_old) {
				var which_status = 'inf_' + str1Array[1];
			 	document[which_status].src = 'images/removed.gif';
				all_removed ++;
				if (str1Array[1] == 'w_b_b') dy_w_b_b = 1;
				if (str1Array[1] == 'd_n') dy_d_n = 1;
			}
			var xtra = ""
			if (status <= 0) {
				status = 0;
				ready = 0;
				xtra = 'Your cottonwood is dead. You still have the Last Resort available.'
				var tree_def = "dead|dead|dead|dead|dead|dead|dead|dead|dead|dead"
			}
			if (dy_w_b_b == 1) {var dy1 = "high";
			}
			else {
				var dy1 = "poor";
			}
			if (dy_w_b_b == 1 && dy_d_n ==1) var dy2 = "high";
			if (dy_w_b_b == 1 && dy_d_n ==0) var dy2 = "moderate";
			if (dy_w_b_b == 0 && dy_d_n ==1) var dy2 = "poor";
			if (dy_w_b_b == 0 && dy_d_n ==0) var dy2 = "dead";
			if (status >= 10 && all_removed < 7) status = 9;	
if (status == 1) var tree_def = "poor|poor|poor|poor|poor|poor|poor|poor|" + dy1 + "|" + dy2;
if (status == 2) var tree_def = "moderate|poor|poor|poor|poor|moderate|poor|poor|" + dy1 + "|" + dy2;
if (status == 3) var tree_def = "moderate|poor|moderate|poor|poor|moderate|poor|poor|" + dy1 + "|" + dy2;
if (status == 4) var tree_def = "moderate|moderate|moderate|poor|poor|moderate|poor|poor|" + dy1 + "|" + dy2;
if (status == 5) var tree_def = "moderate|moderate|moderate|poor|moderate|moderate|poor|moderate|" + dy1 + "|" + dy2;
if (status == 6) var tree_def = "moderate|moderate|moderate|moderate|moderate|moderate|moderate|moderate|" + dy1 + "|" + dy2;
if (status == 7) var tree_def = "moderate|high|moderate|moderate|high|moderate|moderate|moderate|" + dy1 + "|" + dy2;
if (status == 8) var tree_def = "moderate|high|moderate|high|high|moderate|moderate|high|" + dy1 + "|" + dy2;
if (status == 9) var tree_def = "moderate|high|high|high|high|moderate|high|high|" + dy1 + "|" + dy2;
if (all_removed == 7) {
	xtra = 'Even though the cottonwood is not in perfect health, you did a good job of ecosystem restoration by removing the exotic species. Now click on the "Doctor\'s Orders" to receive something special.'
	ready = 0;
}
if (status >= 10) {
	status = 10;
	var tree_def = "high|high|high|high|high|high|high|high|high|high";
	d_notes='';
	xtra = 'Your cottonwood is at 100% healthy. You did an excellent job of ecosystem restoration! Now click on the meadowlark to receive something special.'
}

			var tree_parts = new Array("r1_c2", "r1_c3", "r2_c1", "r2_c2", "r2_c3", "r2_c4", "r3_c1", "r3_c2", "r3_c3", "r4_c3")
			var tree_build = tree_def.split("|");
			for(x=0; x<10; x++)    {   
				document[tree_parts[x]].src = "images/" + tree_build[x] + '_' + tree_parts[x] + '.jpg';
			}
			document.form1.status.value = status;
			document.form1.main_txt.value = d_notes + ' ' +xtra;
			
		}
		var swap_file = "images/" + str1Array[1] + ".gif";
		document[str1Array[1]].src = swap_file;
	}
	bar_state = 1;
	the_cause = null;
}
}
function swapInv(img_name,blank,img_file,one) {
if (ready ==1) {
	if (bar_state == 1) {
		MM_swapImgRestore();
		MM_swapImage(img_name,blank,img_file,one);
	}
}
}
function swapInvRestore() {
if (ready ==1) {
	if (bar_state == 1) {
		MM_swapImgRestore();
	}
}
}

function onOriole() {
if (status == 10 || all_removed == 7) window.location.href = "meadowlark.htm";
}