function checkFields()
{
	var frm = document.creditForm;

	var stmp = frm.customer_name.value;
	if(stmp.length==0)
	{
		fieldRequiredMsg("Customer Name");
		return false;
	}

	stmp = frm.customer_address1.value;
	if(stmp.length==0)
	{
		fieldRequiredMsg("Customer Address 1");
		return false;
	}

	stmp = frm.customer_city.value;
	if(stmp.length==0)
	{
		fieldRequiredMsg("Customer City/State/Zip");
		return false;
	}

	stmp = frm.customer_phone.value;
	if(stmp.length==0)
	{
		fieldRequiredMsg("Customer Phone #");
		return false;
	}

	stmp = frm.customer_fax.value;
	if(stmp.length==0)
	{
		fieldRequiredMsg("Customer fax #");
		return false;
	}

	stmp = frm.customer_fedid.value;
	if(stmp.length==0)
	{
		fieldRequiredMsg("Customer Fed Id #");
		return false;
	}

	stmp = frm.bank_name.value;
	if(stmp.length==0)
	{
		fieldRequiredMsg("Bank Name");
		return false;
	}

	stmp = frm.bank_address.value;
	if(stmp.length==0)
	{
		fieldRequiredMsg("Bank Address");
		return false;
	}

	stmp = frm.bank_contact.value;
	if(stmp.length==0)
	{
		fieldRequiredMsg("Bank Contact");
		return false;
	}

	stmp = frm.bank_phone.value;
	if(stmp.length==0)
	{
		fieldRequiredMsg("Bank Phone #");
		return false;
	}

	stmp = frm.supplier1_name.value;
	if(stmp.length==0)
	{
		fieldRequiredMsg("Supplier 1 Name");
		return false;
	}

	stmp = frm.supplier1_address.value;
	if(stmp.length==0)
	{
		fieldRequiredMsg("Supplier 1 address");
		return false;
	}

	stmp = frm.supplier1_phone.value;
	if(stmp.length==0)
	{
		fieldRequiredMsg("Supplier 1 Phone #");
		return false;
	}

	stmp = frm.supplier1_contact.value;
	if(stmp.length==0)
	{
		fieldRequiredMsg("Supplier 1 Contact");
		return false;
	}

	stmp = frm.supplier2_name.value;
	if(stmp.length==0)
	{
		fieldRequiredMsg("Supplier 2 Name");
		return false;
	}

	stmp = frm.supplier2_address.value;
	if(stmp.length==0)
	{
		fieldRequiredMsg("Supplier 2 address");
		return false;
	}

	stmp = frm.supplier2_phone.value;
	if(stmp.length==0)
	{
		fieldRequiredMsg("Supplier 2 Phone #");
		return false;
	}

	stmp = frm.supplier2_contact.value;
	if(stmp.length==0)
	{
		fieldRequiredMsg("Supplier 2 Contact");
		return false;
	}

	return true;

}


function fieldRequiredMsg(fieldName)
{
	var msg = "Please provide the information for all required fields. \r\nThe input field of '" + fieldName + "' is empty.";
	alert(msg);
}



function hideByTag(attachId)
{
	//var attachId = '__print__';
	attachIdLength = attachId.length;
	//before print, set only selected field visible
	for(var i=0; i<document.all.length;i++)
	{
		var id = document.all[i].id;
		if(id<-999 && document.all[i].style.visibility!='hidden')
		{
			//alert(document.all[i].id);
			document.all[i].id = attachId + id;
			document.all[i].style.visibility = 'hidden';
			//alert(document.all[i].id);
		}
	}
}

function showByTag(attachId)
{
	//after print, reset visibility
	for (var i=0;i<document.all.length;i++)
	{
		var id = document.all[i].id;
		if(id.indexOf(attachId)>-1)
		{
			document.all[i].style.visibility='';
			document.all[i].id = id.substring(attachIdLength, id.length);
		}
	}
}

var printPageText

function printPage()
{
	window.showModelessDialog("page_print.htm", document.body, "");
}

function printOpenPage()
{
	window.open("page_print_open.htm","", "height=560,width=760,status=yes,toolbar=no,menubar=no,location=no,scrollbars=yes");

}

function doPrint()
{
	var attachId = '__print__';
	hideByTag(attachId);
	window.print();
	showByTag(attachId);
}


