
//sIFR Lite image replacement technique
flashReplace = function()
{
	var geinspira = new Font('geinspira.swf', { tags: 'h1' });
	geinspira.replace('h1');
}


uiuisearchRedirectIfEnter = function(e)
{
	var e = jQuery.Event("keypress"); 

	alert(e.type);
	//throw new Error("test");
	//e = e || window.event;
	var code = e.keyCode || e.which;
	alert("code: " + code);
	if (code == 13)
	{
		searchRedirect()();
	}
}


clearText = function(strTextBoxId)
{
	document.getElementById(strTextBoxId).value = "";
}


//clears the text box, but only when the text box contains the string passed (good for putting instructions in a text box that disappear when the user clicks in it)
clearTextOnCondition = function(strTextBoxId, strToClear)
{
	if (document.getElementById(strTextBoxId).value == strToClear)
	{
		document.getElementById(strTextBoxId).value = "";
	}
}


searchRedirect = function()
{
	var strSearchText = document.getElementById('simpleSearchText').value; //$('#simpleSearchText').value;
	if (strSearchText == null || strSearchText == undefined)
	{
		strSearchText = "";
	}

	//tack on extra url vars to clear out any old search from session
	document.location = '/Search/Search-Results.aspx/?srchTxt=' + strSearchText + "&title=&docNum=&app=&industry=&lang=&prodType=&docMediaType=&model=";
}


//hides all individual divs in results
resetResults = function()
{
	//hide all individual results
	$('#idResults1').hide();
	$('#idResults2').hide();
	$('#idResults3').hide();
	$('#idResults4').hide();
	$('#idResults5').hide();
	$('#idResults6').hide();
	$('#idResults7').hide();
	$('#idResults8').hide();
	$('#idResults9').hide();
	$('#idResults10').hide();
	$('#idResults11').hide();
	$('#idResults12').hide();
	
	$('.see-results').hide();
	$('.see-results-one').hide();
	$('.see-results-two').hide();
}


//enables/disables search options on TOC analyzer.  If you pass 0, all are disabled.  If you pass 1, Search #1 will be enabled
tocShowSearch = function(searchToShow)
{
	if (searchToShow == 0)
	{
		//hide everything by showing overlays
		$('#searchOneDisable').hide();
		$('#searchTwoDisable').show();
		$('#searchThreeDisable').show();

		//kill radio button checks if exist
		// $('#radioSearch1').attr("");
		$('#radioSearch1').attr({ 
	          checked: "checked"
	        });
		$('#radioSearch2').removeAttr("checked");
		$('#radioSearch3').removeAttr("checked");

		//remove activated class to input parents
		$('#radioSearch1wrap').addClass("activated");
		$('#radioSearch2wrap').removeClass("activated");
		$('#radioSearch3wrap').removeClass("activated");

		//remove highlighted class to search areas
		$('#search-one').addClass("highlighted");
		$('#search-two').removeClass("highlighted");
		$('#search-three').removeClass("highlighted");

		//hide results pane
		$('#main').fadeOut(500);

		//reset any selected shown results
		resetResults();

		//reset search 1 - just repopulate all drop downs
		populateDropDown('dropIndustry', industryArray, null);
		populateDropDown('dropApplication', appArray, null);
		populateDropDown('dropSampleType', sampleTypeArray, null);

		//reset search 2
		$('#check500RL').removeAttr("checked");
		$('#check500RLe').removeAttr("checked");
		$('#check900Lab').removeAttr("checked");
		$('#check900OL').removeAttr("checked");
		$('#check900OLT').removeAttr("checked");
		$('#check900P').removeAttr("checked");
		$('#check900PT').removeAttr("checked");
		$('#check5310CL').removeAttr("checked");
		$('#check5310COL').removeAttr("checked");
		$('#checkCheckPoint').removeAttr("checked");
		$('#checkInnovOx').removeAttr("checked");
		$('#checkInnovOxOnline').removeAttr("checked");
		$('#checkSelectAll').removeAttr("checked");

		//reset search 3
		$("#slider").slider("values", 0, 20);
		$("#slider").slider("values", 1, 90);

	}
	else if (searchToShow == 1)
	{
		//hide everything by showing overlays
		$('#searchOneDisable').hide();
		$('#searchTwoDisable').show();
		$('#searchThreeDisable').show();

		$('#radioSearch1').attr("checked", "checked");
		//add activated class to input parent, remove on leave
		$('#radioSearch1wrap').addClass("activated");
		$('#radioSearch2wrap').removeClass("activated");
		$('#radioSearch3wrap').removeClass("activated");
		
		//add background effect on active search area
		$('#search-one').addClass("highlighted");
		$('#search-two').removeClass("highlighted");
		$('#search-three').removeClass("highlighted");
	}
	else if (searchToShow == 2)
	{
		//hide everything by showing overlays
		$('#searchOneDisable').show();
		$('#searchTwoDisable').hide()
		$('#searchThreeDisable').show();

		$('#radioSearch2').attr("checked", "checked");
		//add activated class to input parent, remove on leave
		$('#radioSearch2wrap').addClass("activated");
		$('#radioSearch1wrap').removeClass("activated");
		$('#radioSearch3wrap').removeClass("activated");
		
		//add background effect on active search area
		$('#search-two').addClass("highlighted");
		$('#search-one').removeClass("highlighted");
		$('#search-three').removeClass("highlighted");
	}
	else if (searchToShow == 3)
	{
		//hide everything by showing overlays
		$('#searchOneDisable').show();
		$('#searchTwoDisable').show();
		$('#searchThreeDisable').hide()

		$('#radioSearch3').attr("checked", "checked");
		//add activated class to input parent, remove on leave
		$('#radioSearch3wrap').addClass("activated");
		$('#radioSearch1wrap').removeClass("activated");
		$('#radioSearch2wrap').removeClass("activated");
		
		//add background effect on active search area
		$('#search-three').addClass("highlighted");
		$('#search-one').removeClass("highlighted");
		$('#search-two').removeClass("highlighted");
	}
}


