//+--------------------------------------------------------------------------+
//| Project Name     	: Ready Reckoner	
//+ 
//| Project Number 	: P3480
//+ 
//| Reference  		: ill_health_costs_submit.js
//+ 
//| Description		: Functionality to submit manually to another asp 
//|			  page.
//+ 
//| Configuration Record
//| Review		Version	Author		Date		Change No.
//| P??		        1.0     Paul Ash        11/03/2002	Original
//|
//+ 
//| Copyright CMG 2002
//+--------------------------------------------------------------------------+
//|                  VISUAL SOURCESAFE VERSION INFORMATION 
//| $Archive:: /Ready Reckoner (2)/asproot/ill_health_ $Workfile::                                                		     
//| $Revision:: 1                                                                  $Modtime::                                                               
//| $Author:: Thentzsc                                                             $Date::                                                                  
//| $NoKeywords:
//+--------------------------------------------------------------------------+

//+--------------------------------------------------------------------------+
//| Name     		: submitselection						     
//+ 
//| Description		: gets data off the page and redirects the user to
//|			  the appropriate page.				    
//+ 
//| Parameters		: None				                     
//+ 
//| Returns		: Nothing		                     
//+ 
//| Comments		: None						                     
//+--------------------------------------------------------------------------+
function ill_health_view_report()
{
	var j

	var objeditrow = document.getElementById("hndeditrow");	
	if(objeditrow.value!="")
	{
	 // Cannot submit if in cell edit mode
	alert("Cannot submit the details to the report while the user is editing a cell.");  
	}
	else
	{
	var strTableRow = document.all("tblList").rows;

	for (j=0; j < strTableRow.length; j++)
	  {
		strTableRow(j).cells(5).removeNode(true);
	  }

	//insert a header for the table
	inserttableheader();

	document.all.tblList.style.backgroundColor='#ffffff';

	var objtableprint = document.all.item("hndpersistprintTable");
	objtableprint.value  = document.all.tblList.outerHTML;

	page = "print\\ill_health_costs_print.asp";
	submitselection("frmillhealth",page)
	}
}

function inserttableheader()
{
	var calcmode = document.all.item("hndcalcmode")
	
	//insert the row at the top
	document.all.tblList.insertRow(0);
	var offset = 0;
	document.all.tblList.rows[offset].insertCell().width="52%";
 	document.all.tblList.rows[offset].insertCell().width="12%";
 	document.all.tblList.rows[offset].insertCell().width="12%";
   	document.all.tblList.rows[offset].insertCell().width="12%";
 	document.all.tblList.rows[offset].insertCell().width="12%";

	document.all.tblList.rows[offset].cells[0].align = "center";
	document.all.tblList.rows[offset].cells[1].align = "center";
	document.all.tblList.rows[offset].cells[2].align = "center";
	document.all.tblList.rows[offset].cells[3].align = "center";
	document.all.tblList.rows[offset].cells[4].align = "center";

	document.all.tblList.rows[offset].cells[0].className="cellprintheader";
	document.all.tblList.rows[offset].cells[1].className="cellprintheader";
	document.all.tblList.rows[offset].cells[2].className="cellprintheader";
	document.all.tblList.rows[offset].cells[3].className="cellprintheader";
	document.all.tblList.rows[offset].cells[4].className="cellprintheader";

	document.all.tblList.rows[offset].cells[0].innerText = calcmode.value;
	document.all.tblList.rows[offset].cells[1].innerText = "Total number of days off from ill-health";
	document.all.tblList.rows[offset].cells[2].innerText = "No. of people per event";
	document.all.tblList.rows[offset].cells[3].insertAdjacentHTML('AfterBegin', "Wage cost" + '<BR>' +"per day" + '<BR>' + "£");
	document.all.tblList.rows[offset].cells[4].insertAdjacentHTML('AfterBegin', "Calculated Cost" + '<BR>' + "£");

}

//+--------------------------------------------------------------------------+
//| Name     		: submitselection						     
//+ 
//| Description		: gets data off the page and redirects the user to
//|			  the appropriate page.				    
//+ 
//| Parameters		: None				                     
//+ 
//| Returns		: Nothing		                     
//+ 
//| Comments		: None						                     
//+--------------------------------------------------------------------------+
function submitselection(formname,redirectpage)
{
	var objform = document.all.item(formname);
	objform.method="post";
	objform.action = redirectpage;
	objform.target = "_parent"
	objform.submit();

}

//---------------------------------------------------------------------------//
//				END OF FILE
//---------------------------------------------------------------------------//