<!DOCTYPE html>
<script>
	var isenquiry = false;
	var manualPaymentuserData;
	var ismailsend = false;
	var isonlinepay;
	</script>
<html>
<head>
<meta charset="utf-8">
<title>Renewal Detail</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<script type="text/javascript" src="js/lib/aes.js"></script>
<script type="text/javascript" src="js/lib/pbkdf2.js"></script>
<script type="text/javascript" charset="UTF-8" src="Commondata.js"></script>
<script type="text/javascript" charset="UTF-8" src="VehicleDetCommonData.js"></script>
<script type="text/javascript" charset="UTF-8" src="Apiservice.js"></script>
<!--<link rel="stylesheet" type="text/css" href="fonts/stylesheet.css">-->
<link rel="stylesheet" type="text/css" href="css/normalize.css">
<link rel="stylesheet" type="text/css" href="css/framework.css">
<link rel="stylesheet" type="text/css" href="css/axa.min.css">
<script type="text/javascript" charset="utf-8" src="cordova.js"></script>
<script type="text/javascript" src="js/index.js"></script>
<script type="text/javascript" charset="UTF-8" src="js/axa-popup.js"></script>
<script src="js/webfont.js"></script>
<script>
	<!--WebFont.load({
		google : {
			families : [ "Montserrat:400,700" ]
		}
	});-->
</script>
<script type="text/javascript" src="js/modernizr.js"></script>
<link rel="shortcut icon" type="image/x-icon"
	href="images/logoStandford32.ico">
