	
	var cp = new ColorPicker('window');
	var cp2 = new ColorPicker();

	var tt = '';
	
	
	function BodyOnLoad()
	{
		StoreFormInfo();
		CacheImages();
	};
	
	
	function CacheImages()
	{
		image1 = new Image();
		image1.src = "images/mainbutton1h.gif";
		image2 = new Image();
		image2.src = "images/mainbutton2h.gif";
		image3 = new Image();
		image3.src = "images/mainbutton3h.gif";
		image4 = new Image();
		image4.src = "images/mainbutton4h.gif";
		image5 = new Image();
		image5.src = "images/mainbutton5h.gif";
		image6 = new Image();
		image6.src = "images/helpbutton1.gif";
		image7 = new Image();
		image7.src = "images/helpbutton2h.gif";
		image8 = new Image();
		image8.src = "images/mainbutton1.gif";
		image9 = new Image();
		image9.src = "images/mainbutton2.gif";
		image10 = new Image();
		image10.src = "images/mainbutton3.gif";
		image11 = new Image();
		image11.src = "images/mainbutton4.gif";
		image12 = new Image();
		image12.src = "images/mainbutton5.gif";
		image13 = new Image();
		image13.src = "images/colorpickerbutton.gif";
		image14 = new Image();
		image14.src = "images/colorpickerbutton_nc.gif";
	};
	
	
	function GraphSend(temp)
	{
		if (temp == 'Send')
		{
			alert('Your graph has been sent...')
		}
	};
	
	
	function SubmitForm()
	{
		document.form5.ReloadPreview.value = 'true';
		document.form5.submit();
	};
	
	
	function StoreFormInfo()
	{
		tt = GetFormInfo();
	};
	
	
	function GetFormInfo()
	{
		var jj = '';

		for (i=5; i<document.forms[0].elements.length; i++)
		{
			if (document.forms[0].elements.item(i).type == 'radio')
			{
				jj = jj + document.forms[0].elements.item(i).value + '-' + document.forms[0].elements.item(i).checked;
			}
			else
			{
				jj = jj + document.forms[0].elements.item(i).value;
			};
		};
		
		return jj;
	};
	
	
	function CheckForFormChange()
	{
	
		var gg = '';	
		gg = GetFormInfo();
		
		if (tt !== gg)
		{
			return true;
		}
		else
		{
			return false;
		};
	
	};



	function UpdatePreview()
	{
	
		if (CheckForFormChange()==true || document.form5.ReloadPreview.value !=='')
		{
			document.form5.PageSectionNum.value=4;
			document.form5.ReloadPreview.value = '';
			document.form5.submit();
		}
		else
		{
			ChangeView(4,'#E7D9E6');
		};
	
	};
	
	
	function ShowArrows(temp)
	{
		if (temp==true)
		{
			document.images['HelpArrows'].src = 'images/redarrowhelp.gif'
			document.getElementById("HelpArrowsID").className='ClassShow';
		}
		else
		{
			document.images['HelpArrows'].src = 'images/spacer.gif'
			document.getElementById("HelpArrowsID").className='ClassHidden';
		}
	
	};
	

	function Questions()
	{
	
		window.open(temp,tempWin,'width=350,height=250,screenX=0,screenY=0,top=0,left=0,toolbar=no,status=yes,menubar=no,titlebar=no,scrollbars=no,resizable=no');
	
	};
	
	function StartOver()
	{
	
		if(confirm('Are you sure you want to Start Over?\n\nClick OK to start a new graph')==true)
		{
			window.self.location.href='default.aspx';
		}
	
	};

	function EraseGraph(temp)
	{
	
		if(confirm('Are you sure you want to erase this graph?\n\nClick OK to start this graph over.')==true)
		{
			window.self.location.href='processform.aspx?ID='+temp+'&Action=EraseGraph';
		}
	
	};
	
	
	function CopyToNewGraph(temp)
	{
	
		if(confirm('Are you sure you want to copy this graph to a new graph?\n\nClick OK to continue.')==true)
		{
			window.self.location.href='processform.aspx?ID='+temp+'&Action=CopyToNewGraph';
		}
	
	};
	
	
	
	function CheckChartTypeChange(temp)
	{
		var CurrentVal = window.document.form5.ChartType.value;
		var tempval = temp
		
		if (((temp=='Pie' || temp=='XY' || temp=='Gauge') || ((temp=='Bar' || temp=='Line' || temp=='Area') && (CurrentVal=='XY' || CurrentVal=='Gauge'))) && CurrentVal!='')
		{
			if(confirm('Switching to ' + tempval.toLowerCase() + ' chart may erase any data you have entered.\nAre you sure you want to switch to a pie chart?')==false)
			{
				return false;
			}
		};
		
	
		return true;
	
	};
	
	
	function ChartTypeChange(temp)
	{
	
		if (window.document.form5.ChartType.value!==temp && CheckChartTypeChange(temp))
		{
			window.document.form5.ChartType.value=temp;
			document.form5.ReloadPreview.value = 'true';
			document.form5.submit();
		};
	};
	
	
	
	function HighlightField(temp,OnOff)
	{
	
		var ClassTemp
		
		if (OnOff == "On")
		{
			ClassTemp = 'Class1b';
		}
		else if (OnOff == "Off")
		{
			ClassTemp = 'Class1';
		}
	
		eval('document.form5.BarName' + temp).className=ClassTemp;
		eval('document.form5.BarVal' + temp).className=ClassTemp;
	};
	
	
	function RecBrowserCheck()
	{
		var ieversion = 0;

		var appVersion = navigator.appVersion

		if (appVersion.indexOf("MSIE") != -1){
			var ieversion = parseFloat(appVersion.split("MSIE")[1])
		}
			
			
		if (((navigator.appName == 'Microsoft Internet Explorer') && (ieversion >= 6)) || ((navigator.appName == "Netscape") && (parseFloat(navigator.appVersion) >= 5)))
		{
			return true;
		}
		else
		{
			return false;
		}
	};

	
	function ChangeView(temp1,temp2)
	{

		var CurrentVal = window.document.form5.ChartType.value;

		if (document.form5.PageSectionNum.value!=temp1 && CurrentVal!='')
		{
		
			var thestyle_a
			document.form5.PageSectionNum.value=temp1;
			
			var thestyle_b

			if (RecBrowserCheck())
			{
			
				ChangeHelpSec(document.form5.HelpSectionNum.value,document.form5.PageSectionNum.value,document.form5.ChartType.value);
		
				for (i=1; i<6; i++) 
				{
					
					if (i !== temp1)
					{
						document.images['IMG_' + i].src = 'images/mainbutton' + i + '.gif'
					
						document.getElementById("Section"+ i).className='ClassHidden';

					}
				}
				
				document.getElementById("Section"+ temp1).className='ClassShow';

				
				document.images['IMG_' + temp1].src = 'images/mainbutton' + temp1 + 'h.gif'
	
				document.getElementById("MainTable1").style.backgroundColor=temp2;
				
				ShowArrows(false);
			}
			else
			{		
				document.form5.submit();
			}
		}
	};



	function showStatus(sMsg) {
	    window.status = sMsg ;
	    return true;
	};
	
	
	
	function ChangeHelpView(temp1)
	{

		var thestyle_a
		document.form5.HelpSectionNum.value=temp1;

		if (RecBrowserCheck())
		{
			for (i=1; i<3; i++) 
			{
				
				if (i !== temp1)
				{
					document.images['HELPIMG_' + i].src = 'images/helpbutton' + i + '.gif'
				
				}
			}
			
			ChangeHelpSec(document.form5.HelpSectionNum.value,document.form5.PageSectionNum.value,document.form5.ChartType.value);
			
			document.images['HELPIMG_' + temp1].src = 'images/helpbutton' + temp1 + 'h.gif'
			
			ShowArrows(false);
		}
		else
		{		
		document.form5.submit();
		}
	};
	
	
	
	function DownloadWin(temp,tempWin,tempW,tempH)
	{
		window.open(temp,tempWin,'width='+ tempW +',height='+ tempH +',screenX=0,screenY=0,top=0,left=0,toolbar=no,status=yes,menubar=no,titlebar=no,scrollbars=no,resizable=no');
		
		if (CheckForFormChange()==true || document.form5.ReloadPreview.value !=='')
		{
			document.form5.submit();
		}
	};


	function ItemSelect(temp)
	{
		tempobj = eval('document.form5.' + temp);

		ChangeView(3,'#F6F5BA');
		tempobj.focus();
		tempobj.select();
	};


