	
// Sets initial page state on load
	window.onload = initialize
	
	function initialize() {
		update_available_storage()
		update_record_rates(false)
		update_resolution()
		recalculate()
	}
			
	function recalculate() {
		if ( HTMLpage == 'IntellexStorageCalculator' )
			recalculate_storage_requirements(1);
		else if ( HTMLpage == 'IntellexRecordCalculator' )
			recalculate_record_duration(1);
			
	}
		
// RESULTS CALCULATION  ---------------------------------
	function recalculate_storage_requirements() {
		
// CIF scaling factor; value of 'Resolution' radio group
//set the CIF scaling factor according to the platform and video mode
		var cif_scaling_factor	= cif_factor();
// Audio scaling factor; value of 'Record Audio' radio group
		var audio_scaling_factor	= audio_factor();
// Video mode fields/second, used in determining storage scaling facotr; value of 'Video Mode' radio group
		var fields_per_second	= fields_second();
//set camera_update_rate (for output value) and effective_image_rate (for use in calculating storage_scaling_factor)
		var effective_image_rate	= image_update_rate(1);
		var camera_update_rate		= image_update_rate();
		var invert_camera_update_rate = 1/camera_update_rate
// 	Determine Empirical Data Array to use based on: Video Mode, Sesitivity and Quality Settings.
		var empirical_array	= select_empirical_array();
		var duration = $('#desired_record_duration').val();
// Calculate Storage Requirements
		var combined_scaling_factor = (duration * effective_image_rate) / (fields_per_second * audio_scaling_factor * cif_scaling_factor) * 24;
		var storage_array = new Array(4);
		
		storage_array[0] = ( 1 / empirical_array[0] ) * combined_scaling_factor;
		storage_array[1] = ( 1 / ((0.6666667*empirical_array[1]) + (0.3333333*empirical_array[0])) ) * combined_scaling_factor; 
		storage_array[2] = ( 1 / empirical_array[1] ) * combined_scaling_factor;
		storage_array[3] = ( 1 / empirical_array[2] ) * combined_scaling_factor;
		
		var loop_array = 0;
		for (var count_a = 1 ; count_a <=4 ; count_a++ ) {
			var rounded_value = (storage_array[loop_array]).toFixed(0);
			$( '#cell_' + count_a ).html(format_number(rounded_value) + " GB"); 
			loop_array++;
		}

		$('#camera_update_rate').html(format_number(camera_update_rate.toFixed(3)));
		$('#invert_camera_update_rate').html(format_number(invert_camera_update_rate.toFixed(3)));
	}//end recalculate_storage_requirements
	
	function recalculate_record_duration() {
		
// CIF scaling factor; value of 'Resolution' radio group
//set the CIF scaling factor according to the platform and video mode
		var cif_scaling_factor	= cif_factor();
// Audio scaling factor; value of 'Record Audio' radio group
		var audio_scaling_factor	= audio_factor();
// Video mode fields/second, used in determining storage scaling facotr; value of 'Video Mode' radio group
		var fields_per_second	= fields_second();
//set camera_update_rate (for output value) and effective_image_rate (for use in calculating storage_scaling_factor)
		var effective_image_rate	= image_update_rate(1);
		var camera_update_rate		= image_update_rate();
		var invert_camera_update_rate = 1/camera_update_rate;
// 	Determine Empirical Data Array to use based on: Video Mode, Sesitivity and Quality Settings.
		var empirical_array	= select_empirical_array();
		var duration = $('#desired_record_duration').val();
//set storage scaling factor, scale_factor = storage * fields per sec / effective_image_rate
		var storage_scaling_factor;
		var custom_capacity_value;
		var regular_capacity_value = $('#regular_capacity').val();
		var custom_value = $('#custom_capacity').val().split(' ');
		//finds the value and converts to GB if needed
		if( custom_value[1]	== 'GB' )
			custom_capacity_value	= custom_value[0];
		else if( custom_value[1]	== 'TB' )
			custom_capacity_value	= custom_value[0] * 1024;
			
		if ( $('#radio_regular' ).attr('checked') ) { // Use value of selection from 'Regular Capacity' list
			storage_scaling_factor = regular_capacity_value * (fields_per_second / effective_image_rate);
		}
		else { // Use value from 'Custom Capacity' input
			storage_scaling_factor = custom_capacity_value * (fields_per_second / effective_image_rate);
		}

// Calculate Record Durations
		var combined_scaling_factor_days = storage_scaling_factor * audio_scaling_factor * cif_scaling_factor;
		var combined_scaling_factor_hours = combined_scaling_factor_days/24;
		var duration_array = new Array(8);
		
		duration_array[0] = empirical_array[0] * combined_scaling_factor_days
		duration_array[1] = empirical_array[0] * combined_scaling_factor_hours
		duration_array[2] = ((0.6666667*empirical_array[1]) + (0.3333333*empirical_array[0])) * combined_scaling_factor_days 
		duration_array[3] = ((0.6666667*empirical_array[1]) + (0.3333333*empirical_array[0])) * combined_scaling_factor_hours
		duration_array[4] = empirical_array[1] * combined_scaling_factor_days
		duration_array[5] = empirical_array[1] * combined_scaling_factor_hours
		duration_array[6] = empirical_array[2] * combined_scaling_factor_days
		duration_array[7] = empirical_array[2] * combined_scaling_factor_hours
		
		var loop_array = 0
		for (var count_a = 1 ; count_a <=4 ; count_a++ ) {
			for (var count_b = 1 ; count_b <=2 ; count_b++ ) {
				cell = "cell_" + count_a + count_b
				var rounded_value = (duration_array[loop_array]).toFixed(2);
				$('#' + cell).html(format_number(rounded_value));
				loop_array++
			}
		}
		
		$('#camera_update_rate').html(format_number(camera_update_rate.toFixed(3)));
		$('#invert_camera_update_rate').html(format_number(invert_camera_update_rate.toFixed(3)));
	}//end recalculate_record_duration
	
	function cif_factor() {
		var cif_scaling_factor;
	//platform if ip or ultra change to true CIF based on video mode
	//For 4.3 all platforms use true CIF
		//if( $( '#platform_ip' ).attr('checked') || $( '#platform_ultra' ).attr('checked') ){ //platform IP or ULTRA
			if( $( '#ntsc' ).attr('checked') ) { //Video Mode = NTSC
				if( $('#1cif').attr('checked'))
					cif_scaling_factor	= $('#1cif').val()*1/1.1;
				else if( $('#2cif').attr('checked'))
					cif_scaling_factor	= $('#2cif').val()*1/1.1;
				else if( $('#4cif').attr('checked'))
					cif_scaling_factor	= $('#4cif').val()*1/1.1;
			}
			else { //Video Mode = PAL
				if( $('#1cif').attr('checked'))
					cif_scaling_factor	= $('#1cif').val()*1/1.32;
				else if( $('#2cif').attr('checked'))
					cif_scaling_factor	= $('#2cif').val()*1/1.32;
				else if( $('#4cif').attr('checked'))
					cif_scaling_factor	= $('#4cif').val()*1/1.32;
			}
		//}//end if
		/*else { //platform DVMS or LT
			if( $('#1cif').attr('checked'))
				cif_scaling_factor	= $('#1cif').val();
			else if( $('#2cif').attr('checked'))
				cif_scaling_factor	= $('#2cif').val();
			else if( $('#4cif').attr('checked'))
				cif_scaling_factor	= $('#4cif').val();
		}//end else
		*/
		return cif_scaling_factor;
	}
	
	function audio_factor() {
		if( $('#record_audio_on').attr('checked'))
			audio_scaling_factor	= $('#record_audio_on').val();
		else if( $('#record_audio_off').attr('checked'))
			audio_scaling_factor	= $('#record_audio_off').val();
		return audio_scaling_factor;
	}
	
	function fields_second() {
		if( $('#ntsc').attr('checked') )
			fields_per_second	= $('#ntsc').val();
		else if( $('#pal').attr('checked') )
			fields_per_second	= $('#pal').val();
		return fields_per_second;
	}
	
	function image_update_rate( value ) {
		var record_rate_value 	= $('#record_rate option:selected').val();
		var cameras_value 		= $('#cameras option:selected').val();
		var effective_image_rate = record_rate_value
		var camera_update_rate = (record_rate_value/cameras_value)
		if ( $('#ntsc').attr('checked') ) {
			if (camera_update_rate > 30) {
				camera_update_rate = 30
				effective_image_rate = 30 * cameras_value
			}
		}
		else {
			if ( camera_update_rate > 25 ) {
				camera_update_rate = 25
				effective_image_rate = 25 * cameras_value
			}
		}
		//if 1 is passed return effective_image_rate
		if ( value )
			return effective_image_rate;
		else
			return camera_update_rate;
	}
		
	function select_empirical_array() {
		// Determine index of Quality; for use in selecting the appropriate 'empirical array'
		var quality_index; 
		if( $('#high').attr('checked'))
			quality_index	= 0;
		else if( $('#quality_normal').attr('checked'))
			quality_index	= 1;
		else if( $('#quality_extended').attr('checked'))
			quality_index	= 2;

// 	Determine Empirical Data Array to use based on: Video Mode, Sesitivity and Quality Settings.
		if ( $('#ntsc').attr('checked') ) { // Video Mode = NTSC
			if ( $('#sensitivity_high').attr('checked') ) { // Sensitivity = HIGH
				switch(quality_index) {
					case 0: // Quality = HIGH
						var empirical_array = new Array(2.94, 0.41, 0.26, 2.24, 0.33, 0.17)
						break
					case 1: // Quality = NORMAL
						var empirical_array = new Array(4.06, 0.48, 0.43, 2.92, 0.39, 0.23)
						break
					case 2: // Quality = EXTENDED
						var empirical_array = new Array(5.42, 0.89, 0.57, 3.73, 0.70, 0.28)
						break
				}
			}
			else { // Sensitivity = NORMAL
				switch(quality_index) {
					case 0: // Quality = HIGH
						var empirical_array = new Array(4.66, 0.59, 0.26, 3.25, 0.47, 0.17)
						break
					case 1: // Quality = NORMAL
						var empirical_array = new Array(6.59, 0.69, 0.43, 4.18, 0.55, 0.23)
						break
					case 2: // Quality = EXTENDED
						var empirical_array = new Array(8.21, 1.26, 0.57, 5.03, 0.98, 0.28)
						break
				}
			}
		}
		else { // PAL
			if ( $('#sensitivity_high').attr('checked') ) { // Sensitivity = HIGH
				switch(quality_index) {
					case 0: // Quality = HIGH
						var empirical_array = new Array(3.53, 0.49, 0.31, 2.69, 0.40, 0.21)
						break
					case 1: // Quality = NORMAL
						var empirical_array = new Array(4.88, 0.58, 0.51, 3.50, 0.47, 0.28)
						break
					case 2: // Quality = EXTENDED
						var empirical_array = new Array(6.50, 1.06, 0.68, 4.48, 0.84, 0.34)
						break
				}
			}
			else { // Sensitivity = NORMAL
				switch(quality_index) {
					case 0: // Quality = HIGH
						var empirical_array = new Array(5.59, 0.71, 0.31, 3.89, 0.57, 0.21)
						break
					case 1: // Quality = NORMAL
						var empirical_array = new Array(7.90, 0.83, 0.51, 5.02, 0.66, 0.28)
						break
					case 2: // Quality = EXTENDED
						var empirical_array = new Array(9.86, 1.52, 0.68, 6.04, 1.18, 0.34)
						break
				}
			}
		}
		return empirical_array;
	}
	
	function format_number(num)	{ 
		var n = '' + num;
		var numl  = n.length;
		var i = n.indexOf('.');
		var fract = '';
	
		if (i > -1){
			numl -= n.length-i;
			fract = n.substring(i);
		}
		if (numl > 3){
			var s, dl = numl%3;
			var str = (dl > 0) ? n.substring(0,dl):'';
			var max = Math.floor(numl/3);
			for (i=0 ; i < max ; i++){
				s = n.substring(dl+i*3,dl+i*3+3);
				str += (dl==0 && i==0) ? s : ","+s;
			}
			return str+fract;
		}else return n;
	}
	

