	//clears "None of the Above" if other options are checked		
	function ClearChecked( val ) 
	{
		document.forms[0].item(val).checked = false;
	}

	function clearNone(checkbox1) {
		checkbox1.checked = false;
	}
	
	function clearAll (noneVal, opVal) {
	opValArray = opVal.split ("|");
		for (x = 0; x < opValArray.length ; x++) {
		eval ("document.Form1." + opValArray[x] + ".checked = false");
		}
	}
	
	//prevents user from selecting more than the allowed amount
	function checkLimit (currentCheckBox, opVal, allow, textmsg)
	{
		var intQcnt = 0;
		opValArray = opVal.split("|");
		for (x = 0; x < opValArray.length ; x++) {
			if ( eval("document.Form1." + opValArray[x] + ".checked") == true) {
				intQcnt = intQcnt + 1;
				document.getElementById(textmsg).style.color='#000000'; // black
			}
			if (intQcnt > allow){
				currentCheckBox.checked = false;
				document.getElementById(textmsg).style.color='#CC0000'; // turns text red if they go over the limit
			}
		}
	}
		
	var bSubmit;
	bSubmit = false;
	
	function cancelClick() {
		return bSubmit;
	}
	
	function setSubmit(aValue) {
		bSubmit = aValue;
		if (aValue == true)
		{
			document.Form1.submit();
		}
	}
	
    /*
    function to submit form when window is closed; use earlier entered email value
    in confirmation textbox
    */
	function setFormCloseSubmit(txtboxClientID, aValue) {

        var e = document.getElementById('userLitCurrentEmail').innerHTML;
        var t = document.getElementById(txtboxClientID).value;

		bSubmit = aValue;

        if (t == ''){
            
            document.getElementById(txtboxClientID).value = e;
        }

		if (bSubmit == true)
		{    
			document.Form1.submit();
		}
        return null;
	}


	function clearCheckBoxFromText( checkName )
	{
		var inputPath = eval('document.forms[0].' + checkName);		
		if (inputPath.checked == true )
		{
			inputPath.checked = false;
		}				
	}
	
	function ClearTextbox(textName)
		{
			document.getElementById(textName).value = '';
		}
	
	// Deselect a radiobuttonlist 
	function ClearRadioList(question)
	{
		var itemCount = eval("document.forms[0]." + question + ".length");
		var n;
		for (n = 0; n < itemCount; n++)
		{
			eval ("document.forms[0]." + question + "_" + n + ".checked = false");
		}
	}
	
	// Deselect dropdownlists 
	function ClearDropLists(questions)
	{
		var list;
		var questionArray = questions.split ("|");
		
		for (x = 0; x < questionArray.length ; x++) {
			list = eval("document.forms[0]." + questionArray[x]);
			list.selectedIndex = 0;
		}
	}
	
    // Deselect all multiple selections in dropdownlist except first item in list, if it is selected
	function ClearMultiplesInList(theList)
	{
		var list = document.getElementById(theList);
		var selections = new Array();
		var count = 0;
		//create array of all selections
		if (list != null){	
		    for (var i=0; i<list.options.length; i++) 
            {
	            if (list.options[i].selected) {
		            selections[count] = list.options[i].value;
		            count++;
        	    }
            }
            //clear all selections except first item, if selected
	        if (selections.length > 1 && selections[0] == 0) {
	            list.selectedIndex = 0
    	    }
		}	
	}
		
	
	// If source dropdownlist equals value passed, set client dropdownlist to same value
	function SetDropListValue(sourceList, clientList, valueToSet)
	{
		var list1 = document.getElementById(sourceList);
		var list2 = document.getElementById(clientList);
		var sourceValueSelected = list1.options[list1.selectedIndex].value; 
		if (sourceValueSelected == valueToSet)
		{
			//loop through client list options
			for(var i=0;i<list2.length;i++) 
             { 
				//set the selected index of the client list to the option
				if (list2.options[i].value == sourceValueSelected)
					{
						list2.selectedIndex = i
					}
             } 
		}	
	}
			
	// This is used as an alternative to links in order to optimize search engine hits
	function goToPage( path )
	{
		window.location.href = path;
	}
	
	// This is for use on the left navigation of the long form - when the users hits any
	// links on the left, we want to make sure that the current page that they are in saves
	// all of it's data
	function submitToPage( path )
	{
		window.document.forms[0].action = path;
		window.document.forms[0].submit();
	}
	
	// This is used to open a new window to the premium report.  If a window is already open, it
	// will not open another one.
	var newWin;
	function openNewWindowSpecial( path )
	{	
		if (newWin != null)
		{
			if (newWin.closed)
				newWin = window.open( path, '', 'location,status,scrollbars,resizable,menubar,toolbar,width=750,height=550' );
			else
				newWin.focus();
		}
		else
		{
			newWin = window.open( path, '', 'location,status,scrollbars,resizable,menubar,toolbar,width=750,height=550' );
		}
	}	
	
	//This will open a window for printer
	function openPrintPage( pageName )
	{
		window.open( pageName );			
	}	
	
	//Limit the length of keyed input to a Textbox control (maxlength property not available for multiline)
	function LimitTextLengthKeyed(aLimit)
	{
		var textbox = event.srcElement;
		if (textbox.value.length > (aLimit - 1))
		{
			return false;
		}
	}
	
	//Limit the length of pasted input to a Textbox control (maxlength property not available for multiline)
	function LimitTextLengthPasted(aLimit)
	{
		var textbox = event.srcElement;
		if (textbox.value.length > aLimit)
		{
			textbox.value = textbox.value.substr(0,aLimit);
		}
	}
	
	// Used in the results pages for RALong
	function switchChlText(switchTo, resID, val0, val1)
	{
		var spn0_ID  = 'chl_' + parseInt(resID) + '_0';
		var spn1_ID  = 'chl_' + parseInt(resID) + '_1';
		var spnjs_ID = 'chl_js_' + parseInt(resID);			
		var spn0  = eval("document.getElementById('" + spn0_ID + "')");
		var spn1  = eval("document.getElementById('" + spn1_ID + "')");
		var spnjs = eval("document.getElementById('" + spnjs_ID + "')");
		
		if (switchTo == 1)
		{			
			// switching from mg/dl to mmol/L
			var val0_mmol = convertToMmol(val0);
			var val1_mmol = convertToMmol(val1);
			
			// update the display								
			spn0.innerHTML = val0_mmol + ' mmol/L';
			spn1.innerHTML = val1_mmol + ' mmol/L';
			
			// updated the link to change back to mg/dl						
			spnjs.href = 'javascript:switchChlText(0,' + resID + ',' + val0 + ',' + val1 + ');';
			spnjs.innerHTML = '(switch to mg/dL)';			
		}
		else if (switchTo == 0)
		{			
			// switching from mmol/L to mg/dl				
			// update the display								
			spn0.innerHTML = val0 + ' mg/dL';
			spn1.innerHTML = val1 + ' mg/dL';						
			
			// updated the link to change to mmol/L
			spnjs.href = 'javascript:switchChlText(1,' + resID + ',' + val0 + ',' + val1 + ');';
			spnjs.innerHTML = '(switch to mmol/L)';
		}
	}
	
	// Used in the results pages for RALong
	function switchChlText1(switchTo, resID, val0)
	{
		var spn0_ID  = 'chl_' + parseInt(resID) + '_0';		
		var spnjs_ID = 'chl_js_' + parseInt(resID);			
		var spn0  = eval("document.getElementById('" + spn0_ID + "')");		
		var spnjs = eval("document.getElementById('" + spnjs_ID + "')");
		
		if (switchTo == 1)
		{			
			// switching from mg/dl to mmol/L
			var val0_mmol = convertToMmol(val0);
			
			// update the display								
			spn0.innerHTML = val0_mmol + ' mmol/L';
			
			// updated the link to change back to mg/dl						
			spnjs.href = 'javascript:switchChlText1(0,' + resID + ',' + val0 + ');';
			spnjs.innerHTML = '(switch to mg/dL)';
		}
		else if (switchTo == 0)
		{			
			// switching from mmol/L to mg/dl				
			// update the display								
			spn0.innerHTML = val0 + ' mg/dL';
			
			// updated the link to change to mmol/L
			spnjs.href = 'javascript:switchChlText1(1,' + resID + ',' + val0 + ');';
			spnjs.innerHTML = '(switch to mmol/L)';
		}
	}
	
	// Used in the results pages for RALong	
	function convertToMmol(valToConvert)
	{
		// divide mg/dl value by 38.6 to get mmmol/L
		var valPreRound = valToConvert / 38.6;
					
		// round to one decimal point, and return
		return Math.round(valPreRound * 10) / 10;
	}