tocSearch1 = function()
{
	var atLeastOneDisplayed = false
	;
	//show results
	$('#main').fadeOut(150);
	$('#main').fadeIn(1000);

	resetResults();

	//get all selected parameters.  Parameters that don't matter (that mean all) are: "Industry", "Application", "Lab, Portable or On-Line"
	var industrySearchTerm = $("#dropIndustry option:selected").text();
	var appSearchTerm = $("#dropApplication option:selected").text();
	var sampleTypeSearchTerm = $("#dropSampleType option:selected").text();
	var arrayText = "";

	//show search parameters
	var userSearchParams = "";
	if (industrySearchTerm.length > 0)
	{
		userSearchParams = 'INDUSTRY: ' + industrySearchTerm;
	}
	if (appSearchTerm.length > 0)
	{
		if (userSearchParams.length > 0)
		{
			userSearchParams += ' | APPLICATION: ' + appSearchTerm;
		}
		else
		{
			userSearchParams = 'APPLICATION: ' + appSearchTerm;
		}
	}
	if (sampleTypeArray.length > 0)
	{
		if (userSearchParams.length > 0)
		{
			userSearchParams += ' | LAB, PORTABLE, OR ONLINE: ' + sampleTypeSearchTerm;
		}
		else
		{
			userSearchParams = 'LAB, PORTABLE, OR ONLINE: ' + sampleTypeSearchTerm;
		}
	}

	userSearchParams = 'Searching for models in: ' + userSearchParams;
	$('#searchParams').html(userSearchParams);


	//empty search terms if they are the default search terms
	if (industrySearchTerm == 'All Industries')
	{
		industrySearchTerm = null;
	}
	if (appSearchTerm == 'All Applications')
	{
		appSearchTerm = null;
	}
	if (sampleTypeSearchTerm == 'All Modes (Lab, Portable, or On-line)')
	{
		sampleTypeSearchTerm = null;
	}


	//loop through all models to see if we can match search params
	for (var i = 0; i < modelArray.length; i++)
	{
		var isaMatch = true;

		if (industrySearchTerm != null)
		{
			//loop through industries for this model, see if they match
			var arrayMatched = false;
			var currentArray = modelArray[i][1]
			for (var j = 0; j < currentArray.length; j++)
			{
				if (currentArray[j] == industrySearchTerm)
				{
					arrayMatched = true;
					break;
				}
			}

			if (arrayMatched == false)
			{
				isaMatch = false;
			}
		}

		if (appSearchTerm != null & isaMatch != false)
		{
			var arrayMatched = false;
			var currentArray = modelArray[i][2]
			for (var j = 0; j < currentArray.length; j++)
			{
				if (currentArray[j] == appSearchTerm)
				{
					arrayMatched = true;
					break;
				}
			}

			if (arrayMatched == false)
			{
				isaMatch = false;
			}
		}

		if (sampleTypeSearchTerm != null & isaMatch != false)
		{
			var arrayMatched = false;
			var currentArray = modelArray[i][3]
			for (var j = 0; j < currentArray.length; j++)
			{
				if (currentArray[j] == sampleTypeSearchTerm)
				{
					arrayMatched = true;
					break;
				}
			}

			if (arrayMatched == false)
			{
				isaMatch = false;
			}
		}

		if (isaMatch == true)
		{
			showModelInResults(modelArray[i][0]);
			atLeastOneDisplayed = true;
		}
	}


	if (atLeastOneDisplayed == false)
	{
		$('#searchNoResultsFound').html('No results found.');
	}
	else
	{
		$('#searchNoResultsFound').html('');
	}
	
	$('.see-results').show();
	$('.see-results-one').show();
}