// SETTINGS CONTROL --------------------------------------------
	
	// Sets 'Record Capacity' radio button to 'custom' when user selects the value from the Custom drop down.
	function select_custom() {
		$( '#radio_custom' ).attr( 'checked', 'true' );
	}

	// Sets 'Record Capacity' radio button to 'regular' when user selects from standard drive sizes.
	function select_regular() {
		$( '#radio_regular' ).attr( 'checked', 'true' );
	}

	// Validates value in 'Record Capacity' text-box is a decimal within the range of 10 to 5000.
	function validate_custom() {
		
		custom_value = document.getElementById("custom_capacity").value
		numeric_value = parseFloat(custom_value)
		
		if (!IsNumeric(custom_value)) {
			alert("Please enter a number.")
			document.getElementById("custom_capacity").value = ""
			document.getElementById("custom_capacity").focus()
		}
		
		if (numeric_value > 5000) {
			document.getElementById("custom_capacity").value = "5000"
		}

		if (numeric_value < 10) {
			document.getElementById("custom_capacity").value = "10"
		}
	}
	
	function IsNumeric(strString) {
		//  check for valid numeric strings	
		var strValidChars = "0123456789.";
		var strChar;
		var blnResult = true;
		var hasDecimal = false;
		
		if (strString.length == 0) return false;
		
		//  test strString consists of valid characters listed above
		for (i = 0; i < strString.length && blnResult == true; i++) {
			strChar = strString.charAt(i);
			if (strValidChars.indexOf(strChar) == -1) {
				blnResult = false;
			}
			if (IsDot(strChar)) {
				if (!hasDecimal) {
				hasDecimal = true;
				}
				else {
				blnResult = false;
				}
			}
		}
		return blnResult;
	}
   
	function IsDot(strChar) {
		//  check for valid numeric strings	
		var strValidChars = ".";
		var blnResult = true;
		
		//  test strString consists of valid characters listed above
		if (strValidChars.indexOf(strChar) == -1) {
			blnResult = false;
		}
		return blnResult;
	}
	
	//
	function show_video_format() {
		document.forms[1].video_format[0].checked
	}
	
	
	
	// These functions call the appropriate validation routines in response to changes. 
	// This is to ensure that only legal options are available for the various combinations of 
	// platform, resolution and record rate.
	function platform_changed()
	{
		update_available_storage()
		update_record_rates(true) //preserves selected value
		update_resolution()
	}
	
	function video_mode_changed()
	{
		update_record_rates(false) //preserves selected index
	}
	
	function resolution_changed()
	{
		update_record_rates(true) //preserves selected value
	}
	
	function record_rate_changed()
	{
		update_resolution()
	}
	
	
	
	// Updates 'Available Storage' based on selection of 'Select a Platform'
	function update_available_storage() {
		//updates regular storage based on selection of 'Select a Platform'
		var regular_storage = new Array()

		if ( $('#platform_ip').attr('checked') ) {
			regular_storage = ["500", "250"]
		}
		else if ( $('#platform_ultra').attr('checked') ) {
			regular_storage = ["1600", "1200", "800"]
		}
		else if ( $('#platform_dvms').attr('checked') ) {
			regular_storage = ["500", "320", "250", "160"]
		}
		else if ( $('#platform_lt').attr('checked') ) {
			regular_storage = ["320", "160"]
		}

		$('#regular_capacity').children().remove();
		var opt	= '';
		for (counter = 0; counter < regular_storage.length ; counter++) {
			opt	+= '<option value="' + regular_storage[counter] + '">' + regular_storage[counter] + ' GB</option>';
		}
		$('#regular_capacity').html(opt);
		
		//updates custom storage based on selection of 'Select a Platform'
		var custom_storage = new Array()

		if ( $('#platform_ip').attr('checked') ) {
			custom_storage = ["1.0 TB", "500 GB", "250 GB"];
		}
		else if ( $('#platform_ultra').attr('checked') ) {
			custom_storage = ["4.0 TB", "3.0 TB", "2.0 TB", "1.6 TB", "1.5 TB", "1.2 TB", "1.0 TB", "800 GB", "500 GB", "400 GB"]
		}
		else if ( $('#platform_dvms').attr('checked') ) {
			custom_storage = ["1.5 TB", "1.0 TB", "750 GB", "500 GB", "320 GB", "250 GB", "160 GB"]
		}
		else if ( $('#platform_lt').attr('checked') ) {
			custom_storage = ["500 GB", "320 GB", "250 GB", "160 GB"]
		}

		$('#custom_capacity').children().remove();
		var opt	= '';
		for (counter = 0; counter < custom_storage.length ; counter++) {
			opt	+= '<option value="' + custom_storage[counter] + '">' + custom_storage[counter] + '</option>';
		}
		$('#custom_capacity').html(opt);
		
		
	}

	
	// Updates 'Record Rates'
	function update_record_rates(preserve_value) {
		
	// First update the available rates based on the the 'Video Mode' selected
		var rate_array = new Array(9)
		var record_rate_value = $('#record_rate option:selected').val(); // preserve the selected value
		var record_rate_index = $('#record_rate').attr("selectedIndex");  // preserve the selected index
		// set the rate 
		if ($('#ntsc').attr('checked')) {
			rate_array = ["480", "240", "120", "60", "30", "15", "7", "3", "1"]
		}
		else {
			rate_array = ["400", "200", "100", "50", "25", "15", "7", "3", "1"]
		}
		

		$('#record_rate').children().remove();
		var opt	= '';
		for (counter = 0; counter < rate_array.length ; counter++) {
			opt	+= '<option value="' + rate_array[counter] + '">' + rate_array[counter] + ' ips</option>';
		}
		$('#record_rate').html(opt);
	// Now, remove any values that are not appropriate for the selected platform/resolution
		
		// Determine which 'Resolution' is selected
		var selected_resolution;
		if( $('#1cif').attr('checked'))
			selected_resolution	= 0;
		else if( $('#2cif').attr('checked'))
			selected_resolution	= 1;
		else if( $('#4cif').attr('checked'))
			selected_resolution	= 2;
			
		if ( $( '#platform_ip' ).attr('checked') ) {
			switch(selected_resolution) { 
				case 2: // 'Resolution' is set to 4 CIF
					if ( $( '#record_rate option[index="0"]' ).val() == "480" || $( '#record_rate option[index="0"]' ).val() == "400" ) {
						$( '#record_rate option[index="0"]' ).remove();
					}
					break
				case 1: // 'Resolution' is set to 2 CIF
					if ( $( '#record_rate option[index="0"]' ).val() == "480" || $( '#record_rate option[index="0"]' ).val() == "400" ) {
						$( '#record_rate option[index="0"]' ).remove();
					}
					break
				case 0: // 'Resolution' is set to 1 CIF
					break
			}
		}
		else if ($( '#platform_ultra' ).attr('checked')) {
			switch(selected_resolution) { 
				case 2: // 'Resolution' is set to 4 CIF
					break
				case 1: // 'Resolution' is set to 2 CIF
					break
				case 0: // 'Resolution' is set to 1 CIF
					break
			}
		}
		else if ($( '#platform_dvms' ).attr('checked')) {
			switch(selected_resolution) { 
				case 2: // 'Resolution' is set to 4 CIF
					if ( $( '#record_rate option[index="0"]' ).val() == "480" || $( '#record_rate option[index="0"]' ).val() == "400" ) {
						$( '#record_rate option[index="0"]' ).remove();
					}
					break
				case 1: // 'Resolution' is set to 2 CIF
					break
				case 0: // 'Resolution' is set to 1 CIF
					break
			}
		}
		else if ($( '#platform_lt' ).attr('checked')) {
			switch(selected_resolution) { 
				case 2: // 'Resolution' is set to 4 CIF
					if ( $( '#record_rate option[index="0"]' ).val() == "480" || $( '#record_rate option[index="0"]' ).val() == "400" ) {
						$( '#record_rate option[index="0"]' ).remove();
					}
					if ( $( '#record_rate option[index="0"]' ).val() == "240" || $( '#record_rate option[index="0"]' ).val() == "200" ) {
						$( '#record_rate option[index="0"]' ).remove();
					}
					break
				case 1: // 'Resolution' is set to 2 CIF
					if ( $( '#record_rate option[index="0"]' ).val() == "480" || $( '#record_rate option[index="0"]' ).val() == "400" ) {
						$( '#record_rate option[index="0"]' ).remove();
					}
					break
				case 0: // 'Resolution' is set to 1 CIF
					break
			}
		}
				
		if (!preserve_value) {
			$('#record_rate ')[0].selectedIndex	= record_rate_index;
		}
		else {
			$('#record_rate ').val(record_rate_value);
		}

		
	}
	
	
	// Validates legal 'Resolution'
	function update_resolution() {

		var record_rate_value = $('#record_rate option:selected').val(); // preserve the selected value
		var selected_resolution;
		if( $( '#1cif' ).attr( 'checked') )
			selected_resolution = 0;
		else if( $( '#2cif' ).attr( 'checked') )
			selected_resolution = 1;
		else if( $( '#4cif' ).attr( 'checked') )
			selected_resolution = 2;
		$( '#1cif' ).attr( 'disabled', '' );
		$( '#2cif' ).attr( 'disabled', '' );
		$( '#4cif' ).attr( 'disabled', '' );
		if (record_rate_value == "400") { record_rate_value = "480" }
		if (record_rate_value == "200") { record_rate_value = "240" }

		if ( $( '#platform_ip' ).attr('checked') ) {
			switch(record_rate_value) { 
				case "480": // 'Record Rate' is set to 480 ips
					$( '#1cif' ).attr( 'checked', 'checked' ); //set 'Resolution' to 1 CIF
					$( '#2cif' ).attr( 'disabled', 'disabled' ); //disable 2 CIF
					$( '#4cif' ).attr( 'disabled', 'disabled' ); //disable 4 CIF
					break
								
			}
		}
		else if ( $( '#platform_dvms' ).attr('checked') ) {
			switch(record_rate_value) { 
				case "480": // 'Record Rate' is set to 480 ips
					if( selected_resolution == 1 )
						$( '#2cif' ).attr( 'checked', 'checked' ); //set 'Resolution' to 2 CIF
					else 
						$( '#1cif' ).attr( 'checked', 'checked' ); //set 'Resolution' to 1 CIF
					//$( '#2cif' ).attr( 'disabled', '' ); //disable 2 CIF
					$( '#4cif' ).attr( 'disabled', 'disabled' ); //disable 4 CIF
					break
								
			}
		}
		
		else if ( $( '#platform_lt' ).attr('checked') ) {
			switch(record_rate_value) { 
				case "480": // 'Record Rate' is set to 480 ips
					$( '#1cif' ).attr( 'checked', 'checked' ); //set 'Resolution' to 1 CIF
					$( '#2cif' ).attr( 'disabled', 'disabled' ); //disable 2 CIF
					$( '#4cif' ).attr( 'disabled', 'disabled' ); //disable 4 CIF
					break
				case "240": // 'Record Rate' is set to 240 ips
					if( selected_resolution == 1 )
						$( '#2cif' ).attr( 'checked', 'checked' ); //set 'Resolution' to 2 CIF
					else 
						$( '#1cif' ).attr( 'checked', 'checked' ); //set 'Resolution' to 1 CIF
					$( '#4cif' ).attr( 'disabled', 'disabled' ); //disable 4 CIF
					break
								
			}
		}
		
	}
	

	function blockSubmit( e ) {
		var evt = e || window.event;
		var keyPressed = e.which || window.event.keyCode
		if ( keyPressed == 13 ) {
			// If the Enter key is pressed, convert to tab. 
			recalculate();
			//(evt == e)? e.preventDefault() : window.event.keyCode = 9; 
			if( window.event )
				window.event.keyCode = 9; 
			else
				e.preventDefault();
		} 
		else { 
			// If other than the Enter key is pressed, cancel. 
			evt.cancelBubble = true; 
		}
	}
	
	function block_tab() {
		if ( window.event.keyCode = 9 ) {
			window.event.cancelBubble = true;
		}
	}
	


	
	
