// *******************************************
// Billing Inquiry functions and processes ***
// *******************************************
//
//Change History
//SVC 100269  08/01/2008 JWM - added echeck payment (echeckpay)

function bill_processdetail_frame(whereTo){

	//document.writeln("got into processdetail_frame ok");


	var wantToGo = whereTo;

	//document.writeln("we want to go to "+wantToGo+"  .  ");



//set the values of whereAreYouGoing in each frame depending on which
//toolbar button has been clicked.  If the 'continue' toolbar button
//has been clicked, don't change the value of whereAreYouGoing as it's value
//is pre-set at the proper 'continue' value
	if (parent.detail_frame.document.billinquire)
	{
		if (wantToGo != 'toolbarContinue')
		{
			parent.detail_frame.document.billinquire.whereAreYouGoing.value = wantToGo;
		}
		parent.detail_frame.document.billinquire.Continue.click();

	}
	else
	{
	if (parent.detail_frame.document.acctsumm)
		{
			if (wantToGo != 'toolbarContinue')
			{
		  	  	parent.detail_frame.document.acctsumm.whereAreYouGoing.value = wantToGo;
	 		}
	 	parent.detail_frame.document.acctsumm.Continue.click();
	 	}
	else
	{
		if (parent.detail_frame.document.accthist)
		{
			if (wantToGo != 'toolbarContinue')
			{
					parent.detail_frame.document.accthist.whereAreYouGoing.value = wantToGo;
			}
			parent.detail_frame.document.accthist.Continue.click();
		}
	else
	{
		if (parent.detail_frame.document.payment)
		{
			if (wantToGo != 'toolbarContinue')
			{
					parent.detail_frame.document.payment.whereAreYouGoing.value = wantToGo;
			}
			parent.detail_frame.document.payment.Continue.click();
		}
	else
	{
		if (parent.detail_frame.document.pastdue)
		{
			if (wantToGo != 'toolbarContinue')
			{
					parent.detail_frame.document.pastdue.whereAreYouGoing.value = wantToGo;
			}
			parent.detail_frame.document.pastdue.Continue.click();
		}
	else
	{
		if (parent.detail_frame.document.cancel)
		{
			if (wantToGo != 'toolbarContinue')
			{
				parent.detail_frame.document.cancel.whereAreYouGoing.value = wantToGo;
			}
			parent.detail_frame.document.cancel.Continue.click();
		}
	else
	{
		if (parent.detail_frame.document.allact)
		{
			if (wantToGo != 'toolbarContinue')
			{
				parent.detail_frame.document.allact.whereAreYouGoing.value = wantToGo;
			}
			parent.detail_frame.document.allact.Continue.click();
		}
	else
	{
		if (parent.detail_frame.document.confirm)
		{
			if (wantToGo != 'toolbarContinue')
			{
				parent.detail_frame.document.confirm.whereAreYouGoing.value = wantToGo;
			}
			parent.detail_frame.document.confirm.Continue.click();
		}
	else
	{
		if (parent.detail_frame.document.cardpay)
		{
			if (wantToGo != 'toolbarContinue')
			{
				parent.detail_frame.document.cardpay.whereAreYouGoing.value = wantToGo;
			}
			parent.detail_frame.document.cardpay.Continue.click();
		}
	else
	{
		if (parent.detail_frame.document.credconfirm)
		{
			if (wantToGo != 'toolbarContinue')
			{
				parent.detail_frame.document.credconfirm.whereAreYouGoing.value = wantToGo;
			}
			parent.detail_frame.document.credconfirm.Continue.click();
		}
// added echeck payment
	else
	{
		if (parent.detail_frame.document.echeckpay)
		{
			if (wantToGo != 'toolbarContinue')
			{
				parent.detail_frame.document.echeckpay.whereAreYouGoing.value = wantToGo;
			}
			parent.detail_frame.document.echeckpay.Continue.click();
		}
// added echeck payment confirmation
	else
	{
		if (parent.detail_frame.document.echeckconfirm)
		{
			if (wantToGo != 'toolbarContinue')
			{
				parent.detail_frame.document.echeckconfirm.whereAreYouGoing.value = wantToGo;
			}
			parent.detail_frame.document.echeckconfirm.Continue.click();
		}
	}
	}
	}
	}
	}
	}
	}
	}
	}
	}
	}

	//document.writeln("got thru if number one.  ");

	return;

}


//This will reposition date field from yyyymmdd to mm/dd/yyyy
function flipdates(datefield)
{
	var workdate = datefield;
	var workyear = workdate.substring(0, 4);
	var workmonth = workdate.substring(4, 6);
	var workday = workdate.substring(6, 8);

	document.writeln (workmonth+'/'+workday+'/'+workyear)

	return;
}


//This will insert () and - into phone number
function phoneformat(phonefield)
{
	var workphone = phonefield;
	var workarea = workphone.substring(0, 3);
	var workprefx = workphone.substring(3, 6);
	var workrestnm = workphone.substring(6, 10);

	document.writeln ('('+workarea+')'+workprefx+'-'+workrestnm)

	return;
}


//RADIO button routine; This routine will go through the
//array of radio buttons and determine which one was checked
//and return the value of the checked one. This is used for
//radio buttons with the same name, which makes them an array.
function getChecked(thisGroup)
{
for(var i = 0; thisGroup.length > i; i++)
	{
if(thisGroup[i].checked)
		{
return thisGroup[i].value;
		}
	}
}

// print one line for the names.  four names possible.    //
// use which ever name is available for this account.     //
// this function will print only one of the set of names. //
// pastdue accounts, cancelled policies, and all accounts //
// screens use this routine.                              //
function onelinename(table)
{
	if (table.LASTNAME1)
	{
	document.writeln("<td align='left'>");
	document.writeln(table.LASTNAME1);
	document.writeln(", &nbsp;"+(table.FIRSTNAME1)+"</td>");
	}
	else
	if (table.LASTNAME2)
	{
	document.writeln("<td align='left'>");
	document.writeln(table.LASTNAME2);
	document.writeln(", &nbsp;"+(table.FIRSTNAME2)+"</td>");
	}
	else
	if (table.BUSINESS_NAME1)
	{
	document.writeln("<td align='left'>"+(table.BUSINESS_NAME1)+"</td>");
	}
	else
	if (table.BUSINESS_NAME2)
	{
	document.writeln("<td align='left'>"+(table.BUSINESS_NAME2)+"</td>");
	}


return;
}