<link rel="apple-touch-icon" href="images/logoStandford32.ico">
<link href="css/ionicons.min.css" rel="stylesheet" type="text/css" />
<style>
a {
    color: ##AA1B17;
    text-decoration: none;

}
</style>
<script type="text/javascript">
	//window onload
	var count1 = 0;
	window.onload = function what() {
		var lapsedstatus = getItem("lapsedstatus");
		var statusid = getItem("policytype");
		console.log("statusid======" + statusid);
		console.log("lapsedstatus======" + lapsedstatus);
		var userAgentResponse =  getItem("userlist");
		var userAgentResponseList=JSON.parse(userAgentResponse);
		if(userAgentResponseList.length<=1){
			document.getElementById('switchuserclass').style.display = 'none';
		}
		/* Motor and Non Motor Diff */
		motorhealthdiff();
		/* Motor and Non Motor Diff */

		if (statusid > 10) {
			statusid = statusid % 10;
			isenquiry = true;
			if (statusid == 5){
				document.getElementById("netpremiumaccordion").hidden = false;
			}
			document.getElementById('navbartitle').innerHTML = "Enquiry Details";
		} else {
			isenquiry = false;
			document.getElementById('navbartitle').innerHTML = "Renewal Details";
		}
		if (statusid == 4) {
			document.getElementById('divrenew').style.display = 'none';
		}
		else if (statusid == 2 || statusid == 3) {
		    document.getElementById('custpay').value = "PAYMENT DETAILS";
			document.getElementById('butoffline').style.display = 'none';
			document.getElementById('butrenew').style.display = 'none';
		} else if (statusid == 5) {
			document.getElementById("netpremiumaccordion").hidden = false;
			document.getElementById('butoffline').style.display = 'none';
		}
		var request = {
			agentid : getItem("agentcode"),
			policyno : getItem("policynum"),
			renwalpolicyid:getItem("renwalpolicyid")
		};
		var url = renewaldetails;
		Apiservicecall(
				function(result) {
					if (result.status == 1) {
						var response = result.response;
						if (response.status == 1) {
							if(response.data.d2recordsDos.length >= 1){
								document.getElementById('sendEmailDiv').style.display="block";
							}
							if (response.data.contractmessage != ""){
									manualpayblock();
									document.getElementById("contracttypenotallowed").innerHTML = response.data.contractmessage;
									document.getElementById("contracttypenotallowed").hidden=false;
							}
							if (response.data.manualind == "Y"){
									manualpayblock();
									document.getElementById("contracttypenotallowed").innerHTML = response.data.manualmsg;
									document.getElementById("contracttypenotallowed").hidden=false;
							}
							if (response.data.d1_ind == "Y"){
									manualpayblock();
									document.getElementById("contracttypenotallowed").innerHTML = response.data.d1_msg;
									document.getElementById("contracttypenotallowed").hidden=false;
							}
							if(response.data.requeryind == 'Y'){
                                setItem("requeryInd",response.data.requeryind);
								setItem("requerypaymentDO",JSON.stringify(response.data.paymentDO))
								setItem("requeryMessage", response.data.requerymsg);
								document.getElementById('butrenew').style.display = 'none';
								document.getElementById('butoffline').style.display = 'none';
								document.getElementById('custpay').value = "REFRESH PAGE";
								document.getElementById("contracttypenotallowed").innerHTML = getItem('requeryMessage');
								document.getElementById("contracttypenotallowed").hidden=false;
							}
							setItem("renewaldetails", JSON.stringify(response.data));
							manualPaymentuserData = response.data;
							document.getElementById('policyholdername').innerHTML = response.data.policyholdername;
							document.getElementById('policyexpirydate').innerHTML = response.data.policyexpirydate;
							document.getElementById('policyno').innerHTML = response.data.contracttype + "/" + response.data.policyno;
							document.getElementById('productname').innerHTML = response.data.productname;
							document.getElementById('grosspremium').innerHTML = currencyformat(response.data.grosspremium, "");
							document.getElementById('discount').innerHTML = currencyformat(response.data.discount, "");
							document.getElementById('stampduty').innerHTML = currencyformat(response.data.stampduty, "");
							document.getElementById('gstpercent').innerHTML = currencyformat(response.data.gstAmount, "");
							document.getElementById('netPremiumPayable').innerHTML = currencyformat(response.data.premiumPayable, "");
							document.getElementById('gstperval').innerHTML = "Taxes";
							document.getElementById('gstperval3').innerHTML = "(if applicable)";
							document.getElementById('netPremiumPay').innerHTML = currencyformat(response.data.netPremiumPayable, "");
							for (var i = 0; i < response.data.insuredResponseDOs.length; i++) {
								var rowlist;
								var insuredname;
								insuredname = response.data.insuredResponseDOs[i].insuredname;
								console.log(response.data.insuredResponseDOs[i].productDetailsDOs);
								if (response.data.insuredResponseDOs[i].grosspremium == 0) {
									rowlist = "<a class='accordion'><span class='rn-dt-pp-left rd-txt-dot' >"
											+ insuredname
											+ "</span> <div class='acc-r rn-dt-pp-right'>"
											+ currencyformat(
													response.data.insuredResponseDOs[i].grosspremium,
													"")
											+ "</div></a><div class='panel'><table><tbody>";
									if (Array
											.isArray(response.data.insuredResponseDOs[i].productDetailsDOs)) {
										for (var j = 0; j < response.data.insuredResponseDOs[i].productDetailsDOs.length; j++) {
											rowlist = rowlist
													+ "<tr><td align='center'>"
													+ response.data.insuredResponseDOs[i].productDetailsDOs[j].plan
													+ "</td><td align='left'>"
													+ response.data.insuredResponseDOs[i].productDetailsDOs[j].product
													+ "</td><td align='right'>"
													+ currencyformat(
															response.data.insuredResponseDOs[i].productDetailsDOs[j].productpremium,
															"") + "</td></tr>";
										}
									} else {
										console.log("is object"+ JSON.stringify(response.data.insuredResponseDOs[i].productDetailsDOs.message));
										rowlist = "<div class='axa-col-6 no-padding'></div><a class='accordionford2record rd-txt-dot'><span class='rn-dt-pp-left rd-txt-dot'>"
												+ insuredname
												+ "</span> <div class='acc-r rn-dt-pp-right'>"
												+ currencyformat(response.data.insuredResponseDOs[i].grosspremium,"")
												+ "</div></a><div class='panel1'><table><tbody><td style='color: red;'>"
												+ response.data.insuredResponseDOs[i].productDetailsDOs.message
												+ "</td>";
									}
									rowlist = rowlist + "</tbody></table>";
									$('#list').append(rowlist);
								} else {
									rowlist = "<a class='accordion'><span class='rn-dt-pp-left rd-txt-dot'>"
											+ insuredname
											+ "</span> <div class='acc-r rn-dt-pp-right'>"
											+ currencyformat(response.data.insuredResponseDOs[i].grosspremium,"")
											+ "</div></a><div class='panel'><table><thead><tr><th scope='col' align='center'>Plan</th><th scope='col' align='left'>Product</th><th scope='col' align='right'>Product Premium (RM)</th></tr></thead><tbody>";
									if (Array.isArray(response.data.insuredResponseDOs[i].productDetailsDOs)) {
										for (var j = 0; j < response.data.insuredResponseDOs[i].productDetailsDOs.length; j++) {
											console.log(response.data.insuredResponseDOs[i].productDetailsDOs[j].plan);
											rowlist = rowlist
													+ "<tr><td align='center'>"
													+ response.data.insuredResponseDOs[i].productDetailsDOs[j].plan
													+ "</td><td align='left'>"
													+ response.data.insuredResponseDOs[i].productDetailsDOs[j].product
													+ "</td><td align='right'>"
													+ currencyformat(
															response.data.insuredResponseDOs[i].productDetailsDOs[j].productpremium,
															"") + "</td></tr>";
										}
									} else {
										console.log("is object"+ JSON.stringify(response.data.insuredResponseDOs[i].productDetailsDOs.plan));
										rowlist = rowlist
												+ "<tr><td align='center'>"
												+ response.data.insuredResponseDOs[i].productDetailsDOs.plan
												+ "</td><td align='left'>"
												+ response.data.insuredResponseDOs[i].productDetailsDOs.product
												+ "</td><td align='right'>"
												+ currencyformat(
														response.data.insuredResponseDOs[i].productDetailsDOs.productpremium,
														"") + "</td></tr>";
									}
									rowlist = rowlist + "</tbody></table>";
									$('#list').append(rowlist);
								}
							}
							accordiancall();
							for (var i = 0; i < response.data.d2recordsDos.length; i++) {

								var d2recordsDoslist;
								d2recordsDoslist = "<div class='axa-col-6 no-padding'></div><a class='accordionford2record rd-txt-dot'><span class='rn-dt-pp-left rd-txt-dot'>"
										+ response.data.d2recordsDos[i].insuredname
										+ "</span><div class='acc-r rn-dt-pp-right'>"
										+ currencyformat(0,"")
										+ "</div> </a><div class='panel1'><table><tbody><td style='color: red;'>"
										+ response.data.d2recordsDos[i].message
										+ "</td></tbody></table>";
								$('#list').append(d2recordsDoslist);
							}
							if (response.data.discount == 0) {
								document.getElementById('lessdiscount').style.display = 'none';
							}
						}
					}
				}, url, request);
		var x = $("#detailsdiv").position();
        console.log("Top: " + x.top + " Left: " + x.left);
		var detailsdivtElement = document.getElementById("detailsdiv");
        var heroimageElement = document.getElementById("hero-image");
        heroimageElement.style.height = ((detailsdivtElement.offsetTop+80) + "px");
	};
	//onkey pres event
		function handle(e){
		    console.log("press");
		    if(e.keyCode == 32){
		        event.preventDefault();
		        return false;
		    }
		}
	//manual payment <block></block>
	function manualpayblock()
	{
		$('#butoffline').attr('disabled', true);
		$('#butrenew').attr('disabled', true);
		$('#custpay').attr('disabled', true);
		$('#butoffline').css('background', '#dcdcdc');
		$('#butrenew').css('background', '#dcdcdc');
		$('#custpay').css('background', '#dcdcdc');
		$('#butoffline').css('color', '#a5a5a5');
		$('#butrenew').css('color', '#a5a5a5');
		$('#butoffline').css('cursor', 'not-allowed');
		$('#butrenew').css('cursor', 'not-allowed');
		$('#butoffline').css('border', 'none');
		$('#butrenew').css('border', 'none');
		$('#custpay').css('color', '#a5a5a5');
		$('#custpay').css('cursor', 'not-allowed');
		$('#custpay').css('border', 'none');
		}

	function sendD2Mail(){

		if (manualPaymentuserData.d2recordsDos[0] != null) {
			$('#showpop').empty();
			$('#customerform').empty();
			$('#customerform').append("<form onsubmit='return false'><h5 class='text-center'>Child Transfer Form</h5><input class='axa-input input-form' placeholder='Enter customer&#39;s email address' id='emailpdfsend2' type='text' name='email' onkeyup='handlespace(this)'><span class = 'popupspan' style='font-weight: 900;'>Note </span><span class = 'popupspan'>: Multiple email addresses can be given, separated by comma ( , )</span><h6 id='emailinvalid' style='color:red;margin-top: -5px;'></h6><div class='axa-clearfix'></div><button class='popup-btn' id='btn_email' onclick='sendEmail()'>OK</button><button class='popup-btn' id='comm-dismiss' onclick='mailcancel()'>CANCEL</button></form>");
			show('customerform');
			document.getElementById('emailinvalid').style.display = 'none';
		}

	}

	//request offline payment
	function ReqManualpayment() {

		hide('showpop');

		if ((manualPaymentuserData.grosspremium == 0 && count1 == manualPaymentuserData.insuredResponseDOs.length)
				|| (manualPaymentuserData.grosspremium == 0
						&& count1 == manualPaymentuserData.insuredResponseDOs.length && manualPaymentuserData.data.d2recordsDos != null)) {
			backbuttonclk();
		} else {
			var renewaldetails = JSON.parse(getItem("renewaldetails"));
			var policy_no = renewaldetails.policyno;
			var request = {
				policyno : policy_no,
				agentid : getItem("agentcode"),
				renwalpolicyid:getItem("renwalpolicyid")
			};
			Apiservicecall(function(result) {
				if (result.status == 1) {
					var response = result.response;
					if (response.status == 1) {
						showAlert(response.message, true);
					}
					else if(response.status == 2) {
						showAlert(response.message, false);
					}
					else if(response.status == 3) {
						showAlert(response.message, false);
					}
					else {
						showAlert(response.message, false);
					}
				}
			}, manualPayment, request);
		}
	}
	//online payment success redirect to payment-details
	function paiddetails() {
		window.location.href = 'Payment-detail.html';
	}
	//Offline payment
	function ManualPaymentAlert() {
	var message = "Are you sure you want to pay offline at GENERALI&#39;s office? Policy will not be renewed until payment has been made.";
	if(checkOnline()){
		count1 = 0;
		var manualPaymentuserData = JSON.parse(getItem("renewaldetails"));
		for (var i = 0; i < manualPaymentuserData.insuredResponseDOs.length; i++) {
			if (manualPaymentuserData.insuredResponseDOs[i].grosspremium != 0) {
			} else {
				count1 = count1 + 1;
			}
		}
		var statusid = getItem("policytype");
		if (statusid > 10) {
			statusid = statusid % 10;
		}
		if (statusid == 5) {
			backbuttonclk();
		}
		if((ismailsend == false) && (manualPaymentuserData.d2recordsDos[0] != null)){
			isonlinepay = 1;
			mailConfirmation("Do you want to proceed without sending child transfer form?",isonlinepay);
		}
		else{
			offlinepopupshow(message);
		}
	}
	}
	//customer pay function
	function customerPay(){
	if(checkOnline()){
		var manualPaymentuserData = JSON.parse(getItem("renewaldetails"));
		var statusid = getItem("policytype");
		if (statusid > 10) {
			statusid = statusid % 10;
		}
		if (statusid == 2 || statusid == 3) {
			paiddetails();
		}
		else if(getItem('requeryInd') == 'Y') {
			ipayrequeryfunction();
		}
		else if((ismailsend == false) && (manualPaymentuserData.d2recordsDos[0] != null)){
			isonlinepay = 3;
			mailConfirmation("Do you want to proceed without sending child transfer form?",isonlinepay);
		}
		else{
			customerPayService();
		}
	}
}

