function finishAction( value , frm)
{  
	//alert("call finishAction");
	document.getElementById("action").value = value;
	var reconciletype = document.getElementById("reconciletype").value;

	var samplItem = [];
	var method = "post";
	var path="/ibase/webitm/jsp/ICRWizardSaveSample.jsp";

	var valueXmlString = " <?xml version = \"1.0\"?> <Root> <header> <editFlag> ";
	valueXmlString += " </editFlag> </header> ";
	valueXmlString += " <Detail1> ";
	valueXmlString += " <from_tran_date><![CDATA["+ document.getElementById("from_tran_date").value +"]]></from_tran_date> ";
	valueXmlString += " <to_tran_date><![CDATA["+ document.getElementById("to_tran_date").value +"]]></to_tran_date> ";
	valueXmlString += " <site_code_fr><![CDATA["+ document.getElementById("site_code_fr").value +"]]></site_code_fr> ";
	valueXmlString += " <site_code_to><![CDATA["+ document.getElementById("site_code_to").value +"]]></site_code_to> ";
	valueXmlString += " <chg_user><![CDATA["+ document.getElementById("chg_user").value +"]]></chg_user> ";
	valueXmlString += " <chg_term><![CDATA["+ document.getElementById("chg_term").value +"]]></chg_term> ";
	valueXmlString += " <sundry_type_fr><![CDATA["+ document.getElementById("sundry_type_fr").value +"]]></sundry_type_fr> ";
	valueXmlString += " <sundry_type_to><![CDATA["+ document.getElementById("sundry_type_to").value +"]]></sundry_type_to> ";
	valueXmlString += " <sundry_code_fr><![CDATA["+ document.getElementById("sundry_code_fr").value +"]]></sundry_code_fr> ";
	valueXmlString += " <sundry_code_to><![CDATA["+ document.getElementById("sundry_code_to").value +"]]></sundry_code_to> ";
	valueXmlString += " </Detail1> ";
	valueXmlString += getCheckedValues(frm);
	valueXmlString += " </Root> "; 
	
	samplItem["SAVE_SAMPLE_DATA"] = valueXmlString;
	samplItem["RECONCILETYPE"] = reconciletype;
	post_to_url(path, samplItem, method);
}
function getCheckedValues(frm) {
	var cnt = "Your chose:\n\n";
	//alert(cnt);
	var xmlData = "<Detail2>";
	// For each checkbox see if it has been checked, record the value.
	for (i = 0; i < frm.checkbox1.length; i++) {
		if (frm.checkbox1[i].checked) {

			cnt = frm.checkbox1[i].value;
			//alert("messages111-- " + cnt)
			var trandate = document.getElementById("TRAN_DATE" + cnt).innerHTML;
			var refser = document.getElementById("REF_SER" + cnt).innerHTML;
			var refid = document.getElementById("REF_ID" + cnt).innerHTML;
			var sitecode = document.getElementById("SITE_CODE" + cnt).innerHTML;
			var drAmt = document.getElementById("DR_AMT" + cnt).innerHTML;
			var crAmt = document.getElementById("CR_AMT" + cnt).innerHTML;
			//alert("Tran date-- " + trandate);
			//alert("Ref ser-- " + refser);
			//alert("Ref ID-- " + refid);
			//alert("sitecode-- " + sitecode);
			//alert("DR_AMT-- " + drAmt);
			//alert("CR_AMT-- " + crAmt);
			
			xmlData += "<Detail>";
			xmlData += "<TRAN_DATE><![CDATA[" + trandate + "]]></TRAN_DATE>";
			xmlData += "<REF_SER><![CDATA[" + refser + "]]></REF_SER>";
			xmlData += "<REF_ID><![CDATA[" + refid + "]]></REF_ID>";
			xmlData += "<SITE_CODE><![CDATA[" + sitecode + "]]></SITE_CODE>";
			xmlData += "<DR_AMT><![CDATA[" + drAmt + "]]></DR_AMT>";
			xmlData += "<CR_AMT><![CDATA[" + crAmt + "]]></CR_AMT>";
			xmlData += "</Detail>";
		}
	}
	xmlData += "</Detail2>";
	alert("xmlData : " + xmlData);
	return xmlData;
}


function isNumberKey(e)
{
	// alert("isNumberKey called...");
	var unicode = e.charCode ? e.charCode : e.keyCode;
	if ((unicode == 8) || (unicode == 9) || (unicode > 47 && unicode < 58)
		|| (unicode == 37) || (unicode == 46) || (unicode == 39)
		|| (unicode == 115) || (unicode == 121) || (unicode == 117)) {
	return true;
	} 
	else 
	{
		window.alert("This field accepts only Numbers");
		return false;
	}
}
	
function numbersonly(myfield, e, dec)
{
	var key;
	var keychar;

	if ( window.event )
	{
		key = window.event.keyCode;
	}
	else
	{
		return true;
	}

	if( key >= 48 && key <= 57 )
	{
		return true;
	}
	else
	{
		return false;
	}
}

function post_to_url(path, params, method) {
	method = method || "post"; // Set method to post by default if not specified.

	// The rest of this code assumes you are not using a library.
	// It can be made less wordy if you use one.
	var form = document.createElement("form");
	form.setAttribute("method", method);
	form.setAttribute("action", path);
	form.target = 'Items';

	for(var key in params) {
		if(params.hasOwnProperty(key)) {
			var hiddenField = document.createElement("input");
			hiddenField.setAttribute("type", "hidden");
			hiddenField.setAttribute("name", key);
			hiddenField.setAttribute("value", params[key]);

			form.appendChild(hiddenField);
		}
	}

	document.body.appendChild(form);
	form.submit();
}