tocSearch2 = function()
{
	var atLeastOneDisplayed = false;

	//show results
	$('#main').fadeOut(150);
	$('#main').fadeIn(1000);

	resetResults();

	//show search parameters
	$('#searchParams').html('Searching by model');

	//see which models the user selected, and populate results accordingly
	if ($('#check500RL').attr("checked") == true)
	{
		//user selected the model
		showModelInResults('500 RL On-Line');
		atLeastOneDisplayed = true;
	}
	if ($('#check500RLe').attr("checked") == true)
	{
		showModelInResults('500 RLe On-Line');
		atLeastOneDisplayed = true;
	}
	if ($('#check900Lab').attr("checked") == true)
	{
		showModelInResults('900 Laboratory');
		atLeastOneDisplayed = true;
	}
	if ($('#check900OL').attr("checked") == true)
	{
		showModelInResults('900 On-Line');
		atLeastOneDisplayed = true;
	}
	if ($('#check900OLT').attr("checked") == true)
	{
		showModelInResults('900 On-Line Turbo');
		atLeastOneDisplayed = true;
	}
	if ($('#check900P').attr("checked") == true)
	{
		showModelInResults('900 Portable');
		atLeastOneDisplayed = true;
	}
	if ($('#check900PT').attr("checked") == true)
	{
		showModelInResults('900 Portable Turbo');
		atLeastOneDisplayed = true;
	}
	if ($('#check5310CL').attr("checked") == true)
	{
		showModelInResults('5310 C Laboratory');
		atLeastOneDisplayed = true;
	}
	if ($('#check5310COL').attr("checked") == true)
	{
		showModelInResults('5310 C On-Line');
		atLeastOneDisplayed = true;
	}
	if ($('#checkCheckPoint').attr("checked") == true)
	{
		showModelInResults('CheckPoint Sensor');
		atLeastOneDisplayed = true;
	}
	if ($('#checkInnovOx').attr("checked") == true)
	{
		showModelInResults('InnovOx Laboratory');
		atLeastOneDisplayed = true;
	}
	if ($('#checkInnovOxOnline').attr("checked") == true) {
		showModelInResults('InnovOx On-Line');
		atLeastOneDisplayed = true;
	}

	if (atLeastOneDisplayed == false)
	{
		$('#searchNoResultsFound').html('No results found.');
	}
	else
	{
		$('#searchNoResultsFound').html('');
	}

	$('.see-results').show();
	$('.see-results-two').show();
}


