function SetLoginSource(Source){document.getElementById('LoginSource').value=Source;}
function UpdateUIHeaderRows(Source){var AccountLablesRow=document.getElementById("AccountLablesRow");var AccountInputsRow=document.getElementById("AccountInputsRow");var TelInputsRow=document.getElementById("TelInputsRow");var TelLabelsRow=document.getElementById("TelLabelsRow");if(Source=="Account"){AccountLablesRow.style.display='';AccountInputsRow.style.display='';TelLabelsRow.style.display='none';TelInputsRow.style.display='none';}
else{AccountLablesRow.style.display='none';AccountInputsRow.style.display='none';TelLabelsRow.style.display='';TelInputsRow.style.display='';}}
function IsUserLoggedWithAccount(){if(document.getElementById('LoginSource')==null){return false;}
else{if(document.getElementById('LoginSource').value=="Account")
return true;else
return false;}}
function SubmitFormOnEnter(formName){if(event.keyCode==13){document.forms[formName].submit();}}
function TotalAmountChecked()
{var ns6=(document.getElementById&&(!document.all))?true:false;var ns4=(document.layers)?true:false;var ie4=(document.all)?true:false;flag=1;if(ns6)
{var total=0.0;index=0;var objInvoices=document.BillPayment.CheckBox_Invoices;if(!objInvoices)
objInvoices=document.BillPayment.InvAmount;if(!(objInvoices))
{total=-1;return total;}
if(isNaN(objInvoices.length))
{GetInvoice(objInvoices.value,objInvoices.title).checked=objInvoices.checked;if(objInvoices.checked==true)
{total+=GetInvoice(objInvoices.value,objInvoices.title).Amount;flag=0;}}
else
{check_num=objInvoices.length;while(index<check_num)
{GetInvoice(objInvoices[index].value,objInvoices[index].title).checked=objInvoices[index].checked;flag=0;if(objInvoices[index].checked==true)
{total+=Invoices[index].Amount;}
index++;}}
if(flag==1)
{total=0;}
document.BillPayment.SelectedInvoices.value=Serialize(Invoices);return total;}
else if(ns4)
{var total=0.0;index=0;if(!(document.BillPayment.InvAmount))
{total=-1;return total;}
if(isNaN(document.BillPayment.InvAmount.length))
{if(document.BillPayment.InvAmount.checked==true)
{total+=parseFloat(document.BillPayment.InvAmount.value);flag=0;}}
else
{check_num=document.BillPayment.InvAmount.length;while(index<check_num)
{flag=0;if(document.BillPayment.InvAmount[index].checked==true)
total+=parseFloat(document.BillPayment.InvAmount[index].value);index++;}}
if(flag==1)
{total=0;}
return total;}
else if(ie4)
{var total=0.0;index=0;var objInvoices=document.BillPayment.CheckBox_Invoices;if(!objInvoices)
objInvoices=document.BillPayment.InvAmount;if(!(objInvoices))
{total=-1;return total;}
if(isNaN(objInvoices.length))
{GetInvoice(objInvoices.value,objInvoices.title).checked=objInvoices.checked;if(objInvoices.checked==true)
{total+=GetInvoice(objInvoices.value,objInvoices.title).Amount;flag=0;}}
else
{check_num=objInvoices.length;while(index<check_num)
{GetInvoice(objInvoices[index].value,objInvoices[index].title).checked=objInvoices[index].checked;flag=0;if(objInvoices[index].checked==true)
{total+=Invoices[index].Amount;}
index++;}}
if(flag==1)
{total=0;}
document.BillPayment.SelectedInvoices.value=Serialize(Invoices);return total;}}
function CalculateAmount()
{var ns6=(document.getElementById&&(!document.all))?true:false;var ns4=(document.layers)?true:false;var ie4=(document.all)?true:false;if(ns6)
{var osTotalInvoices=Object(document.getElementById("TotalInvoices"));var osEPayFees=Object(document.getElementById("EPayFees"));var strTemp="";if(osTotalInvoices!=null)
{var total=TotalAmountChecked();InternetFee=total;total=Math.round(total*100)/100;InternetFee=Math.round(InternetFee*100)/100;strInternetFee=String(InternetFee);strTotal=String(total);if(total>0)
{nIndex=strTotal.indexOf(".");if(nIndex>0)
{if(osTotalInvoices!=null)
{strTotal=strTotal.slice(0,nIndex+3);strTemp=strTotal;strTemp='<layer id="lTotalInvoices" left="804" top="834" width="189">'+strTemp+'</layer>';osTotalInvoices.innerHTML=strTemp;document.forms['BillPayment']['TotalAmount'].value=parseFloat(strTotal);}
if(osEPayFees!=null)
{strTemp=strInternetFee.slice(0,nIndex+3);strTemp='<layer id="lEPayFees" left="804" top="814" width="189">'+strTemp+'</layer>';osEPayFees.innerHTML=strTemp;}}
else
{if(osTotalInvoices!=null)
{strTemp=strTotal;strTemp='<layer id="lTotalInvoices" left="804" top="834" width="189">'+strTemp+'</layer>';osTotalInvoices.innerHTML=strTemp;document.forms['BillPayment']['TotalAmount'].value=parseFloat(strTotal);}
if(osEPayFees!=null)
{strTemp=strInternetFee;strTemp='<layer id="lEPayFees" left="804" top="814" width="189">'+strTemp+'</layer>';osEPayFees.innerHTML=strTemp;}}}
else
{if(osTotalInvoices!=null)
{strTemp="--";strTemp='<layer id="lTotalInvoices" left="804" top="834" width="189">'+strTemp+'</layer>';osTotalInvoices.innerHTML=strTemp;document.forms['BillPayment']['TotalAmount'].value=parseFloat("0");}
if(osEPayFees!=null)
{strTemp="0";strTemp='<layer id="lEPayFees" left="804" top="814" width="189">'+strTemp+'</layer>';osEPayFees.innerHTML=strTemp;}}}}
else if(ns4)
{var olTotalInvoices=Object(document.lTotalInvoices);var olEPayFees=Object(document.lEPayFees);var oDummyImg1=Object(document.DummyImg1);var oDummyImg2=Object(document.DummyImg2);if(olTotalInvoices!=null)
{var total=TotalAmountChecked();InternetFee=total;total=Math.round(total*100)/100;InternetFee=Math.round(InternetFee*100)/100;strInternetFee=""+InternetFee;strTotal=""+total;if(total>0)
{nIndex=strTotal.indexOf(".");if(nIndex>0)
{if(olTotalInvoices!=null)
{olTotalInvoices.document.open();olTotalInvoices.left=oDummyImg2.x-24;olTotalInvoices.top=oDummyImg2.y-8;olTotalInvoices.document.write(strTotal.slice(0,nIndex+3));olTotalInvoices.document.close();document.forms['BillPayment']['TotalAmount'].value=strTotal.slice(0,nIndex+3);}
if(olEPayFees!=null)
{olEPayFees.document.open();olEPayFees.left=oDummyImg1.x-24;olEPayFees.top=oDummyImg1.y;olEPayFees.document.write(strInternetFee.slice(0,nIndex+3));olEPayFees.document.close();}}
else
{if(olTotalInvoices!=null)
{olTotalInvoices.document.open();olTotalInvoices.left=oDummyImg2.x-24;olTotalInvoices.top=oDummyImg2.y-8;olTotalInvoices.document.write(strTotal);olTotalInvoices.document.close();document.forms['BillPayment']['TotalAmount'].value=strTotal;}
if(olEPayFees!=null)
{olEPayFees.document.open();olEPayFees.left=oDummyImg1.x-24;olEPayFees.top=oDummyImg1.y;olEPayFees.document.write(strInternetFee);olEPayFees.document.close();}}}
else
{if(olTotalInvoices!=null)
{olTotalInvoices.document.open();olTotalInvoices.left=oDummyImg2.x;olTotalInvoices.top=oDummyImg2.y-8;olTotalInvoices.document.write("--");olTotalInvoices.document.close();document.forms['BillPayment']['TotalAmount'].value="0";}
if(olEPayFees!=null)
{olEPayFees.document.open();olEPayFees.left=oDummyImg1.x;olEPayFees.top=oDummyImg1.y;olEPayFees.document.write("0");olEPayFees.document.close();}}}}
else if(ie4)
{if(document.all("TotalInvoices")!=null)
{var total=TotalAmountChecked();InternetFee=total;total=Math.round(total*100)/100;InternetFee=Math.round(InternetFee*100)/100;strInternetFee=""+InternetFee;strTotal=""+total;if(total>0)
{nIndex=strTotal.indexOf(".");if(nIndex>0)
{if(document.all("TotalInvoices")!=null)
{document.all("TotalInvoices").innerText=strTotal.slice(0,nIndex+3);document.all("TotalAmount").value=strTotal.slice(0,nIndex+3);}
if(document.all("EPayFees")!=null)
{document.all("EPayFees").innerText=strInternetFee.slice(0,nIndex+3);}}
else
{if(document.all("TotalInvoices")!=null)
{document.all("TotalInvoices").innerText=strTotal
document.all("TotalAmount").value=strTotal}
if(document.all("EPayFees")!=null)
{document.all("EPayFees").innerText=strInternetFee;}}}
else
{if(document.all("TotalInvoices")!=null)
document.all("TotalInvoices").innerText="--";document.all("TotalAmount").value="0"
if(document.all("EPayFees")!=null)
{document.all("EPayFees").innerText=0;}}}}}
function payClicked()
{var ns6=(document.getElementById&&(!document.all))?true:false;var ns4=(document.layers)?true:false;var ie4=(document.all)?true:false;if(ns6)
var oTotalInvoices=Object(document.getElementById("TotalInvoices"));else if(ns4)
var oTotalInvoices=Object(document.lTotalInvoices);else if(ie4)
var oTotalInvoices=Object(document.all("TotalInvoices"));var bMinimumCheckBox=false;if(document.BillPayment.CheckBox_Invoices==null)
{alert("You don't have any bills to pay ...");return;}
if(isNaN(document.BillPayment.CheckBox_Invoices.length))
{var oCheckBox=document.BillPayment.CheckBox_Invoices;GetInvoice(oCheckBox.value,oCheckBox.title).checked=oCheckBox.checked;if(oCheckBox.checked==true)bMinimumCheckBox=true;}
else
{for(j=0;j<=document.BillPayment.CheckBox_Invoices.length-1;j++)
{var oCheckBox=document.BillPayment.CheckBox_Invoices[j];GetInvoice(oCheckBox.value,oCheckBox.title).checked=oCheckBox.checked;if(oCheckBox.checked==true)bMinimumCheckBox=true;}}
if(bMinimumCheckBox==true)
{try{document.BillPayment.SelectedInvoices.value=Serialize(Invoices.filter(CheckedInvoices));}
catch(e){document.BillPayment.SelectedInvoices.value=Serialize(Invoices);}
document.forms.BillPayment.action="Payment.aspx";document.forms.BillPayment.submit();return;}
else
{if(Invoices.length<1)
alert("You don't have any bills to pay ...");else
alert("You must check at least one invoice to be able to pay");return;}}
function showBillClicked()
{alert("Refresh the data below...");}
function detailsClicked()
{location.href="customer_sign_in_details.aspx";}
function submitClickedNew(source)
{if(source=="TelNo")
{if(!checkForm())
return;}
else if(source=="ACCREF")
{if(!checkFormACCREF())
return;}
else
{return;}
if(document.BILL_REQ.NewTelNo)
{document.BILL_REQ.NewTelNo.value="NewTelNo";}
document.BILL_REQ.action="customer_bill_status.aspx?New=1&From="+source;document.BILL_REQ.method="post";document.BILL_REQ.submit();}
function submitClicked()
{if(checkForm())
{if(document.BILL_REQ.NewTelNo)
{document.BILL_REQ.NewTelNo.value="NewTelNo";}
document.BILL_REQ.action="customer_bill_status.aspx?New=1";document.BILL_REQ.method="post";document.BILL_REQ.submit();}}
function PINsubmitClicked(nDest)
{var ValidPIN=/^\d{4}$/;varStr="Please,\n";if(document.BILL_REQ.PIN_Code.value==""||(!(ValidPIN.test(document.BILL_REQ.PIN_Code.value))))
{varStr=varStr+"\nEnter a valid PIN code (4 numeric characters).";alert(varStr);}
else
{if(nDest==0)
document.BILL_REQ.action="Customer_Bill_Pin.aspx?Dest=0&Save=true";else if(nDest==1)
document.BILL_REQ.action="history.aspx";else if(nDest==2)
document.BILL_REQ.action="int_history.aspx";else if(nDest==3)
document.BILL_REQ.action="epay_trans.aspx";else if(nDest==4)
document.BILL_REQ.action="Payment.aspx";else if(nDest==5)
document.BILL_REQ.action="Customer_Average_Invoices.aspx?Dest=5&Save=true";else if(nDest==6)
document.BILL_REQ.action="Customer_Bill_Pin.aspx?Dest=0&Save=true&isAccount=1";document.BILL_REQ.method="post";document.BILL_REQ.submit();}}
function checkFormACCREF()
{varStr="Please,\n";if(document.BILL_REQ.ACCREF.value.toString()=="")
{varStr=varStr+"\nEnter the account number."}
else if(document.BILL_REQ.ACCREF.value.toString().indexOf(" ")!=-1||document.BILL_REQ.ACCREF.value.toString().indexOf(".")!=-1||document.BILL_REQ.ACCREF.value.toString().indexOf("-")!=-1||document.BILL_REQ.ACCREF.value.toString().indexOf("+")!=-1||isNaN(document.BILL_REQ.ACCREF.value.toString()))
{varStr=varStr+"\nenter a valid Account Number."}
else
{return true;}
if(varStr!="Please,\n")
{alert(varStr);return false;}}
function checkForm()
{varStr="Please,\n";if(document.BILL_REQ.AreaCode.value==""){varStr=varStr+"\nenter the area code."}
if(document.BILL_REQ.TelNo.value==""){varStr=varStr+"\nenter the Phone Number."}
if(document.BILL_REQ.AreaCode.value.toString().length>3){varStr=varStr+"\nArea code length must be less than 3."}
if(document.BILL_REQ.TelNo.value.toString()>document.BILL_REQ.maxlength){varStr=varStr+"\nPhone Number should be shorter than "+document.BILL_REQ.maxlength}
if(document.BILL_REQ.TelNo.value.toString().indexOf(" ")!=-1||document.BILL_REQ.TelNo.value.toString().indexOf(".")!=-1||document.BILL_REQ.TelNo.value.toString().indexOf("-")!=-1||document.BILL_REQ.TelNo.value.toString().indexOf("+")!=-1||isNaN(document.BILL_REQ.TelNo.value.toString())){varStr=varStr+"\nenter a valid Phone Number."}
if(document.BILL_REQ.ACCREF.value.toString().indexOf(" ")!=-1||document.BILL_REQ.ACCREF.value.toString().indexOf(".")!=-1||document.BILL_REQ.ACCREF.value.toString().indexOf("-")!=-1||document.BILL_REQ.ACCREF.value.toString().indexOf("+")!=-1||isNaN(document.BILL_REQ.ACCREF.value.toString())){varStr=varStr+"\nenter a valid Account Number."}
if(document.BILL_REQ.AreaCode.value.toString().indexOf(" ")!=-1||document.BILL_REQ.AreaCode.value.toString().indexOf(".")!=-1||document.BILL_REQ.AreaCode.value.toString().indexOf("-")!=-1||document.BILL_REQ.AreaCode.value.toString().indexOf("+")!=-1||isNaN(document.BILL_REQ.AreaCode.value.toString())){varStr=varStr+"\nenter a valid Area Code."}
if(varStr!="Please,\n")
{alert(varStr);return false;}
else
{return true;}}
function closeClicked()
{window.parent.location.href="Customer_Bill_Inquiry.aspx";}
function closeClicked2()
{window.close();}
function confirmClicked()
{document.BM.action="epay_trans.aspx"
document.BM.method="post";document.BM.submit();}
function confirmCloseClicked()
{history.back();}
function outClicked(varAC,varTN,varSession)
{document.epay_trans.action="customer_bill_status.aspx";document.epay_trans.AreaCode.value=varAC;document.epay_trans.TelNo.value=varTN;document.epay_trans.Session.value=varSession;document.epay_trans.method="post";document.epay_trans.submit();}
function ChangeImage(strImageName,strNewSrc)
{document.images[strImageName].src=strNewSrc;}
function Open(url,h,w)
{window.open(url,null,"height="+h+",width="+w+",status=yes,toolbar=no,menubar=no,location=no,resizable=yes");}
function Open2(url,w,h)
{window.open(url,null,"height="+h+",width="+w+",status=yes,toolbar=yes,menubar=yes,location=yes,resizable=yes,scrollbars=yes,top=20,left=20");}
function Open3(url,h,w)
{window.open(url,null,"height="+h+",width="+w+",status=no,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=no,top=20,left=20");}
function ChangePosition()
{switch(screen.width)
{case 800:document.getElementById("PINCODETable").style.left="522px";document.getElementById("PINCODETable").style.top="211px";break;case 1024:document.getElementById("PINCODETable").style.left="670px";document.getElementById("PINCODETable").style.top="235px";break;}}
function changePINEmail()
{var ValidPIN=/^\d{6}$/;var ValidEmail=/^[A-Za-z0-9_-]+[.]?[A-Za-z0-9_-]+[@][A-Za-z0-9_-]+[.][A-Za-z0-9_-]+[.]?[A-Za-z0-9_-]+$/;varStr="Please,\n";if(!(ValidPIN.test(document.Change.PINCode.value))){varStr=varStr+"\nEnter a valid PIN code (6 numeric characters)."}
if((!(ValidEmail.test(document.Change.Email.value)))||document.Change.Email.length>100){varStr=varStr+"\nEnter a valid Email."}
if(varStr!="Please,\n")
{alert(varStr);}
else
{document.Change.action='ChangePinEmail_save.aspx';document.Change.submit();}}
function sendPINEmail()
{document.Forgot.action='ForgotYourPinCode_save.aspx';document.Forgot.submit();}
function ChangePinCode()
{document.BILL_REQ.action='ChangePinCode.aspx';document.BILL_REQ.method="post";document.BILL_REQ.submit();}
function changePIN()
{varStr="Please\n";var ValidPIN=/^\d{4}$/;varStr="Please\n";if(!(ValidPIN.test(document.Change.OldPINCode.value))){varStr=varStr+"\nEnter old pin code consisting of 4 digits"}
if(!(ValidPIN.test(document.Change.NewPINCode.value))){varStr=varStr+"\nEnter new pin code consisting of 4 digits"}
if(!(ValidPIN.test(document.Change.ConfirmPINCode.value))){varStr=varStr+"\nEnter confirm new pin code consisting of 4 digits"}
if(document.Change.NewPINCode.value!=document.Change.ConfirmPINCode.value){varStr=varStr+"\nNew Pin Code and Confirm new Pin Code must be identical"}
if(varStr!="Please\n")
{alert(varStr);document.Change.action='ChangeYourPinCode.aspx';document.Change.submit();}
else
{document.Change.action='ChangeYourPinCode.aspx?Save=true';document.Change.submit();}}
function GetQueryStringParams()
{var args=new Object();var query=location.search.substring(1);var pairs=query.split("&");for(var i=0;i<pairs.length;i++){var pos=pairs[i].indexOf('=');if(pos==-1)continue;var argname=pairs[i].substring(0,pos);var value=pairs[i].substring(pos+1);args[argname]=unescape(value);}
return args;}
function SubmitToPage(varForm,varPage)
{if(document.myform)
{if(document.myform.NewTelNo)
{document.myform.NewTelNo.value="NewTelNo";}}
var args=new Object();args=GetQueryStringParams();document.getElementById(varForm).action=varPage+"?New=1&From="+args["From"];document.getElementById(varForm).method="post";document.getElementById(varForm).submit();}
function SetInvoicesNum(SelectedNum,InvoicesNum)
{if(InvoicesNum!=0)
{if(eval(SelectedNum)==eval(InvoicesNum))
{document.myform.InvoicesNum.selected=true;}}}
function SelectInvoiceNum(InvoicesNum)
{if(InvoicesNum!=0)
{document.myform.InvoicesNum.value=InvoicesNum;}}
function AddToShopCartClicked()
{var ns6=(document.getElementById&&(!document.all))?true:false;var ns4=(document.layers)?true:false;var ie4=(document.all)?true:false;if(ns6)
var oTotalInvoices=Object(document.getElementById("TotalInvoices"));else if(ns4)
var oTotalInvoices=Object(document.lTotalInvoices);else if(ie4)
var oTotalInvoices=Object(document.all("TotalInvoices"));var bMinimumCheckBox=false;if(document.BillPayment.CheckBox_Invoices==null)
{alert("You don't have any bills to pay ...");return;}
if(isNaN(document.BillPayment.CheckBox_Invoices.length))
{var oCheckBox=document.BillPayment.CheckBox_Invoices;GetInvoice(oCheckBox.value,oCheckBox.title).checked=oCheckBox.checked;if(oCheckBox.checked==true)bMinimumCheckBox=true;}
else
{for(j=0;j<=document.BillPayment.CheckBox_Invoices.length-1;j++)
{var oCheckBox=document.BillPayment.CheckBox_Invoices[j];GetInvoice(oCheckBox.value,oCheckBox.title).checked=oCheckBox.checked;if(oCheckBox.checked==true)bMinimumCheckBox=true;}}
if(bMinimumCheckBox==true)
{try{document.BillPayment.SelectedInvoices.value=Serialize(Invoices.filter(CheckedInvoices));}
catch(e){document.BillPayment.SelectedInvoices.value=Serialize(Invoices);}
document.forms.BillPayment.action="ShoppingCart.aspx";document.forms.BillPayment.submit();return;}
else
{if(Invoices.length<1)
alert("You don't have any bills to pay ...")
else
alert("You must check at least one invoice to be able to pay");return}
if(oTotalInvoices!=null)
{total=TotalAmountChecked();var objInvoices=document.BillPayment.CheckBox_Invoices;if(!objInvoices)
objInvoices=document.BillPayment.InvAmount;if(total>0)
{document.BillPayment.CheckedInv.value='';if(isNaN(objInvoices.length))
{if(objInvoices.checked)
{document.BillPayment.CheckedInv.value='0';}}
else
{whichElem='first';for(i=0;i<=objInvoices.length-1;i++)
{if(objInvoices[i].checked)
{if(whichElem=='first')
{document.BillPayment.CheckedInv.value=i;whichElem='not-first';}
else
{document.BillPayment.CheckedInv.value=document.BillPayment.CheckedInv.value+','+i;}}}}
document.forms.BillPayment.action="ShoppingCart.aspx";document.forms.BillPayment.submit();}
else
{if(total==0)
alert("You must check at least one invoice to be able to pay");if(total==-1)
alert("You don't have any bills to pay ...")}}
else
{document.forms.BillPayment.action="ShoppingCart.aspx";document.forms.BillPayment.submit();}}
function ShopCartPayClicked()
{var ns6=(document.getElementById&&(!document.all))?true:false;var ns4=(document.layers)?true:false;var ie4=(document.all)?true:false;if(ns6)
var oTotalInvoices=Object(document.getElementById("TotalInvoices"));else if(ns4)
var oTotalInvoices=Object(document.lTotalInvoices);else if(ie4)
var oTotalInvoices=Object(document.all("TotalInvoices"));if(oTotalInvoices!=null)
{total=TotalAmountChecked();var objInvoices=document.BillPayment.CheckBox_Invoices;if(!objInvoices)
objInvoices=document.BillPayment.InvAmount;if(total>0)
{document.BillPayment.CheckedInv.value='';if(isNaN(objInvoices.length))
{if(objInvoices.checked)
{document.BillPayment.CheckedInv.value='0';}}
else
{whichElem='first';for(i=0;i<=objInvoices.length-1;i++)
{if(objInvoices[i].checked)
{if(whichElem=='first')
{document.BillPayment.CheckedInv.value=i;whichElem='not-first';}
else
{document.BillPayment.CheckedInv.value=document.BillPayment.CheckedInv.value+','+i;}}}}
document.forms.BillPayment.action="ShoppingCartPayment.aspx";document.forms.BillPayment.submit();}
else
{if(total==0)
alert("You must check at least one invoice to be able to pay");if(total==-1)
alert("You don't have any bills to pay ...")}}
else
{document.forms.BillPayment.action="ShoppingCartPayment.aspx";document.forms.BillPayment.submit();}}
function ShopCartConfirmClicked()
{document.BM.action="EPay_Trans.aspx"
document.BM.submit();}
function ShopCartBackClicked()
{var ns6=(document.getElementById&&(!document.all))?true:false;var ns4=(document.layers)?true:false;var ie4=(document.all)?true:false;if(ns6)
var oTotalInvoices=Object(document.getElementById("TotalInvoices"));else if(ns4)
var oTotalInvoices=Object(document.lTotalInvoices);else if(ie4)
var oTotalInvoices=Object(document.all("TotalInvoices"));if(oTotalInvoices!=null)
{total=TotalAmountChecked();var objInvoices=document.BillPayment.CheckBox_Invoices;if(!objInvoices)
objInvoices=document.BillPayment.InvAmount;if(objInvoices.length==31){alert('You have reached the maximum number of invoices to be paid at one time.');return;}
if(total>0)
{document.BillPayment.CheckedInv.value='';if(isNaN(objInvoices.length))
{if(objInvoices.checked)
{document.BillPayment.CheckedInv.value='0';}}
else
{whichElem='first';for(i=0;i<=objInvoices.length-1;i++)
{if(objInvoices[i].checked)
{if(whichElem=='first')
{document.BillPayment.CheckedInv.value=i;whichElem='not-first';}
else
{document.BillPayment.CheckedInv.value=document.BillPayment.CheckedInv.value+','+i;}}}}
document.forms.BillPayment.action="ShoppingCart_Submit.aspx";document.forms.BillPayment.submit();}
else{document.forms.BillPayment.action="ShoppingCart_Submit.aspx";document.forms.BillPayment.submit();}}
else
{document.forms.BillPayment.action="ShoppingCart_Submit.aspx";document.forms.BillPayment.submit();}}
function ShopCartPayClicked2()
{total=TotalAmountChecked();if(total<=0)
{document.forms.BillPayment.method="post";document.forms.BillPayment.action="ShoppingCartPayment.aspx?GetAll=1";document.forms.BillPayment.submit();}
else
{AddToShopCartClicked()}}
function BuildPage()
{var oXML=new ActiveXObject("Microsoft.XMLDOM")
oXML.async="false"
oXML.loadXML(xmlData.xml);var oXSL=new ActiveXObject("Microsoft.XMLDOM")
oXSL.async="false"
oXSL.loadXML(objXSL.xml);var Result=oXML.transformNode(oXSL.documentElement);document.getElementById("ContentDiv").innerHTML=Result;}
function Invoice(Inv_Id,Tel_No,Inv_Date,Inv_Type,SubTotal,Penalty,Amount,checked,ACCREF)
{this.Inv_Id=Inv_Id;this.Tel_No=Tel_No;this.Inv_Date=Inv_Date;this.Inv_Type=Inv_Type;this.SubTotal=SubTotal;this.Penalty=Penalty;this.Amount=Amount;this.checked=checked;this.ACCREF=ACCREF;}
function CheckedInvoices(element,index,array)
{return element.checked;}
function Serialize(oInvoices)
{var strSerializedDate="";for(i=0;i<oInvoices.length;i++)
{if(oInvoices[i].checked==true)
{strSerializedDate+=oInvoices[i].Tel_No+','+oInvoices[i].Inv_Date+','+oInvoices[i].Inv_Type+','+oInvoices[i].SubTotal+','+oInvoices[i].Penalty+','+oInvoices[i].Amount+','+oInvoices[i].ACCREF;if(i<oInvoices.length-1)strSerializedDate+=";";}}
return strSerializedDate;}
function GetInvoice(inv_id,Type)
{for(i=0;i<Invoices.length;i++)
{var invTitle=Invoices[i].Inv_Date+"-"+Invoices[i].Tel_No
if(invTitle==inv_id&&Invoices[i].Inv_Type==Type)
{return Invoices[i];}}
return 0;}
function CalculateAmount2()
{var TotalToPaid=0;if(isNaN(document.BillPayment.CheckBox_Invoices.length))
{var inv=GetInvoice(document.BillPayment.CheckBox_Invoices.value,document.BillPayment.CheckBox_Invoices.title);if(document.BillPayment.CheckBox_Invoices.checked==true)
{TotalToPaid+=GetInvoice(document.BillPayment.CheckBox_Invoices.value,document.BillPayment.CheckBox_Invoices.title).Amount;}}
else
{for(j=0;j<document.BillPayment.CheckBox_Invoices.length;j++)
{var inv=GetInvoice(document.BillPayment.CheckBox_Invoices[j].value,document.BillPayment.CheckBox_Invoices[j].title);if(document.BillPayment.CheckBox_Invoices[j].checked==true)
{TotalToPaid+=GetInvoice(document.BillPayment.CheckBox_Invoices[j].value,document.BillPayment.CheckBox_Invoices[j].title).Amount;}}}
if(TotalToPaid>0)
document.getElementById("TotalInvoices").innerHTML='<layer id="lTotalInvoices" width="189" top="834" left="804">'+TotalToPaid.toFixed(2)+'</layer>'
else
document.getElementById("TotalInvoices").innerHTML='<layer id="lTotalInvoices" width="189" top="834" left="804">--</layer>'}
function ValidateAverageInvoices()
{var source=checkFormAverageInvoices();if(source=="NotValid")
return;else
{if(document.myform.NewTelNo)
{document.myform.NewTelNo.value="NewTelNo";}
document.myform.action="Customer_Average_Invoices.aspx?New=1&From="+source;document.myform.method="post";document.myform.submit();}}
function checkFormAverageInvoices(from){var AccountVisible=false;if(IsUserLoggedWithAccount())
AccountVisible=true;var AccountAlert="Please\n";var TelAlert="Please\n";var AccountValid=true;var TelValid=true;if(AccountVisible==true)
{varStr="Please\n";if(document.myform.ACCREF.value=="")
{AccountAlert=AccountAlert+"Enter A Valid Account Number";AccountValid=false;}
else if(document.myform.ACCREF.value.toString().indexOf(" ")!=-1||document.myform.ACCREF.value.toString().indexOf(".")!=-1||document.myform.ACCREF.value.toString().indexOf("-")!=-1||document.myform.ACCREF.value.toString().indexOf("+")!=-1)
{AccountAlert=AccountAlert+"Enter A Valid Account Number";AccountValid=false;}}
else if(AccountAlert!="Please\n"||AccountVisible==false)
{varStr="Please\n";if(document.myform.AreaCode.value=="")
{TelAlert=TelAlert+" Enter The Area Code\n";TelValid=false;}
if(document.myform.TelNo.value=="")
{TelAlert=TelAlert+" Enter The Phone Number\n";TelValid=false;}
if(document.myform.AreaCode.value.toString().length>3)
{TelAlert=TelAlert+" Area Code Should not Exceed 3 digits\n";TelValid=false;}
if(document.myform.TelNo.value.toString().length>8)
{TelAlert=TelAlert+" Phone Number Should not exceed 8 digits\n";TelValid=false;}
if(document.myform.TelNo.value.toString().length>document.myform.TelNo.maxlength)
{TelAlert=TelAlert+" Phone Number Should not excced "+document.BIL_REQ.TelNo.maxlength+" digits";TelValid=false;}
if(document.myform.TelNo.value.toString().indexOf(" ")!=-1||document.myform.TelNo.value.toString().indexOf(".")!=-1||document.myform.TelNo.value.toString().indexOf("-")!=-1||document.myform.TelNo.value.toString().indexOf("+")!=-1||isNaN(document.myform.TelNo.value.toString()))
{TelAlert=TelAlert+" Enter A Valid Phone Number\n";TelValid=false;}
if(document.myform.AreaCode.value.toString().indexOf(" ")!=-1||document.myform.AreaCode.value.toString().indexOf(".")!=-1||document.myform.AreaCode.value.toString().indexOf("-")!=-1||document.myform.AreaCode.value.toString().indexOf("+")!=-1||isNaN(document.myform.AreaCode.value.toString()))
{TelAlert=TelAlert+" Enter A Valid Area Code\n";TelValid=false;}}
if(AccountVisible==true&&AccountValid==false&&TelValid==false)
{alert(AccountAlert);return"NotValid";}
if(AccountVisible==false&&TelValid==false)
{alert(TelAlert);return"NotValid";}
if(AccountVisible==true&&AccountValid==true)
return"ACCREF";else if(TelValid==true)
return"TelNo";return"NotValid";}
function SubmitToBillStatus(varForm,varPage)
{var source=checkFormAverageInvoices();if(source=="NotValid")
return;if(document.myform)
{if(document.myform.NewTelNo)
{document.myform.NewTelNo.value="NewTelNo";}}
document.getElementById(varForm).action=varPage+"?New=1&From="+source;document.getElementById(varForm).method="post";document.getElementById(varForm).submit();}
function SubmitToAveragePage(varForm,varPage)
{if(document.myform)
{if(document.myform.NewTelNo)
{document.myform.NewTelNo.value="NewTelNo";}}
var source="";var AccountVisible=false;if(IsUserLoggedWithAccount())
AccountVisible=true;if(AccountVisible==true&&checkFormACCREF(false))
{source="ACCREF"}
else if(checkFormTelephoneNumber(false))
{source="TelNo";}
if(source=="")
{if(AccountVisible==true)
checkFormACCREF(true);else
checkFormTelephoneNumber(true);return;}
document.getElementById(varForm).action=varPage+"?New=1&From="+source;document.getElementById(varForm).method="post";document.getElementById(varForm).submit();}
function submitClickedNew(){var source="";source="TelNo";var AccountVisible=false;if(IsUserLoggedWithAccount()){AccountVisible=true;source="ACCREF";if(!checkFormACCREF(true)){return;}}
else{if(!checkFormTelephoneNumber(true)){return;}}
if(document.BILL_REQ.NewTelNo){document.BILL_REQ.NewTelNo.value="NewTelNo";}
document.BILL_REQ.action="customer_bill_status.aspx?New=1&From="+source;document.BILL_REQ.method="post";document.BILL_REQ.submit();}
function checkFormTelephoneNumber(showAlert)
{varStr="Please,\n";if(document.BILL_REQ.AreaCode.value==""){varStr=varStr+"\nenter the area code."}
if(document.BILL_REQ.TelNo.value==""){varStr=varStr+"\nenter the Phone number."}
if(document.BILL_REQ.AreaCode.value.toString().length>3){varStr=varStr+"\nArea code length must be less than 3."}
if(document.BILL_REQ.TelNo.value.toString()>document.BILL_REQ.maxlength){varStr=varStr+"\nPhone number should be shorter than "+document.BILL_REQ.maxlength}
if(document.BILL_REQ.TelNo.value.toString().indexOf(" ")!=-1||document.BILL_REQ.TelNo.value.toString().indexOf(".")!=-1||document.BILL_REQ.TelNo.value.toString().indexOf("-")!=-1||document.BILL_REQ.TelNo.value.toString().indexOf("+")!=-1||isNaN(document.BILL_REQ.TelNo.value.toString())){varStr=varStr+"\nenter a valid Phone Number."}
if(document.BILL_REQ.ACCREF.display=="")
{if(document.BILL_REQ.ACCREF.value.toString().indexOf(" ")!=-1||document.BILL_REQ.ACCREF.value.toString().indexOf(".")!=-1||document.BILL_REQ.ACCREF.value.toString().indexOf("-")!=-1||document.BILL_REQ.ACCREF.value.toString().indexOf("+")!=-1||isNaN(document.BILL_REQ.ACCREF.value.toString())){varStr=varStr+"\nenter a valid Account Number."}}
if(document.BILL_REQ.AreaCode.value.toString().indexOf(" ")!=-1||document.BILL_REQ.AreaCode.value.toString().indexOf(".")!=-1||document.BILL_REQ.AreaCode.value.toString().indexOf("-")!=-1||document.BILL_REQ.AreaCode.value.toString().indexOf("+")!=-1||isNaN(document.BILL_REQ.AreaCode.value.toString())){varStr=varStr+"\nenter a valid Area Code."}
if(varStr!="Please,\n")
{if(showAlert==true)
alert(varStr);return false;}
else
{return true;}}
function checkFormACCREF(showAlert)
{varStr="Please,\n";if(document.BILL_REQ.ACCREF.value.toString()=="")
{varStr=varStr+"\nEnter the account number."}
else if(document.BILL_REQ.ACCREF.value.toString().indexOf(" ")!=-1||document.BILL_REQ.ACCREF.value.toString().indexOf(".")!=-1||document.BILL_REQ.ACCREF.value.toString().indexOf("-")!=-1||document.BILL_REQ.ACCREF.value.toString().indexOf("+")!=-1)
{varStr=varStr+"\nenter a valid Account Number."}
else
{return true;}
if(varStr!="Please,\n")
{if(showAlert==true)
alert(varStr);return false;}}
function submitClickedPopupNew(){document.BILL_REQ.action="Popup_Window.aspx?New=1&From=TelNo";document.BILL_REQ.method="post";document.BILL_REQ.submit();}
function SubmitToAveragePagePopup(varForm,varPage){if(document.myform){if(document.myform.NewTelNo){document.myform.NewTelNo.value="NewTelNo";}}
var source="";source="TelNo";if(IsUserLoggedWithAccount()){source="ACCREF"}
document.getElementById(varForm).action=varPage+"?New=1&From="+source;document.getElementById(varForm).method="post";document.getElementById(varForm).submit();}
function Check(){cShopCartBillsCount=parseInt(document.getElementById('ShopCartBillsCount').value);cMaxNumOfBillsToBePaid=parseInt(document.getElementById('MaxNumOfBillsToBePaid').value);if(document.getElementById('PaymentMethod').getAttribute("Value")=="0"&&cShopCartBillsCount>cMaxNumOfBillsToBePaid){alert('At the present time you can pay up to '+document.getElementById('MaxNumOfBillsToBePaid').value+' invoices at the same time if you select Payment by Credit Card');}
else
ShopCartConfirmClicked();}