function customerPayService(){
	renewaldetails=JSON.parse(getItem("renewaldetails"));
	var policyno=renewaldetails.policyno;
	var premiumamount = renewaldetails.premiumPayable;
	var contracttype  = renewaldetails.contracttype;
	var expirydate =  renewaldetails.policyexpirydate;
	var request = {policyno: policyno, premiumamount: premiumamount, contracttype: contracttype, expirydate: expirydate, agentcode: getItem('agentcode'), renwalpolicyid: getItem('renwalpolicyid')};
	Apiservicecall(function(result)
	{
		cuspaystatus=result.status;
		var responsecustomerpay = result.response;
			if(result.status==1)
			{
			if(responsecustomerpay.status == 1){
						setItem("customerpayList",JSON
								.stringify(result.response));
						window.location.href = 'Customer-pay.html';
			}
			else if(responsecustomerpay.status == 2){
				showAlert(responsecustomerpay.message, false);
			}
			else if(responsecustomerpay.status == 3){
				showAlert(responsecustomerpay.message, false);
			}
			else {
				showAlertIcError(responsecustomerpay.message, false);
			}
		}
	},customerPayment,request);
}
	//common alert
	function showAlert(message, issuccess) {
		$('#showpop').empty();
		$('#showpop').append(
				"<h5>Message</h5><p id='para_messageid'>" + message
						+ "</p><button class='popup-btn' id='comm-dismiss' onclick='onDismiss("
						+ issuccess + ")'>OK</button>");
		show('showpop');
	}
	function showAlertIcError(cuspaymessage, issuccess){
		$('#showpop').empty();
		$('#showpop').append(
				"<div class='big-div'><h5>Message</h5><p id='para_messageid'>" + cuspaymessage
						+ "</p><button class='popup-btn' id='comm-dismiss' onclick='onDismiss("
						+ issuccess + ")'>OK</button></div>");
		show('showpop');
		}
	// ipayalert
	function showAlertIpay(message, issuccess){
		$('#showpop').empty();
		$('#showpop').append(
				"<h5>Payment Gateway Response</h5><p id='para_messageid'>" + message
						+ "</p><button class='popup-btn' id='comm-dismiss' onclick='onDismissRequery("
						+ issuccess + ")'>OK</button>");
		show('showpop');
	}

	function onDismissRequery(issuccess){
		if (issuccess) {
			var statusid = getItem("policytype");
			hide('showpop');
			if (statusid > 10) {
			  statusid = statusid % 10;
			  isenquiry = true;
			}
				if(statusid == 1){
					document.getElementById('custpay').value = "PAY BY CUSTOMER";
					$("#butrenew").removeAttr("style","none");
					$("#butoffline").removeAttr("style","none");
					document.getElementById("contracttypenotallowed").hidden=true;
				}
				else if(statusid == 5){
					document.getElementById('custpay').value = "PAY BY CUSTOMER";
					$("#butrenew").removeAttr("style","none");
					document.getElementById("contracttypenotallowed").hidden=true;
				}

		} else {
			hide('showpop');
		}
	}
	function mailConfirmation(message, isonlinepay){
	if(checkOnline()){
		$('#showpop').empty();
		$('#showpop').append(
				"<h5>Message</h5><p id='para_messageid'>" + message + "</p><button class='popup-btn' id='btn_mailconfirmation' onclick='mailconfirm("+isonlinepay+");'>YES</button><button class='popup-btn' id='comm-dismiss' onclick=hide('showpop')>NO</button>");
		show('showpop');
	}
	}

	function mailconfirm(isonlinepay){
	if(checkOnline()){
		if(isonlinepay == 2){
		window.location.href = 'Payment.html';
		}
		else if(isonlinepay == 1){
		offlinepopupshow('Are you sure you want to pay offline at AXA&#39;s office? Policy will not be renewed until payment has been made.');
		}
		else {
		customerPayService();
		}
	}
	}
	// dismiss popup
	function onDismiss(issuccess) {
		if (issuccess) {
			backbuttonclk();
		} else {
			hide('showpop');
		}
	}
	//online payment redirect
	function renew() {
	if(checkOnline()){
		var statusid = getItem("policytype");
		if (statusid > 10) {
			statusid = statusid % 10;
		}
		if (statusid == 2 || statusid == 3) {
			paiddetails();
		}
		else if(getItem('requeryInd') == 'Y') {
			ipayrequeryfunction();
		}
		else if((ismailsend == false) && (manualPaymentuserData.d2recordsDos[0] != null)){
			isonlinepay = 2;
			mailConfirmation("Do you want to proceed without sending child transfer form?",isonlinepay);
		}
		 else {
			window.location.href = 'Payment.html';
		}
	}
	}
	//ipay requery function
	function ipayrequeryfunction(){
	if(checkOnline()){
		var requestObj = JSON.parse(getItem("requerypaymentDO"));
		var esubmissionidObj = { agentid: getItem("agentcode") };
		var request = objectmerge(requestObj,esubmissionidObj);
		console.log(request);
		Apiservicecall(
				function(result) {
					console.log(result);
					if (result.status == 1) {
						if(result.response.status == 1){
							paiddetails();
						}
						if(result.response.status == 0){
							if(result.response.data.requeryind == 'N') {
								showAlertIpay(result.response.data.requerymsg, true);
								setItem('requeryInd',result.response.data.requeryind);
							}
							else{
								showAlertIpay(result.response.data.requerymsg, false);
							}
						}
					}
				}, ipayrequeryurl, request);
		}
	}

	//object merge
	 function objectmerge(Requestdata, agentIdObj) {
	 for (var key in agentIdObj) {
	  Requestdata[key] = agentIdObj[key];
	 }
	 return Requestdata;
	}
	//mail cancel button function
	function mailcancel(){
		// hide('showpop');
		hide('customerform');
		// offlinePayment();
	}
	//mail request
	function sendEmail() {
	if(checkOnline()){
		var mailid = document.getElementById('emailpdfsend2').value;
		var emailid = mailid.replace(/\s/g, '');
		if (validateEmail(mailid) == true) {
			document.getElementById('emailinvalid').style.display = 'none';
			emailService(emailid);
		} else {
			if(mailid.length<=0){
				document.getElementById('emailinvalid').innerHTML = "Please enter email address";
				document.getElementById('emailinvalid').style.display = 'block';
			}
			else{
				document.getElementById('emailinvalid').innerHTML = "Email format incorrect";
				document.getElementById('emailinvalid').style.display = 'block';
			}
		}
	}
	}

