﻿// JScript File


	// Functions for using the enter key with submit buttons
	
	document.onkeydown = getKey;
	
	var ValidationFunction = '';
	var PostBackData = '';

	// Set the validation and postback data ...
	function SetInfo(Validation,Data)
	{
		ValidationFunction = Validation;
		PostBackData = Data;
	}

	// Check to see if the user is using Internet Explorer ...
	function IsIE()
	{
	    return(window.navigator.appName.toLowerCase().indexOf("microsoft") > -1)
	}

	// Handle the KeyDown event ...
	function getKey(keyStroke) 
	{
	    // Is it Internet Explorer ...
		if(IsIE())
		{
		    // Is it the enter key ...
			if(event.keyCode == 13)
			{
			    // Do we need to call a validation function ...
				if (ValidationFunction != '')
				{
					// Run the validation and postback event ...
					if(eval(ValidationFunction + '()'))
					{
					    __doPostBack(PostBackData, '')
					}
				}
			}
		}
	}