tocSearch3 = function()
{
	//slider logic:
	//spec has to be <= what user selected for low end
	//spec has to be >= than what user selected
	//model specs have to be same or greater RANGE than what user wants

	//just divide by 100000000000 to get real number
	//.0000000001 = .1 ppb = 10
	//.000000001 = 1 ppb = 20
	//.00000001 = 10 ppb = 30
	//.0000001 = 100 ppb = 40
	//.000001 = 1 ppm = 50
	//.00001 = 10 ppm = 60
	//.0001 = 100 ppm = 70
	//.001 = 1000 ppm = 80
	//.01 = 10000 ppm = 90
	//.1 = 100000 ppm = 100

	var atLeastOneDisplayed = false;

	//show results
	$('#main').fadeOut(150);
	$('#main').fadeIn(1000);

	resetResults();

	//get slider values
	var lowRange = $("#slider").slider("values", 0);
	var highRange = $("#slider").slider("values", 1);

	//turn slider values into actual usable numbers
	if (lowRange == 10)
	{
		lowRange = .0000000001;
	}
	else if (lowRange == 20)
	{
		lowRange = .000000001;
	}
	else if (lowRange == 30)
	{
		lowRange = .00000001;
	}
	else if (lowRange == 40)
	{
		lowRange = .0000001;
	}
	else if (lowRange == 50)
	{
		lowRange = .000001;
	}
	else if (lowRange == 60)
	{
		lowRange = .00001;
	}
	else if (lowRange == 70)
	{
		lowRange = .0001;
	}
	else if (lowRange == 80)
	{
		lowRange = .001;
	}
	else if (lowRange == 90)
	{
		lowRange = .01;
	}
	else if (lowRange == 100)
	{
		lowRange = .1;
	}


	if (highRange == 10)
	{
		highRange = .0000000001;
	}
	else if (highRange == 20)
	{
		highRange = .000000001;
	}
	else if (highRange == 30)
	{
		highRange = .00000001;
	}
	else if (highRange == 40)
	{
		highRange = .0000001;
	}
	else if (highRange == 50)
	{
		highRange = .000001;
	}
	else if (highRange == 60)
	{
		highRange = .00001;
	}
	else if (highRange == 70)
	{
		highRange = .0001;
	}
	else if (highRange == 80)
	{
		highRange = .001;
	}
	else if (highRange == 90)
	{
		highRange = .01;
	}
	else if (highRange == 100)
	{
		highRange = .1;
	}

	//show search parameters
	var userSearchParams = "";
	userSearchParams = 'Searching for models with a range of: ' + convertToPartPer(lowRange) + ' - ' + convertToPartPer(highRange);
	$('#searchParams').html(userSearchParams);





	//perform search using user selected values - we are now doing this via a spreadsheet F sent over and not with true ranges
	//if lower >= 1ppm display innovOx
	if (lowRange >= .000001)
	{
		//'InnovOx Laboratory'
		showModelInResults(modelArray[10][0]);
		//'InnovOx On-Line'
		showModelInResults(modelArray[11][0]);
		atLeastOneDisplayed = true;
	}

	//if upper <= 10ppm display 500 RL, 500RLe
	if (highRange <= .00001)
	{
		//'500 RL On-Line'
		showModelInResults(modelArray[0][0]);
		//'500 RLe On-Line'
		showModelInResults(modelArray[1][0]);
		atLeastOneDisplayed = true;
	}

	//if upper <= 100ppm display 900 Lab, Online, Portable
	if (highRange <= .0001)
	{
		//'900 Laboratory'
		showModelInResults(modelArray[2][0]);
		//'900 On-Line'
		showModelInResults(modelArray[3][0]);
		//'900 Portable'
		showModelInResults(modelArray[5][0]);
		atLeastOneDisplayed = true;
	}

	//if lower >= 1ppb & upper <= 1ppm display CheckPoint
	if (lowRange >= .0000000001 & highRange <= .000001)
	{
		//'CheckPoint Sensor'
		showModelInResults(modelArray[9][0]);
		atLeastOneDisplayed = true;
	}

	//if lower >= 1ppm & upper <= 10ppm display 900 Turbos
	if (lowRange >= .0000000001 & highRange <= .00001)
	{
		//'900 On-Line Turbo'
		showModelInResults(modelArray[4][0]);
		//'900 Portable Turbo'
		showModelInResults(modelArray[6][0]);
		atLeastOneDisplayed = true;
	}

	//if lower >= 1ppb & upper <= 100ppm display 5310 C
	if (lowRange >= .0000000001 & highRange <= .0001)
	{
		//'5310 C Laboratory'
		showModelInResults(modelArray[7][0]);
		//'5310 C On-Line'
		showModelInResults(modelArray[8][0]);
		atLeastOneDisplayed = true;
	}

	if (atLeastOneDisplayed == false)
	{
		$('#searchNoResultsFound').html('For best results, please modify your search range or search by application (choose Search #1 above).');
	}
	else
	{
		$('#searchNoResultsFound').html('');
	}
	
	$('.see-results').show();
}


showModelInResults = function(modelName)
{
	if ('500 RL On-Line' == modelName)
	{
		//user selected the model
		$('#idResults1').fadeIn(500);
	}
	else if ('500 RLe On-Line' == modelName)
	{
		$('#idResults2').fadeIn(500);
	}
	else if ('900 Laboratory' == modelName)
	{
		$('#idResults3').fadeIn(500);
	}
	else if ('900 On-Line' == modelName)
	{
		$('#idResults4').fadeIn(500);
	}
	else if ('900 On-Line Turbo' == modelName)
	{
		$('#idResults5').fadeIn(500);
	}
	else if ('900 Portable' == modelName)
	{
		$('#idResults6').fadeIn(500);
	}
	else if ('900 Portable Turbo' == modelName)
	{
		$('#idResults7').fadeIn(500);
	}
	else if ('5310 C Laboratory' == modelName)
	{
		$('#idResults8').fadeIn(500);
	}
	else if ('5310 C On-Line' == modelName)
	{
		$('#idResults9').fadeIn(500);
	}
	else if ('CheckPoint Sensor' == modelName)
	{
		$('#idResults10').fadeIn(500);
	}
	else if ('InnovOx Laboratory' == modelName) 
	{
		$('#idResults11').fadeIn(500);
	}
	else if ('InnovOx On-Line' == modelName) 
	{
		$('#idResults12').fadeIn(500);
	}
}


tocSelectAllModels = function()
{
	if ($('#checkSelectAll').attr("checked") == true)
	{
		$('#check500RL').attr("checked", "checked");
		$('#check500RLe').attr("checked", "checked");
		$('#check900Lab').attr("checked", "checked");
		$('#check900OL').attr("checked", "checked");
		$('#check900OLT').attr("checked", "checked");
		$('#check900P').attr("checked", "checked");
		$('#check900PT').attr("checked", "checked");
		$('#check5310CL').attr("checked", "checked");
		$('#check5310COL').attr("checked", "checked");
		$('#checkCheckPoint').attr("checked", "checked");
		$('#checkInnovOx').attr("checked", "checked");
		$('#checkInnovOxOnline').attr("checked", "checked");
	}
	else
	{
		$('#check500RL').removeAttr("checked");
		$('#check500RLe').removeAttr("checked");
		$('#check900Lab').removeAttr("checked");
		$('#check900OL').removeAttr("checked");
		$('#check900OLT').removeAttr("checked");
		$('#check900P').removeAttr("checked");
		$('#check900PT').removeAttr("checked");
		$('#check5310CL').removeAttr("checked");
		$('#check5310COL').removeAttr("checked");
		$('#checkCheckPoint').removeAttr("checked");
		$('#checkInnovOx').removeAttr("checked");
		$('#checkInnovOxOnline').removeAttr("checked");
	}
}


