function SearchSI()
{
	var x=document.mega;
	strOption = 'toolbar=0,location=0,directories=0,menubar=0,resizable=1,scrollbars=1,status=1';
	popwin = window.open("SIList.php","SIList", strOption);
	popwin.focus();
	GenerateLog();
}
function ListSI()
{
	var x=document.mega;
	if (isBlank(x.iSINo.value )) {
		alert("Please Enter SI #");
		x.iSINo.focus();
		x.iSINo.select();
		return false;
	}
	x.iListx.value='List';
	GenerateLog();
	x.submit();
	return true;
}
function CR_AR()
{
	var x=document.mega;
	if (isBlank(x.iSINumber.value )) {
		alert("Cannot save empty receivable");
		return false;
	}
	x.saveme.value='save';
	GenerateLog();
	x.submit();
	return true;
}
function AttachSI(tran)
{
		var x= document.mega;
		//alert(tran);
		setCookie("List","list","","","",""); 
		setCookie("iSINo",tran,"","","",""); 
		opener.location.reload(true);
		GenerateLog();
		window.close();
	
}
function SearchAR()
{
	var x=document.mega;
	strOption = 'toolbar=0,location=0,directories=0,menubar=0,resizable=1,scrollbars=1,status=1';
	popwin = window.open("ARList.php","ARList", strOption);
	popwin.focus();
	GenerateLog();
}
function AttachAR(tran)
{
		var x= document.mega;
		//alert(tran);
		setCookie("List","list","","","",""); 
		setCookie("iSINo",tran,"","","",""); 
		opener.location.reload(true);
		GenerateLog();
		window.close();
	
}
function CR_Payment()
{
	var x=document.mega;
	if (isBlank(x.iARNumber.value )) {
		alert("Cannot save empty receivable");
		return false;
	}
	if (isBlank(x.iSI.value )) {
		alert("Cannot save empty receivable");
		return false;
	}
	if (isBlank(x.iAmount.value )) {
		alert("Cannot save empty receivable");
		return false;
	}
	if (isBlank(x.iOR.value )) {
		alert("Please enter OR!");
		x.iOR.focus();
		x.iOR.select();
		return false;
	}
	if (isBlank(x.iDatePaid.value )) {
		alert("Please enter date paid!");
		x.iDatePaid.focus();
		x.iDatePaid.select();
		return false;
	}
	if (isBlank(x.iCheckNo.value )) {
		alert("Please enter check number!");
		x.iCheckNo.focus();
		x.iCheckNo.select();
		return false;
	}
	if (isBlank(x.iCheckDate.value )) {
		alert("Please enter check date!");
		x.iCheckDate.focus();
		x.iCheckDate.select();
		return false;
	}
	if (isBlank(x.iCustBank.value )) {
		alert("Please enter customer bank!");
		x.iCustBank.focus();
		x.iCustBank.select();
		return false;
	}
	x.saveme.value='save';
	GenerateLog();
	x.submit();
	return true;
}
function view_report()
{
		var x= document.mega;
		//alert(tran);
		setCookie("datefrom",x.date_from.value,"","","",""); 
		setCookie("dateto",x.date_to.value,"","","",""); 
		strOption = 'toolbar=0,location=0,directories=0,menubar=0,resizable=1,scrollbars=1,status=1';
		popwin = window.open("Reports/" + x.reports.value,"reports", strOption);
		GenerateLog();
	
}