//sending Email Apiservice
  function emailService(emailid){
		var manualPaymentuserData = JSON.parse(getItem("renewaldetails"));
		var agentmailid = getItem("username");
		var sendEmail = {
				insuredname : []
			};
			for ( var i in manualPaymentuserData.d2recordsDos) {
				var item = manualPaymentuserData.d2recordsDos[i];
				sendEmail.insuredname.push(item.insuredname);
			}
			var emailObj = {
				agentEmailId : agentmailid,
				emailid : emailid,
				policyno : manualPaymentuserData.policyno,
				insuredname : sendEmail.insuredname,
				agentcode : manualPaymentuserData.agentid,
				renwalpolicyid:getItem("renwalpolicyid")
			}
			console.log(emailObj);
			$("#customerform").empty();
			hide('customerform');
			Apiservicecall(
					function(result) {
						if (result.status == 1) {
							ismailsend = true;
							commonpaydetails(result.response.message);
						}
					}, sendMail, emailObj);

	}

	function commonpaydetails(message){
		$('#showpop').empty();
		$('#showpop').append("<h5>Message</h5><p id='para_messageid'>"+ message+ "</p><button class='popup-btn' id='comm-dismiss' onclick=hide('showpop')>OK</button>");
		show('showpop');
	}
	//offline payment request function
	function offlinePayment() {
		count1=0;
		hide('customerform');
		$("#customerform").empty();
		hide('showpop');
		$('#showpop').empty();
		$('#showpop1').empty();
		var manualPaymentuserData = JSON.parse(getItem("renewaldetails"));
		for (var i = 0; i < manualPaymentuserData.insuredResponseDOs.length; i++) {
			if (manualPaymentuserData.insuredResponseDOs[i].grosspremium != 0) {
			} else {
				count1 = count1 + 1;
			}
		}
		if ((manualPaymentuserData.grosspremium == 0 && count1 == manualPaymentuserData.insuredResponseDOs.length)
				|| (manualPaymentuserData.grosspremium == 0
						&& count1 == manualPaymentuserData.insuredResponseDOs.length && manualPaymentuserData.data.d2recordsDos != null)) {
			backbuttonclk();
		} else {
			var renewaldetails = JSON.parse(getItem("renewaldetails"));
			var policy_no = renewaldetails.policyno;
			var request = {
				policyno : policy_no,
				agentid : getItem("agentcode"),
				renwalpolicyid:getItem("renwalpolicyid")
			};
			Apiservicecall(function(result) {
				if (result.status == 1) {
					var response = result.response;
					if (response.status == 1) {
						showAlert(response.message, true);
					} else {
						showAlert(response.message, false);
					}
				}
			}, manualPayment, request);
		}
	}
	//net and gross display offline payment
	function offlinepopupshow(message) {
		var manualPaymentuserData = JSON.parse(getItem("renewaldetails"));
		var lapsedstatus = getItem("lapsedstatus");
		$('#showpop').empty();
		netPremiumPayable
		var gross_premium = currencyformat(
				manualPaymentuserData.premiumPayable, "");
		var net_premium = currencyformat(
				manualPaymentuserData.netPremiumPayable, "");
		if (lapsedstatus == 'Y')
			$('#showpop').append("<div class='big-div'><h5>Message</h5> <p>Gross Premium :&nbsp;RM&nbsp;"
									+ gross_premium
									+ "<br>Net Premium &nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;RM&nbsp;"
									+ net_premium
									+ "</p><p id='para_messageid'>"
									+ message
									+ "</p><h6 style='color:red;font-weight: 400;font-size: 93%;'>"
									+ "Note: Payment must be made to GENERALI by <span  style='font-weight: 700;'>"
									+ manualPaymentuserData.overdueDate
									+ "</span> date for policy to be renewed."
									+ "</h6><button class='popup-btn' id='btn_manPaymentReq' onclick=ReqManualpayment();>OK</button><button class='popup-btn' id='comm-dismiss' onclick='onDismiss(false)'>CANCEL</button></div>");
		else
			$('#showpop').append("<div class='big-div'><h5>Message</h5><p>Gross Premium :&nbsp;RM&nbsp;"
									+ gross_premium
									+ "</p><p>Net Premium &nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;RM&nbsp;"
									+ net_premium
									+ "</p><p id='para_messageid'>"
									+ message
									+ "</p><button class='popup-btn' id='btn_manPaymentReq' onclick=ReqManualpayment();>OK</button><button class='popup-btn' id='comm-dismiss' onclick='onDismiss(false)'>CANCEL</button></div>");
		show('showpop');
	}

	//respective back page redirect
	function backbuttonclk() {
		hide('showpop');
		if(checkOnline()){
		$('.loading-mask').removeClass('stop-loading')
		if (isenquiry) {
			window.location.href = 'Enquiry-detail.html';
		} else {
			window.location.href = 'Renewal-info.html';
		}
		$('.loading-mask').addClass('stop-loading');
		}
	}
	//backbutton function
	document.addEventListener("backbutton", onBackKeyDown, false);
	function onBackKeyDown() {
		backbuttonclk();
		}