industryClick = function()
{
	//get selection
	var selectedText = $("#dropIndustry option:selected").text();

	//get 'key' - using array like hashtable that holds a text key and an array value
	var appDropDownArray = null;
	var sampleDropDownArray = null;
	for (var i = 0; i < industryArray.length; i++)
	{
		if (industryArray[i][0] == selectedText)
		{
			//get array that will populate drop downs according to what was selected in industry
			appDropDownArray = industryArray[i][1];
			sampleDropDownArray = industryArray[i][2];
		}
	}

	//repopulate application drop down according to what was selected in the industry drop down
	if (appDropDownArray != null & sampleDropDownArray != null)
	{
		populateDropDown('dropApplication', appDropDownArray, 'All Applications');
		populateDropDown('dropSampleType', sampleDropDownArray, 'All Modes (Lab, Portable, or On-line)');
	}
	else
	{
		//if we are here then the user selected "Industry" which means 'all industries', but we are just calling it Industry for some reason
		//if that is the case, we need to make sure the industry drop down DOESN'T drive the application drop down since 'all' shouldn't drive the app drop down to have less values

		//populate drop down with all options
		populateDropDown('dropApplication', appArray, null);
		populateDropDown('dropSampleType', sampleTypeArray, null);
	}
}


applicationClick = function()
{
	//get selection
	var selectedText = $("#dropApplication option:selected").text();

	//modify sample type drop down

	//get 'key' - using array like hashtable that holds a text key and an array value
	var sampleDropDownArray = null;
	for (var i = 0; i < appArray.length; i++)
	{
		if (appArray[i][0] == selectedText)
		{
			//get array that will populate drop downs according to what was selected in industry
			sampleDropDownArray = appArray[i][1];
		}
	}

	//repopulate application drop down according to what was selected in the industry drop down
	if (sampleDropDownArray != null)
	{
		populateDropDown('dropSampleType', sampleDropDownArray, 'All Modes (Lab, Portable, or On-line)');
	}
	else
	{
		//populate drop down with all options
		populateDropDown('dropSampleType', sampleTypeArray, null);
	}
}


populateDropDown = function(dropDownName, arrayOfValues, prependToList)
{
	//create html to add to select element.  For each array should add html like this: <option value="Application">Application</option>
	var htmlToAdd = '';

	if (prependToList != null)
	{
		htmlToAdd += "<option value='" + prependToList + "'>" + prependToList + "</option>";
	}

	for (var i = 0; i < arrayOfValues.length; i++)
	{
		var textToAdd = arrayOfValues[i][0];

		//account for the 1D array getting passed - also, FF only views arrayOfValues[i][0] as the first character of the value, but IE doesn't recognize that statement at all so we have to make sure the length here isn't 1
		if (textToAdd == null || textToAdd.length == 1)
		{
			textToAdd = arrayOfValues[i];
		}

		htmlToAdd += "<option value='" + textToAdd + "'>" + textToAdd + "</option>";
	}

	dropDownName = '#' + dropDownName;
	$(dropDownName).html(htmlToAdd);
}



//part per billion - 1 in 1,000,000,000
//part per millino - 1 in 1,000,000
//takes a small decimal number and converts it to a human readable form of parts per million or parts per billion (e.g. 1ppm = 1 into 1,000,000 = .000001)
convertToPartPer = function(numberToConvert)
{
	var textToReturn = "";

	if (numberToConvert > .0000001)
	{
		//greater or equal to 1 ppm
		textToReturn = (numberToConvert * 1000000 + ' ppm');
	}
	else
	{
		//ppb
		textToReturn = (numberToConvert * 1000000000 + ' ppb');
	}

	return textToReturn;
}



