// $Header: /Ready Reckoner (2)/asproot/accidentcost_calc/js/cross_scripting.js 1     9/12/02 18:10 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/accidentcost_calc/js/cross_scripting.js $ 
//
//1     9/12/02 18:10 Thentzsc
//added from uat server due to corruption problems
//
//6     2/12/02 13:43 Pash
//
//5     19/11/02 13:56 Pash
//
//4     19/11/02 11:54 Pash
//
//3     19/11/02 11:27 Pash
//
//2     4/10/02 10:39 Pash
//
//1     4/10/02 10:11 Pash
//Created
//--------------------------------------------------------------------------------

//--------------------------------------------------------------------------------
// 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 19-Nov-2002 v0.1 (Created) 
//
// Comment		The key press event is found in Editmasks.js
//--------------------------------------------------------------------------------
function NS_Startup() 
{
	// Positive number only
	document.getElementById("txtNoofEmployees").onkeypress = NSkeypress_valnumEVENT;
	// Positive floating point
	document.getElementById("txtInsPremium").onkeypress = NSkeypress_valdecEVENT;
	// Positive floating point
	document.getElementById("txtTurnover").onkeypress = NSkeypress_valdecEVENT;
	// Positive floating point
	document.getElementById("txtProfitMargin").onkeypress = NSkeypress_valdecEVENT;
	
}
//--------------------------------------------------------------------------------
// Purpose		Attaches keypress events to textboxes and renames classes for
//			textboxes when it detects Netscape
//	
// Parameters		None
//
// Returns 		nothing			
//
// History		PA 19-Nov-2002 v0.1 (Created) 
//
// Comment		The key press event is found in Editmasks.js
//--------------------------------------------------------------------------------
function NS_Startup2() 
{
	// For other details
	document.getElementById("txtNoOffWork").onkeypress = NSkeypress_valnumEVENT;
	document.getElementById("txtNoFirstAid").onkeypress = NSkeypress_valnumEVENT;
	document.getElementById("txtNoDamageOnly").onkeypress = NSkeypress_valnumEVENT;
	
}
//--------------------------------------------------------------------------------
// Purpose		Detects if a Macintosh has loaded the page and if so
//			hides the print button
//	
// Parameters		strPrintid - name of the print button 
//
// Returns 		nothing			
//
// History		PA 02-Dec-2002 v0.1 (Created) 
//
// Comment		Works for only Mac running IE 
//--------------------------------------------------------------------------------
function detectMac()
{
	
	var strAppName = "Microsoft Internet Explorer";

	if(navigator.appVersion.indexOf("Macintosh")>0 && navigator.appName == strAppName)
	{
	  //hide the PC print buttons
	  document.getElementById("rowPC").style.display = "none";	
	  //display only the MAC buttons
	  document.getElementById("rowMAC").style.display = "";	  	  	  
	}
}