// HELP SECTION ------------------------------------------------------
function top() {
	window.location.hash = "#calc"
}
	
function show_help(help_term) {
	
	var term
	var text
	
	switch(help_term) {
		
		case 'platform':
				term = "Intellex Platforms"
				text = "<p>For detailed information on the available Intellex harware platforms, visit the <a href='http://www.americandynamics.net/products/intellex_home.aspx'>Intellex Family section</a> of the American Dynamics website.</p>"
				break
			case 'video':
				term = "Video Mode"
				text = "<p>Video Mode indicates the video standard Intellex is using - NTSC or PAL. Your selection affects the list of choices in the Aggregate Record Rate and the resultant Camera Update Rate in the calculator.</p>"
				break
			case 'quality':
				term = "Quality"
				text = "<p>Quality determines the tradeoff between image quality and storage space consumption. “Super” emphasizes better image quality at the cost of greater storage consumption. “Extended” favors conservation of storage space, but at the cost of reduced image quality. “Normal” selects a balance between the two.</p>"
				break
			case 'sensitivity':
				term = "Sensitivity"
				text = "<p>Sensitivity affects how responsive Intellex is to small changes between images. This affects image resolution and the rate at which storage space is consumed. “High” records smaller changes, resulting in better resolution but greater storage consumption. “Normal” ignores smaller changes, resulting in less resolution but also decreased storage consumption.</p>"
				break
			case 'resolution':
				term = "Resolution"
				text = "<p>Resolution indicates the image size being recorded by Intellex. Larger image sizes provide better resolution, while smaller image sizes save on storage space. If the video mode is 'NTSC', a setting of '1 CIF' sets the image size to 352 x 240, '2 CIF' selects an image size of 704 x 240, and '4 CIF' sets the size at 704 x 480 and if the video mode is 'PAL', a setting of '1 CIF' sets the image size to 352 x 288, '2 CIF' sets an image size of 704 x 288, and '4 CIF' sets the size at 704 x 576.</p>"
			break

			case 'available_storage':
				term = "Available Storage"
				text = "<p>Available Storage indicates the total amount of hard drive space available to Intellex for recording video, including any external devices (e.g., additional ESMs).</p"
				break
			case 'record_rate':
				term = "Aggregate Record Rate"
				text = "<p>Aggregate Record Rate describes the maximum rate at which images <b>from all cameras</b> can be recorded on Intellex. For example, if the aggregate rate is set to 120 IPS, 4 cameras could be recorded at 30 IPS each. However, if 16 cameras were being recorded, each camera could only record at 7.5 IPS.</p>"
				break
			case 'cameras':
				term = "Number of Cameras"
				text = "<p>Number of Cameras indicates how many cameras are being recorded on Intellex.</p>"
				break
			case 'audio':
				term = "Record Audio"
				text = "<p>Checking the Record Audio box indicates that Intellex will be recording audio as well as video. Recording audio will reduce the record duration by less than 3%.</p>"
				break
			case 'duration_desired':
				term = "Desired Record Durration"
				text = "<p>Enter the number of days recording you desire. The calculator will automatically update the estimated storage required to achaive the desired record duration for the four motion secarios.</p>"
				break
			case 'estRecordDuration':
				term = "Estimated Record Duration"
				text = "<p>The Estimated Record Duration uses all of the calculator settings to predict how much recording time is likely for four different motion scenarios.</p><p>Click the 'Motion' heading for information about each scenario.</p>"
				break
			case 'estStorageRequired':
				term = "Estimated Storage Required"
				text = "<p>The Estimated Storage Required uses the calculator settings to predict how much storage would be required to acheive teh desired record duration under four different motion scenarios.</p><p>Click the 'Motion' heading for information about each scenario.</p>"
				break
			case 'minimal':
				term = "Minimal Motion"
				text = "<p>A quiet room or hallway with an occasional occupant or traffic. Virtually no motion or change due to wind, camera motion, or camera noise.</p>"
				break
			case 'casual':
				term = "Casual Motion"
				text = "<p>A room or hallway with a couple of occupants or fairly frequent traffic. A sidewalk or street with some traffic and little motion due to wind, light, or camera noise.</p>"
				break
			case 'moderate':
				term = "Moderate Motion"
				text = "<p>A busy room or hallway with several moving occupants at a time. A street or sidewalk with moderate traffic and/or moderate motion of trees and bushes due to wind.</p>"
				break
			case 'severe':
				term = "Severe Motion"
				text = "<p>Extreme motion caused by camera motion or severe camera noise. A panning dome camera or severe wind motion in most of the image.</p>"
				break
			case 'camera_update':
				term = "Camera Update Rate"
				text = "<p>Camera Update Rate indicates how many images per second (IPS) are being recorded on any particular camera. This is calculated by dividing the Aggregate Record Rate by the Number of Cameras. Note that the maximum record rate of any single camera is limited to 30 IPS for NTSC and 25 IPS for PAL. These are considered real time rates.</p><p>In addition, the inverse calculation is displayed (seconds per image), indicating how much time elapses between each update to a camera.</p>"
				break				
			default:
				term = "Undefined"
				text = "<p>No help text defined.</p>"
	}
	
	document.getElementById('help_term').innerHTML = term
	document.getElementById('help_text').innerHTML = text
	window.location.hash = "#help"

}

