// $Header: /Ready Reckoner (2)/asproot/visitors_book/js/cross_scripting.js 1     9/12/02 17:54 Thentzsc $ 
//-------------------------------------------------------------------------------- 
// Document	: cross_scripting.js
// Purpose 	: Common interface that allows individual routines to test for 
//		  Object Detection and run appropriate routines for that browser. 
//		  NS6.2.3, NS7, IE5.x. 
// Project 	: Ready Reckoner 
// History 	: PA 20-Nov-2002 (Created)
// Author 	: pash 
//-------------------------------------------------------------------------------- 
// Revision History 
//-------------------------------------------------------------------------------- 
// $Revision: 1 $ 
// $Log: /Ready Reckoner (2)/asproot/visitors_book/js/cross_scripting.js $ 
//
//1     9/12/02 17:54 Thentzsc
//added from uat server due to corruption problems
//
//2     20/11/02 18:05 Pash
//
//1     20/11/02 17:19 Pash
//--------------------------------------------------------------------------------
//--------------------------------------------------------------------------------
// Purpose		Attaches keypress events to textboxes and renames classes for
//			textboxes when it detects Netscape
//	
// Parameters		None
//
// Returns 		nothing			
//
// History		PA 07-Nov-2002 v0.1 (Created) 
//
// Comment		The key press event is found in Editmasks.js
//--------------------------------------------------------------------------------
function NS_Startup() 
{
	// - Textareas
	document.getElementById("easyUseReason").onkeypress = NSKeypress_CutTextEVENT;
	document.getElementById("helpfulReason").onkeypress = NSKeypress_CutTextEVENT;
	document.getElementById("futureRequests").onkeypress = NSKeypress_CutTextEVENT;
	document.getElementById("otherComments").onkeypress = NSKeypress_CutTextEVENT;
}

//--------------------------------------------------------------------------------
// Purpose		Everytime the user presses the key to 
//	
// Parameters		None
//
// Returns 		nothing			
//
// History		PA 07-Nov-2002 v0.1 (Created) 
//
// Comment		The key press event is found in Editmasks.js
//--------------------------------------------------------------------------------
function NSKeypress_CutTextEVENT(e) 
{
var intLimit;
var intBSkey = 8; //Back space key
var intSysKey = 0; //Delete, Tab keys etc

	//get the name of the control causing the event
	var objSourceCtrl = e.target;
	
	switch(objSourceCtrl.id)
	{
	//Everything else is 255
	default:
		intLimit = 255;
	break;

	}

	switch(e.which)
	{
	case intBSkey:
	break;

	case intSysKey:
	break;
	
	default:
		//filter out the system keys.	
		var strText = document.getElementById(objSourceCtrl.id).value;
		if(strText.length == intLimit)	
		{ return false; } //no more characters
	break;
	}

}