</script>
</head>
<body>
	<section class="axa-section mobile-wrapper">
		<div class="page-content" id="main-stack">
			<div class="axa-nav navbar" data-collapse="all"
				data-animation="over-left" data-duration="400" data-contain="1"
				data-easing="ease-out-quint" data-no-scroll="1">
				<div class="axa-container">
					<nav class="axa-nav-menu nav-menu" role="navigation">
						<a class="nav-menu-header" id="navi_welcomepage" onclick = "redirectionpage('dashboard.html');">
							<div class="logo">
								<img alt="navlogo_img_icon" src="images/nav-logo.svg">
							</div>
						</a>
						<div id="health_div_header">
							<a class="axa-clearfix axa-inline-block nav-menu-link">
							  <div class="icon-list-menu">
								<div class="icon ion-ios-pulse"></div>
							  </div>
							  <div class="nav-menu-titles">Health</div>
							</a>
							<a class="axa-clearfix axa-inline-block nav-menu-link1" id="navi_renewalinfo" onclick = "redirectionpage('welcome.html');">
							  <div class="sub-icon-list-menu">
								<div class="icon ion-clipboard"></div>
							  </div>
							  <div class="nav-menu-titles">Renewal Info</div>
							</a>
							<a class="axa-clearfix axa-inline-block nav-menu-link1" id="navi_enquiry" onclick = "redirectionpage('Enquiry.html');">
							  <div class="sub-icon-list-menu">
								<div class="icon ion-ios-help-outline"></div>
							  </div>
							  <div class="nav-menu-titles">Enquiry</div>
							</a>
						  </div>
						  <div id="motor_div_header">
							<a class="axa-clearfix axa-inline-block nav-menu-link">
							  <div class="icon-list-menu">
								<div class="icon ion-android-car"></div>
							  </div>
							  <div class="nav-menu-titles">Motor</div>
							</a>
							<a class="axa-clearfix axa-inline-block nav-menu-link1" id="navi_vehicledet" onclick = "redirectionpage('vehicle-details.html');">
							  <div class="sub-icon-list-menu">
								<div class="icon ion-ios-calculator-outline"></div>
							  </div>
							  <div class="nav-menu-titles">New Quote</div>
							</a>
							<a class="axa-clearfix axa-inline-block nav-menu-link1" id="navi_retrivequote" onclick = "redirectionpage('retrieve-quote.html');">
							  <div class="sub-icon-list-menu">
								<div class="icon ion-document"></div>
							  </div>
							  <div class="nav-menu-titles">Retrieve Quote</div>
							</a>
							</div>
							<a class="axa-clearfix axa-inline-block nav-menu-link" id="navi_agenttools" onclick = "redirectionpage('Contact-us.html');">
							  <div class="icon-list-menu">
								<div class="icon ion-ios-telephone-outline"></div>
							  </div>
							  <div class="nav-menu-titles">Agent Tools</div>
							</a>
							<a class="axa-clearfix axa-inline-block nav-menu-link" id="switchuserclass" onclick="switchuser()">
							  <div class="icon-list-menu">
								<div class="icon ion-ios-personadd-outline"></div>
							  </div>
							  <div class="nav-menu-titles">Switch Agent</div>
							</a>
							<a class="axa-clearfix axa-inline-block nav-menu-link" id="nav_logoutid" onclick="exitAlert()">
							  <div class="icon-list-menu">
								<div class="icon ion-log-out"></div>
							  </div>
							  <div class="nav-menu-titles">Logout</div>
							</a>
						<div class="separator-bottom"></div>
						<div class="separator-bottom"></div>
						<div class="separator-bottom"></div>
					</nav>
					<div class="wrapper-mask" data-ix="menu-mask"></div>
					<div class="left-back" id="menu_icon" data-ix="hide-navbar-icons"
						onclick="backbuttonclk();">
						<a onclick="backbuttonclk();" class=" back-icon">
							<div class="left-arrow"><img alt="left_img_icon" class="left-icon" src="images/left-arrow.svg" /></div>
						</a>
					</div>
					<div class="icon-logo-rgt"><img alt="navlogo4_img_icon" src="images/logo-4.svg"></div><div class="navbar-title-bck" id="navbartitle">Renewal Details</div>
					<div class="home-menuicon">
						<a id="icon_home" onclick = "redirectionpage('dashboard.html');"><img alt="homelogo_img_icon" class="hmeicon" src="images/home1.svg" /></a>
						<div class="axa-nav-button navbar-button left" id="menu-button"
							data-ix="hide-navbar-icons">
							<div class="navbar-button-icon home-icon">
								<div class="bar-home-icon"></div>
								<div class="bar-home-icon"></div>
								<div class="bar-home-icon"></div>
							</div>
						</div>
					</div>
				</div>
			</div>
			<div class="inner-body">
				<div class="hero-image" id="hero-image">
					<div class="hero-image-title"></div>
					<div class="hero-image-img"></div>
				</div>
				<div class="axa-wrapper">
					<div class="r-heading-top">
						<div>
							<div class="rn-left-sec">
								<span class="r-text axa-l">Policy No.</span>
							</div>
							<div class="rn-right-sec">
								<span class="r-text" id="policyno">-</span>
							</div>
							<hr>
						</div>
						<div>
							<div class="rn-left-sec">
								<span class="r-text axa-l">Policyholder</span>
							</div>
							<div class="rn-right-sec">
								<span class="r-text" id="policyholdername">-</span>
							</div>
							<hr>
						</div>
						<div>
							<div class="rn-left-sec">
								<span class="r-text axa-l">Expiry Date</span>
							</div>
							<div class="rn-right-sec">
								<span class="r-text" id="policyexpirydate">-</span>
							</div>
						</div>
					</div>
					<div id="detailsdiv">
						<div class="r-detail axa-content-sec-rn" style="clear: both;">
							<div class="row">
								<div class="axa-col-8 no-padding">
									<h5 id="productname">Smartcare Optimum - Individual</h5>
								</div>
								<div class="axa-col-4" style="text-align: right;">
									<a href="#" class="expand" id="expandall">Expand All[+]</a> <a
										href="#" class="collapse" id="collapseall">Collapse All[-]</a>
								</div>
								<div class = "axa-clearfix"></div>
							</div>
							<div class="accordion" id="list">
								<div class="heading">
									<div class="row">
										<div class="axa-col-6 no-padding">
											<span class="heading-content">Insured Name</span>
										</div>
										<div class="axa-col-6 no-padding txt-sec-r">
											<span class="heading-content">Gross premium (RM)</span>
										</div>
										<div class = "axa-clearfix"></div>
									</div>
								</div>
							</div>
						</div>
						<div class="axa-col-12 mg-tp text-centered" id="sendEmailDiv" style="display:none;">
						<button class="axa-btn" id="sendEmailId" onclick="sendD2Mail();" ><i class="icon ion-email" style="font-size: 140%;"></i> Email Form </button>
					</div>
						<div class="row mg-tp" id="accordian_netPremium">
							<div class="accordion1">
								<a class="accordion1 acc-heading pd"> <span class="rn-dt-pp-left">Premium
										Payable (RM)</span>
									<div class="acc-r rn-dt-pp-right" id="netPremiumPayable">-</div>
								</a>
								<div class="panel">
									<div class="pp-1">
										<div class="axa-col-7">
											<span>Total Gross Premium</span>
										</div>
										<div class="axa-col-5">
											<span class="pp-1-right" id="grosspremium">1,254.00</span>
										</div>
									</div>
									<div class="pp-1" id="lessdiscount">
										<div class="axa-col-7">
											<span>Less Discount</span>
										</div>
										<div class="axa-col-5">
											<span class="pp-1-right" id="discount">-188.10</span>
										</div>
									</div>
									<div class="pp-1">
										<div class="axa-col-7">
											<span>Stamp Duty</span>
										</div>
										<div class="axa-col-5">
											<span class="pp-1-right" id="stampduty">10.00</span>
										</div>
									</div>
									<div class="pp-1">
										<div class="axa-col-7">
											<span id="gstperval"></span><br/>
											<span id="gstperval3"></span>
										</div>
										<div class="axa-col-5">
											<span class="pp-1-right" id="gstpercent">63.95</span>
										</div>
									</div>
								</div>
							</div>
						</div>
						<div class="row mg-tp" id="netpremiumaccordion" hidden="true">
							<div class='accordion2'>
								<a class="accordion2 acc-heading1 pd"> <span>Net
										Premium Payable</span>
								</a>
								<div class='panel'>
									<div class="pp-1">
										<div class="axa-col-7">
											<span>Net Premium (RM)</span>
										</div>
										<div class="axa-col-5">
											<span class="pp-1-right" id="netPremiumPay">1,254.00</span>
										</div>
									</div>
								</div>
							</div>
						</div>
						<div class="axa-col-12 mg-tp text-centered" id="divrenew">
							<h5 class="noteOfflinepay" id="contracttypenotallowed" hidden="false">
							</h5>
							<input type=button class="axa-btn" onclick="ManualPaymentAlert()" value="PAY OFFLINE/IPP" id="butoffline" />
							<input type=button class="axa-btn" onclick="renew()" value="PAY ONLINE" id="butrenew" />
							<input type="button" class="axa-btn" onclick="customerPay()" value="PAY BY CUSTOMER" id="custpay" />
						</div>
					</div>
				</div>
			</div>
		</div>
		<div class="page-content loading-mask" id="new-stack">
			<div class="loading-icon">
				<div class="navbar-button-icon icon ion-load-d"></div>
			</div>
		</div>
		<div class="shadow-layer"></div>
		<div id="showpop" class="popup"></div>
		<div id="showpop1" class="popup"></div>
		<div id="customerform" class="popup"></div>

	</section>
	<script type="text/javascript" src="js/jquery.min.js"></script>
	<script type="text/javascript" src="js/framework.js"></script>
	<script>
		$(document).ready(function() {
			$(window).scroll(function() {
				var scroll = $(window).scrollTop();
				if (scroll > 10) {
					$(".axa-nav").css("background", "#C21B17");
				} else
					$(".axa-nav").css("background", "transparent");
			})
		});
		//logout popup
		function exitAlert() {
			if(checkOnline()){
			$('#showpop').empty();
			$('#showpop')
					.append(
							"<h5>Message</h5><p>Are you sure want to logout?</p><button class='popup-btn' id='btn_logout' onclick='logout()'>OK</button><button class='popup-btn' id='comm-dismiss' onclick=hide('showpop')>CANCEL</button>");
			show('showpop');
		}
		}

		//accordian function
		function accordiancall() {
			var statusidForOffline = getItem("policytype");
			/** Expand and Collapse Start */
			var acc = document.getElementsByClassName("accordion");
			var i;
			for (i = 0; i < acc.length; i++) {
				acc[i].onclick = function() {
					var panel = this.nextElementSibling;
					if (panel != null) {
						this.classList.toggle("active");
						if (panel.style.display === "block") {
							panel.style.display = "none";
						} else {
							panel.style.display = "block";
						}
					}
					var expandAll = document.getElementById("expandall");
					var collapseall = document.getElementById("collapseall");
					var status = true;
					for (i = 0; i < acc.length; i++) {
						var panel = acc[i].nextElementSibling;
						if (panel != null
								&& (panel.style.display === "none" || panel.style.display === "")) {
							$('#expandall').attr('style', 'display: block');
							$('#collapseall').attr('style', 'display: none');
							status = false;
						}
					}
					for (i = 0; i < acc1.length; i++) {
						var panel = acc1[i].nextElementSibling;
						if (panel != null
								&& (panel.style.display === "none" || panel.style.display === "")) {
							$('#expandall').attr('style', 'display: block');
							$('#collapseall').attr('style', 'display: none');
							status = false;
						}
					}
					if (statusidForOffline == 5 || statusidForOffline == 15) {
						for (i = 0; i < acc2.length; i++) {
							var panel = acc2[i].nextElementSibling;
							if (panel != null
									&& (panel.style.display === "none" || panel.style.display === "")) {
								$('#expandall').attr('style', 'display: block');
								$('#collapseall')
										.attr('style', 'display: none');
								status = false;
							}
						}
					}
					if (status == true) {
						$('#expandall').attr('style', 'display: none');
						$('#collapseall').attr('style', 'display: block');
					}
				}
			}
			var acc1 = document.getElementsByClassName("accordion1");
			var j;
			for (j = 0; j < acc1.length; j++) {
				acc1[j].onclick = function() {
					var panel = this.nextElementSibling;
					if (panel != null) {
						this.classList.toggle("active");
						if (panel.style.display === "block") {
							panel.style.display = "none";
						} else {
							panel.style.display = "block";
							var positionAccordian = $(".accordion1").position();
							window.scrollTo(positionAccordian.left,positionAccordian.top);
						}
					}
					var expandAll = document.getElementById("expandall");
					var collapseall = document.getElementById("collapseall");
					var status = true;
					for (i = 0; i < acc.length; i++) {
						var panel = acc[i].nextElementSibling;
						if (panel != null
								&& (panel.style.display === "none" || panel.style.display === "")) {
							$('#expandall').attr('style', 'display: block');
							$('#collapseall').attr('style', 'display: none');
							status = false;
						}
					}
					for (j = 0; j < acc1.length; j++) {
						var panel = acc1[j].nextElementSibling;
						if (panel != null
								&& (panel.style.display === "none" || panel.style.display === "")) {
							$('#expandall').attr('style', 'display: block');
							$('#collapseall').attr('style', 'display: none');
							status = false;
						}
					}
					if (statusidForOffline == 5 || statusidForOffline == 15) {
						for (j = 0; j < acc2.length; j++) {
							var panel = acc2[j].nextElementSibling;
							if (panel != null
									&& (panel.style.display === "none" || panel.style.display === "")) {
								$('#expandall').attr('style', 'display: block');
								$('#collapseall')
										.attr('style', 'display: none');
								status = false;
							}
						}
					}
					if (status == true) {
						$('#expandall').attr('style', 'display: none');
						$('#collapseall').attr('style', 'display: block');
					}
				}
			}
			if (statusidForOffline == 5 || statusidForOffline == 15) {
				var acc2 = document.getElementsByClassName("accordion2");
				var i;
				for (i = 0; i < acc2.length; i++) {
					acc2[i].onclick = function() {
						var panel = this.nextElementSibling;
						if (panel != null) {
							this.classList.toggle("active");
							if (panel.style.display === "block") {
								panel.style.display = "none";
							} else {
								panel.style.display = "block";
							}
						}
						var expandAll = document.getElementById("expandall");
						var collapseall = document
								.getElementById("collapseall");
						var status = true;
						for (i = 0; i < acc.length; i++) {
							var panel = acc[i].nextElementSibling;
							if (panel != null
									&& (panel.style.display === "none" || panel.style.display === "")) {
								$('#expandall').attr('style', 'display: block');
								$('#collapseall')
										.attr('style', 'display: none');
								status = false;
							}
						}
						for (i = 0; i < acc1.length; i++) {
							var panel = acc1[i].nextElementSibling;
							if (panel != null
									&& (panel.style.display === "none" || panel.style.display === "")) {
								$('#expandall').attr('style', 'display: block');
								$('#collapseall')
										.attr('style', 'display: none');
								status = false;
							}
						}
						for (i = 0; i < acc2.length; i++) {
							var panel = acc2[i].nextElementSibling;
							if (panel != null
									&& (panel.style.display === "none" || panel.style.display === "")) {
								$('#expandall').attr('style', 'display: block');
								$('#collapseall')
										.attr('style', 'display: none');
								status = false;
							}
						}
						for (i = 0; i < acc2.length; i++) {
							var panel = acc2[i].nextElementSibling;
							if (panel != null
									&& (panel.style.display === "none" || panel.style.display === "")) {
								$('#expandall').attr('style', 'display: block');
								$('#collapseall')
										.attr('style', 'display: none');
								status = false;
							}
						}
						if (status == true) {
							$('#expandall').attr('style', 'display: none');
							$('#collapseall').attr('style', 'display: block');
						}
					}
				}
			}
			/** Expand and Collapse End */
			/** Expand All */
			var expandAll = document.getElementById("expandall");
			expandAll.onclick = function() {
				var acc = document.getElementsByClassName("accordion");
				var acc1 = document.getElementsByClassName("accordion1");
				var i;
				for (i = 0; i < acc.length; i++) {
					var panel = acc[i].nextElementSibling;
					if (panel != null
							&& (panel.style.display === "none" || panel.style.display === "")) {
						acc[i].classList.toggle("active");
						panel.style.display = "block";
						$('#expandall').attr('style', 'display: none');
						$('#collapseall').attr('style', 'display: block');
					}
				}
				for (i = 0; i < acc1.length; i++) {
					var panel = acc1[i].nextElementSibling;
					if (panel != null
							&& (panel.style.display === "none" || panel.style.display === "")) {
						acc1[i].classList.toggle("active");
						panel.style.display = "block";
						$('#expandall').attr('style', 'display: none');
						$('#collapseall').attr('style', 'display: block');
					}
				}
				if (statusidForOffline == 5 || statusidForOffline == 15) {
					for (i = 0; i < acc2.length; i++) {
						var panel = acc2[i].nextElementSibling;
						if (panel != null
								&& (panel.style.display === "none" || panel.style.display === "")) {
							acc2[i].classList.toggle("active");
							panel.style.display = "block";
							$('#expandall').attr('style', 'display: none');
							$('#collapseall').attr('style', 'display: block');
						}
					}
				}
			};
			/** Expand All End*/
			/** Collapse All Start*/
			var collapseall = document.getElementById("collapseall");
			collapseall.onclick = function() {
				var acc = document.getElementsByClassName("accordion");
				var acc1 = document.getElementsByClassName("accordion1");
				var i;
				for (i = 0; i < acc.length; i++) {
					var panel = acc[i].nextElementSibling;
					if (panel != null
							&& (panel.style.display === "block" || panel.style.display === "")) {
						acc[i].classList.toggle("active");
						panel.style.display = "none";
						$('#expandall').attr('style', 'display: block');
						$('#collapseall').attr('style', 'display: none');
					}
				}
				for (i = 0; i < acc1.length; i++) {
					var panel = acc1[i].nextElementSibling;
					if (panel != null
							&& (panel.style.display === "block" || panel.style.display === "")) {
						acc1[i].classList.toggle("active");
						panel.style.display = "none";
						$('#expandall').attr('style', 'display: block');
						$('#collapseall').attr('style', 'display: none');
					}
				}
				if (statusidForOffline == 5 || statusidForOffline == 15) {
					for (i = 0; i < acc2.length; i++) {
						var panel = acc2[i].nextElementSibling;
						if (panel != null
								&& (panel.style.display === "block" || panel.style.display === "")) {
							acc2[i].classList.toggle("active");
							panel.style.display = "none";
							$('#expandall').attr('style', 'display: block');
							$('#collapseall').attr('style', 'display: none');
						}
					}
				}
			};
			/** Collapse All End*/
		}
	</script>
</body>
</html>