var industryArray = new Array();
industryArray[0] = new Array(3);
industryArray[1] = new Array(3);
industryArray[2] = new Array(3);
industryArray[3] = new Array(3);
industryArray[4] = new Array(3);
industryArray[5] = new Array(3);
industryArray[6] = new Array(3);
industryArray[7] = new Array(3);
industryArray[8] = new Array(3);
industryArray[0][0] = 'All Industries'; //the 'all' industry value
industryArray[0][1] = null;
industryArray[0][2] = null;
industryArray[1][0] = 'Chemical/Petrochemical';
industryArray[1][1] = ['Boiler Water', 'Cooling/Condensate', 'Process Water', 'Stormwater', 'Wastewater Monitoring'];
industryArray[1][2] = ['Lab', 'On-Line', 'Portable'];
industryArray[2][0] = 'Drinking Water';
industryArray[2][1] = ['Ground/Surface Water', 'Process Optimization', 'Regulatory - Drinking Water', 'Security/Distribution'];
industryArray[2][2] = ['Lab', 'On-Line', 'Portable'];
industryArray[3][0] = 'Environmental/Wastewater';
industryArray[3][1] = ['Regulatory - Environmental', 'Stormwater', 'Wastewater Monitoring', 'Wastewater - Municipal'];
industryArray[3][2] = ['Lab', 'On-Line', 'Portable'];
industryArray[4][0] = 'Food, Flavor & Beverage';
industryArray[4][1] = ['Process Water', 'Wastewater Monitoring'];
industryArray[4][2] = ['Lab'];
industryArray[5][0] = 'Other';
industryArray[5][1] = ['Chlor-Alkali', 'Plating', 'Pulp & Paper', 'Research', 'Textiles'];
industryArray[5][2] = ['Lab', 'On-Line', 'Portable'];
industryArray[6][0] = 'Pharma/Biopharmaceutical';
industryArray[6][1] = ['Cleaning Validation & Verification', 'Non-regulatory Monitoring - Pharma', 'Raw Water', 'Real-time Water Release', 'Regulatory - Pharma', 'Wastewater - Pharma', 'Water System Diagnostics'];
industryArray[6][2] = ['Lab', 'On-Line', 'Portable'];
industryArray[7][0] = 'Power';
industryArray[7][1] = ['Boiler Water - Turbines', 'Cooling Water-Power', 'Condensate Steam Loop', 'Make-up/Deionized Water', 'Raw Water', 'Solar Cells'];
industryArray[7][2] = ['Lab', 'On-Line', 'Portable'];
industryArray[8][0] = 'Semiconductor/Display';
industryArray[8][1] = ['Portable Check', 'Pre-RO', 'Raw Water', 'Reclaim', 'Ultrapure Fab', 'Ultrapure Monitoring'];
industryArray[8][2] = ['On-Line', 'Portable'];


var appArray = new Array();
appArray[0] = new Array(2);
appArray[1] = new Array(2);
appArray[2] = new Array(2);
appArray[3] = new Array(2);
appArray[4] = new Array(2);
appArray[5] = new Array(2);
appArray[6] = new Array(2);
appArray[7] = new Array(2);
appArray[8] = new Array(2);
appArray[9] = new Array(2);
appArray[10] = new Array(2);
appArray[11] = new Array(2);
appArray[12] = new Array(2);
appArray[13] = new Array(2);
appArray[14] = new Array(2);
appArray[15] = new Array(2);
appArray[16] = new Array(2);
appArray[17] = new Array(2);
appArray[18] = new Array(2);
appArray[19] = new Array(2);
appArray[20] = new Array(2);
appArray[21] = new Array(2);
appArray[22] = new Array(2);
appArray[23] = new Array(2);
appArray[24] = new Array(2);
appArray[25] = new Array(2);
appArray[26] = new Array(2);
appArray[27] = new Array(2);
appArray[28] = new Array(2);
appArray[29] = new Array(2);
appArray[30] = new Array(2);
appArray[31] = new Array(2);
appArray[32] = new Array(2);
appArray[33] = new Array(2);
appArray[34] = new Array(2);
appArray[0][0] = 'All Applications';
appArray[0][1] = null;
appArray[1][0] = 'All Diagnostics-Power';
appArray[1][1] = ['On-Line', 'Portable'];
appArray[2][0] = 'Boiler Water';
appArray[2][1] = ['Lab', 'On-Line', 'Portable'];
appArray[3][0] = 'Boiler Water - Turbines';
appArray[3][1] = ['On-Line', 'Portable'];
appArray[4][0] = 'Chlor-Alkali';
appArray[4][1] = ['Lab'];
appArray[5][0] = 'Cleaning Validation & Verification';
appArray[5][1] = ['Lab', 'On-Line', 'Portable'];
appArray[6][0] = 'Condensate Steam Loop';
appArray[6][1] = ['On-Line', 'Portable'];
appArray[7][0] = 'Cooling Water-Power';
appArray[7][1] = ['On-Line', 'Portable'];
appArray[8][0] = 'Cooling/Condensate';
appArray[8][1] = ['Lab'];
appArray[9][0] = 'Ground/Surface Water';
appArray[9][1] = ['Lab', 'On-Line', 'Portable'];
appArray[10][0] = 'Make-up/Deionized Water';
appArray[10][1] = ['On-Line', 'Portable'];
appArray[11][0] = 'Non-regulatory Monitoring - Pharma';
appArray[11][1] = ['On-Line', 'Portable'];
appArray[12][0] = 'Plating';
appArray[12][1] = ['Lab'];
appArray[13][0] = 'Portable Check';
appArray[13][1] = ['Portable'];
appArray[14][0] = 'Pre-RO';
appArray[14][1] = ['On-Line', 'Portable'];
appArray[15][0] = 'Process Optimization';
appArray[15][1] = ['Lab', 'On-Line', 'Portable'];
appArray[16][0] = 'Process Water';
appArray[16][1] = ['Lab'];
appArray[17][0] = 'Pulp & Paper';
appArray[17][1] = ['Lab'];
appArray[18][0] = 'Raw Water';
appArray[18][1] = ['On-Line', 'Portable'];
appArray[19][0] = 'Real-time Water Release';
appArray[19][1] = ['On-Line'];
appArray[20][0] = 'Reclaim';
appArray[20][1] = ['On-Line', 'Portable'];
appArray[21][0] = 'Regulatory - Drinking Water';
appArray[21][1] = ['Lab', 'On-Line', 'Portable'];
appArray[22][0] = 'Regulatory - Environmental';
appArray[22][1] = ['Lab', 'On-Line', 'Portable'];
appArray[23][0] = 'Regulatory - Pharma';
appArray[23][1] = ['Lab', 'Portable'];
appArray[24][0] = 'Research';
appArray[24][1] = ['Lab', 'Portable'];
appArray[25][0] = 'Security/Distribution';
appArray[25][1] = ['Lab', 'On-Line', 'Portable'];
appArray[26][0] = 'Solar Cells';
appArray[26][1] = ['On-Line', 'Portable'];
appArray[27][0] = 'Stormwater';
appArray[27][1] = ['Lab'];
appArray[28][0] = 'Textiles';
appArray[28][1] = ['Lab'];
appArray[29][0] = 'Ultrapure Monitoring';
appArray[29][1] = ['On-Line', 'Portable'];
appArray[30][0] = 'Ultrapure Fab';
appArray[30][1] = ['On-Line'];
appArray[31][0] = 'Wastewater - Municipal';
appArray[31][1] = ['Lab', 'On-Line', 'Portable'];
appArray[32][0] = 'Wastewater - Pharma';
appArray[32][1] = ['On-Line', 'Portable'];
appArray[33][0] = 'Wastewater Monitoring';
appArray[33][1] = ['Lab'];
appArray[34][0] = 'Water System Diagnostics';
appArray[34][1] = ['Lab', 'On-Line', 'Portable'];


