// $Header: /Ready Reckoner (2)/asproot/ill_health_costs/js/cross_scripting.js 1     9/12/02 18:19 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 03-Oct-2002 (Created)
// Author 	: pash 
//-------------------------------------------------------------------------------- 
// Revision History 
//-------------------------------------------------------------------------------- 
// $Revision: 1 $ 
// $Log: /Ready Reckoner (2)/asproot/ill_health_costs/js/cross_scripting.js $ 
//
//1     9/12/02 18:19 Thentzsc
//added from uat server due to corruption problems
//
//2     18/11/02 10:25 Pash
//
//1     4/10/02 12:53 Pash
//
//1     4/10/02 11:19 Pash
//This file is duplicated in other areas because individual functionality
//besides common routines may apply.  It may in the future be combined. 
//--------------------------------------------------------------------------------

//--------------------------------------------------------------------------------
// Purpose		Interface for cross browser date validation on asp forms.
//	
// Parameters		strTxtbox - text box id / name to be validated
//
// Returns 		true,(Success)
//			false,(Fail)			
//
// History		PA 04-Oct-2002 v0.1 (Created) 
//
// Comment		Applies to Accident Cost calc, Incident Cost calc, 
//			Ill-health cost calc.
//--------------------------------------------------------------------------------
function other_dateVal(strTxtbox)
{
  if(valDate(document.getElementById(strTxtbox).value)!="")
  {
	document.getElementById(strTxtbox).value = ""; // not a valid date
  }
}

//--------------------------------------------------------------------------------
// Purpose		Attaches keypress events to textboxes and renames classes for
//			textboxes when it detects Netscape
//	
// Parameters		None
//
// Returns 		nothing			
//
// History		PA 08-Nov-2002 v0.1 (Created) 
//
// Comment		The key press event is found in Editmasks.js
//--------------------------------------------------------------------------------
function NS_Startup() 
{
	// Total number of days off from ill-health
	document.getElementById("txttbldata2").onkeypress = NSkeypress_valdecEVENT;
	// Wage cost per day £
	document.getElementById("txttbldata3").onkeypress = NSkeypress_valnumEVENT;
	// No. of people  per event
	document.getElementById("txttbldata4").onkeypress = NSkeypress_valdecEVENT;

	// Change the classes
	document.getElementById("txttbldata2").setAttribute("class","DataHeadRighta");
	document.getElementById("txttbldata3").setAttribute("class","DataHeadRighta");
	document.getElementById("txttbldata4").setAttribute("class","DataHeadRighta");

	// - Number of workers leaving
	document.getElementById("txtind1").onkeypress = NSkeypress_valnumEVENT;
	// - Average cost of replacing staff
	document.getElementById("txtind2").onkeypress = NSkeypress_valdecEVENT;
	// Change the classes
	document.getElementById("txtind1").setAttribute("class","DataHeadRighta");
	document.getElementById("txtind2").setAttribute("class","DataHeadRighta");
	
}

//--------------------------------------------------------------------------------
// Purpose		Attaches keypress events to textboxes for number 
//			validation textboxes when it detects Netscape
//
// Parameters		None
//
// Returns 		nothing			
//
// History		PA 08-Nov-2002 v0.1 (Created) 
//
// Comment		The key press event is found in Editmasks.js
//--------------------------------------------------------------------------------
function NS_Startup_opt1() 
{
	// - Total number of days off from ill-health
	document.getElementById("txttbldata2").onkeypress = NSkeypress_valdecEVENT;
	// - Wage cost per day £
	document.getElementById("txttbldata4").onkeypress = NSkeypress_valdecEVENT;
	// Change the classes
	document.getElementById("txttbldata2").setAttribute("class","DataHeadRighta");
	document.getElementById("txttbldata4").setAttribute("class","DataHeadRighta");

	// - Number of workers leaving
	document.getElementById("txtind1").onkeypress = NSkeypress_valnumEVENT;
	// - Average cost of replacing staff
	document.getElementById("txtind2").onkeypress = NSkeypress_valdecEVENT;
	// Change the classes
	document.getElementById("txtind1").setAttribute("class","DataHeadRighta");
	document.getElementById("txtind2").setAttribute("class","DataHeadRighta");

}