var sampleTypeArray = new Array();
sampleTypeArray = ['All Modes (Lab, Portable, or On-line)', 'Lab', 'On-Line', 'Portable'];



//TODO - REMOVE REGULATORY - DRINKING WATER FROM EVERYTHING EXCEPT DRINKING WATER
//array of models, organized: 'model name', industry[], application[], sampleType[], rangeLow, rangeHigh
var modelArray = new Array();
modelArray[0] = new Array(6);
modelArray[1] = new Array(6);
modelArray[2] = new Array(6);
modelArray[3] = new Array(6);
modelArray[4] = new Array(6);
modelArray[5] = new Array(6);
modelArray[6] = new Array(6);
modelArray[7] = new Array(6);
modelArray[8] = new Array(6);
modelArray[9] = new Array(6);
modelArray[10] = new Array(6);
modelArray[11] = new Array(6);
modelArray[0] = ['500 RL On-Line', ['Power', 'Pharma/Biopharmaceutical'], ['Regulatory - Pharma', 'Condensate Steam Loop', 'Make-up/Deionized Water', 'Real-time Water Release', 'Regulatory - Drinking Water'], ['On-Line'], [.00000000003], [.0000025]];
modelArray[1] = ['500 RLe On-Line', ['Power', 'Semiconductor/Display'], ['Solar Cells', 'Ultrapure Monitoring', 'Ultrapure Fab'], ['On-Line'], [.00000000003], [.0000025]];
modelArray[2] = ['900 Laboratory', ['Environmental/Wastewater', 'Other', 'Pharma/Biopharmaceutical'], ['Water System Diagnostics', 'Wastewater - Pharma', 'Regulatory - Pharma', 'Regulatory - Environmental', 'Solar Cells', 'Ultrapure Monitoring', 'Wastewater - Municipal', 'Research', 'Cleaning Validation & Verification', 'Regulatory - Drinking Water'], ['On-Line'], [.00000000003], [.000050]];
modelArray[3] = ['900 On-Line', ['Chemical/Petrochemical', 'Environmental/Wastewater', 'Power', 'Pharma/Biopharmaceutical', 'Semiconductor/Display'], ['Wastewater - Pharma', 'Regulatory - Pharma', 'Wastewater - Municipal', 'Cooling/Condensate', 'Boiler Water', 'All Diagnostics-Power', 'Boiler Water - Turbines', 'Condensate Steam Loop', 'Cooling Water-Power', 'Make-up/Deionized Water', 'Cleaning Validation & Verification', 'Raw Water', 'Real-time Water Release', 'Pre-RO', 'Raw Water', 'Reclaim', 'Ultrapure Monitoring', 'Regulatory - Drinking Water'], ['On-Line'], [.00000000003], [.000050]];
modelArray[4] = ['900 On-Line Turbo', ['Chemical/Petrochemical', 'Power', 'Pharma/Biopharmaceutical', 'Semiconductor/Display'], ['Cooling/Condensate', 'Boiler Water', 'All Diagnostics-Power', 'Boiler Water - Turbines', 'Condensate Steam Loop', 'Cooling Water-Power', 'Make-up/Deionized Water', 'Cleaning Validation & Verification', 'Raw Water', 'Pre-RO', 'Reclaim'], ['On-Line'], [.0000000002], [.000010]];
modelArray[5] = ['900 Portable', ['Chemical/Petrochemical', 'Drinking Water', 'Environmental/Wastewater', 'Other', 'Power', 'Pharma/Biopharmaceutical', 'Semiconductor/Display', 'Raw Water'], ['Water System Diagnostics', 'Wastewater - Pharma', 'Regulatory - Pharma', 'Regulatory - Environmental', 'Cooling/Condensate', 'Boiler Water', 'Research', 'Pre-RO', 'Raw Water', 'Reclaim', 'Portable Check', 'Cooling Water-Power', 'Wastewater - Municipal', 'Security/Distribution', 'Process Optimization', 'Ground/Surface Water', 'Ultrapure Monitoring', 'All Diagnostics-Power', 'Boiler Water - Turbines', 'Condensate Steam Loop', 'Make-up/Deionized Water', 'Raw Water', 'Cleaning Validation & Verification', 'Regulatory - Drinking Water'], ['Portable', 'On-Line'], [.00000000003], [.000050]];
modelArray[6] = ['900 Portable Turbo', ['Chemical/Petrochemical', 'Power', 'Pharma/Biopharmaceutical', 'Semiconductor/Display'], ['Water System Diagnostics', 'Cooling/Condensate', 'Boiler Water', 'All Diagnostics-Power', 'Portable Check', 'Boiler Water - Turbines', 'Condensate Steam Loop', 'Cooling Water-Power', 'Make-up/Deionized Water', 'Raw Water', 'Cleaning Validation & Verification', 'Pre-RO', 'Reclaim'], ['Portable', 'On-Line'], [.0000000002], [.000010]];
modelArray[7] = ['5310 C Laboratory', ['Drinking Water', 'Other'], ['Ground/Surface Water', 'Wastewater - Municipal', 'Process Optimization', 'Regulatory - Drinking Water', 'Security/Distribution', 'Research'], ['Lab'], [.000000004], [.000050]];
modelArray[8] = ['5310 C On-Line', ['Drinking Water'], ['Ground/Surface Water', 'Wastewater - Municipal', 'Process Optimization', 'Regulatory - Drinking Water', 'Security/Distribution', 'Research'], ['On-Line'], [.000000004], [.000050]];
modelArray[9] = ['CheckPoint Sensor', ['Power', 'Pharma/Biopharmaceutical', 'Semiconductor/Display'], ['Water System Diagnostics', 'Non-regulatory Monitoring - Pharma', 'Solar Cells', 'Portable Check', 'Condensate Steam Loop', 'Make-up/Deionized Water', 'Reclaim', 'Ultrapure Monitoring'], ['On-Line', 'Portable'], [.0000000005], [.000001]];
modelArray[10] = ['InnovOx Laboratory', ['Chemical/Petrochemical', 'Environmental/Wastewater', 'Food, Flavor & Beverage', 'Other', 'Pharma/Biopharmaceutical'], ['Wastewater - Pharma', 'Regulatory - Environmental', 'Boiler Water', 'Cooling/Condensate', 'Process Water', 'Stormwater', 'Wastewater Monitoring', 'Wastewater Monitoring', 'Wastewater - Municipal', 'Chlor-Alkali', 'Plating', 'Pulp & Paper', 'Research', 'Textiles'], ['Lab'], [.0000005], [.05]];
modelArray[11] = ['InnovOx On-Line', ['Chemical/Petrochemical', 'Environmental/Wastewater', 'Food, Flavor & Beverage', 'Other', 'Pharma/Biopharmaceutical'], ['Wastewater - Pharma', 'Regulatory - Environmental', 'Boiler Water', 'Cooling/Condensate', 'Process Water', 'Stormwater', 'Wastewater Monitoring', 'Wastewater Monitoring', 'Wastewater - Municipal', 'Chlor-Alkali', 'Plating', 'Pulp & Paper', 'Research', 'Textiles'], ['On-Line'], [.0000005], [.05]];








