<script>
		var isback = false;
		var addonList = [];
		var retrivequoteJSON;
		var policyListCopy = [];
		var additionalcoverageretriveadded = false;
		var additionalcoverageaddDetails = false;
		var pagenumberCount = 1;
		var pagecountstop = false;
		var isretrive2 = "N";
		var isaddalertocc = false;
		var canbackproceed = false;
		var ncdpercentageValueToPremium = 0;
		var ncdamoluntValueToPremium = 0;
		var nvicnumber = "";
		var stateloaded = false;
		var ncdClearBucket = false;
		var statecodesetOnce = true;
		var pdfBaseData;
		var quotenumbersaveQuote;
		var oldValueForAdditionalnamedcount = 0;
		var editQuoteFormalReq;
		var ncdFormalReq;
		var ncdRetriveQuoteReq;
		var isNCDRecordChanged = "N";
		var isPremiumCallOccured ="N";
		var ispremiumRecordChanged = "N";
		var isOnclickPiam = "N";
		var savedOrPremiumCalled = false;
		var isRetriveQuoteRecord = false;
		var isRetriveCanProceedNCD = false;
		var isRetriveCanProceedPremium = false;
		var retriveIdAdditionalNamed = false;
		var isSavedQuoteSuccess = false;
		var isNcdCallProceedSucc = false;
		var isdropdownclick = "Y";
		var isdropdownNotClick = "N";
		</script>
		<!DOCTYPE html>
		<html>
		<head>
		  <meta charset="utf-8">
		  <title>Vehicle Details</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="VehicleDetCommonValidation.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" href="./css/bootstrap-material-datetimepicker.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">
		  <link rel="stylesheet" type="text/css" href="css/smk-accordion.css">
		  <link rel="stylesheet" type="text/css" href="css/ion.rangeSlider.css">
		  <link rel="stylesheet" type="text/css" href="css/ion.rangeSlider.skinFlat.css">
		  <script type="text/javascript" charset="utf-8" src="cordova.js"></script>
		  <script type="text/javascript" charset="UTF-8" src="js/axa-popup.js"></script>
		  <script src="js/webfont.js"></script>
		  <script>
		  //web font loading
		  WebFont.load({
			google: {
			  families: ["Arial:400,700"]
			}
		  });

		  </script>
		<style>
		.axa-content-sec {
			padding: 10px 0px 1px;
		}
		.padding {
			padding-right: 5px;
			padding-left: 5px;
		}
		.home-menuicon {
			position: relative;
			left: 0px;
		}
		.navbar-title-Pay {
			width: auto;
		}

		.popup .popup-Quote {
			word-break: break-all;
			line-height: 21px;
		}

		@media (max-width: 2000px) and (min-width: 320px)
		  {
		  .navbar-title {
			padding-top: 0px;
		   }
			.axa-nav-overlay{
				position: fixed;
			}
		 }

		  </style>
		  <script type="text/javascript">
		  //window onload
		  window.onload = function what() {
			isback = true;
			$('#findmyveh_accordian').attr( "style", "display: none !important;" );
			p2AccordianOnLoadNonVisible();
			$('#findvehDet_acccont').attr("style","display:none");
			var retriveQuoteJson =  getItem("retrivequoteclicked");
			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 */
			var request = { agentid: getItem("agentcode") };
			Apiservicecall(function(result)
			{
				if(result.status==1)
				{
					if(!isEmpty(result.response)){
						var response=result.response;
						console.log(response);
						//garage list
						for(var i=0;i<response.data[0].length;i++){
							$('#sel_garagelist').append( "<option value="+response.data[0][i].masteDataCode+">"+response.data[0][i].masterDataDesc.toUpperCase()+"</option>");
						}
						//safety list
						for(var i=0;i<response.data[1].length;i++){
							$('#sel_safetylist').append( "<option value="+response.data[1][i].masteDataCode+">"+response.data[1][i].masterDataDesc.toUpperCase()+"</option>");
						}
						//region list
						for(var i=0;i<response.data[3].length;i++){
							$('#inp_policyholderregion').append( "<option value="+response.data[3][i].masteDataCode+">"+response.data[3][i].masterDataDesc.toUpperCase()+"</option>");
						}
						//occupation list
						for(var i=0;i<response.data[4].length;i++){
							$('#inp_policyholderocc').append( "<option value="+response.data[4][i].masteDataCode+">"+response.data[4][i].masterDataDesc.toUpperCase()+"</option>");
						}
						localStorage.setItem("occupationListJSON",JSON.stringify(response.data[4]));
						//anti theft list sel_antiteftlist
						for(var i=0;i<response.data[5].length;i++){
							$('#sel_antiteftlist').append( "<option value="+response.data[5][i].masteDataCode+">"+response.data[5][i].masterDataDesc.toUpperCase()+"</option>");
						}
						// gender
						for(var i=0;i<response.data[8].length;i++){
							if(i==0)
							$("#div_gender").append("<div class='axa-radio axa-clearfix radio-button'><div class='radio-bullet-replacement checked' id='"+response.data[8][i].masteDataCode+"Gender' name='button_replacement1'></div><input class='axa-radio-input radio-bullet' id='Gender"+response.data[8][i].masteDataCode+"' type='radio' name='Gender' value='"+response.data[8][i].masteDataCode+"' data-name='Gender' onclick='radiobuttonclick(this,1);'  checked><label class='axa-form-label' for='Gender"+response.data[8][i].masteDataCode+"'>"+response.data[8][i].masterDataDesc+"</label></div>");
							else
							$("#div_gender").append("<div class='axa-radio axa-clearfix radio-button'><div class='radio-bullet-replacement'  id='"+response.data[8][i].masteDataCode+"Gender' name='button_replacement1'></div><input class='axa-radio-input radio-bullet' id='Gender"+response.data[8][i].masteDataCode+"' type='radio' name='Gender' value='"+response.data[8][i].masteDataCode+"' data-name='Gender' onclick='radiobuttonclick(this,1);'  ><label class='axa-form-label' for='Gender"+response.data[8][i].masteDataCode+"'>"+response.data[8][i].masterDataDesc+"</label></div>");
						}
						setItem("genderlist",JSON.stringify(response.data[8]));
						// martial status
						for(var i=0;i<response.data[7].length;i++){
							if(i==0)
							$("#div_martialStatus").append("<div class='axa-radio axa-clearfix radio-button'><div class='radio-bullet-replacement checked' id='"+response.data[7][i].masteDataCode+"MartialStatus' name='button_replacement2'></div><input class='axa-radio-input radio-bullet' id='MartialStatus"+response.data[7][i].masteDataCode+"' type='radio' name='MartialStatus' value='"+response.data[7][i].masteDataCode+"' data-name='MartialStatus' onclick='radiobuttonclick(this,2);' checked><label class='axa-form-label' for='MartialStatus"+response.data[7][i].masteDataCode+"'>"+response.data[7][i].masterDataDesc+"</label></div>");
							else
							$("#div_martialStatus").append("<div class='axa-radio axa-clearfix radio-button'><div class='radio-bullet-replacement'  id='"+response.data[7][i].masteDataCode+"MartialStatus' name='button_replacement2'></div><input class='axa-radio-input radio-bullet' id='MartialStatus"+response.data[7][i].masteDataCode+"' type='radio' name='MartialStatus' value='"+response.data[7][i].masteDataCode+"' data-name='MartialStatus' onclick='radiobuttonclick(this,2);'><label class='axa-form-label' for='MartialStatus"+response.data[7][i].masteDataCode+"'>"+response.data[7][i].masterDataDesc+"</label></div>");
						}
						setItem("martialstatusList",JSON.stringify(response.data[7]));
						// vehicle type
						for (i = 0; i < response.data[9].length; i++)
						{
								$('#vehtype_select').append( "<option value="+response.data[9][i].masteDataCode+">"+response.data[9][i].masterDataDesc.toUpperCase()+"</option>");
						}
						// vehicle body
						for (i = 0; i < response.data[10].length; i++)
						{
								$('#inp_vehiclebody').append( "<option value="+response.data[10][i].masteDataCode+">"+response.data[10][i].masterDataDesc.toUpperCase()+"</option>");
						}
						$("#page1Li").addClass("is-active");
						if(!isEmpty(retriveQuoteJson))
						{
							ncdFormalReq = {agentid: getItem("agentcode") , bizregno:"",newic:"",oldic : "" ,passportno:"",regno: "", cncondition: "", regioncode: ""}
							isOnclickPiam = "Y";
							isRetriveQuoteRecord = true;
							document.getElementById("navbartitle").innerHTML = "";
							document.getElementById("navbartitle").innerHTML = "Retrieve Quote";
							console.log(retriveQuoteJson);
							retrivequoteJSON = JSON.parse(retriveQuoteJson);
							document.getElementById("vehicle_regnum_inp").value=retrivequoteJSON.vehicleregistno;
							var ncdFormalTempM = { regno: retrivequoteJSON.vehicleregistno};
							ncdFormalReq =  objectmerge(ncdFormalReq,ncdFormalTempM);
							$("#vehtype_select").val(retrivequoteJSON.vehicletypecode).attr("selected","selected");

							if(!isEmpty(retrivequoteJSON.newicno)){
								$('input[name=IndentifyType]').attr('checked',false);
								commonvehicledetailradio();
								$("input:radio[name=IndentifyType][value ='newIC']").attr('checked', true);
								$("#newIcDiv").addClass("checked");
								$("#div_BusOrPasBlock").addClass("p2_displaynone");
								$("#div_OldICBlock").addClass("p2_displaynone");
								$("#div_NewICBlock").removeClass("p2_displaynone");
								var newicarray = retrivequoteJSON.newicno.split("-");
								document.getElementById("inp_newIcNumber").value = newicarray[0]+""+newicarray[1]+""+newicarray[2];
								var ncdFormalTempM = { newic: retrivequoteJSON.newicno};
								ncdFormalReq =  objectmerge(ncdFormalReq,ncdFormalTempM);
							}
							else if(!isEmpty(retrivequoteJSON.oldicno)){
								$('input[name=IndentifyType]').attr('checked',false);
								commonvehicledetailradio();
								$("input:radio[name=IndentifyType][value ='oldIC']").attr('checked', true);
								$("#oldIcDiv").addClass("checked");
								$("#div_NewICBlock").addClass("p2_displaynone");
								$("#div_BusOrPasBlock").addClass("p2_displaynone");
								$("#div_OldICBlock").removeClass("p2_displaynone");
								dateofbirthreadonlyremove();
								document.getElementById("oldicnumber_inp").value=retrivequoteJSON.oldicno;
								var ncdFormalTempM = { oldic: retrivequoteJSON.oldicno};
								ncdFormalReq =  objectmerge(ncdFormalReq,ncdFormalTempM);
							}
							else if(!isEmpty(retrivequoteJSON.passportno)){
								$('input[name=IndentifyType]').attr('checked',false);
								commonvehicledetailradio();
								$("input:radio[name=IndentifyType][value ='passport']").attr('checked', true);
								$("#passportnumDiv").addClass("checked");
								$("#div_NewICBlock").addClass("p2_displaynone");
								$("#div_OldICBlock").addClass("p2_displaynone");
								$("#div_BusOrPasBlock").removeClass("p2_displaynone");
								dateofbirthreadonlyremove();
								document.getElementById("newbusnessorpass_inp").value=retrivequoteJSON.passportno;
								var ncdFormalTempM = { passportno: retrivequoteJSON.passportno};
								ncdFormalReq =  objectmerge(ncdFormalReq,ncdFormalTempM);
							}
							else if(!isEmpty(retrivequoteJSON.businessregno)){
								$('input[name=IndentifyType]').attr('checked',false);
								commonvehicledetailradio();
								$("input:radio[name=IndentifyType][value ='business']").attr('checked', true);
								$("#businessnumDiv").addClass("checked");
								$("#div_NewICBlock").addClass("p2_displaynone");
								$("#div_OldICBlock").addClass("p2_displaynone");
								$("#div_BusOrPasBlock").removeClass("p2_displaynone");
								document.getElementById("newbusnessorpass_inp").value=retrivequoteJSON.businessregno;
								var ncdFormalTempM = { bizregno: retrivequoteJSON.businessregno};
								ncdFormalReq =  objectmerge(ncdFormalReq,ncdFormalTempM);
							}
							else{
								// Nothing value is available
							}
							if(!isEmpty(retrivequoteJSON.ncdperc)){
								ncdpercentageValueToPremium = retrivequoteJSON.ncdperc;
								document.getElementById("inp_ncdpercentage").value = currencyformat(retrivequoteJSON.ncdperc,"")+" %";
							}
							else{
								ncdpercentageValueToPremium = 0;
								document.getElementById("inp_ncdpercentage").value = "0.0 %";
							}
							if(!isEmpty(retrivequoteJSON.ncdamount)){
								ncdamoluntValueToPremium = retrivequoteJSON.ncdamount;
							}
							else{
								ncdamoluntValueToPremium = 0;
							}

							$("#inp_policyholderregion").val(retrivequoteJSON.regioncode).attr("selected","selected");
							var ncdFormalTempM = { regioncode: retrivequoteJSON.regioncode};
							ncdFormalReq =  objectmerge(ncdFormalReq,ncdFormalTempM);
							document.getElementById("inp_makemodelyear").value=retrivequoteJSON.vehiclemakedesc;
							document.getElementById("inp_seatcapacity").value=retrivequoteJSON.seatcapacity;
							document.getElementById("inp_enginecapacity").value=retrivequoteJSON.enginecapacity;
							document.getElementById("inp_manufactureryear").value=retrivequoteJSON.manufactureyear;
							document.getElementById("inp_chassisno").value=retrivequoteJSON.chassisno;
							document.getElementById("inp_enginenumber").value=retrivequoteJSON.engineno;
							setItem("vehiclemakecode", retrivequoteJSON.vehiclemakecode);
							setItem("vehiclemodelcode", retrivequoteJSON.vehiclemodelcode);
							setItem("vehiclebodydesc", retrivequoteJSON.vehiclebodydesc);
							setItem("vehiclebodycode", retrivequoteJSON.vehiclebodycode);
							if(!isEmpty(retrivequoteJSON.vehiclebodycode)){
								$("#inp_vehiclebody").val(retrivequoteJSON.vehiclebodycode).attr("selected","selected");
							}
							else{
								// nothing should be done
							}
							setItem("clientIdNCDRes", retrivequoteJSON.clientid);
							document.getElementById("inp_policyholdername").value=retrivequoteJSON.insuredname;
							document.getElementById("inp_policyholderadd1").value=retrivequoteJSON.address1;
							document.getElementById("inp_policyholderadd2").value=retrivequoteJSON.address2;
							document.getElementById("inp_policyholderpostal").value=retrivequoteJSON.postcode;
							if(!isEmpty(retrivequoteJSON.occupationcode)){
								$("#inp_policyholderocc").val(retrivequoteJSON.occupationcode).attr("selected","selected");
							}
							else{
								$("#inp_policyholderocc").val(0).attr("selected","selected");
							}

							if(retrivequoteJSON.cncondition != "") {
								$('input[name=InsurType]').attr('checked',false);
								$("#InsurTypeNewDiv").removeClass("checked");
								$("#InsurTyperegisteredDiv").removeClass("checked");
								if(retrivequoteJSON.cncondition == "n"){
									$("input:radio[name=InsurType][value =new]").attr('checked', true);
									$("#InsurTypeNewDiv").addClass("checked");
									registrationtype = "n";
									$("#div_chassisnumbersel").css("display","none");
									$("#div_enginenumbersel").css("display","none");
									setItem("policyExpiryDate","");
									var ncdFormalTempM = { cncondition: retrivequoteJSON.cncondition};
									ncdFormalReq =  objectmerge(ncdFormalReq,ncdFormalTempM);
								}
								else{
									$("input:radio[name=InsurType][value =registered]").attr('checked', true);
									$("#InsurTyperegisteredDiv").addClass("checked");
									registrationtype = "u";
									$("#div_chassisnumbersel").css("display","block");
									$("#div_enginenumbersel").css("display","block");
									setItem("policyExpiryDate",JSON.parse(retriveQuoteJson).currentpolexpirydate);
									var ncdFormalTempM = { cncondition: retrivequoteJSON.cncondition};
									ncdFormalReq =  objectmerge(ncdFormalReq,ncdFormalTempM);
								}
							}
							// div_gender
							if(retrivequoteJSON.gendercode != "") {
								$('input[name=Gender]').attr('checked',false);
								var genderJSONLS = JSON.parse(getItem("genderlist"))
								commonpolicyholderradio(genderJSONLS, "Gender");
								$("input:radio[name=Gender][value ="+retrivequoteJSON.gendercode+"]").attr('checked', true);
								$("#"+retrivequoteJSON.gendercode+"Gender").addClass("checked");
							}
							//martial status
							if(retrivequoteJSON.maritalstatuscode != "") {
								$('input[name=MartialStatus]').attr('checked',false);
								var martialstatusJSONLS = JSON.parse(getItem("martialstatusList"))
								commonpolicyholderradio(martialstatusJSONLS, "MartialStatus");
								$("input:radio[name=MartialStatus][value ="+retrivequoteJSON.maritalstatuscode+"]").attr('checked', true);
								$("#"+retrivequoteJSON.maritalstatuscode+"MartialStatus").addClass("checked");
							}
							$('input[name=policyHolderInsuredType]').attr('checked',false);
							$("#policyHolderInsuredTypeIndDIV").removeClass("checked");
							$("#policyHolderInsuredTypecorDIV").removeClass("checked");
							if(retrivequoteJSON.ownershipcode != ""){
								if(retrivequoteJSON.ownershipcode == "I"){
									$("input:radio[name=policyHolderInsuredType][value ="+retrivequoteJSON.ownershipcode+"]").attr('checked', true);
									$("#policyHolderInsuredTypeIndDIV").addClass("checked");
									if(retrivequoteJSON.dateofbirth !=""){
										var dateofbirthsplit = retrivequoteJSON.dateofbirth.split("-");
										$("#inp_dateofbirthyear").val(dateofbirthsplit[0]);
										$("#inp_dateofbirthmonth").val(dateofbirthsplit[1]);
										$("#inp_dateofbirthdate").val(dateofbirthsplit[2]);
										$("#GenderC").attr("disabled","disabled");
										$("#GenderS").attr("disabled","disabled");
										$("#MartialStatusC").attr("disabled","disabled");
										radiobuttonchangeUsingIcnumber(true);
									}
								}
								else {
									$("input:radio[name=policyHolderInsuredType][value ="+retrivequoteJSON.ownershipcode+"]").attr('checked', true);
									$("#policyHolderInsuredTypecorDIV").addClass("checked");
									$("#div_genderpart").css("display","none");
									$("#div_martialstatuspart").css("display","none");
									$("#div_dateofbirth").css("display","none");
								}
							}
							if(!isEmpty(retrivequoteJSON.nvic)){
								nvicnumber = retrivequoteJSON.nvic;
							}
							else{
								nvicnumber = "";
							}
							if(retrivequoteJSON.ncdind == "Y" && retrivequoteJSON.premiumind == "Y" && retrivequoteJSON.savequoteind == "Y"){
								commonDepencencyservicescall("Y");
								isretrive2 = "Y";
								savedOrPremiumCalled = true;
								$('#saveQuote_btn').attr('disabled','disabled');
								$("#saveQuote_btn").addClass("p2_disablebtn");
								$("html, body").animate({ scrollTop: 0 }, "slow");
								quotationfilling(retrivequoteJSON, "Y");
								$("#vehicledetailsdiv").hide();
								$("#page2").hide();
								$('#page3').show();
								$("#page2Li").addClass("is-active");
								$("#page3Li").addClass("is-active");
								$('#quotecreateddate_tr').removeClass('p2_quotation_tble_none').addClass('p2_quotation_tble_block');
								$('#quoteexpireddate_tr').removeClass('p2_quotation_tble_none').addClass('p2_quotation_tble_block');
								 canbackproceed = false;
								if ($("#QuotationContent_acccont1").is(":visible")) {
									$("#QuotationContent_acccont1").css("display","none");
								}
								if(!$("#QuotationContent_acccont3").is(":visible")){
									document.getElementById("QuotationHead_accordian3").click();
								}
								if(!$("#QuotationContent_accordian2").is(":visible")){
									document.getElementById("QuotationHead_accordian2").click();
								}
								if(!isEmpty(retrivequoteJSON.quotationrecep)){
									pdfBaseData = retrivequoteJSON.quotationrecep;
								}
								if(!isEmpty(retrivequoteJSON.flasquotationno)){
									quotenumbersaveQuote = retrivequoteJSON.flasquotationno;
								}
								draftsuminsured(retrivequoteJSON, "Y");
							}
							else if(retrivequoteJSON.ncdind == "Y" && retrivequoteJSON.premiumind == "Y" && retrivequoteJSON.savequoteind != "Y"){
								commonDepencencyservicescall("Y");
								isretrive2 = "Y";
								savedOrPremiumCalled = true;
								quotationbtndisable();
								$("html, body").animate({ scrollTop: 0 }, "slow");
								quotationfilling(retrivequoteJSON, "Y");
								$("#vehicledetailsdiv").hide();
								$("#page2").hide();
								$('#page3').show();
								$("#page2Li").addClass("is-active");
								$("#page3Li").addClass("is-active");
								canbackproceed = true;
								quotationAccordian();
								draftsuminsured(retrivequoteJSON, "Y");
							}
							else if(retrivequoteJSON.ncdind == "Y" && retrivequoteJSON.premiumind != "Y" && retrivequoteJSON.savequoteind != "Y"){
								commonDepencencyservicescall("Y");
								isretrive2 = "Y";
								canbackproceed = true;
								isNcdCallProceedSucc = true;
								$("html, body").animate({ scrollTop: 0 }, "slow");
								draftsuminsured(retrivequoteJSON, "N");
								if(!isEmpty(retrivequoteJSON.businessregno)){
									$("input:radio[name=policyHolderInsuredType][value ='C']").attr('checked', true);
									$("#policyHolderInsuredTypecorDIV").addClass("checked");
									$("#div_martialstatuspart").css("display","none");
									$("#div_genderpart").css("display","none");
								}
								else{
									$("input:radio[name=policyHolderInsuredType][value ='I']").attr('checked', true);
									$("#policyHolderInsuredTypeIndDIV").addClass("checked");
								}
							}
						}
						else{
							 canbackproceed = true;
							 document.getElementById("navbartitle").innerHTML = "New Quote";
						}
						$('#vehicle_detail_title').removeClass("p2_displaynone").addClass("p2_displayblock");
						$('#findmyveh_accordian').attr( "style", "display: block !important;" );
						p2AccordianOnLoadNonVisible();
						if (!$("#findvehDet_acccont").is(":visible")) {
							$('#accordion-id').click();
						}
						$('.loading-mask').addClass('stop-loading');
					}
					else{
						// response null
					}
				}
				else {
				console.log(result);
					$('#findmyveh_accordian').attr( "style", "display: block !important;" );
					p2AccordianOnLoadNonVisible();
				}

			},p2_master,request);


			function draftsuminsured(retrivequoteJSON, retriveQuoteIndChange){

				if(retriveQuoteIndChange == "Y"){
					if(!isEmpty(retrivequoteJSON.suminsured) && !isEmpty(retrivequoteJSON.marketvalue)){
						document.getElementById("inp_vehiclemarketprice").value=currencyformat(retrivequoteJSON.marketvalue,"");
						document.getElementById("inp_ncdvehmarval").value=currencyformat(retrivequoteJSON.marketvalue,"");
						document.getElementById("inp_suminsured").value=retrivequoteJSON.marketvalue;
						ncdCalculations(retrivequoteJSON.marketvalue,0,"");
						document.getElementById("inp_suminsured").value=retrivequoteJSON.suminsured;
						ncdCalculations(retrivequoteJSON.marketvalue,1,retrivequoteJSON.suminsured);
					}
					else{
						document.getElementById("inp_vehiclemarketprice").value="0.00";
						document.getElementById("inp_ncdvehmarval").value="0.00";
						document.getElementById("inp_suminsured").value=0;
						ncdCalculations(0,0,"");
						document.getElementById("inp_suminsured").value=0;
					}
				}
				else{
					if(!isEmpty(retrivequoteJSON.marketvalue)){
						document.getElementById("inp_vehiclemarketprice").value=currencyformat(retrivequoteJSON.marketvalue,"");
						document.getElementById("inp_ncdvehmarval").value=currencyformat(retrivequoteJSON.marketvalue,"");
						document.getElementById("inp_suminsured").value=retrivequoteJSON.marketvalue;
						ncdCalculations(retrivequoteJSON.marketvalue,0,"");
						document.getElementById("inp_suminsured").value=retrivequoteJSON.marketvalue;
						ncdCalculations(retrivequoteJSON.marketvalue,1,retrivequoteJSON.marketvalue);
					}
					else{
						document.getElementById("inp_vehiclemarketprice").value="0.00";
						document.getElementById("inp_ncdvehmarval").value="0.00";
						document.getElementById("inp_suminsured").value=0;
						ncdCalculations(0,0,"");
						document.getElementById("inp_suminsured").value=0;
					}
				}
			}

			function coverageUsageDisable(){
				if(retrivequoteJSON.cncondition != "") {
					if(retrivequoteJSON.cncondition != "n"){
						// $("#sel_vehicleusage").attr("disabled","disabled");
						$("#sel_vehiclecoverage").attr("disabled","disabled");
						setItem("policyExpiryDate","");
					}
					else{
						setItem("policyExpiryDate",retriveQuoteJson.currentpolexpirydate);
					}
				}
			}

			$(".smk_accordion").show();
			};
			function closerenewal()
			{
				if(!isEmpty(retrivequoteJSON) || isRetriveQuoteRecord == true)
				{
					redirectionpage('retrieve-quote.html');
				}
				else{
					redirectionpage('dashboard.html');
				}
			}
			  //common popup
			  function showAlert(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');
			  }
			//common popup
			function showAlertValidation(message,focusedId,focusedIdInd) {
				$('#showpop').empty();
				$('#showpop').append("<h5>Message</h5><p id='para_messageid'>" + message + "</p><button class='popup-btn' id='comm-dismiss' onclick=autofocusAlert("+focusedId+","+focusedIdInd+");>OK</button>");
				show('showpop');
			}
			//common popup
			function showAlertAdditionalCoveragereset(message) {
			$('#showpop').empty();
			$('#showpop').append("<h5>Message</h5><p id='para_messageid'>"+message+"</p><button class='popup-btn' id='btn_resetform' onclick='additionalcoveragereset();'>YES</button><button class='popup-btn' id='comm-dismiss' onclick=hide('showpop')>NO</button>");
			show('showpop');
			}

			function showAlertAdditionalnamedDriverreset(message) {
			$('#showpop').empty();
			$('#showpop').append("<h5>Message</h5><p id='para_messageid'>"+message+"</p><button class='popup-btn' id='btn_resetform' onclick='additionalcoveragereset();'>YES</button><button class='popup-btn' id='comm-dismiss' onclick=hide('showpop')>NO</button>");
			show('showpop');
			}

			function autofocusAlert(focusedId,focusedIdInd2){
				hide('showpop')
				if(focusedIdInd2){
					accordianvehicleInformation();
					focusedId.focus();
				}
				else{
					if ($("#page5").is(":visible")) {
						focusedId.focus();
					}
					else{
						addonlistshowfn(true,focusedId);
					}
				}
			}
			  //logout popup
			  function exitAlert() {
				$('#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');
			  }


			   function showAlertAdditionalCoverage(message) {
				$('#showpop').empty();
				$('#showpop').append("<h5>Message</h5><p>"+message+"</p><button class='popup-btn' id='btn_logout' onclick='alertadditionalcoveragesuccess(false)'>YES</button><button class='popup-btn' id='comm-dismiss' onclick='alertadditionalcoveragesuccess(true)'>NO</button>");
				show('showpop');
			  }

			  function alertadditionalcoveragesuccess(issucc){
				  if(issucc){
					$('#showpop').hide();
					addonlistshowfn();
				  }
				  else{
					$('#showpop').hide();
					isaddalertocc = true;
					additionalinfo_nxtbtnclick();
				  }
			  }

			function closeAlert() {
				$('#showpop').empty();
				$('#showpop').append("<h5>Message</h5><p>Are you sure want to close?</p><button class='popup-btn' id='btn_logout' onclick='closerenewal()'>OK</button><button class='popup-btn' id='comm-dismiss' onclick=hide('showpop')>CANCEL</button>");
				show('showpop');
			  }

			  function EditQuoteAlert(){

				if(canbackproceed === false){
					$('#showpop').empty();
					$('#showpop').append("<h5>Message</h5><p>Are you sure you want to edit your saved quote?</p><h6 style='font-size: 12px;'>Note : If you edit anything, application will create it as a new quote</h6><button class='popup-btn' id='btn_logout' onclick='editQuoteConfirm(true);'>OK</button><button class='popup-btn' id='comm-dismiss' onclick=hide('showpop')>CANCEL</button>");
					show('showpop');
				}
				else{
					EditQuoteNonAlert();
				}
				}

			  function editQuoteConfirm(isFromAlert){
				if(isFromAlert){
					hide('showpop');
					//canbackproceed = false;
					canbackproceed = true;
				}
				EditQuoteQuotation();
			  }
			//respective back page redirect
			  function backbuttonclk() {
					if ($("#showpop").is(":visible")) {
						hide('showpop');
					}
					else if ($("#showpop1").is(":visible")) {
						hide('showpop1');
					}
					else if($("#page5").is(":visible"))
					{
						additionalcoveragecancel("DummyValue");
					}
					else if($("#page3").is(":visible"))
					{
						if(canbackproceed){
							EditQuoteNonAlert();
						}
						else{
							EditQuoteAlert();
						}
					}

					else if($("#page2").is(":visible"))
					{
						vehicleinformationAcc();
					}
					else if($("#page4").is(":visible"))
					{
						$('#page4').find('input:text').val('');
						$("#vehicledetailsdiv").show();
						$("#page4").hide();
					}
					else if (!$("#findvehDet_acccont").is(":visible")) {
						$('#findmyveh_accordian').attr( "style", "display: block !important" );
						commonaccordianshwhde();
						p2AccordianOnLoadNonVisible();
					}
					else {
						closeAlert();
			  	}
			  	}

			  history.pushState(null, null, document.URL);
			  //event listener popstate
			  window.addEventListener('popstate', function () {
				if(getItem("agentcode")!=null){
					backbuttonclk();
				}
				history.pushState(null, null, document.URL);
				});

			  </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" />
			</head>
			<body style="background-color: #ededed;">
			  <section class="axa-section welcome-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" style="background: #fff;" ontouchend="keypadclose()">
					<div class="axa-container Pay-detail" style=" clear: both;">
					  <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="navimg" 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" href="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 = "redirectionpagevehicledet('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" href="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" style="opacity: 0;"></div>
					  <div class="left-back" id="menu-button" data-ix="hide-navbar-icons">
								<a id="btn_paymentdetails" onclick="backbuttonclk();" class=" back-icon">
									<div class="left-arrow"><img alt="lefticonimg" class="left-icon" src="images/left-arrow.svg"></div>
								</a>
							</div>
					  <div class="navbar-title-Pay" id="navbartitle" style=" clear: both;"></div>
					  <div class="home-menuicon">
					   <a id="icon_home" onclick="redirectionpage('dashboard.html');"><img alt="homeimg" 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 id="controll">
					<div class="inner-body" style="background: #f6f6f6;">
								<!---wizard---->
					  <div class="progress-bar-section">
					<ol class="progress-bar">
						<li class="" data-step="" id="page1Li">
						<div class="progress-bar-circle is-active" id="page1Div">
							<img alt="progimg1" src="images/progress-bar-icon-1.svg" style="width: 18px;">
							</div>
						  </li>
							<li class="" data-step="" id="page2Li">
							<div class="progress-bar-circle" id="page2Div">
								<img alt="progimg2" src="images/progress-bar-icon-2.svg" style="width: 22px;">
							</div>
						  </li>
							<li class="" data-step="" id="page3Li">
							<div class="progress-bar-circle" id="page3Div">
								<img alt="progimg3" src="images/progress-bar-icon-3.svg" style="width: 17px;">
							</div>
						  </li>
						</ol>
					</div>

					<div class="" id="vehicledetailsdiv">
						<div class="axa-col-12 no-padding axa-dark-blue-bg p2_displaynone" id="vehicle_detail_title">
							<div class="page-title">
								<h5>Vehicle Details</h5>
							</div>
						</div>
						<div class="welcome-body padding">
						  <div class="">
							<div class="axa-form">
							  <form id="email-form" name="email-form" data-name="Email Form" action="#">
								<ul class="smk_accordion" style="display:none;">
								  <li class="accordion-toggle"  id="findmyveh_accordian">
									<div class = "accordationToogleUpDown" id="accordion-id"> <h3>Find my vehicle details <span class="arrow arrowDown"></span></h3></div>
									<div class="accordion-content" id="findvehDet_acccont">
									  <div class="form-group" style="margin-bottom: 20px;">
										<label class="axa-form-label" style="margin-bottom: 10px;">Vehicle Condition</label>
										<div class="axa-clearfix radios-container">
												<div class="axa-radio radio-button axa-col-6 no-padding" style="margin-right: 7px;">
													<div>
														<img alt="carimg" src="images/car.svg" style="width: 45px; margin-bottom: -15px;">
													</div>
													<div class="radio-bullet-replacement checked" style="position: relative; top: 17px; left: -20px;" id="InsurTypeNewDiv"></div>
													<input class="axa-radio-input radio-bullet" id="InsurTypeNew" onclick="vehicleconditionchange();" type="radio" name="InsurType" value="new" data-name="InsurType" checked>
													<label class="axa-form-label" for="InsurTypeNew" >New/Unregistered</label>
												</div>
												<div class="axa-radio axa-clearfix radio-button axa-col-4 no-padding">
													<div>
														<img alt="editimg" src="images/edit.svg" style="width: 30; margin-bottom: 0px;">
													</div>
												<div class="radio-bullet-replacement radio-btn-veh" id="InsurTyperegisteredDiv"></div>
													<input class="axa-radio-input radio-bullet" id="InsurTypeReg" onclick="vehicleconditionchange();" type="radio" name="InsurType" value="registered" data-name="InsurType">
													<label class="axa-form-label" for="InsurTypeReg">Registered</label>
												</div>
											</div>
									  </div>
										<div class="form-group">
											<label class="axa-form-label">Vehicle Registration Number</label>
											<input class="axa-input input-form p2_textUpperCase" id="vehicle_regnum_inp" type="text"  oninput="spaceandmaxlengthsplice(this);" maxlength="25">
										</div>
										<div class="form-group">
											<label class="axa-form-label">Vehicle Type</label>
											<select type="text" id="vehtype_select" class="axa-input input-form">
												<option value="0">-- Please Select --</option>

											</select>
										</div>
										<div class="form-group identifytype_veh">
											<label class="axa-form-label">Identity Type</label>
											<div class="axa-clearfix radios-container" id="rad_indentifytype" style="margin-left: -10px;">
											<div class="axa-row axa-col-12">
												<div class="axa-radio axa-clearfix radio-button">
												<div class="radio-bullet-replacement checked" id="newIcDiv"></div>
												<input class="axa-radio-input radio-bullet" id="IndentifyTypenew" type="radio"  name="IndentifyType" value="newIC" data-name="IndentifyType" checked=true onclick="inputtypecontentchange('Y');">
												<label class="axa-form-label" for="IndentifyTypenew">New IC Number</label>
											</div>
											<div class="axa-radio axa-clearfix radio-button">
												<div class="radio-bullet-replacement" id="oldIcDiv"></div>
												<input class="axa-radio-input radio-bullet" id="IndentifyTypeold" type="radio"  name="IndentifyType" value="oldIC" data-name="IndentifyType"  onclick="inputtypecontentchange('Y');">
												<label class="axa-form-label" for="IndentifyTypeold">Old IC Number</label>
											  </div>
											</div>
											<div class="axa-row axa-col-12">
											  <div class="axa-radio axa-clearfix radio-button">
												<div class="radio-bullet-replacement" id="passportnumDiv"></div>
												<input class="axa-radio-input radio-bullet" id="IndentifyTypepass" type="radio"  name="IndentifyType" value="passport" data-name="IndentifyType" onclick="inputtypecontentchange('Y');">
												<label class="axa-form-label" for="IndentifyTypepass">Passport Number</label>
											</div>
											<div class="axa-radio axa-clearfix radio-button">
													<div class="radio-bullet-replacement" id="businessnumDiv"></div>
													<input class="axa-radio-input radio-bullet" id="IndentifyTypebusi" type="radio"  name="IndentifyType" value="business" data-name="IndentifyType" onclick="inputtypecontentchange('Y');">
													<label class="axa-form-label" for="IndentifyTypebusi">Business Registration Number</label>
											</div>
										</div>
									</div>
								</div>
									<div class="form-group" id="div_NewICBlock">
										<input class="axa-input input-form" id="inp_newIcNumber" type="number" oninput="spaceandmaxlengthspliceIm(this);"  maxlength="12">
									</div>
									<div class="form-group p2_displaynone" id="div_OldICBlock">
										<input class="axa-input input-form" id="oldicnumber_inp" type="text" oninput="spaceandmaxlengthspliceIm(this);" maxlength="8">
									</div>
									<div class="form-group p2_displaynone" id="div_BusOrPasBlock">
										<input class="axa-input input-form" id="newbusnessorpass_inp" type="text" oninput="spaceandmaxlengthspliceIm(this);" maxlength="25">
									</div>
									<div class="form-group">
										<label class="axa-form-label">Region</label>
										<select type="text" id="inp_policyholderregion" class="axa-input input-form" onchange="regionchange()">
											<option value="0">-- Please Select --</option>
										</select>
									</div>
										<div class="axa-col-12 text-centered" id="">
										<input type="button" class="axa-btn" onclick="" value="Proceed" id="findvehproceed">
									</div>
								</div>
							</li>

							<li class="accordion-toggle" id="vehiInfo_accordian">
								<div class = "accordationToogleUpDown" id="accordion-id2"> <h3>Vehicle information <span class="arrow arrowDown"></span></h3></div>
								<div class="accordion-content" id="vehinfo_acccont">
										<div class="form-group">
											<label class="axa-form-label">Make Model</label>
								<input class="axa-input input-form p2_inputoverflow" id="inp_makemodelyear" type="text"  placeholder="" maxlength="" readonly>
											<span class="ion-ios-search-strong form-control-icon" id="searchmodel_inp" style="width: 37px;"></span>
										</div>
							<div class="form-group" style="display:inline-block;">
							<div class="axa-col-6 no-padding">
								<label class="axa-form-label">Seating Capacity</label>
											<input class="axa-input input-form line-height-input" id="inp_seatcapacity" oninput="spaceandmaxlengthsplice(this);" type="number" pattern="[0-9]*" placeholder="" maxlength="2" >
							</div>
							<div class="axa-col-6">
								<label class="axa-form-label mr--5">Engine Capacity</label>
								<input class="axa-input input-form line-height-input" id="inp_enginecapacity" type="text"  placeholder="" maxlength="" readonly>
							</div>
						</div>
										<div class="form-group">
											<label class="axa-form-label">Year Of Manufacture</label>
											<input class="axa-input input-form" id="inp_manufactureryear" type="text"  placeholder="" maxlength="" readonly>
										</div>
										<div class="form-group" id="div_chassisnumbersel">
											<label class="axa-form-label">Chassis No.</label>
											<input class="axa-input input-form" id="inp_chassisno" type="text"  oninput="spaceandmaxlengthsplice(this);" placeholder="" maxlength = "30" >
										</div>
										<div class="form-group" id="div_enginenumbersel">
											<label class="axa-form-label">Engine No.</label>
											<input class="axa-input input-form" id="inp_enginenumber" type="text"  oninput="spaceandmaxlengthsplice(this);" placeholder="" maxlength = "25" >
										</div>
										<div class="form-group">
											<label class="axa-form-label">Vehicle Body</label>
											<select type="text" id="inp_vehiclebody" class="axa-input input-form" onchange="vehiclebodysetls();">
												<option value="0">-- Please Select --</option>
											</select>
										</div>
										<div class="form-group">
											<label class="axa-form-label">Market Price</label>
											<input class="axa-input input-form" id="inp_vehiclemarketprice" type="text"  placeholder="" maxlength="" readonly>
										</div>
									</div>
								</li>

								  <li class="accordion-toggle" id="AddvehiInfo_accordian">
									<div class = "accordationToogleUpDown" id="accordion-id3"> <h3>Additional vehicle information <span class="arrow arrowDown"></span></h3></div>
									<div class="accordion-content" id="Addvehinfo_acccont">
										<div class="form-group">
												<label class="axa-form-label">Driving Experience (years)</label>
												<input class="axa-input input-form" id="inp_driverExp" type = "number" pattern="[0-9]*" oninput="javascript: if (this.value.length > this.maxLength) this.value = this.value.slice(0, this.maxLength);"  maxlength="2">
										</div>
										<div class="form-group">
											<label class="axa-form-label">Vehicle Usage</label>
											<select type="text" id="sel_vehicleusage" class="axa-input input-form" onchange="commonmasterCoverageservice(p2_coverageList, 'sel_vehiclecoverage', isretrive2, isdropdownclick);">
												<option value="0">-- Please Select --</option>
											</select>
										</div>
										<div class="form-group">
											<label class="axa-form-label">Vehicle Coverage</label>
											<select type="text" id="sel_vehiclecoverage" class="axa-input input-form" disabled="disabled" onchange="commonmasterCoverageChange('sel_vehiclecoverage', isretrive2, isdropdownclick);">
												<option value="0">-- Please Select --</option>
											</select>
										</div>
										<div class="form-group">
											<label class="axa-form-label">Garage</label>
											<select type="text" id="sel_garagelist" class="axa-input input-form">
												<option value="0">-- Please Select --</option>
											</select>
										</div>
										<div class="form-group">
											<label class="axa-form-label">PIAM Driver</label>
											<select type="text" id="sel_piamdriver" class="axa-input input-form" disabled="disabled" onchange="additionaldriverchangebyPiam(this,'N','N');">
												<option value="0">-- Please Select --</option>
											</select>
										</div>
										<div class="form-group">
											<label class="axa-form-label">Safety</label>
											<select type="text" id="sel_safetylist" class="axa-input input-form">
												<option value="0">-- Please Select --</option>
											</select>
										</div>
										<div class="form-group">
											<label class="axa-form-label">Anti Theft</label>
											<select type="text" id="sel_antiteftlist" class="axa-input input-form">
												<option value="0">-- Please Select --</option>
											</select>
										</div>
									</div>
								  </li>

								  <li class="accordion-toggle" id="ncddetails_accordian">
									<div class = "accordationToogleUpDown" id="accordion-id4"> <h3>Your NCD details <span class="arrow arrowDown"></span></h3></div>
									<div class="accordion-content" id="ncdInfo_acccont">
										  <div class="form-group">
											<label class="axa-form-label">Market Value</label>
											<input class="axa-input input-form" id="inp_ncdvehmarval" type="text"  placeholder="" maxlength="" readonly>
										</div>
						  <div class="form-group">
							<div class="registration-number">
							 <div class="registration-number form-wrapper clear">
								<div class="hide-this">
									  <div class="slider">
									  <div>
										<input type="text" id="range" value="" name="range" onchange="sliderchange(this);"/>
									  </div>
									  </div>
								</div>
							 </div>
						   </div>
										</div>
						  <div class="form-group">
											<label class="axa-form-label axa-margin-padding">Sum Insured <strong>RM</strong></label>
											<input class="sum-insured-box" id="inp_suminsured" type="number"  placeholder="" maxlength="8" oninput ="sliderchange(this);">
											<p id="sumInsuredError" style="color:red"></p>
										</div>
										<div class="form-group">
											<label class="axa-form-label">NCD Percentage</label>
											<input class="axa-input input-form" id="inp_ncdpercentage" type="text" value="" placeholder="" maxlength="" readonly>
										</div>

										<div class="form-group">
											<span class="axa-blue-light-text" onclick="addonlistshowfn(false,'');" id="add-on-list-show">Need additional coverage?</span>
										</div>
										<div class="axa-col-12 text-centered axa-clearfix">
												<input type="button" class="axa-btn" value="Back" id="additionalinfo_bckbtn">
												<input type="button" class="axa-btn" value="Next" onclick="additionalinfo_nxtbtnclick();" id="additionalinfo_nxtbtn">
										</div>
											</div>
										</li>
										</ul>
										</form>
									</div>
								</div>
							</div>
						</div>
					  <div id="page2" style="display:none;">
						  <div class="axa-col-12 no-padding axa-dark-blue-bg">
							<div class="page-title">
								<h5>Policy Holder Information</h5>
							</div>
						  </div>
						  <div class="content-box">
							<div class="form-group" style="margin-bottom: 20px;">
								<label class="axa-form-label" style="margin-bottom: 10px;">Insurer Type</label>
								<div class="axa-clearfix radios-container">
								  <div class="axa-radio axa-clearfix radio-button axa-col-5">
									<div>
										<img alt="indiimg" src="images/individual.svg" style="width: 35px;" >
									</div>
									<div id="policyHolderInsuredTypeIndDIV" class="radio-bullet-replacement checked" style="position: relative; top: 17px; left: -20px;"></div>
									<input class="axa-radio-input radio-bullet" id="policyHolderInsuredTypeInd" type="radio" onclick="policyholderinsuredtypechange(this);" name="policyHolderInsuredType"  value="I" data-name="policyHolderInsuredType"  checked>
									<label class="axa-form-label" for="policyHolderInsuredTypeInd">Individual</label>
								  </div>
								  <div class="axa-radio axa-clearfix radio-button">
									<div>
										<img alt="corpimg" src="images/corporate.svg" style="width: 35px;" >
									</div>
									<div id="policyHolderInsuredTypecorDIV" class="radio-bullet-replacement" style="position: relative; top: 17px; left: -20px;"></div>
									<input class="axa-radio-input radio-bullet" id="policyHolderInsuredTypecor" type="radio" onclick="policyholderinsuredtypechange(this);" name="policyHolderInsuredType" value="C" data-name="policyHolderInsuredType" >
									<label class="axa-form-label" for="policyHolderInsuredTypecor">Corporate</label>
								  </div>
								</div>
							</div>
							<div class="form-group">
								<label class="axa-form-label">Name</label>
								<input class="axa-input input-form" id="inp_policyholdername" type="text" oninput="javascript: if (this.value.length > this.maxLength) this.value = this.value.slice(0, this.maxLength);" placeholder="" maxlength = "80">
							</div>
							<div class="form-group" id="div_dateofbirth" >
								<label class="axa-form-label">Date of Birth</label>
								<div id="div_dateofbirthfield">
									<input class="axa-input input-form daywidth" id="inp_dateofbirthdate" type="number" name="DOVdate" oninput="dateofbirthIndividual(this);" placeholder="" maxlength = "2" readonly><label class="spanDOB">/</label>
									<input class="axa-input input-form monthwidth" id="inp_dateofbirthmonth" type="number" name="DOVdate" oninput="dateofbirthIndividual(this);"  placeholder="" maxlength = "2" readonly><label class="spanDOB">/</label>
									<input class="axa-input input-form yearwidth" id="inp_dateofbirthyear" type="number" name="DOVdate" oninput="dateofbirthIndividual(this);" placeholder="" maxlength = "4" readonly>
								</div>
								<div>
									<label class="spanDOBLab spanDOBLable1">DD</label>
									<label class="spanDOBLab spanDOBLable2">MM</label>
									<label class="spanDOBLab">YYYY</label>
								</div>
							</div>
							<div class="form-group" id="div_genderpart">
								<label class="axa-form-label">Gender</label>
								<div class="axa-clearfix radios-container" style="margin-left: -10px;" id="div_gender">
								</div>
							</div>
							<div class="form-group" id="div_martialstatuspart">
								<label class="axa-form-label">Marital Status</label>
								<div class="axa-clearfix radios-container" style="margin-left: -10px;" id="div_martialStatus">
								</div>
							</div>
							<div class="form-group">
								<label class="axa-form-label">Address</label>
								<input class="input-form" id="inp_policyholderadd1" type="text"  oninput="javascript: if (this.value.length > this.maxLength) this.value = this.value.slice(0, this.maxLength);" placeholder="" maxlength = "80">
								<input class="axa-input input-form" id="inp_policyholderadd2" type="text"  oninput="javascript: if (this.value.length > this.maxLength) this.value = this.value.slice(0, this.maxLength);" placeholder="" maxlength = "80">
							</div>
							<div class="form-group">
								<label class="axa-form-label">Postcode</label>
								<input class="axa-input input-form" id="inp_policyholderpostal" type="number" onblur="postcodeviastateloading()" oninput="postcodespacetrimothcase(this)" pattern="[0-9]*" placeholder="" maxlength = "5">
							</div>
							<div class="form-group">
								<label class="axa-form-label">Occupation</label>
								<select type="text" id="inp_policyholderocc" class="axa-input input-form">
									<option value="0">-- Please Select --</option>
								</select>
							</div>
							<div class="form-group">
								<label class="axa-form-label">State Code</label>
								<select type="text" id="inp_policyholderstate" class="axa-input input-form" disabled="disabled">
									<option value="0">-- Please Select --</option>
								</select>
							</div>

							<div class="axa-col-12 text-centered axa-clearfix">
									<input type="button" class="axa-btn" onclick="" value="Back" id="policyholder_bckbtn">
									<input type="button" class="axa-btn" onclick="" value="Next" id="policyholder_nxtbtn">
							</div>
						</div>
					  </div>
					  <div id="page3" style="display:none;">
						 <div class="axa-col-12 no-padding axa-dark-blue-bg">
							<div class="page-title">
								<h5>Quotation</h5>
							</div>
						</div>
						<div class="content-box">
							<div class="axa-col-12">
									<h3 class="p2_autoheight p2_textalign_center" id="lab_ncdvehiclenumValue">Vehicle number </h3>
							</div>
								<div class="axa-row quotation-he-de">
									<div  class="axa-col-6 p2_quotation_sumInsuredLft">
										<span class="p2_autoheight" id="lab_ncdsumInsuredpercentage">Sum Insured</span>
									</div>
									<div  class="axa-col-6 p2_quotation_sumInsuredRgt">
										<div>
											<span class="p2_autoheight p2_wordbreak" id="lab_ncdsumInsuredamount">RM 0.00</span>
										</div>
										<div>
											<span class="p2_autoheight" id="lab_ncdsumInsuredAgreedOrMark"></span>
										</div>
									</div>
								</div>
									<ul class="smk_accordion">
										<li class="accordion-toggle acc_section" id="Quotation_accordian1">
											<div class="accordationToogleUpDown acc_head" id="QuotationHead_accordian1"> <h3 style="text-align: center;">Total premium payable <div id="lab_totalamount"></div><span class="quo-head-farrow arrow arrowDown"></span></h3></div>
											<div class="accordion-content acc_content" id="QuotationContent_acccont1">
											<table class="quotation-item-list">
												<tr>
													<!-- (Basic Premium) -->
													<td class="p2_quotation_right_tble">Basic Premium</td>
													<td class="p2_wordbreak" id="lab_traiffpremium">RM 0.00</td>
												</tr>
												<tr id="loadingpercentage_tr" class="p2_displaynone">
													<td id="lab_loadingpercentage">Loading (0.00 %)</td>
													<td id="lab_loadingamount">0</td>
												</tr>
												<tr>
													<td class="p2_quotation_right_tble" id="lab_ncdpercentage">NCD (0.00 %)</td>
													<td class="p2_wordbreak" id="lab_ncdamount">RM 0.00</td>
												</tr>
												<tr>
													<td class="p2_quotation_right_tble" id="lab_ncdExtracoverage">Extra Coverage</td>
													<td class="p2_wordbreak" id="lab_ncdExtracoverageamt">RM 0.00</td>
												</tr>
												<tr>
													<td class="p2_quotation_right_tble" id="lab_ncdserviceTaxPerc">Service Tax (0.00 %)</td>
													<td class="p2_wordbreak" id="lab_ncdserviceTaxamt">RM 0.00</td>
												</tr>
												<tr>
													<td class="p2_quotation_right_tble" id="lab_ncdstampduty">Stamp Duty</td>
													<td class="p2_wordbreak" id="lab_ncdstampdutyamt">RM 0.00</td>
												</tr>
												<tr>
													<td class="p2_quotation_right_tble" id="lab_owndamageexcess">Own Damage Excess</td>
													<td class="p2_wordbreak" id="lab_owndamageexcessamt">RM 0.00</td>
												</tr>
												<tr>
													<td class="p2_quotation_right_tble" id="lab_compulsoryexcess">Compulsory Excess</td>
													<td class="p2_wordbreak" id="lab_compulsoryexcessamt">RM 0.00</td>
												</tr>

											</table>
										</div>
									</li>
								</ul>
							<br/>
							<ul class="smk_accordion">
								<li class="accordion-toggle acc_section acc_active" id="Quotation_accordian3" style="display: block !important;">
									<div class="accordationToogleUpDown acc_head active" id="QuotationHead_accordian3"> <h3 >Quotation info section <span class="quo-head-farrow arrow arrowUp"></span></h3></div>
									<div class="accordion-content acc_content" id="QuotationContent_acccont3" style="display: block;">
									<table class="quotation-item-list">
										<tbody><tr>
											<!-- (Basic Premium) -->
											<td class="p2_quotation_right_tble">Quotation Number </td>
											<td class="p2_quotation_number_lble" id="lab_quoterefno">-</td>
										</tr>
										<tr id="quotecreateddate_tr" class="p2_quotation_tble_none">
											<td class="p2_quotation_right_tble">Quotation Creation Date</td>
											<td class="p2_wordbreak" id="lab_quotecreatedate">-</td>
										</tr>
										<tr id="quoteexpireddate_tr" class="p2_quotation_tble_none">
											<td class="p2_quotation_right_tble">Quotation Validity Date</td>
											<td class="p2_wordbreak" id="lab_quoteexpiredate">-</td>
										</tr>
									</tbody>
								</table>
								</div>
							</li>
						</ul>
					<br/>
								<ul class="smk_accordion">
									<li class="accordion-toggle acc_section" id="Quotation_accordian2" style="display: block !important;">
										<div class="accordationToogleUpDown acc_head active" id="QuotationHead_accordian2"> <h3>Agent info section <span class="arrow arrowUp"></span></h3></div>
										<div class="accordion-content acc_content" id="QuotationContent_accordian2" style="display: block;">
											<table class="quotation-item-list">
												<tr>
													<td class="p2_quotation_right_tble" id="lab_commissionpercentage">Commission (0%)</td>
													<td class="p2_wordbreak" id="lab_commissionamount">RM 0.0</td>
												</tr>
												<tr>
													<td class="p2_quotation_right_tble">Net Premium</td>
													<td class="p2_wordbreak" id="lab_netpremium">RM 0.0</td>
												</tr>
											</table>
										</div>
									</li>
								</ul>
								<br>
								<div class="axa-row">
									<div class="axa-col-12 p2_quotation_referCodeLft" id="div_referdesc">
										<h4><span class="p2_referdescnote" id="lab_referdescnote"></span></h4>
										</div>
										<br>
								</div>
									<div class="axa-col-12 text-centered axa-clearfix">
											<input type="button" class="axa-btn" onclick="" value="Save Quote" id="saveQuote_btn">
											<input type="button" class="axa-btn" onclick="" value="Share Quote" id="shareQuote_btn">
											<input type="button" class="axa-btn" onclick="EditQuoteAlert();" value="Edit Quote" id="EditQuote_btn">
									</div>
								</div>

						</div>
						<!-- page 4 started-->
						<div id="page4" style="display:none;">
								<div class="axa-col-12 no-padding axa-dark-blue-bg">
										<div class="page-title">
											<h5>Search Make/Model</h5>
										</div>
									</div>
										<div class="content-box">
												<div class="form-group">
													<label class="axa-form-label">Vehicle Make &amp; Model   <span style="color:red">*</span></label>
													<input class="axa-input input-form" id="inp_vechiclemakemodel" type="text" oninput="maxlengthspice(this);" maxlength="30">
												</div>
												<div class="form-group">
													<label class="axa-form-label">Year</label>
													<input class="axa-input input-form" id="inp_vechiclemakeyear" type="number" oninput="spaceandmaxlengthsplice(this);" maxlength="4">
												</div>
												<div class="form-group">
													<label class="axa-form-label">Capacity CC</label>
													<input class="axa-input input-form" id="inp_vechiclecapacity" type="number" oninput="spaceandmaxlengthsplice(this);" maxlength="4">
												</div>
												<div class="axa-col-12 text-centered axa-clearfix">
													<input type="button" class="axa-btn" onclick="" value="CANCEL" id="searchmodelboxcancel_btn">
													<input type="button" class="axa-btn" onclick="" value="SEARCH" id="searchmodelbox_btn">
												</div>
												<div id="search_model_tab_div">
													<div>
														<div class="axa-col-12 mg-tp axa-dark-blue-bg">
															<div class="page-title">
																<h5>Search Model</h5>
															</div>
														</div>
														<div class="search-model-table-section search-model-table-height">

														</div>
													</div>
													<div class="fab" id="div_selectmodelbox_btn"><div class="icon ion-checkmark"></div></div>
												</div>
											</div>
						  </div>
						<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!! Additional coverage starts !!!!!!!!!!!!!!!!!!!!!!!!! -->
						<div id="page5" style="display:none;">
							<div class="axa-col-12 no-padding axa-dark-blue-bg">
								<div class="page-title">
									<h5>Additional Coverage</h5>
								</div>
							</div>
							<div id="additionalcoverageDivAddheader">
								<div class="content-box1" id="additionalcoverageDivAdd">
									<div class="axa-col-12 add-on-check"  id="addcoverage_div">
									</div>
								</div>
								<div class="axa-col-12 text-centered axa-clearfix" id="">
										<input type="button" class="axa-btn" value="RESET" onclick="additionalcoverageresetAlert();" id="btn_additionalcoveragereset">
										<input type="button" class="axa-btn" value="SUBMIT" onclick="additionalcoveragesubmit(this);" id="btn_additionalcoveragesubmit">
								</div>
							</div>
						  </div>
						<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!! Additional coverage ends   !!!!!!!!!!!!!!!!!!!!!!!!! -->
				</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>
			  </section>
			  <script type="text/javascript" src="js/jquery.min.js"></script>
			  <script  type="text/javascript" src="js/ion.rangeSlider.js"></script>
			  <script type="text/javascript" charset="UTF-8" src="VehDetRedirectionCommonData.js"></script>
			  <script type="text/javascript" src="js/framework.js"></script>
			  <script type="text/javascript" src="./js/date-picker.js"></script>
			  <script type="text/javascript" src="./js/bootstrap-material-datetimepicker.js"></script>
			  <script type="text/javascript" src="js/smk-accordion.js"></script>
			<script>
			/*  on pressing proceed button  */
			$("#findvehproceed").click(function(e){
				var isValidatedV = findmyvehiclevalidation();
				if(isValidatedV){
					//paim based additional named driver changes when ic type changed
					if(($("#sel_piamdriver").val() == "01") && (savedOrPremiumCalled == false)){
						var numberofDriver = document.getElementById("inp_numberofdrivers");
						var childnodesofacc = numberofDriver.nextElementSibling.nextElementSibling.nextElementSibling.nextElementSibling.childNodes;
						if (childnodesofacc[0]!=null){
						childnodesofacc[0].childNodes[0][1].value = "";
						childnodesofacc[0].childNodes[0][2].value = "";
						childnodesofacc[0].childNodes[0][3].value = "";
						var id_DOBAdditionalNamed = childnodesofacc[0].childNodes[0][3].id;
						if(!isEmpty($("#oldicnumber_inp").val())){
							childnodesofacc[0].childNodes[0][2].value = $("#oldicnumber_inp").val();
							$("#"+id_DOBAdditionalNamed).removeAttr("disabled");
						}
						else if(!isEmpty($("#newbusnessorpass_inp").val())){
							childnodesofacc[0].childNodes[0][2].value = $("#newbusnessorpass_inp").val();
							$("#"+id_DOBAdditionalNamed).removeAttr("disabled");
						}
						else if(!isEmpty($("#inp_newIcNumber").val())){
							childnodesofacc[0].childNodes[0][1].value = $("#inp_newIcNumber").val();
							var dateofbirthformation = JSON.parse(getItem("DOBFromIc"));
							var dateofbirth = dateofbirthformation.day+"/"+dateofbirthformation.month+"/"+dateofbirthformation.year;
							childnodesofacc[0].childNodes[0][3].value = dateofbirth;
						}
					  }
						else{
						}
					}
					savedOrPremiumCalled = true;
					//paim based additional named driver changes when ic type changed

					if(!isEmpty(retrivequoteJSON) && (isRetriveCanProceedNCD == false))
					{
						var jsonV = retrivequoteJSON;
						if(jsonV.ncdind == "Y"){
							var valuealtered = isvaluechangevehicleDetails();
							if(valuealtered){
								isNCDRecordChanged = "Y";
								radiobuttonchangeUsingIcnumber(false);
								ncdservicecallcommon("Y");
							}
							else{
								OldInputNotAltered(false);
							}
						}
						else{
							radiobuttonchangeUsingIcnumber(false);
							ncdservicecallcommon("N");
						}
					}
					else
					{
						radiobuttonchangeUsingIcnumber(false);
						ncdservicecallcommon("N");
					}
				}
				else{
					// console.log("Failure");
				}
			});

			function OldInputNotAltered(isRetriveQuote){
				radiobuttonchangeUsingIcnumber(true);
				if(isRetriveQuote){
					commonDepencencyservicescall("N");
				}
				else{
					commonDepencencyservicescall("Y");
				}
				OldInputNotAlteredAccordian();
			}

			function radiobuttonchangeUsingIcnumber(isRetriveOvercome)
			{
				var newIcNumber_inpVal = document.getElementById("inp_newIcNumber").value;
				var newIcLastPart = newIcNumber_inpVal.substring(12, 8);
						if(!isEmpty(newIcLastPart))
						{
							lastDigit = newIcLastPart % 10;
							if(newIcLastPart % 2 == 0){
								// div_gender for New Ic even case
								$('input[name=Gender]').attr('checked',false);
								var genderJSONLS = JSON.parse(getItem("genderlist"))
								commonpolicyholderradioforremove(genderJSONLS, "Gender");
								$("#GenderC").attr("disabled","disabled");
								$("#GenderM").attr("disabled","disabled");
								$("#GenderS").attr("disabled","disabled");
								$("#GenderF").removeAttr("disabled");
								$("input:radio[name=Gender][value ='F']").attr('checked', true);
								$("#FGender").addClass("checked");
								if(!isEmpty(retrivequoteJSON)){
									$("#MartialStatusC").attr("disabled","disabled");
									if(isRetriveOvercome == false){
										$('input[name=MartialStatus]').attr('checked',false);
										var martialstatusJSONLS = JSON.parse(getItem("martialstatusList"))
										commonpolicyholderradioforremove(martialstatusJSONLS, "MartialStatus");
										$("#MartialStatusC").attr("disabled","disabled");
										$("input:radio[name=MartialStatus][value ='S']").attr('checked', true);
										$("#SMartialStatus").addClass("checked");
										isRetriveOvercome = true;
									}
								}
								else{
									retriveQuoteJsonRadio();
								}
							}
							else{
								// div_gender for New Ic odd case
								$('input[name=Gender]').attr('checked',false);
								var genderJSONLS = JSON.parse(getItem("genderlist"))
								commonpolicyholderradioforremove(genderJSONLS, "Gender");
								$("#GenderC").attr("disabled","disabled");
								$("#GenderF").attr("disabled","disabled");
								$("#GenderS").attr("disabled","disabled");
								$("#GenderM").removeAttr("disabled");
								$("input:radio[name=Gender][value ='M']").attr('checked', true);
								$("#MGender").addClass("checked");
								if(!isEmpty(retrivequoteJSON)){
									$("#MartialStatusC").attr("disabled","disabled");
								}
								else{
									retriveQuoteJsonRadio();
								}
							}
						}
						else{
							inputtypecontentchange("N");
							// its not new Ic
						}
			}

			function inputtypecontentchange(isCameFromService){
				var IndentifyName = document.getElementsByName("IndentifyType");
				var res = radiobuttonId(IndentifyName);
				// console.log(res);
				if(isCameFromService == "N"){
					if(isEmpty(retrivequoteJSON)){
						if(res == "passport" || res == "oldIC" || res == "newIC" || res == "business"){
							// div_gender
							jsonRadioChange();
						}
					}
					else{
						//others
						if(res == "passport" || res == "oldIC"){
							// div_gender
							jsonRadioChange();
							$("#CMartialStatus").removeClass("checked");
							$("input:radio[name=MartialStatus][value ='S']").attr('checked', true);
							$("#SMartialStatus").addClass("checked");
						}
						else if(res == "newIC"){
							// div_gender
							dateofbirthreadonly();
							jsonRadioChange();
						}
						else {
							// div_gender
							$('input[name=Gender]').attr('checked',false);
							var genderJSONLS = JSON.parse(getItem("genderlist"))
							commonpolicyholderradioforremove(genderJSONLS, "Gender");
							$("#GenderM").removeAttr("disabled","disabled");
							$("#GenderF").removeAttr("disabled","disabled");
							$("#GenderS").attr("disabled","disabled");
							$("#GenderC").attr("disabled","disabled");
							$("input:radio[name=Gender][value ='C']").attr('checked', true);
							$("#CGender").addClass("checked");
						}
					}
				}
				else{
					if(res == "business" ){
						$("#div_BusOrPasBlock").removeClass("p2_displaynone");
						$("#div_NewICBlock").addClass("p2_displaynone");
						$("#div_OldICBlock").addClass("p2_displaynone");
						$('#div_BusOrPasBlock').find(':input').val('');
						$('#div_NewICBlock').find(':input').val('');
						$('#div_OldICBlock').find(':input').val('');
						$('#div_dateofbirthfield').find(':input').val('');
						$("#div_genderpart").css("display","none");
						$("#div_martialstatuspart").css("display","none");
					}
					else if(res == "passport"){
						$("#div_BusOrPasBlock").removeClass("p2_displaynone");
						$("#div_NewICBlock").addClass("p2_displaynone");
						$("#div_OldICBlock").addClass("p2_displaynone");
						$('#div_BusOrPasBlock').find(':input').val('');
						$('#div_NewICBlock').find(':input').val('');
						$('#div_OldICBlock').find(':input').val('');
						$('#div_dateofbirthfield').find(':input').val('');
						dateofbirthreadonlyremove();
						$("#div_genderpart").css("display","block");
						$("#div_martialstatuspart").css("display","block");
						if(isEmpty(retrivequoteJSON)){
							nonretriveQuoteJsonRadio();
						}
						else{
							//
						}

					}
					else if(res == "oldIC"){
						$("#div_OldICBlock").removeClass("p2_displaynone");
						$("#div_NewICBlock").addClass("p2_displaynone");
						$("#div_BusOrPasBlock").addClass("p2_displaynone");
						$('#div_NewICBlock').find(':input').val('');
						$('#div_BusOrPasBlock').find(':input').val('');
						$('#div_dateofbirthfield').find(':input').val('');
						dateofbirthreadonlyremove();
						$("#div_genderpart").css("display","block");
						$("#div_martialstatuspart").css("display","block");
						if(isEmpty(retrivequoteJSON)){
							nonretriveQuoteJsonRadio();
						}
						else{
							//
						}
					}
					else {
						$("#div_NewICBlock").removeClass("p2_displaynone");
						$("#div_OldICBlock").addClass("p2_displaynone");
						$("#div_BusOrPasBlock").addClass("p2_displaynone");
						$('#div_OldICBlock').find(':input').val('');
						$('#div_BusOrPasBlock').find(':input').val('');
						$("#div_genderpart").css("display","block");
						$("#div_martialstatuspart").css("display","block");
						dateofbirthreadonly();
						if(isEmpty(retrivequoteJSON)){
							// div_gender
							$('input[name=Gender]').attr('checked',false);
							var genderJSONLS = JSON.parse(getItem("genderlist"))
							commonpolicyholderradioforremove(genderJSONLS, "Gender");
							$("#GenderM").removeAttr("disabled","disabled");
							$("#GenderF").removeAttr("disabled","disabled");
							$("#GenderS").removeAttr("disabled","disabled");
							$("#GenderC").attr("disabled","disabled");
							$("input:radio[name=Gender][value ='F']").attr('checked', true);
							$("#FGender").addClass("checked");
							//martial status
							$('input[name=MartialStatus]').attr('checked',false);
							var martialstatusJSONLS = JSON.parse(getItem("martialstatusList"))
							commonpolicyholderradioforremove(martialstatusJSONLS, "MartialStatus");
							$("#MartialStatusC").attr("disabled","disabled");
							$("input:radio[name=MartialStatus][value ='S']").attr('checked', true);
							$("#SMartialStatus").addClass("checked");
						}
						else{
							//
						}
					}
				}
				savedOrPremiumCalled = false;
			}

			/* Radio button color switch */
			function radiobuttonclick(Value,diff_id){
				var SearchModel = document.getElementsByName("Searchmodelradio");
				var MartialStatus = document.getElementsByName("MartialStatus");
				var GenderNam = document.getElementsByName("Gender");
				var btn2 = document.getElementsByName("button_replacement2");
				var btn1 = document.getElementsByName("button_replacement1");
				var btn3 = document.getElementsByName("modelbuttonreplacement");

				if(diff_id == 1){
					commonstatusid = GenderNam;
					buttonstatus = btn1;
				}
				else if(diff_id == 2){
					commonstatusid = MartialStatus;
					buttonstatus = btn2;
				}
				else{
					commonstatusid = SearchModel;
					buttonstatus = btn3;
				}
				for(var i=0;i<commonstatusid.length;i++){
					if(commonstatusid[i].checked){
						checkedValue = commonstatusid[i].value;
						$(buttonstatus[i]).addClass('checked');
					}
					else if(!commonstatusid[i].checked){
						$(buttonstatus[i]).removeClass('checked');
					}
				}
			}

			function OldInputNotAlteredAccordian(){
				$("#accordion-id").click();
				$('#findmyveh_accordian').attr( "style", "display: none !important" );
				p2AccordianOnLoadBlock();
				accordianvehicleInformation();
				$('#range').attr( "style", "display: none !important;");
				$("html, body").animate({ scrollTop: 0 }, "slow");
			}

			function additionalinfo_nxtbtnclick(){
			var sel_vehiclecoverage = $("#sel_vehiclecoverage option:selected").val();
			var sel_vehicleusage = $("#sel_vehicleusage option:selected").val();
				console.log("selected coverage from additionalinfo_nxtbtnclick :",sel_vehiclecoverage);
			if(sel_vehicleusage=='VPP0201' && sel_vehiclecoverage!='VPPCO0201'){
				changeaddonList();
			}
				savedOrPremiumCalled = true;
				var piamLoadedInd = 0;
				var additionalcov_element = document.getElementById("additionalcoverageDivAdd");
				for(j = 1; j < additionalcov_element.childNodes[1].childNodes.length ; j++){
					var checkboxElement = additionalcov_element.childNodes[1].childNodes[j].childNodes[0].childNodes[0].childNodes[0];
					if(checkboxElement.checked){
						piamLoadedInd++;
						if(piamLoadedInd == 1 && isaddalertocc == false){
							isaddalertocc = false;
						}
						else{
							isaddalertocc = true;
						}
					}
				}

					var isValidatedAcc1 = false;
					var isValidatedV = false;
					isValidatedAcc1 = findmyvehiclevalidation();
					if(isValidatedAcc1){
						isValidatedV = vehicleinfoNcdValidation();
					}
					if(isValidatedAcc1 && isValidatedV){
							var isValidatedM = additionalcoveragevalidation();
							if(isValidatedM){
								if(!isaddalertocc){
									showAlertAdditionalCoverage("Are you sure you want to proceed without additional coverages?");
								}
								else{
									var IndentifyName = document.getElementsByName("IndentifyType");
									var IndentifyValue = radiobuttonId(IndentifyName);
									if(IndentifyValue == "newIC"){
										$("#div_dateofbirth").css("display","block");
										var DOBIC = JSON.parse(getItem("DOBFromIc"));
										document.getElementById("inp_dateofbirthdate").value = DOBIC.day;
										document.getElementById("inp_dateofbirthmonth").value = DOBIC.month;
										document.getElementById("inp_dateofbirthyear").value = DOBIC.year;
										$("inp_dateofbirthdate").attr('readonly', true);
										$("inp_dateofbirthmonth").attr('readonly', true);
										$("inp_dateofbirthyear").attr('readonly', true);
									}
									else if(IndentifyValue != "business"){
										//$('#div_dateofbirth').find(':input').val('');
										$("#div_dateofbirth").css("display","block");
										$("inp_dateofbirthdate").removeAttr('readonly');
										$("inp_dateofbirthmonth").removeAttr('readonly');
										$("inp_dateofbirthyear").removeAttr('readonly');

									}
									else{
										//$('#div_dateofbirth').find(':input').val('');
										$("#div_dateofbirth").css("display","none");
									}

									$("#vehicledetailsdiv").hide();
									$("#page3").hide();
									$("#page2").show();
									$("html, body").animate({ scrollTop: 0 }, "slow");
									$("#page2Li").addClass("is-active");
								}
							}
							else{
								console.log("Failure");
							}
					}
					else{
						console.log("Failure");
					}
			//	}
			}
			
				//to alter addonList everytime nxtbtn is clciked
			function changeaddonList(){
				console.log("addonList :",addonList);
				if(addonList!=null && addonList.length>0){
					for(i=0;i<addonList.length;i++){
						if(addonList[i].bendesc=="ADDITIONAL NAMED DRIVER"){
							addonList.splice(i, 1);
						}else if(addonList[i].bendesc=="ALL DRIVERS"){
							addonList.splice(i, 1);
						}else{}
					}
				}
			
			}

			$("#policyholder_bckbtn").click(function(e){
					vehicleinformationAcc();
			});

			$("#policyholder_nxtbtn").click(function(e){
				savedOrPremiumCalled = true;
				var isValidated1 = false;
				var isValidated2 = false;
				var isValidated3 = false;
				var isValidated4 = false;
				isValidated1 = findmyvehiclevalidation();
				if(isValidated1){
					isValidated2 = vehicleinfoNcdValidation();
					if(isValidated2){
						isValidated3 = additionalcoveragevalidation();
						if(isValidated3){
							isValidated4 = policyholdervalidation();
						}
					}
				}
				if(isValidated1 && isValidated2 && isValidated3 && isValidated4){
					if((!isEmpty(retrivequoteJSON)) && (isRetriveCanProceedPremium == false))
					{
						var jsonV = retrivequoteJSON;
						//valuealtered = false;
						if(jsonV.premiumind == "Y"){
							var valuealtered = isvaluechangepremiumcall();
							if(valuealtered){
								ispremiumRecordChanged = "Y";
								premiumservicecallcommon();
							}
							else{
								if(isNCDRecordChanged == "Y"){
									ispremiumRecordChanged = "Y";
									premiumservicecallcommon();
								}
								else{
									quotationfilling(jsonV, "Y");
									// not edited so no service call
									OldInputNotAlteredPC();
								}
							}
						}
						else{
							var valuealtered = isvaluechangepremiumcall();
							if(valuealtered){
								ispremiumRecordChanged = "Y";
								premiumservicecallcommon();
							}
							else{
								premiumservicecallcommon();
							}
						}
					}
					else
					{
						if(isSavedQuoteSuccess){
							var registrationtype;
							var newIcAvail;
							var VehicleValue = document.getElementById("vehicle_regnum_inp").value;
							var VechicleRegionValue = $("#inp_policyholderregion option:selected").val();
							var newIcPasOrBus = document.getElementById("newbusnessorpass_inp").value;
							var newIcNumber_inpVal = document.getElementById("inp_newIcNumber").value;
							console.log(newIcNumber_inpVal.substring(6, 0));
							console.log(newIcNumber_inpVal.substring(8, 6));
							console.log(newIcNumber_inpVal.substring(12, 8));
							var newIcValue1 = newIcNumber_inpVal.substring(6, 0);
							var newIcValue2 = newIcNumber_inpVal.substring(8, 6);
							var newIcValue3 = newIcNumber_inpVal.substring(12, 8);
							if((!isEmpty(newIcValue1) || !isEmpty(newIcValue3))){
								newIcAvail = newIcValue1+"-"+newIcValue2+"-"+newIcValue3;
							}
							else{
								newIcAvail = "";
							}
							var OldIcValue = document.getElementById("oldicnumber_inp").value;
							var InsurTypeName = document.getElementsByName("InsurType");
							var GenderName = document.getElementsByName("Gender");
							InsurTypeValue = radiobuttonId(InsurTypeName);
							GenderValue = radiobuttonId(GenderName);
							console.log(IndentifyValue);
							if(InsurTypeValue == "new"){
								registrationtype = "n";
							}
							else{
								registrationtype = "u";
							}
							if(!isEmpty(ncdFormalReq)){
							 	var validationres1 = requestrecheck(ncdFormalReq, VehicleValue, VechicleRegionValue, registrationtype, newIcPasOrBus, newIcAvail, OldIcValue);
								isNCDRecordChanged = validationres1;
								if(isNCDRecordChanged == "Y"){
									isRetriveCanProceedNCD == true;
								}
							}
						}
						premiumservicecallcommon();
					}
				}
				else{
					console.log("Validation failure");
				}

			});

			$("#searchmodel_inp").click(function(){
					policyListCopy = [];
					pagenumberCount = 1;
					$('#inp_vechiclecapacity').val('');
					$('#inp_vechiclemakeyear').val('');
					$('#inp_vechiclemakemodel').val('');
					$('.search-model-table-section').empty();
					$("#vehicledetailsdiv").hide();
					$("#page2").hide();
					$("#page3").hide();
					$("#search_model_tab_div").hide();
					$("#div_selectmodelbox_btn").attr("style","display:none");
					$("#page4").show();
			});


			function addonlistshowfn(isautofocus, focuselement){

				var marketVal = document.getElementById("inp_ncdvehmarval").value;
				var marketvalstring = marketVal.toString();
				var newval = marketvalstring.split(',').join("").split(".")[0];
				if(!isEmpty(marketVal)){
					additionalcoverageheight($('#additionalcoverageDivAdd'));
					$("#vehicledetailsdiv").hide();
					$("#page5").show();
					$('#rooftop_add_con').attr( "style", "display: none" );
					$('#infoadddri1_acccont').attr("style","display: none");
					$('#extention_thai_con').attr("style","display: none");

					if(isautofocus){
						var accordianidUnique1 = focuselement.id;
						var accordianidUnique;
						if(accordianidUnique1 == "inp_numberofdrivers"){
							focuselement.focus();
						}
						else{
							accordianidUnique = accordianidUnique1.match(/\d/g);
							accordianidUnique = accordianidUnique.join("");
							if(!$("#infoadddri2_acccont"+accordianidUnique).is(":visible")){
								document.getElementById("accordion-idacc"+accordianidUnique).click();
							}
							focuselement.focus();
						}

					}
					else{
						// came from normal flow
						$("#additionalcoverageDivAdd").animate({ scrollTop: 0 }, "slow");
					}

				}
				else{
					showAlert("Please select your vehicle make & model");
				}

			}

			$("#searchmodelbox_btn").click(function(){
				document.getElementById("inp_vechiclemakemodel").blur();
				document.getElementById("inp_vechiclemakeyear").blur();
				document.getElementById("inp_vechiclecapacity").blur();
				var vechiclemakemodel = document.getElementById("inp_vechiclemakemodel").value;
				var vechiclemakeyear = document.getElementById("inp_vechiclemakeyear").value;
				var vechiclemakecapacity = document.getElementById("inp_vechiclecapacity").value;
				var VechicleRegionValue = $("#inp_policyholderregion option:selected").val();
				policyListCopy = [];
				var iaValidatedSearchFields = true;
				var ismodelEmpty = false;
				if(isEmpty(vechiclemakemodel)){
					showAlert("Please enter vehicle make & model");
					iaValidatedSearchFields = false;
					ismodelEmpty = true;
				}
				else if(!isEmpty(vechiclemakeyear)){
					var idyearValidated = yearValidationsearch(vechiclemakeyear);
					iaValidatedSearchFields = idyearValidated;
				}
				if(iaValidatedSearchFields){
					pagenumberCount = 1;
					makemodelsearchfn();

				}
				else{
					//validation Failed
					if(!ismodelEmpty)
					showAlert("Please enter valid year");
				}
			});

			function makemodelsearchfn(){
			if(checkOnline()){
				var vechiclemakemodel = document.getElementById("inp_vechiclemakemodel").value.trim();
				var vechiclemakeyear = document.getElementById("inp_vechiclemakeyear").value;
				var vechiclemakecapacity = document.getElementById("inp_vechiclecapacity").value;
				var VechicleRegionValue = $("#inp_policyholderregion option:selected").val();
				var newRegOrOldReg = document.getElementsByName("InsurType");
				var newRegOrOldRegdata = radiobuttonId(newRegOrOldReg);
				var request = { agentid: getItem("agentcode") ,pageno:pagenumberCount,pagesize:"10", vehmakemadelsearch : vechiclemakemodel.toUpperCase(), yearSearch : vechiclemakeyear, capacitysearch : vechiclemakecapacity, regioncode : VechicleRegionValue, cncondition: newRegOrOldRegdata};
				Apiservicecall(function(result)
				{
					if(result.status==1)
					{
						var response=result.response;
						console.log(response.data);

						if (response.data != null) {
							for(var i=0;i<response.data.length;i++){
								policyListCopy.push(response.data[i]);
							}
							pagecountstop = false;
						}
						else{
							pagecountstop = true;
						}
						loadTable(policyListCopy);
						setItem("searchmodeltable",JSON.stringify(policyListCopy));
						$('.loading-mask').addClass('stop-loading');
						$("#search_model_tab_div").show();
					}
					else {
						console.log("Failure case");
						$('.loading-mask').addClass('stop-loading');
					}
				},p2_makemodel,request);
			  }
			}


			function loadTable(tableData,pagenumbereDefault){
					//search-model-table
					$('.search-model-table-section').empty();
					var isbtnvisible = false;
					if(tableData != null && tableData.length != 0){
						var tablelength = 0;
						isbtnvisible = true;
						while(tablelength<tableData.length){
							if(tablelength == 0)
								$(".search-model-table-section").append("<table><tr><td>Select</td><td><div class='axa-radio axa-clearfix radio-button'><div class='radio-bullet-replacement checked' name='modelbuttonreplacement'></div><input class='axa-radio-input radio-bullet' type='radio' name='Searchmodelradio' value='selected' data-name='Searchmodelradio' onclick='radiobuttonclick(this,3);' checked></div></td></tr><tr><td>Model Description</td><td>"+tableData[tablelength].makemodeldesc+"</td></tr><tr><td>Market Value</td><td>"+tableData[tablelength].marketvalue+"</td></tr><tr><td>Vehicle Capacity</td><td>"+tableData[tablelength].enginecapacity+"</td></tr></table>");
							else
								$(".search-model-table-section").append("<table><tr><td>Select</td><td><div class='axa-radio axa-clearfix radio-button'><div class='radio-bullet-replacement' name='modelbuttonreplacement'></div><input class='axa-radio-input radio-bullet' type='radio' name='Searchmodelradio' value='selected' data-name='Searchmodelradio' onclick='radiobuttonclick(this,3);'></div></td></tr><tr><td>Model Description</td><td>"+tableData[tablelength].makemodeldesc+"</td></tr><tr><td>Market Value</td><td>"+tableData[tablelength].marketvalue+"</td></tr><tr><td>Vehicle Capacity</td><td>"+tableData[tablelength].enginecapacity+"</td></tr></table>");
							tablelength++;
						}
					}
					else{
						isbtnvisible = false;
						$(".search-model-table-section").append("<table><tr><td style='padding-left: 0; text-align: center;'>No Records Found</td></tr></table>");

					}
					if(isbtnvisible){
						$("#div_selectmodelbox_btn").attr("style","display:block");
					}
					else
					{
						$("#div_selectmodelbox_btn").attr("style","display:none");
					}
			}


			$("#div_selectmodelbox_btn").click(function(){
					var tablediv = $(".search-model-table-section");
					var tableiterate = 0;
					var searchtableres = JSON.parse(getItem("searchmodeltable"));
					while(tableiterate<tablediv[0].childNodes.length){
						if(tablediv[0].childNodes[tableiterate].childNodes[0].childNodes[0].childNodes[1].childNodes[0].childNodes[0].classList.contains('checked')){
							/* vehicle information */
							document.getElementById("inp_vehiclemarketprice").value = currencyformat(searchtableres[tableiterate].marketvalue, "");
							document.getElementById("inp_enginecapacity").value = searchtableres[tableiterate].enginecapacity;

							if(!isEmpty(searchtableres[tableiterate].bodycode)){
								$("#inp_vehiclebody").val(searchtableres[tableiterate].bodycode).attr("selected","selected");
							}
							else{
							}

							document.getElementById("inp_makemodelyear").value = searchtableres[tableiterate].makemodeldesc;
							/* Ncd market value */
							document.getElementById("inp_ncdvehmarval").value = currencyformat(searchtableres[tableiterate].marketvalue, "");
							document.getElementById("inp_suminsured").value = searchtableres[tableiterate].marketvalue;
							document.getElementById("inp_seatcapacity").value = searchtableres[tableiterate].seatingcapacity;
							document.getElementById("inp_manufactureryear").value = searchtableres[tableiterate].manufactureyear;
							ncdCalculations(searchtableres[tableiterate].marketvalue,0,"");
							resetVehUsageCov();
							setItem("vehiclemakecode", searchtableres[tableiterate].makecode);
							setItem("vehiclemodelcode", searchtableres[tableiterate].modelcode);
							setItem("vehiclebodydesc", searchtableres[tableiterate].bodydesc);
							setItem("vehiclebodycode", searchtableres[tableiterate].bodycode);
							nvicnumber = searchtableres[tableiterate].nvic;
							$("#vehicledetailsdiv").show();
							$("#page4").hide();
							break;
						}
						tableiterate++;
					}
			});

			$("#saveQuote_btn").click(function(){
				savedOrPremiumCalled = true;
				if(!isEmpty(retrivequoteJSON)){
					var isRetriveQuoteValid = isRetriveQuoteValidfn();
					if(isRetriveQuoteValid){
						if(retrivequoteJSON.savequoteind == "Y"){
							saveQuoteFn("Y");
						}
						else{
							saveQuoteFn("Y");
						}
					}
					else{
						saveQuoteFn("N");
					}
				}
				else{
					saveQuoteFn("N");
				}
			});

			function isRetriveQuoteValidfn(){
				var JSONValue1 = retrivequoteJSON;
				var isValidated = false;
				if(!isEmpty(getItem("premiumresponse"))){
					if(JSONValue1.flasquotationno == JSON.parse(getItem("premiumresponse")).data.flquoteno){
						return false;
					}
					else{
						return true;
					}
				}
				else{
					return true;
				}
			}

			function saveQuoteFn(isretrive){
				var flquoteNumber = "";
				var premiumName = "";
				var vehRegNumber = "";
				var quotationIdRes = "";
				var refercoderes = "";

				if(isretrive=="N"){
					var premium_response = JSON.parse(getItem("premiumresponse"));
					flquoteNumber = premium_response.data.flquoteno;
					premiumName = premium_response.data.name;
					vehRegNumber = premium_response.data.regno;
					quotationIdRes = premium_response.quotationId;
					refercoderes = premium_response.data.refercode;
					
				}
				else{
					var retriveQuoteJSONVal = retrivequoteJSON;
					console.log(retriveQuoteJSONVal);
					flquoteNumber = retriveQuoteJSONVal.flasquotationno;
					premiumName = retriveQuoteJSONVal.insuredname;
					vehRegNumber = retriveQuoteJSONVal.vehicleregistno;
					quotationIdRes = retriveQuoteJSONVal.quotationid;
					refercoderes = retriveQuoteJSONVal.refercode;
				}
				// save quote
				var request =  {
					agentid: getItem("agentcode"),
					flquoteno: flquoteNumber,
					name:premiumName,
					quoteno:null,
					regno:vehRegNumber,
					quotationid: quotationIdRes,
					refercode: refercoderes
				}

					console.log(request);
					//premium call
					if(checkOnline()){
					Apiservicecallp2(function(result)
					{
						if(result.status==1)
						{
							if(!isEmpty(result.response.data))
							{
								console.log(result);
								if(!isEmpty(result.response.quotationrecep)){
									pdfBaseData = result.response.quotationrecep;

								}
								if(!isEmpty(result.response.data.flquoteno)){
									quotenumbersaveQuote = result.response.data.flquoteno;
								}
								showAlertPolicysuccess("Quotation:"+result.response.data.flquoteno+" saved successfully!","Are you sure you want to proceed without quotation share?");
								$("#saveQuote_btn").attr("disabled","disabled");
								$("#saveQuote_btn").addClass("p2_disablebtn");
								$("#shareQuote_btn").removeAttr("disabled");
								$("#shareQuote_btn").removeClass("p2_disablebtn");
								$("#EditQuote_btn").removeAttr("disabled");
								$("#EditQuote_btn").removeClass("p2_disablebtn");
								$('#quotecreateddate_tr').removeClass('p2_quotation_tble_none').addClass('p2_quotation_tble_block');
								$('#quoteexpireddate_tr').removeClass('p2_quotation_tble_none').addClass('p2_quotation_tble_block');
								canbackproceed = false;
								if(!isEmpty(result.response.quotecreationdate) && !isEmpty(result.response.data.quovaliditydate)){
									document.getElementById("lab_quotecreatedate").innerHTML = dateFormatchangeFromRetrive(result.response.quotecreationdate);
									document.getElementById("lab_quoteexpiredate").innerHTML = dateFormatchangeFromRetrive(result.response.data.quovaliditydate);
								}
								else{
									// Nothing should be done
								}
								isSavedQuoteSuccess = true;

							}
							else{
								if(!isEmpty(result.response.message)){
										showAlert("Transaction fail - "+result.response.message);
										$('#quotecreateddate_tr').removeClass('p2_quotation_tble_block').addClass('p2_quotation_tble_none');
										$('#quoteexpireddate_tr').removeClass('p2_quotation_tble_block').addClass('p2_quotation_tble_none');
								}
								else{
								showAlert("Oops! Something went wrong, please try again later.", false);
								console.log("failure case");
								}
							}
						}
						else {
							console.log("failure case");
							//oops some thing went wrong case
							canbackproceed = true;
						}
					},p2_savequote,request);
			}
		}

				$("#shareQuote_btn").click(function(){
					if(!isEmpty(pdfBaseData) && !isEmpty(quotenumbersaveQuote)){
						//var messages = "Quotation generated successfully";
						var DefaultString = "data:application/pdf;base64,";
						receiptstream = DefaultString.concat(pdfBaseData);
						var createddate=quotenumbersaveQuote;
						var message = "";
						var subject = "";
						var options = {
							message: message ,
							subject: createddate,
							files: [receiptstream],
							url: "",
						};
						var onSuccess = function(result) {
						console.log("Share completed? " + result.completed);
						console.log("Shared to app: " + result.app);
						};
				
						var onError = function(msg) {
						console.log("Sharing failed with message: " + msg);
						};
				
						window.plugins.socialsharing.shareWithOptions(options, onSuccess, onError);
					}
					else{
						showAlert("Oops! Something went wrong, please try again later.", false);
					}
				});

			  jQuery(document).ready(function ($) {
				$('.add').on('click', function () {
				  var cc = $(this).prev();
				  cc.append('<li><div>Yeah</div><div>Test</div></li>');
				  cc.smk_Accordion('refresh');
				});

				//accordian
			   var acc = document.getElementsByClassName("accordationToogleUpDown");
				  var i;
				  for (i = 0; i < acc.length; i++) {
					acc[i].onclick = function(e) {
								var panel = this.nextElementSibling;
								if ($(this).find('.arrow').hasClass('arrowUp')) {
									$(this).find('.arrow').removeClass('arrowUp').addClass('arrowDown');
								}
								else if($(this).find('.arrow').hasClass('arrowDown')){
									$(this).find('.arrow').removeClass('arrowDown').addClass('arrowUp');
								}
					  if (panel != null) {
									this.classList.toggle("active");
						if (panel.style.display === "block") {
										var contentid = panel.id;
										$("#"+contentid).slideUp('fast');
						} else {
										var contentid = panel.id;
										$("#"+contentid).slideDown('fast');
						}
					  }
					}
				}
			  });

			$(function(){
				$("#range").ionRangeSlider({
						grid: true,
						min: 0,
						max: 100,
						from: 50,
						to: 100,
					});
			})
			function commonmasterCoverageChange(domelementid, isretrive, isOnclickPress){
			var sel_vehiclecoverage = $("#sel_vehiclecoverage option:selected").val();
							console.log("selected coverage 1 :",sel_vehiclecoverage);
						
									$('#sel_piamdriver option[value=0]').prop('selected', true);
									$('#sel_piamdriver').empty();
									$('#sel_piamdriver').append("<option value='0'>-- Please Select --</option>")
									
									// resetting additional coverage
									if(document.getElementById("ckUNAM").checked){
										$('#ckUNAM').removeAttr("disabled","disabled");
										document.getElementById("ckUNAM").click();
										$('#ckNAME').removeAttr("disabled","disabled");
										if(document.getElementById("ckNAME").checked){
											document.getElementById("inp_numberofdrivers").value = 0;
											document.getElementById("ckNAME").click();
											$('#div_noofdriverslist').empty();
											
										}
									}
									else{
										$('#ckUNAM').attr("disabled","disabled");
										
										if(document.getElementById("ckNAME").checked){
											$('#ckNAME').removeAttr("disabled","disabled");
											document.getElementById("inp_numberofdrivers").value = 0;
											document.getElementById("ckNAME").click();
											$('#div_noofdriverslist').empty();
										}

									}
									
									var optionlength = document.getElementById("sel_piamdriver").options.length;
									if(optionlength > 1){
										//option length greater than 1
										$('#sel_piamdriver option[value=0]').prop('selected', true);
										$('#sel_piamdriver').empty();
										$('#sel_piamdriver').append("<option value='0'>-- Please Select --</option>")
									}
									commonmasterpiamdriverservice(p2_piamDriverList, 'sel_piamdriver', isretrive,isOnclickPiam);
								
									
									
									
			}

		

			function commonmasterCoverageservice(url, domelementid, isretrive, isOnclickPress){

					if($("#sel_vehicleusage option:selected").val()!='0')
					{
						var sel_vehicleusage = $("#sel_vehicleusage option:selected").val();
						$("#"+domelementid+"").blur();
						var request = { agentid: getItem("agentcode") , vehicletype: "" , usagecode: sel_vehicleusage};
						if(checkOnline()){
							Apidropdownservice(function(result)
							{
								$("#"+domelementid+"").empty();
								var response = result.response;
								if(!isEmpty(response)){
									console.log(result.response.status);
									console.log(result.response.data);
									$("#"+domelementid+"").append("<option value='0'>-- Please Select --</option>");
									for(var i=0;i<response.data.length;i++){
										$("#"+domelementid+"").append("<option value="+response.data[i].coveragecode+">"+response.data[i].coveragedesc.toUpperCase()+"</option>");
									}
									if(isretrive == "Y" && isOnclickPress == "N"){

										if(!isEmpty(getItem("ncdresponse"))){
											var ncdresponseData = JSON.parse(getItem("ncdresponse"));
											$("#sel_vehiclecoverage").val(ncdresponseData.data.covercode).attr("selected","selected");
										}
										else if(!isEmpty(retrivequoteJSON)){
											var retJson = retrivequoteJSON;
											$("#sel_vehiclecoverage").val(retJson.coveragecode).attr("selected","selected");
											if($("#sel_vehiclecoverage option:selected").val() == "VPPTP0201" || $("#sel_vehiclecoverage option:selected").val() == "VPPTP0202") {
												$("#loadingpercentage_tr").removeClass("p2_quotation_tble_none").addClass("p2_quotation_tble_block");
											}
											else{
												$("#loadingpercentage_tr").removeClass("p2_quotation_tble_block").addClass("p2_quotation_tble_none");
											}
										}
									}
									if(isretrive == "N"){
										//getItem("ncdresponse");
										if(!isEmpty(getItem("ncdresponse"))){
											var ncdresponseData = JSON.parse(getItem("ncdresponse"));
											console.log(JSON.parse(getItem("ncdresponse")));
											$("#sel_vehiclecoverage").val(ncdresponseData.data.covercode).attr("selected","selected");
										}
										else{
											// new registration
										}
									}
									var id = "#"+domelementid+"";
									console.log(id);
									console.log("selected coverage",sel_vehicleusage);
									
									if(document.getElementById("sel_piamdriver").length>0){
									$('#sel_piamdriver').empty();
									}
									$('#sel_piamdriver option[value=0]').prop('selected', true);
									$('#sel_piamdriver').append("<option value='0'>-- Please Select --</option>")
									commonmasterpiamdriverservice(p2_piamDriverList, 'sel_piamdriver', isretrive,isOnclickPiam);
									$('#sel_vehiclecoverage').removeAttr('disabled');

								}
								if(isretrive == "N"){
									// resetting additional coverage
									if(document.getElementById("ckUNAM").checked){
										$('#ckUNAM').removeAttr("disabled","disabled");
										document.getElementById("ckUNAM").click();
										$('#ckNAME').removeAttr("disabled","disabled");
										if(document.getElementById("ckNAME").checked){
											document.getElementById("inp_numberofdrivers").value = 0;
											document.getElementById("ckNAME").click();
											$('#div_noofdriverslist').empty();
										}
									}
									else{
										$('#ckUNAM').removeAttr("disabled","disabled");

										if(document.getElementById("ckNAME").checked){
											$('#ckNAME').removeAttr("disabled","disabled");
											document.getElementById("inp_numberofdrivers").value = 0;
											document.getElementById("ckNAME").click();
											$('#div_noofdriverslist').empty();
										}

									}
								}

								var newRegOrOldRegIn = document.getElementsByName("InsurType");
								newRegOrOldRegIn = radiobuttonId(newRegOrOldRegIn);
								if(newRegOrOldRegIn != "new"){
									$("#sel_vehicleusage").attr("disabled","disabled");
									$("#sel_vehiclecoverage").attr("disabled","disabled");
								}

							// resetting additional coverage
							},url,request);
				}
					}
					else{
					$("#"+domelementid+"").blur();
					}
			}

			function ncdCalculations(marketprice,update,updateVal){
				var ncdStartVal;
				var ncdendVal;
				var ncdstartmidVal;
				var ncdendmidVal;
				var finalMarketVal;
				var ncd_restrictPrice = ((parseInt(marketprice)/100)*10);
				ncdStartVal = (parseInt(marketprice)-ncd_restrictPrice);
				ncdendVal = (parseInt(marketprice)+ncd_restrictPrice);
				var slider = $("#range").data("ionRangeSlider");
				if(marketprice == 0){
					$(".slider").addClass("p2_displaynone");
				}
				else{
					$(".slider").removeClass("p2_displaynone");
					if(update == 1){
						var newRegOrOldReg = document.getElementsByName("InsurType");
						newRegOrOldReg = radiobuttonId(newRegOrOldReg);
						finalMarketVal = updateVal;
						document.getElementById("sumInsuredError").innerHTML = "";
						if((parseInt(ncdStartVal) > parseInt(updateVal) ||( isEmpty(updateVal)))){
							if(newRegOrOldReg == "new"){
								document.getElementById("sumInsuredError").innerHTML = "Your vehicle does not get less than 10% of Market Value";
							}
							else{
								document.getElementById("sumInsuredError").innerHTML = "Your vehicle does not get less than 10% of Agreed Value";
							}
						}
						else if(parseInt(ncdendVal) < parseInt(updateVal))
						{
							if(newRegOrOldReg == "new"){
								document.getElementById("sumInsuredError").innerHTML = "Your vehicle does not get greater than 10 % of Market Value";
							}
							else{
								document.getElementById("sumInsuredError").innerHTML = "Your vehicle does not get greater than 10% of Market Value";
							}
						}
						else{
							document.getElementById("sumInsuredError").innerHTML = "";
							slider.update({
								grid: true,
								min: ncdStartVal,
								max: ncdendVal,
								from: finalMarketVal,
								to: ncdendVal,
							});
						}
					}
					else if(update == 0){
						slider.update({
								grid: true,
								min: ncdStartVal,
								max: ncdendVal,
								from: marketprice,
								to: ncdendVal,
								polyfill: false
							});
					}
				}
			}

			function sliderchange(defaultvaluechange){
				spaceandmaxlengthsplice(defaultvaluechange);
				var marketVal = document.getElementById("inp_ncdvehmarval").value;
				console.log(marketVal);
				var marketvalstring = marketVal.toString();
				var newval = marketvalstring.split(',').join("").split(".")[0];
				console.log(newval);
				if(!isEmpty(marketVal) && newval!=0){
					console.log(defaultvaluechange.id)
					if( defaultvaluechange.id == "inp_suminsured"){
						ncdCalculations(newval,1,defaultvaluechange.value);
					}
					else{
						document.getElementById("inp_suminsured").value = defaultvaluechange.value;
						document.getElementById("sumInsuredError").innerHTML = "";
					}
				}
				else if(!isEmpty(marketVal) && newval==0){
					//market value 0
				}
				else{
					$('#inp_suminsured').blur();
					$('#inp_suminsured').val('');
					showAlert("Please select your vehicle make & model");
				}
			}

			//save quote success
			 function showAlertPolicysuccess(message, message2) {
				$('#showpop').empty();
				$('#showpop').append("<h5>Message</h5><p class='showAlertPolicysuccess' id='para_messageid'>" + message + "</p><p class='showAlertPolicysuccess' id='para_messageid'>" + message2 + "</p><br/><button class='popup-btn' id='comm-dismissquotation' onclick=quotesuccess(true)>NO</button><button class='popup-btn' id='comm-dismissDashboard' onclick=quotesuccess(false)>YES</button>");
				show('showpop');
			  }

			function quotesuccess(CurrentValue){

				if(CurrentValue){
					hide('showpop');
					$('#showpop').empty();
				}
				else{
					hide('showpop');
					$('#showpop').empty();
					localStorage.removeItem("premiumresponse");
					localStorage.removeItem("searchmodeltable");
					location.href='dashboard.html';
				}
			}

			function accordiangenerate(elementaccordian){
				if (elementaccordian.value.length > elementaccordian.maxLength)
				elementaccordian.value = elementaccordian.value.slice(0, elementaccordian.maxLength);
				console.log(elementaccordian.id);
				console.log(elementaccordian.value);
				var driveraccordianlength = $('#div_noofdriverslist').find('.accordianfromlist');
				console.log("helo" +driveraccordianlength.length);
				var numberofDriver = document.getElementById("inp_numberofdrivers").value;
				var todayDate = new Date().getDate();
				if($("#sel_piamdriver").val() == 01){
					if(numberofDriver == 1){
						accordiangenerateGeneralbasedpiam();
					}
				}
				else{
					if(numberofDriver <= 0){
						var i = oldValueForAdditionalnamedcount+1;
						console.log(i);
						$("#div_noofdriverslist").append("<div class='accordion-content accordianfromlist accordationToogleUpDownadditional' id='addNamDriv_add_con'><form id='email-form' name='email-form' data-name='Email Form' action='#'><ul class='smk_accordion named-driver-acc'><li class='accordion-toggle'><div class = 'accordationToogleUpDown' id='accordion-idacc"+i+"' onclick='accordianfromlist(this);'><h3 class='add-on-input-sec-acc' style='line-height: 1; margin: 0px 0px 4px 0px; font-size: 93.8%; color: #464545; font-weight: 600; padding: 12px 10px 6px 10px; margin-left: 5px;'><span style='width:5%; text-align: left;float:left;margin-left:0px;margin-right:10px;' class='arrow arrowDown'></span><span style='width:80%;display:inline-block;font-weight:500;'>Information of additional driver</span><a id='accordion-idtrash"+i+"' style='width:8%;text-align: right;float:right;' onclick = 'trashadditionalnameddri(this);'><i style='font-size:21px;float:right;margin-left:5px;color:#333;' class='icon ion-ios-trash'></i></a></h3> </div><div class='accordion-content' id='infoadddri2_acccont"+i+"'><div class='form-group'><label class='axa-form-label'>Driver Name</label><input class='input-form' id='accordion_driverName"+i+"' type='text' oninput='maxlengthspice(this);' maxlength='25'></div><div class='form-group'><label class='axa-form-label'>New IC</label><input class='input-form' id='inp_newIc"+i+"' oninput='maxdigitrestrict(this);' onblur='newICAdditionalcoverageLst(this)' type = 'number' maxlength = '12'></div><div class='form-group'><label class='axa-form-label'>Other IC</label><input class='input-form' id='accordion_otherIc"+i+"' oninput='maxdigitrestrict(this);' type = 'text' maxlength = '30'></div><div class='form-group'><label class='axa-form-label'>Date of Birth</label><div class='block-input-combined'><input class='axa-input input-form left floating-label startDateExpiryDate"+i+"' id='expiryfromdate"+i+"' type='datepickerVD'  name='location'></div></div><div class='form-group'><label class='axa-form-label'>Driving Experience (years)</label><input class='input-form' pattern='[0-9]*' id='accordion_drivingExper"+i+"'  oninput='maxdigitrestrict(this);' type = 'number' maxlength = '2'></div><div class='form-group'><label class='axa-form-label'>Occupation</label><select type='text' id='occupation"+i+"' class='input-form'><option value='0'>-- Please Select --</option></select></div></div></li></ul></form></div>");
						var responseVal = JSON.parse(localStorage.getItem("occupationListJSON"));
						for(var j=0;j<responseVal.length;j++){
							$("#occupation"+i).append( "<option value="+responseVal[j].masteDataCode+">"+responseVal[j].masterDataDesc.toUpperCase()+"</option>");
						}
						$(".startDateExpiryDate"+i).bootstrapMaterialDatePicker({ time:false, maxDate: new Date() }).on('change', function(e, date){});
					}
					else if(!(numberofDriver >= 50 ) && numberofDriver >= 1){
						accordiangenerateGeneralbasedpiam();
					}
					else{
						$("#para_numberofdriver").css("display","block");
					}
				}
			}

			function accordiangenerateGeneralbasedpiam(){
				var totalLength;
				var driveraccordianlength;
				var FullId;
				if((isRetriveQuoteRecord == true) && (retriveIdAdditionalNamed == false)){
					driveraccordianlength = $('#div_noofdriverslist').find('.accordianfromlist');
					totalLength = driveraccordianlength.length-1;
					FullId = driveraccordianlength[totalLength].childNodes[0][1].id;
					retriveIdAdditionalNamed = true;
				}
				else{
					driveraccordianlength = $('#div_noofdriverslist').find('.accordianfromlist');
					console.log(driveraccordianlength)
					FullId = driveraccordianlength[0].childNodes[0][1].id;

				}
				var lastdigit = parseInt(FullId[FullId.length -1])+1;
				var lastseconddigit = parseInt(FullId[FullId.length -2]);
				var lastthirddigit = parseInt(FullId[FullId.length -3]);
				if(lastdigit.toString()[lastdigit.toString().length -1] == 0){
					lastdigit+=1;
				}
				if(lastseconddigit.toString()[lastseconddigit.toString().length -1] == 0){
					lastseconddigit+=1;
				}
				if(lastthirddigit.toString()[lastthirddigit.toString().length -1] == 0){
					lastthirddigit+=1;
				}

				var i = lastdigit;
				if(!isNaN(lastseconddigit)){

					if(!isNaN(lastthirddigit)){
						i = parseInt(lastthirddigit+""+lastseconddigit+""+lastdigit)+1;
					}
					else{
						i = parseInt(lastseconddigit+""+lastdigit)+1;
					}

					console.log("lastdigit"+lastdigit);
					console.log("lastseconddigit"+lastseconddigit);
					console.log("lastthirddigit"+lastthirddigit);
					console.log("Current Id"+FullId+"current i:"+i);

				}
				var overallDivCount = document.getElementById("accordion-idacc"+oldValueForAdditionalnamedcount);
				$("#div_noofdriverslist").prepend("<div class='accordion-content accordianfromlist accordationToogleUpDownadditional' id='addNamDriv_add_con'><form id='email-form' name='email-form' data-name='Email Form' action='#'><ul class='smk_accordion named-driver-acc'><li class='accordion-toggle'><div class = 'accordationToogleUpDown' id='accordion-idacc"+i+"' onclick='accordianfromlist(this);'><h3 class='add-on-input-sec-acc' style='line-height: 1; margin: 0px 0px 4px 0px; font-size: 93.8%; color: #464545; font-weight: 600; padding: 12px 10px 6px 10px; margin-left: 5px;'><span style='width:5%; text-align: left;float:left;margin-left:0px;margin-right:10px;' class='arrow arrowDown'></span><span style='width:80%;display:inline-block;font-weight:500;'>Information of additional driver</span><a id='accordion-idtrash"+i+"' style='width:8%;text-align: right;float:right;' onclick = 'trashadditionalnameddri(this);'><i style='font-size:21px;float:right;margin-left:5px;color:#333;' class='icon ion-ios-trash'></i></a></h3> </div><div class='accordion-content' id='infoadddri2_acccont"+i+"'><div class='form-group'><label class='axa-form-label'>Driver Name</label><input class='input-form' type='text' id='accordion_driverName"+i+"'  oninput='maxlengthspice(this);' maxlength='25'></div><div class='form-group'><label class='axa-form-label'>New IC</label><input class='input-form' id='inp_newIc"+i+"' oninput='maxdigitrestrict(this);' onblur='newICAdditionalcoverageLst(this)' type = 'number' maxlength = '12'></div><div class='form-group'><label class='axa-form-label'>Other IC</label><input class='input-form' id='accordion_otherIc"+i+"' oninput='maxdigitrestrict(this);' type = 'text' maxlength = '30'></div><div class='form-group'><label class='axa-form-label'>Date of Birth</label><div class='block-input-combined'><input class='axa-input input-form left floating-label startDateExpiryDate"+i+"' id='expiryfromdate"+i+"' type='datepickerVD'  name='location'></div></div><div class='form-group'><label class='axa-form-label'>Driving Experience (years)</label><input class='input-form' pattern='[0-9]*' id='accordion_drivingExper"+i+"' oninput='maxdigitrestrict(this);' type = 'number' maxlength = '2'></div><div class='form-group'><label class='axa-form-label'>Occupation</label><select type='text' id='occupation"+i+"' class='input-form'><option value='0'>-- Please Select --</option></select></div></div></li></ul></form></div>");
				var responseVal = JSON.parse(localStorage.getItem("occupationListJSON"));
				for(var j=0;j<responseVal.length;j++){
					$("#occupation"+i).append( "<option value="+responseVal[j].masteDataCode+">"+responseVal[j].masterDataDesc.toUpperCase()+"</option>");
				}
				$(".startDateExpiryDate"+i).bootstrapMaterialDatePicker({ time:false, maxDate: new Date() }).on('change', function(e, date){});
			}


			function newICAdditionalcoverageLst(CurrentElement){
				console.log(CurrentElement.id);
				var CurrentElementIdLastDigit = CurrentElement.id[CurrentElement.id.length -1];
				var CurrentElementPairDate = document.getElementById("expiryfromdate"+CurrentElementIdLastDigit);
				console.log(CurrentElementPairDate);
				var icnumberfromadditional = document.getElementById(CurrentElement.id).value;
				if(icnumberfromadditional.length == 12){
					var icnumberfromadditionalsplit = icnumberfromadditional.slice(0, 6);
					console.log(icnumberfromadditionalsplit)
					var isvalidate = AdditionalCovICDOBValidate(icnumberfromadditionalsplit);
					if(isvalidate){
						AdditionalCovICDOBValidatedSplitDOB(icnumberfromadditionalsplit, CurrentElementIdLastDigit,CurrentElement);
					}
					else{
						showAlert("Additional Named Driver - Please enter valid New IC number.");
						var numberinDatePickerId = CurrentElement.id.match(/\d/g);
						numberinDatePickerId = numberinDatePickerId.join("");
						document.getElementById("inp_newIc"+numberinDatePickerId).value = "";
						document.getElementById("expiryfromdate"+numberinDatePickerId).value = "";
						$("#expiryfromdate"+numberinDatePickerId).removeAttr("disabled","disabled");
					}
				}
				else if(icnumberfromadditional.length == 0){

				}
				else{
					var numberinDatePickerId = CurrentElement.id.match(/\d/g);
					numberinDatePickerId = numberinDatePickerId.join("");
					document.getElementById("expiryfromdate"+numberinDatePickerId).value = "";
					$("#expiryfromdate"+numberinDatePickerId).removeAttr("disabled","disabled");
				}
			}
			function AdditionalCovICDOBValidatedSplitDOB(currentElementIcnumber, CurrentElementIdLastDigit,CurrentElement){
				var IcSplitYear = currentElementIcnumber.slice(0, currentElementIcnumber.length-4);
				var IcSplitMonth = currentElementIcnumber.slice(0, currentElementIcnumber.length-2);
				var IcSplitdigitMonth = IcSplitMonth.substring(2);
				var IcSplitdigitdays = currentElementIcnumber.substring(4);
				var yearsplitdigit = IcSplitYear.substring()[0];
				if( yearsplitdigit == "0"  || yearsplitdigit == "1"){
					IcSplitYear = "20"+IcSplitYear;
				}
				else
				{
					IcSplitYear = "19"+IcSplitYear;
				}
				var numberinDatePickerId = CurrentElement.id.match(/\d/g);
				numberinDatePickerId = numberinDatePickerId.join("");
				document.getElementById("expiryfromdate"+numberinDatePickerId).value = IcSplitdigitdays+"/"+IcSplitdigitMonth+"/"+IcSplitYear;
				$("#expiryfromdate"+numberinDatePickerId).attr("disabled","disabled");
			}

			function AdditionalCovICDOBValidate(currentElementIcnumber){
				var isValidatedAdd = false;
				if(IcnumberDateofbirthValidation(currentElementIcnumber,"Y")){
					var IcSplitYear = currentElementIcnumber.slice(0, currentElementIcnumber.length-4);
					var IcSplitMonth = currentElementIcnumber.slice(0, currentElementIcnumber.length-2);
					var IcSplitdigitMonth = IcSplitMonth.substring(2);
					var IcSplitdigitdays = currentElementIcnumber.substring(4);
					var yearsplitdigit = IcSplitYear.toString()[0];
					if( yearsplitdigit == "0"  || yearsplitdigit == "1"){
						IcSplitYear = "20"+IcSplitYear;
					}
					else
					{
						IcSplitYear = "19"+IcSplitYear;
					}
					var yearValidated = yearValidationsearch(IcSplitYear);
					if(yearValidated){
						var findLeapYear = (IcSplitYear % 100 === 0) ? (IcSplitYear % 400 === 0) : (IcSplitYear % 4 === 0);
						if(IcSplitdigitMonth <= 12){
							if(IcSplitdigitMonth == 01 || IcSplitdigitMonth == 03 || IcSplitdigitMonth == 05 || IcSplitdigitMonth == 07 || IcSplitdigitMonth == 08 || IcSplitdigitMonth == 10 || IcSplitdigitMonth == 12)
							{
								if(IcSplitdigitdays == 00){
									showAlert("Additional Named Driver - Please enter valid New IC number.");
									isValidatedAdd = false;
								}
								else if(IcSplitdigitdays<=31){
									isValidatedAdd = true;
								}
								else{
									showAlert("Additional Named Driver - Please enter valid New IC number.");
									isValidatedAdd = false;
								}
							}
							else if(IcSplitdigitMonth == 02 )
							{
								if(findLeapYear){
									if(IcSplitdigitdays == 00){
										showAlert("Additional Named Driver - Please enter valid New IC number.");
										isValidatedAdd = false;
									}
									else if(IcSplitdigitdays<=29){
										isValidatedAdd = true;
									}
									else{
										showAlert("Additional Named Driver - Please enter valid New IC number.");
										isValidatedAdd = false;
									}
								}
								else{
									if(IcSplitdigitdays == 00){
										showAlert("Additional Named Driver - Please enter valid New IC number.");
										isValidatedAdd = false;
									}
									else if(IcSplitdigitdays<=28){
										isValidatedAdd = true;
									}
									else{
										showAlert("Additional Named Driver - Please enter valid New IC number.");
										isValidatedAdd = false;
									}
								}
							}
							else if(IcSplitdigitMonth == 04 || IcSplitdigitMonth == 06 || IcSplitdigitMonth == 09 || IcSplitdigitMonth == 11 )
							{
								if(IcSplitdigitdays == 00){
									showAlert("Additional Named Driver - Please enter valid New IC number.");
									isValidatedAdd = false;
								}
								else if(IcSplitdigitdays<=30){
									isValidatedAdd = true;
								}
								else{
									showAlert("Additional Named Driver - Please enter valid New IC number.");
									isValidatedAdd = false;
								}
							}
							else{
								showAlert("Additional Named Driver - Please enter valid New IC number.");
								isValidatedAdd = false;
							}
						}
						else{
							showAlert("Additional Named Driver - Please enter valid New IC number.");
							isValidatedAdd = false;
						}
					}
					else{
						showAlert("Additional Named Driver - Please enter valid New IC number.");
						isValidatedAdd = false;
					}
					return isValidatedAdd;
			}
			else{
				return isValidatedAdd;
			}
			}

			function increaseValue() {
				var value = parseInt(document.getElementById('inp_numberofdrivers').value);
				value = isNaN(value) ? 0 : value;
				if(value != "50"){
					oldValueForAdditionalnamedcount = value;
					value++;
				}

				accordiangenerate(document.getElementById("inp_numberofdrivers"));

				if($("#sel_piamdriver").val() == 01){
					document.getElementById("inp_numberofdrivers").value = "2";
				}
				else{
					document.getElementById('inp_numberofdrivers').value = value;
				}
			}

			function decreaseValue() {
				var value = parseInt(document.getElementById('inp_numberofdrivers').value);
				value = isNaN(value) ? 0 : value;
				value < 1 ? value = 1 : '';
				value--;
				document.getElementById('inp_numberofdrivers').value = value;
				accordiangenerate(document.getElementById("inp_numberofdrivers"));
			}

			function commonmasteraddcovservice(url, domelementid, isretrive){
				if($("#vehtype_select option:selected").val()!='0')
				{
					var sel_vehicletype = $("#vehtype_select option:selected").val();
					var request = { agentid: getItem("agentcode") , vehicletype: sel_vehicletype};
					if(checkOnline()){
						Apidropdownservice(function(result)
						{
							var response = result.response;
						if(!isEmpty(response)){
							console.log(result.response.status);
							console.log(result.response.data);
							if(domelementid == "add-on-check"){
								for(var i=0;i<response.data.length;i++){
									if(response.data[i].extcoveragecode == "ACER" || response.data[i].extcoveragecode == "ACES" || response.data[i].extcoveragecode == "NGVT" || response.data[i].extcoveragecode == "WSCR")
									$("."+domelementid+"").append("<div class='add-on-list-item'><div class='check-section'><div class='check-icon axa-col-12'><input type='checkbox' onclick='checkboxclicked(this);' id='ck"+response.data[i].extcoveragecode+"'  value="+response.data[i].extcoveragecode+" ><label class='label-content'>"+result.response.data[i].extcoveragedesc+"</label></div><div style='display:none;' class='add-on-input-sec' id="+response.data[i].extcoveragecode+"><label class='axa-form-label axa-margin-padding add-on-input-padding'>Sum Insured</label><input class='input-field-sm'             type='number'  id='sum"+response.data[i].extcoveragecode+"'       oninput='maxlengthspice(this);'  pattern='[0-9]*'    maxlength='6' placeholder=''></div></div></div>");
									else if(response.data[i].extcoveragecode == "CART")
									$("."+domelementid+"").append("<div class='add-on-list-item'><div class='check-section'><div class='check-icon axa-col-12'><input type='checkbox' onclick='checkboxclicked(this);' id='ck"+response.data[i].extcoveragecode+"'  value="+response.data[i].extcoveragecode+" ><label class='label-content'>"+result.response.data[i].extcoveragedesc+"</label></div><div style='display:none;' class='add-on-input-sec' id="+response.data[i].extcoveragecode+"><div><div><label class='axa-form-label axa-margin-padding add-on-input-padding'>Amount per day: RM</label><input class='input-field-sm' type='number'  id='amtperday"+response.data[i].extcoveragecode+"' oninput='maxlengthspice(this);'  pattern='[0-9]*'    maxlength='6' placeholder=''></div><div><label class='axa-form-label axa-margin-padding add-on-input-padding'>Day(s)</label><input class='input-field-xs' id='days"+response.data[i].extcoveragecode+"' type='number' pattern='[0-9]*' oninput='maxlengthspice(this);' maxlength='2' placeholder=''></div></div></div></div></div>");
									else if(response.data[i].extcoveragecode == "NAME")
									$("."+domelementid+"").append("<div class='add-on-list-item'><div class='check-section'><div class='check-icon axa-col-12'><input type='checkbox' onclick='checkboxclicked(this);' id='ck"+response.data[i].extcoveragecode+"'  value="+response.data[i].extcoveragecode+" ><label class='label-content'>"+result.response.data[i].extcoveragedesc+"</label></div></div><div style='display:none;' class='add-on-input-sec' id="+response.data[i].extcoveragecode+"><label class='axa-form-label axa-margin-padding add-on-input-padding'>No. of Driver(s)</label><input class='input-field-sm input-field-sm-jointcss' type='number'  id='inp_numberofdrivers' pattern='[0-9]*' value='0' maxlength='2' placeholder='' readonly><a onclick='increaseValue();'><i class='icon ion-plus-circled inp-sm-additional-add'></i></a><a onclick='resetadditionalnameddreiversReset();'><i style='font-size:24px;text-align: left;vertical-align: middle;margin-left:10px;color:#C21B17;' class='icon ion-ios-refresh'></i></a><p class='para_numberofdriver' style='color:red; display:none;'>Number of drivers should not exceed 10 </p><div id='div_noofdriverslist' style='padding-right:10px;'></div></div></div>");
									else if(response.data[i].extcoveragecode == "PASS")
									$("."+domelementid+"").append("<div class='add-on-list-item'><div class='check-section'><div class='check-icon axa-col-12'><input type='checkbox' onclick='checkboxclicked(this);' id='ck"+response.data[i].extcoveragecode+"'  value="+response.data[i].extcoveragecode+" ><label class='label-content'>"+result.response.data[i].extcoveragedesc+"</label></div><div style='display:none;' class='add-on-input-sec' id="+response.data[i].extcoveragecode+"><div><label class='axa-form-label axa-margin-padding add-on-input-padding'>Persons/Seat</label><input class='input-field-sm'       type='number'  id='inp_personalseat' pattern='[0-9]*' oninput='maxlengthspice(this);'      maxlength='2' placeholder=''></div></div></div></div>");
									else
									$("."+domelementid+"").append("<div class='add-on-list-item'><div class='check-section'><div class='check-icon axa-col-12'><input type='checkbox' onclick='checkboxclicked(this);' id='ck"+response.data[i].extcoveragecode+"'   value="+response.data[i].extcoveragecode+"><label class='label-content'>"+result.response.data[i].extcoveragedesc+"</label></div></div></div>");
								}
							}
							if(isretrive == "Y" && additionalcoverageretriveadded == false){
								var reJson = retrivequoteJSON;
								console.log(reJson.retriveExtCovResDOs);
								if(!isEmpty(reJson.retriveExtCovResDOs)){
									for(var additionacovcount = 0; additionacovcount < reJson.retriveExtCovResDOs.length; additionacovcount++){
										$("#ck"+reJson.retriveExtCovResDOs[additionacovcount].extcoveragecode).click();
										//sumACER
										addonList.push({ bencode : reJson.retriveExtCovResDOs[additionacovcount].extcoveragecode ,bendesc: reJson.retriveExtCovResDOs[additionacovcount].extcoveragedesc});
									}
									for(var additionacovcount2 = 0; additionacovcount2 < reJson.retriveExtCovResDOs.length; additionacovcount2++){
										//sumACER
										if(reJson.retriveExtCovResDOs[additionacovcount2].extcoveragecode == "ACER" || reJson.retriveExtCovResDOs[additionacovcount2].extcoveragecode == "ACES" || reJson.retriveExtCovResDOs[additionacovcount2].extcoveragecode == "NGVT" || reJson.retriveExtCovResDOs[additionacovcount2].extcoveragecode == "WSCR"){
											$("#sum"+reJson.retriveExtCovResDOs[additionacovcount2].extcoveragecode+"").val(reJson.retriveExtCovResDOs[additionacovcount2].benfitsuminsured);
										}
										if(reJson.retriveExtCovResDOs[additionacovcount2].extcoveragecode == "CART")
										{
											$("#amtperdayCART").val(reJson.retriveExtCovResDOs[additionacovcount2].benfitsuminsured);
											// need to change
											$("#daysCART").val(reJson.retriveExtCovResDOs[additionacovcount2].unit);
											// need to change
										}
										if(reJson.retriveExtCovResDOs[additionacovcount2].extcoveragecode == "NAME"){
											$("#inp_numberofdrivers").val(reJson.retriveNameDriverResDOs.length);
											var todayDate = new Date().getDate();
											for(var i=0;i<reJson.retriveNameDriverResDOs.length;i++){
												$("#div_noofdriverslist").append("<div class='accordion-content accordianfromlist accordationToogleUpDownadditional' id='addNamDriv_add_con'><form id='email-form' name='email-form' data-name='Email Form' action='#'><ul class='smk_accordion named-driver-acc'><li class='accordion-toggle'><div class = 'accordationToogleUpDown' id='accordion-idacc"+i+"' onclick='accordianfromlist(this);'><h3 class='add-on-input-sec-acc' style='line-height: 1; margin: 0px 0px 4px 0px; font-size: 93.8%; color: #464545; font-weight: 600; padding: 12px 10px 6px 10px; margin-left: 5px;'><span style='width:5%; text-align: left;float:left;margin-left:0px;margin-right:10px;' class='arrow arrowDown'></span><span style='width:80%;display:inline-block;font-weight:500;'>Information of additional driver</span><a id='accordion-idtrash"+i+"' style='width:8%;text-align: right;float:right;' onclick = 'trashadditionalnameddri(this);'><i style='font-size:21px;float:right;margin-left:5px;color:#333;' class='icon ion-ios-trash'></i></a></h3> </div><div class='accordion-content' id='infoadddri2_acccont"+i+"'><div class='form-group'><label class='axa-form-label'>Driver Name</label><input class='input-form' type='text' id='accordion_driverName"+i+"' oninput='maxlengthspice(this);' maxlength='25'></div><div class='form-group'><label class='axa-form-label'>New IC</label><input class='input-form' id='inp_newIc"+i+"' oninput='maxdigitrestrict(this);' onblur='newICAdditionalcoverageLst(this)' type = 'number' maxlength = '12'></div><div class='form-group'><label class='axa-form-label'>Other IC</label><input class='input-form' id='accordion_otherIc"+i+"' oninput='maxdigitrestrict(this);' type = 'text' maxlength = '30'></div><div class='form-group'><label class='axa-form-label'>Date of Birth</label><div class='block-input-combined'><input class='axa-input input-form left floating-label startDateExpiryDate"+i+"' id='expiryfromdate"+i+"' type='datepickerVD'  name='location'></div></div><div class='form-group'><label class='axa-form-label'>Driving Experience (years)</label><input class='input-form' pattern='[0-9]*' id='accordion_drivingExper"+i+"' oninput='maxdigitrestrict(this);' type = 'number' maxlength = '2'></div><div class='form-group'><label class='axa-form-label'>Occupation</label><select type='text' id='occupation"+i+"' class='input-form'><option value='0'>-- Please Select --</option></select></div></div></li></ul></form></div>");
												//occupation list
												var responseVal = JSON.parse(localStorage.getItem("occupationListJSON"));
												for(var j=0;j<responseVal.length;j++){
													$("#occupation"+i).append( "<option value="+responseVal[j].masteDataCode+">"+responseVal[j].masterDataDesc.toUpperCase()+"</option>");
												}
												$(".startDateExpiryDate"+i).bootstrapMaterialDatePicker({ time:false, maxDate: new Date() }).on('change', function(e, date){});
													var numberofDriver = document.getElementById("inp_numberofdrivers");
													var childnodesofacc = numberofDriver.nextElementSibling.nextElementSibling.nextElementSibling.nextElementSibling.childNodes;
													childnodesofacc[i].childNodes[0][0].value = reJson.retriveNameDriverResDOs[i].drivername;
													childnodesofacc[i].childNodes[0][1].value = reJson.retriveNameDriverResDOs[i].newicno.replace(/\-/g,"");
													childnodesofacc[i].childNodes[0][2].value = reJson.retriveNameDriverResDOs[i].oldicno;
													childnodesofacc[i].childNodes[0][3].value = dateofbirthadditionaldriver(reJson.retriveNameDriverResDOs[i].dateofbirth);
													childnodesofacc[i].childNodes[0][4].value = reJson.retriveNameDriverResDOs[i].drivingexperience;
													$("#occupation"+i).val(reJson.retriveNameDriverResDOs[i].occupationcode).attr("selected","selected");
											}
										}
										if(reJson.retriveExtCovResDOs[additionacovcount2].extcoveragecode == "PASS"){
											 $("#inp_personalseat").val(reJson.retriveExtCovResDOs[additionacovcount2].unit);
										}
										else{

										}
									}
									additionalcoverageretriveadded = true;
									console.log("HHHHHHHHHHHHHHHHHHHHHHHHHHHHH");
									console.log(addonList);
								}
								else{
									// additional coverage empty
								}
								commonmasterCoverageservice(p2_coverageList, 'sel_vehiclecoverage', isretrive2,isdropdownNotClick);
							}
							else{
								commonmasterCoverageservice(p2_coverageList, 'sel_vehiclecoverage', isretrive2,isdropdownNotClick);
							}
							if(isretrive == "Y"){
								postcodeviastateloading();
							}
							var id = "#"+domelementid+"";
							console.log(id);
						}
					},url,request);
				}
			}
				else{
					$("#"+domelementid+"").blur();
					showAlert("Please select vehicle type");
				}
			}

			function accordianfromlist(e){
				console.log(e);
				var acc2 = document.getElementsByClassName("accordationToogleUpDownadditional");
					var i;
					var commid = e.id;
					console.log(e);
					var panel = e.nextElementSibling;
					if($("#sel_piamdriver").val() == 01){
						var currentElementIdlastDigit = commid[commid.length-1];
						if(currentElementIdlastDigit == 1){
							if ($(e).find('.arrow').hasClass('arrowUp')) {
								$(e).find('.arrow').removeClass('arrowUp').addClass('arrowDown');
							}
							else if($(e).find('.arrow').hasClass('arrowDown')){
								$(e).find('.arrow').removeClass('arrowDown').addClass('arrowUp');
							}
						}
						else{
							if ($("#showpop").is(":visible")) {
							}
							else{
								if ($(e).find('.arrow').hasClass('arrowUp')) {
									$(e).find('.arrow').removeClass('arrowUp').addClass('arrowDown');
								}
								else if($(e).find('.arrow').hasClass('arrowDown')){
									$(e).find('.arrow').removeClass('arrowDown').addClass('arrowUp');
								}
							}
						}
					}
					else{
						if ($(e).find('.arrow').hasClass('arrowUp')) {
							$(e).find('.arrow').removeClass('arrowUp').addClass('arrowDown');
						}
						else if($(e).find('.arrow').hasClass('arrowDown')){
							$(e).find('.arrow').removeClass('arrowDown').addClass('arrowUp');
						}
					}
					if (panel != null) {
						if($("#sel_piamdriver").val() == 01){
							var currentElementIdlastDigit = commid[commid.length-1];
							if(currentElementIdlastDigit == 1){
								if (panel.style.display === "block") {
									$("#"+panel.id).slideUp('fast');
								}
								else {
									$("#"+panel.id).slideDown('fast');
								}
							}
							else{
								if ($("#showpop").is(":visible")) {
								}
								else{
									if (panel.style.display === "block") {
										$("#"+panel.id).slideUp('fast');
									}
									else {
										$("#"+panel.id).slideDown('fast');
									}
								}
							}
						}
						else{
							if (panel.style.display === "block") {
								$("#"+panel.id).slideUp('fast');
							}
							else {
								$("#"+panel.id).slideDown('fast');
							}
						}
					}
			};

		function checkboxclicked(elementchecked){
			console.log(elementchecked.value);
			if(elementchecked.value == "ACER" || elementchecked.value == "CART" || elementchecked.value == "ACES" || elementchecked.value == "NAME" || elementchecked.value == "PASS" || elementchecked.value == "NGVT" || elementchecked.value == "WSCR"){
				if(elementchecked.checked){
					console.log("checked");
					$("#"+elementchecked.value).css("display","block");

				}
				else {
					console.log("check removed");
					$("#"+elementchecked.value).css("display","none");
					$("#"+elementchecked.value).find(':input').val('');
					if(elementchecked.value == "NAME")
					$("#div_noofdriverslist").empty();

				}
			}
			if(elementchecked.value == "NAME"){
				//ckUNAM
				document.getElementById("inp_numberofdrivers").value = 0;
				if(elementchecked.checked){
					$('#ckUNAM').attr("disabled","disabled");
				}
				else{
					$('#ckUNAM').removeAttr("disabled","disabled");
				}
			}
			else if(elementchecked.value == "UNAM"){
				if(elementchecked.checked){
					$('#ckNAME').attr("disabled","disabled");
				}
				else{
					$('#ckNAME').removeAttr("disabled","disabled");
				}
			}
			else if(elementchecked.value == "DPPA5x"){
				if(elementchecked.checked){
					if(document.getElementById("ckDPPA5Cx").checked){
						document.getElementById("ckDPPA5Cx").click();
					}
					else if(document.getElementById("ckDPPA5Bx").checked){
						document.getElementById("ckDPPA5Bx").click();
					}
				}
			}
			else if(elementchecked.value == "DPPA5Bx"){
				if(elementchecked.checked){
					if(document.getElementById("ckDPPA5Cx").checked){
						document.getElementById("ckDPPA5Cx").click();
					}
					else if(document.getElementById("ckDPPA5x").checked){
						document.getElementById("ckDPPA5x").click();
					}
				}
			}
			else if(elementchecked.value == "DPPA5Cx"){
				if(elementchecked.checked){
					if(document.getElementById("ckDPPA5x").checked){
						document.getElementById("ckDPPA5x").click();
					}
					else if(document.getElementById("ckDPPA5Bx").checked){
						document.getElementById("ckDPPA5Bx").click();
					}
				}
			}
			else if(elementchecked.value == "DPPA5D"){
				if(elementchecked.checked){
					if(document.getElementById("ckDPPA5E").checked){
						document.getElementById("ckDPPA5E").click();
					}
				}
			}
			else if(elementchecked.value == "DPPA5E"){
				if(elementchecked.checked){
					if(document.getElementById("ckDPPA5D").checked){
						document.getElementById("ckDPPA5D").click();
					}
				}
			}
			else if(elementchecked.value == "DPPA5H"){
				if(elementchecked.checked){
					if(document.getElementById("ckDPPA5I").checked){
						document.getElementById("ckDPPA5I").click();
					}
					else if(document.getElementById("ckDPPA5J").checked){
						document.getElementById("ckDPPA5J").click();
					}
				}
			}
			else if(elementchecked.value == "DPPA5I"){
				if(elementchecked.checked){
					if(document.getElementById("ckDPPA5H").checked){
						document.getElementById("ckDPPA5H").click();
					}
					else if(document.getElementById("ckDPPA5J").checked){
						document.getElementById("ckDPPA5J").click();
					}
				}
			}
			else if(elementchecked.value == "DPPA5J"){
				if(elementchecked.checked){
					if(document.getElementById("ckDPPA5I").checked){
						document.getElementById("ckDPPA5I").click();
					}
					else if(document.getElementById("ckDPPA5H").checked){
						document.getElementById("ckDPPA5H").click();
					}
				}
			}
		}

			$("#search-close_div").click(function(){
				// other started
				$("#page5").hide();
			});

		function dateofbirthIndividual(currectelementfrominp){

			if (currectelementfrominp.value.length > currectelementfrominp.maxLength-1){

				if(currectelementfrominp.nextElementSibling){
					var nextelement = currectelementfrominp.nextElementSibling.nextElementSibling.id;
					console.log(nextelement);
					currectelementfrominp.value = currectelementfrominp.value.slice(0, currectelementfrominp.maxLength);
					if(nextelement == "inp_dateofbirthyear" || nextelement == "inp_dateofbirthmonth"){
						document.getElementById(nextelement).value="";
						$("#"+nextelement).focus();
					}
				}
				else{
					if(currectelementfrominp.value.length > currectelementfrominp.maxLength){
						console.log("No element found");
						currectelementfrominp.value = currectelementfrominp.value.slice(0, currectelementfrominp.maxLength);
					}
				}
			}
			else if (currectelementfrominp.value.length == 0){

				console.log(currectelementfrominp.value.length);
				if(currectelementfrominp.previousElementSibling){
					if(currectelementfrominp.previousElementSibling.previousElementSibling){
						var previouselement = currectelementfrominp.previousElementSibling.previousElementSibling.id;
						console.log(previouselement);
						if(previouselement == "inp_dateofbirthdate" || previouselement == "inp_dateofbirthmonth"){
							$("#"+previouselement).focus();
						}
					}
					else{
						if(currectelementfrominp.value.length > currectelementfrominp.maxLength){
							console.log("No element found");
							currectelementfrominp.value = currectelementfrominp.value.slice(0, currectelementfrominp.maxLength);
						}
					}
				}
				else{
					//Nothing should be done
				}
			}
		}

		function policyholderinsuredtypechange(currentElementSelection){
				console.log(currentElementSelection.value);
				var policyholdertype = document.getElementsByName("IndentifyType");
				IndentifyValue = radiobuttonId(policyholdertype);
				if(currentElementSelection.value == "I"){
					if(IndentifyValue == "newIC"){
						var DOBIC = JSON.parse(getItem("DOBFromIc"));
						document.getElementById("inp_dateofbirthdate").value = DOBIC.day;
						document.getElementById("inp_dateofbirthmonth").value = DOBIC.month;
						document.getElementById("inp_dateofbirthyear").value = DOBIC.year;
					}
					else if(IndentifyValue == "business"){
						event.preventDefault();
						showAlert("Please change the identification type from business to continue with individual insurer");
					}
					else{
						$('#div_dateofbirth').find(':input').val('');
					}
				}
				else{

					if(IndentifyValue != "business"){
						event.preventDefault();
						showAlert("Please change the identification type as business to continue with corporate insurer");
					}
					else{
						$("#div_dateofbirth").css("display","none");
						$('#div_dateofbirth').find(':input').val('');
					}
				}
		}

		function vehicleconditionchange(){
				$("#vehicle_regnum_inp").val("");
				$('#vehtype_select option[value=0]').prop('selected', true);
				$('#inp_policyholderregion option[value=0]').prop('selected', true);
				$("#oldicnumber_inp").val("");
				$("#inp_newIcNumber").val("");
				$("#newbusnessorpass_inp").val("")
				localStorage.removeItem("ncdresponse");
				//vehicle details clean
				document.getElementById("inp_makemodelyear").value="";
				document.getElementById("inp_seatcapacity").value="";
				document.getElementById("inp_enginecapacity").value="";
				$('#inp_vehiclebody option[value=0]').prop('selected', true);
				document.getElementById("inp_manufactureryear").value="";
				document.getElementById("inp_vehiclemarketprice").value="0.0";
				document.getElementById("inp_ncdvehmarval").value="0.0";
				document.getElementById("inp_suminsured").value="";
				ncdCalculations(0,0,"");
				var newRegOrOldReg = document.getElementsByName("InsurType");
				newRegOrOldReg = radiobuttonId(newRegOrOldReg);
				if(newRegOrOldReg == "new"){
					$("#sel_vehicleusage").removeAttr("disabled","disabled");
					//$("#sel_vehicleusage").removeAttr("disabled","disabled");
				}
				else{
					$("#sel_vehicleusage").attr("disabled","disabled");
					$("#sel_vehiclecoverage").attr("disabled","disabled");
				}
		}
		function regionchange(){
		var newRegOrOldReg = document.getElementsByName("InsurType");
				newRegOrOldReg = radiobuttonId(newRegOrOldReg);
				if(newRegOrOldReg == "new"){
				document.getElementById("inp_makemodelyear").value="";
				document.getElementById("inp_seatcapacity").value="";
				document.getElementById("inp_enginecapacity").value="";
				$('#inp_vehiclebody option[value=0]').prop('selected', true);
				document.getElementById("inp_manufactureryear").value="";
				document.getElementById("inp_vehiclemarketprice").value="0.0";
				}
		}
		function additionalcoveragesubmit(currentElement) {
			var additionalcov_element = document.getElementById("additionalcoverageDivAdd");

			var isValidatedV = additionalcoveragevalidation();
			if(isValidatedV){
				var checkedList = {};
				var checkedListObj = []
				for(j = 1; j < additionalcov_element.childNodes[1].childNodes.length ; j++){
					var checkboxElement = additionalcov_element.childNodes[1].childNodes[j].childNodes[0].childNodes[0].childNodes[0];
					/* Ben-code and Ben-description */
					var Bencode = checkboxElement.value;
					var Bendesc = checkboxElement.nextElementSibling.innerHTML;
					/* Ben-code and Ben-description */
					checkedList = { bencode : Bencode , bendesc : Bendesc};
					if(checkboxElement.checked){
							checkedListObj.push({ bencode : Bencode , bendesc : Bendesc});
					}
					else{
						for( var i = addonList.length; i--;){
							if (JSON.stringify(addonList[i].bencode) === JSON.stringify(checkedList.bencode)) {
								console.log("came inside");
								checkedListObj.splice(i, 1);
							}
						}
					}
				}
				console.log(addonList);
					addonList = [];
					console.log(checkedListObj);
					for(var q = 0; q< checkedListObj.length;q++){
							addonList.push({ bencode : checkedListObj[q].bencode ,bendesc: checkedListObj[q].bendesc});
					}
					console.log(addonList);
					$("html, body").animate({ scrollTop: 0 }, "slow");
					$("#page5").hide();
					$("#vehicledetailsdiv").show();
					isaddalertocc=true;
				}
				else{
					//Validation failure
					console.log("additional coverage validation failure");
				}
			}

			function additionalcoveragecancel(currentElement){
				var additionalcov_element = document.getElementById("additionalcoverageDivAdd");
				for(j = 1; j < additionalcov_element.childNodes[1].childNodes.length ; j++){
					var checkboxElement = additionalcov_element.childNodes[1].childNodes[j].childNodes[0].childNodes[0].childNodes[0];
					console.log(checkboxElement);
					if(checkboxElement.checked){
						if(addonList.length != 0){
							console.log("Nothing is clicked");
						}
						else{
							$('.add-on-input-sec').find(':input').val('');
							$("#"+checkboxElement.id).click();
						}
					}
					else {
						// Nothing should be done
					}
				}
				$("html, body").animate({ scrollTop: 0 }, "slow");
				$("#page5").hide();
				$("#vehicledetailsdiv").show();
			}

			function additionalcoverageresetAlert(){
				showAlertAdditionalCoveragereset("Are you sure you want to clear all Additional Coverage fields ?",false);
			}

			function additionalcoveragereset(){
				hide('showpop');
				var additionalcov_element = document.getElementById("additionalcoverageDivAdd");
				for(j = 1; j < additionalcov_element.childNodes[1].childNodes.length ; j++){
					var checkboxElement = additionalcov_element.childNodes[1].childNodes[j].childNodes[0].childNodes[0].childNodes[0];
					console.log(checkboxElement);
					if(checkboxElement.checked){
						var additionalcoverageBencode = checkboxElement.id.substr(2);
						console.log(additionalcoverageBencode);
						additionalcoverageBencode

						if(additionalcoverageBencode == "ACER"){
							$("#"+checkboxElement.id).click();
							$('#ACER').find(':input').val('');
						}
						else if(additionalcoverageBencode == "ACES"){
							$("#"+checkboxElement.id).click();
							$('#ACES').find(':input').val('');
						}
						else if(additionalcoverageBencode == "CART"){
							$("#"+checkboxElement.id).click();
							$('#CART').find(':input').val('');
						}
						else if(additionalcoverageBencode == "NAME"){
							if($("#sel_piamdriver").val() == 01){
								$('#infoadddri2_acccont1').find('input').val('');
								$("#occupation1 option[value=0]").prop('selected', true);
							}
							else{
								$('.accordationToogleUpDownadditional').find('input').val('');
								var nameddriverVal = document.getElementById("inp_numberofdrivers").value;
								if(!isEmpty(nameddriverVal)){
									for(var i=0; i <= nameddriverVal; i++)
									{
										$("#occupation"+i+" option[value=0]").prop('selected', true);
									}
								}
							}
						}
						else if(additionalcoverageBencode == "NGVT"){
							$("#"+checkboxElement.id).click();
							$('#NGVT').find(':input').val('');
						}
						else if(additionalcoverageBencode == "PASS"){
							$("#"+checkboxElement.id).click();
							$('#PASS').find(':input').val('');
						}
						else if(additionalcoverageBencode == "WSCR"){
							$("#"+checkboxElement.id).click();
							$('#WSCR').find(':input').val('');
						}
						else{
							$("#"+checkboxElement.id).click();
						}
					}
				}
			}

			/* -NCD service call request mapping function
				 -New Register vehicle old record changes checking and redirecting	*/
			function ncdservicecallcommon(isretrive){
				var IndentifyValue;
				var InsurTypeValue;
				var registrationtype;
				var newIcNumber_inpVal = document.getElementById("inp_newIcNumber").value;
				var newIcValue1 = newIcNumber_inpVal.substring(6, 0);
				var newIcValue2 = newIcNumber_inpVal.substring(8, 6);
				var newIcValue3 = newIcNumber_inpVal.substring(12, 8);
				if((!isEmpty(newIcValue1) || !isEmpty(newIcValue3))){
					newIcAvail = newIcValue1+"-"+newIcValue2+"-"+newIcValue3;
				}
				else{
					newIcAvail = "";
				}
				var OldIcValue = document.getElementById("oldicnumber_inp").value;
				var newIcPasOrBus = document.getElementById("newbusnessorpass_inp").value;
				var VehicleValue = document.getElementById("vehicle_regnum_inp").value;
				var VechicleSelectValue = $("#vehtype_select option:selected").val();
				var VechicleRegionValue = $("#inp_policyholderregion option:selected").val();
				var IndentifyName = document.getElementsByName("IndentifyType");
				var InsurTypeName = document.getElementsByName("InsurType");
				var GenderName = document.getElementsByName("Gender");
				IndentifyValue = radiobuttonId(IndentifyName);
				InsurTypeValue = radiobuttonId(InsurTypeName);
				GenderValue = radiobuttonId(GenderName);
				console.log(IndentifyValue);
				if(InsurTypeValue == "new"){
					registrationtype = "n";
					$("#div_chassisnumbersel").css("display","none");
					$("#div_enginenumbersel").css("display","none");
				}
				else{
					registrationtype = "u";
					$("#div_chassisnumbersel").css("display","block");
					$("#div_enginenumbersel").css("display","block");
				}

				if(InsurTypeValue == "new"){
					document.getElementById("inp_ncdpercentage").value = "0.0 %"
					ncdpercentageValueToPremium = 0;
					ncdamoluntValueToPremium = 0;

					if(IndentifyValue == "business"){
						$('#policyHolderInsuredTypeInd').removeAttr('checked', true);
						$('#policyHolderInsuredTypeIndDIV').removeClass("checked");
						$('#policyHolderInsuredTypecor').attr('checked', true);
						$('#policyHolderInsuredTypecorDIV').addClass("checked");
					}
					else{
						$('#policyHolderInsuredTypecor').removeAttr('checked', true);
						$('#policyHolderInsuredTypecorDIV').removeClass("checked");
						$('#policyHolderInsuredTypeInd').attr('checked', true);
						$('#policyHolderInsuredTypeIndDIV').addClass("checked");
					}

					if(!isEmpty(ncdFormalReq)){
						var validationres2 = requestrecheck(ncdFormalReq, VehicleValue, VechicleRegionValue, registrationtype, newIcPasOrBus, newIcAvail, OldIcValue);
						isNCDRecordChanged = validationres2;
						if(isNCDRecordChanged == "Y"){
							isRetriveCanProceedNCD == true;

							ncdFormalReqTemp = {agentid: getItem("agentcode") , bizregno:"",newic:"",oldic : OldIcValue ,passportno:"",regno: VehicleValue, cncondition: registrationtype, regioncode: VechicleRegionValue}
							ncdFormalReq =  objectmerge(ncdFormalReq,ncdFormalReqTemp);

							if(IndentifyValue == "passport"){
								var passTemp = {passportno: newIcPasOrBus};
								ncdFormalReq =  objectmerge(ncdFormalReq,passTemp);
							}
							else{
								var buszTemp = {bizregno: newIcPasOrBus};
								ncdFormalReq =  objectmerge(ncdFormalReq,buszTemp);
							}
							if(IndentifyValue == "newIC"){
								var newIcValue = newIcValue1+"-"+newIcValue2+"-"+newIcValue3;
								var newIcTemp = {newic: newIcValue};
								ncdFormalReq =  objectmerge(ncdFormalReq,newIcTemp);
							}
						}
					}
					isNcdCallProceedSucc = false;
					OldInputNotAltered(true);
				}
				else{

					console.log(InsurTypeValue);
					if(IndentifyValue == "oldIC")
					{
						oldic = OldIcValue;
						var request = { agentid: getItem("agentcode") , bizregno:"",newic:"",oldic : OldIcValue ,passportno:"",regno: VehicleValue, cncondition: registrationtype, regioncode: VechicleRegionValue};
					}
					else if(IndentifyValue == "newIC")
					{
						var newIcValue = newIcValue1+"-"+newIcValue2+"-"+newIcValue3;
						console.log(newIcValue);
						newic = newIcValue;
						var request = { agentid: getItem("agentcode") , bizregno:"",newic: newIcValue ,oldic :"",passportno:"",regno: VehicleValue, cncondition: registrationtype, regioncode: VechicleRegionValue};
					}
					else if(IndentifyValue == "passport")
					{
						var request = { agentid: getItem("agentcode") , bizregno:"",newic:"",oldic :"",passportno:newIcPasOrBus,regno: VehicleValue, cncondition: registrationtype, regioncode: VechicleRegionValue};
					}
					else{
						var request = { agentid: getItem("agentcode") , bizregno:newIcPasOrBus,newic:"",oldic :"",passportno:"",regno: VehicleValue, cncondition: registrationtype, regioncode: VechicleRegionValue};
					}
					if(IndentifyValue == "oldIC" || IndentifyValue == "newIC" || IndentifyValue == "passport"){
						$('#policyHolderInsuredTypecor').removeAttr("checked", true);
						$('#policyHolderInsuredTypecorDIV').removeClass("checked");
						$('#policyHolderInsuredTypeInd').attr('checked', true);
						$('#policyHolderInsuredTypeIndDIV').addClass("checked");
					}
					else{
						$('#policyHolderInsuredTypeInd').removeAttr("checked", true);
						$('#policyHolderInsuredTypeIndDIV').removeClass("checked");
						$('#policyHolderInsuredTypecor').attr('checked', true);
						$('#policyHolderInsuredTypecorDIV').addClass("checked");
					}

					if(isEmpty(ncdFormalReq)){
						ncdFormalReq = request;
						ncdcallGenF(true,request,isretrive);
						isRetriveCanProceedNCD == true;
					}
					else{
						delete ncdFormalReq.referenceData;
						delete ncdFormalReq.esubmissionuserid;
						delete ncdFormalReq.clientid;
						delete ncdFormalReq.quotationid;

						if(JSON.stringify(ncdFormalReq) === JSON.stringify(request)){
							ncdFormalReq = request;
							ncdcallGenF(false,request,isretrive);
							isNCDRecordChanged = "N";

						}
						else{
							ncdFormalReq = request;
							var quotationIdEmpty = { quotationid: "",clientid:"" };
							isNCDRecordChanged = "Y";
  							Requestdata2 =  objectmerge(request,quotationIdEmpty);
							ncdcallGenF(true,Requestdata2,isretrive);
						}
						isRetriveCanProceedNCD = true;
					}
				}
			}
			/* -Registered vehicle Ncd Call	 */
			function ncdcallGenF(canPremiumProceed,request,isretrive){

				if(canPremiumProceed){
					if(checkOnline()){
					Apiservicecall(function(result)
						{
						console.log(result);

						if(!isEmpty(result.response)){
							if(result.response.status==1)
							{
								setItem("ncdresponse", JSON.stringify(result.response));
								commonDepencencyservicescall("N");
								$('#vehinfo_acccont').find(':input').val('');
								var ncdResponse=result.response.data;
								if(!isEmpty(ncdResponse.ncdperc)){

									document.getElementById("inp_ncdpercentage").value = currencyformat(parseFloat(ncdResponse.ncdperc),"")+" %";
									ncdpercentageValueToPremium = ncdResponse.ncdperc;
									ncdamoluntValueToPremium = 0;
								}
								else{
									document.getElementById("inp_ncdpercentage").value = "0.0 %"
									ncdpercentageValueToPremium = 0;
									ncdamoluntValueToPremium = 0;
								}
								if(!isEmpty(ncdResponse.engineno)){
									document.getElementById("inp_enginenumber").value = ncdResponse.engineno;
								}
								if(!isEmpty(ncdResponse.chassisno)){
									document.getElementById("inp_chassisno").value = ncdResponse.chassisno;
								}
								if(!isEmpty(ncdResponse.clientid)){
									setItem("clientIdNCDRes", ncdResponse.clientid);
								}
								if(!isEmpty(ncdResponse.expirydate)){
									setItem("policyExpiryDate",formatExpiryDateNCD(ncdResponse.expirydate));
								}
								if(!isEmpty(ncdResponse.modelSearchDOs)){
									if(ncdResponse.modelSearchDOs.length > 0){
										document.getElementById("inp_makemodelyear").value = ncdResponse.modelSearchDOs[0].makemodeldesc;
										//bodycode
										if(!isEmpty(ncdResponse.modelSearchDOs[0].bodycode)){
											$("#inp_vehiclebody").val(ncdResponse.modelSearchDOs[0].bodycode).attr("selected","selected");
										}
										else{
											$("#inp_vehiclebody").val(0).attr("selected","selected");
										}

										if(!isEmpty(ncdResponse.modelSearchDOs[0].marketvalue)){
											document.getElementById("inp_vehiclemarketprice").value = currencyformat(ncdResponse.modelSearchDOs[0].marketvalue, "");
											document.getElementById("inp_suminsured").value = ncdResponse.modelSearchDOs[0].marketvalue;
											document.getElementById("inp_ncdvehmarval").value = currencyformat(ncdResponse.modelSearchDOs[0].marketvalue, "");
											ncdCalculations(ncdResponse.modelSearchDOs[0].marketvalue,0,"");
										}
										else{
											document.getElementById("inp_vehiclemarketprice").value = currencyformat(0, "");
											document.getElementById("inp_suminsured").value = 0;
											document.getElementById("inp_ncdvehmarval").value = currencyformat(0, "");
											ncdCalculations(0,0,"");
										}

										nvicnumber = ncdResponse.modelSearchDOs[0].nvic;
										document.getElementById("inp_manufactureryear").value = ncdResponse.modelSearchDOs[0].manufactureyear;
										document.getElementById("inp_seatcapacity").value = ncdResponse.modelSearchDOs[0].seatingcapacity;
										document.getElementById("inp_enginecapacity").value = ncdResponse.modelSearchDOs[0].enginecapacity;

										setItem("vehiclemakecode", ncdResponse.modelSearchDOs[0].makecode);
										setItem("vehiclemodelcode", ncdResponse.modelSearchDOs[0].modelcode);
										setItem("vehiclebodydesc", ncdResponse.modelSearchDOs[0].bodydesc);
										setItem("vehiclebodycode", ncdResponse.modelSearchDOs[0].bodycode);
									}
									else{
										document.getElementById("inp_vehiclemarketprice").value = currencyformat(0, "");
										document.getElementById("inp_suminsured").value = 0;
										document.getElementById("inp_ncdvehmarval").value = currencyformat(0, "");
										ncdCalculations(0,0,"");
									}
								}
							OldInputNotAlteredAccordian();
							isNcdCallProceedSucc = true;
							}
							else {
								ncdFormalReq = "";
								showAlert("Transaction fail - " + result.response.message);
								console.log("NCD FAILURE")

							}
						}
						else{
							ncdFormalReq = "";
							// token expire place
						}
					},p2_flashNCD,request);
                      }
				}
				else{
					OldInputNotAlteredAccordian();
				}
			}


			function isvaluechangevehicleDetails(){
				var jsonV = retrivequoteJSON;
				var isallValidated = isretriveNCDdatachanged(jsonV);
				return isallValidated;
			}

			function commonmasterusageservice(url, domelementid,isretrive){

				var optionlength = document.getElementById(domelementid).options.length;
				if(optionlength > 1){
					//option length greater than 1
					if(isretrive == "N"){
						//getItem("ncdresponse");
						if(!isEmpty(getItem("ncdresponse"))){
							var ncdresponseData = JSON.parse(getItem("ncdresponse"));
							console.log(JSON.parse(getItem("ncdresponse")));
							$("#sel_vehicleusage").val(ncdresponseData.data.vehusecode).attr("selected","selected");
							commonmasterCoverageservice(p2_coverageList, 'sel_vehiclecoverage', isretrive2,isdropdownNotClick)
						}
					}
				}
				else{
					if($("#vehtype_select option:selected").val()!='0')
					{
						var sel_vehicletype = $("#vehtype_select option:selected").val();
						if($("#"+domelementid+" option[value='0']").length > 1){
							// nothing should be done
						}
						else{
							$("#"+domelementid+"").blur();
							var request = { agentid: getItem("agentcode") , vehicletype: sel_vehicletype};
							if(checkOnline()){
							Apidropdownservice(function(result)
							{
								var response = result.response;
								if(!isEmpty(response)){
									console.log(result.response.status);
									console.log(result.response.data);
									for(var i=0;i<response.data.length;i++){
										$("#"+domelementid+"").append("<option value="+response.data[i].vehicleusagecode+">"+response.data[i].vehicleusagedesc.toUpperCase()+"</option>");
									}
									if(isretrive == "Y"){
										var retJson = retrivequoteJSON;
										$("#sel_vehicleusage").val(retJson.vehicleusagecode).attr("selected","selected");
									}
									else if(isretrive == "N"){
										//getItem("ncdresponse");
										if(!isEmpty(getItem("ncdresponse"))){
											var ncdresponseData = JSON.parse(getItem("ncdresponse"));
											console.log(JSON.parse(getItem("ncdresponse")));
											$("#sel_vehicleusage").val(ncdresponseData.data.vehusecode).attr("selected","selected");
										}
										else{
											// new Registration
										}
									}
									var id = "#"+domelementid+"";
									console.log(id);
									commonmasteraddcovservice(p2_extracoverageList, 'add-on-check', isretrive);
								}
							},url,request);
							}
						}
					}
					else{
						$("#"+domelementid+"").blur();
						showAlert("Please select vehicle type");
					}
				}
			}
				function commonmasterpiamdriverservice(url, domelementid,isretrive,isOnclickPressPiam){

				var optionlength = document.getElementById(domelementid).options.length;
				if(optionlength > 1){
					//option length greater than 1
				}
				else{
					if($("#vehtype_select option:selected").val()!='0')
					{
						var sel_vehicletype = $("#vehtype_select option:selected").val();
						if($("#"+domelementid+" option[value='0']").length > 1){
							// nothing should be done
						}
						else{
							var sel_vehicleusage = $("#sel_vehicleusage option:selected").val();
							$("#"+domelementid+"").blur();
							var request = { agentid: getItem("agentcode") , vehicletype: sel_vehicletype, usagecode: sel_vehicleusage};
							if(checkOnline()){
							Apidropdownservice(function(result)
							{
									var response = result.response;
									if(!isEmpty(response)){
									console.log(result.response.status);
									console.log(result.response.data);
									var optionlength = $("#"+domelementid+" option").length;
									if(optionlength <= 1){
										for(var i=0;i<response.data.length;i++){
											$("#"+domelementid+"").append("<option value="+response.data[i].piamdrivercode+">"+response.data[i].piamdriverdesc.toUpperCase()+"</option>");
										}
									}
								if(isretrive == "Y" && isOnclickPressPiam == 'Y'){
									var retJson = retrivequoteJSON;
									var selusageVal = $("#sel_vehicleusage").val();
									if(isEmpty(retJson.piamdrivercode)){
										if($("#sel_vehicleusage").val() == "VPP0202"){
											$("#sel_piamdriver").val("03").attr("selected","selected");
											additionaldriverchangebyPiam(document.getElementById("sel_piamdriver"),isretrive,'Y');
										}
										else{
											$("#sel_piamdriver").val(0).attr("selected","selected");
											additionaldriverchangebyPiam(document.getElementById("sel_piamdriver"),isretrive,'Y');
										}
									}
									else{
										$("#sel_piamdriver").val(retJson.piamdrivercode).attr("selected","selected");
										additionaldriverchangebyPiam(document.getElementById("sel_piamdriver"),isretrive,'Y');
									}
									isOnclickPiam = "N";
								}
								else{
									if($("#sel_vehicleusage").val() == "VPP0202"){
										$("#sel_piamdriver").val("03").attr("selected","selected");
										additionaldriverchangebyPiam(document.getElementById("sel_piamdriver"),'N','N');
									}
								}

									var id = "#"+domelementid+"";
									console.log(id);
								$('#sel_piamdriver').removeAttr('disabled');

									}
							},url,request);
							}
						}
					}
					else{
						$("#"+domelementid+"").blur();
						showAlert("Please select vehicle type");
					}
				}
			}

			function commonDepencencyservicescall(isretrive){
				if(additionalcoverageaddDetails == false){
					commonmasterusageservice(p2_vehicleusageList, 'sel_vehicleusage', isretrive);
					if(isretrive == "Y"){
						additionalvehicleinforetrive();
					}
					additionalcoverageaddDetails = true;
				}
				else {
					commonmasterusageservice(p2_vehicleusageList, 'sel_vehicleusage', isretrive);
				}
			}

			function additionalvehicleinforetrive(){
				vehicleinformationloadretrive(retrivequoteJSON);
			}

			function premiumservicecallcommon(){
				var oldic = "";
				var newic = "";
				var bizregno = "";
				var passportno = "";
				var registrationtype = "n";
				var ncdresponse;
				var quotationid = "";
				var vehicleusagecode = "";
				var ncdcompcode="";
				var ncdismmakecode="";
				var ncdvehusecode="";
				var clientID = "";
				var marketValIndicatorFromscroll = "";
				var agreedValIndicatorFromscroll = "";

				var policyexpirydatefromNCD = "";
				if(!isEmpty(getItem("policyExpiryDate"))){
					policyexpirydatefromNCD = getItem("policyExpiryDate");
				}
				if(!isEmpty(getItem("clientIdNCDRes"))){
					clientID = getItem("clientIdNCDRes");
				}
				if(!isEmpty(getItem("ncdresponse")))
				{
				 ncdresponse = JSON.parse(getItem("ncdresponse"));
				 ncdcompcode=ncdresponse.data.compcode;
				 ncdismmakecode=ncdresponse.data.ismmakecode;
				 ncdvehusecode=ncdresponse.data.vehusecode;
				}
				else {
				  ncdismmakecode=document.getElementById("inp_makemodelyear").value
				}
				if(isEmpty(ncdcompcode)){
					ncdcompcode = "";
				}
				/* By Name */
				var InsurTypeName = document.getElementsByName("InsurType");
				var IndentifyName = document.getElementsByName("IndentifyType");
				var insurertype = document.getElementsByName("policyHolderInsuredType");
				var gender = document.getElementsByName("Gender");
				var martialstatus = document.getElementsByName("MartialStatus");
				/* By Id */
				var policyholdername = document.getElementById("inp_policyholdername").value;
				var policyholderadd1 = document.getElementById("inp_policyholderadd1").value;
				var policyholderadd2 = document.getElementById("inp_policyholderadd2").value;
				var policyholderportal = document.getElementById("inp_policyholderpostal").value;
				var chassisnumberval = document.getElementById("inp_chassisno").value;
				/* IC Queue */
				var newIcNumber_inpVal = document.getElementById("inp_newIcNumber").value;
				console.log(newIcNumber_inpVal.substring(6, 0));
				console.log(newIcNumber_inpVal.substring(8, 6));
				console.log(newIcNumber_inpVal.substring(12, 8));
				var newIcValue1 = newIcNumber_inpVal.substring(6, 0);
				var newIcValue2 = newIcNumber_inpVal.substring(8, 6);
				var newIcValue3 = newIcNumber_inpVal.substring(12, 8)
				var OldIcValue = document.getElementById("oldicnumber_inp").value;
				var newIcPasOrBus = document.getElementById("newbusnessorpass_inp").value;
				/* IC Queue */
				var driverexperience = document.getElementById("inp_driverExp").value;
				var vehiclemakeyear = document.getElementById("inp_manufactureryear").value;
				var vehicleseatingCapacity = document.getElementById("inp_seatcapacity").value;
				var Vehicleregnumber = document.getElementById("vehicle_regnum_inp").value;
				var vehiclecapacitycc = document.getElementById("inp_enginecapacity").value;
				var vehicleenginenum = document.getElementById("inp_enginenumber").value;
				var vehiclesuminsured = document.getElementById("inp_suminsured").value;

				var vehiclemarketValue = document.getElementById("inp_ncdvehmarval").value;
				/* select button */
				var policyholderoccu = $("#inp_policyholderocc option:selected").val();
				var policyholderstate = $("#inp_policyholderstate option:selected").val();
				var policyholderregion = $("#inp_policyholderregion option:selected").val();
				var antitheftcodeVal = $("#sel_antiteftlist option:selected").val();
				var vehiclecovercode = $("#sel_vehiclecoverage option:selected").val();
				var vehiclegaragecode = $("#sel_garagelist option:selected").val();
				var piamdriverVal = $("#sel_piamdriver option:selected").val();
				var safetylstVal = $("#sel_safetylist option:selected").val();
				var vehicletypevalue = $("#vehtype_select option:selected").val();
				vehicleusagecode = $("#sel_vehicleusage option:selected").val();
				/* radio button */
				//Gender
				//Martial Status need to do
				IndentifyValue = radiobuttonId(IndentifyName);
				if(IndentifyValue == "oldIC")
				{
					oldic = OldIcValue;
				}
				else if(IndentifyValue == "newIC")
				{
					var newIcValue = newIcValue1+"-"+newIcValue2+"-"+newIcValue3;
					newic = newIcValue;

				}
				else if(IndentifyValue == "passport")
				{
					passportno = newIcPasOrBus;
				}
				else{
					bizregno = newIcPasOrBus;
				}

				insurertype = radiobuttonId(insurertype);
				IndentifyName = radiobuttonId(IndentifyName);
				InsurTypeName = radiobuttonId(InsurTypeName);
				var FulldateVirthdate = "";
				if(insurertype == "I"){
					var birthdayValue = document.getElementById("inp_dateofbirthdate").value;
					var birthmonthValue = document.getElementById("inp_dateofbirthmonth").value;
					var birthyearValue = document.getElementById("inp_dateofbirthyear").value;
					FulldateVirthdate =  birthyearValue+"-"+birthmonthValue+"-"+birthdayValue;
					gender = radiobuttonId(gender);
					martialstatus = radiobuttonId(martialstatus);
				}
				else{
					//FulldateVirthdate = "1984-02-24";
					gender = "C";
					martialstatus = "C";
				}
				if(InsurTypeName == "new"){
					registrationtype = "n";
					quotationid = "";
					if(!isEmpty(retrivequoteJSON)){
						if(!isEmpty(retrivequoteJSON.quotationid)){
							quotationid = retrivequoteJSON.quotationid;
						}
						else{
							quotationid = "";
						}
					}
					else{
						quotationid = "";
					}
					vehicleenginenum = "Engine123";
					chassisnumberval = "Chassis123";
					var marketValueFrom = document.getElementById("inp_ncdvehmarval").value;
					marketValueFrom = marketValueFrom.split(',').join("").split(".")[0].trim();
					if(marketValueFrom == 0){
						agreedValIndicatorFromscroll = "N";
						marketValIndicatorFromscroll = "N";
					}
					else{
						marketValIndicatorFromscroll = "Y";
						agreedValIndicatorFromscroll = "";
					}
				}
				else{
					registrationtype = "u";
					if(!isEmpty(retrivequoteJSON)){
						if(!isEmpty(retrivequoteJSON.quotationid)){
							quotationid = retrivequoteJSON.quotationid;
						}
						else{
							quotationid = "";
						}
					}
					if(!isEmpty(getItem("ncdresponse")))
					{
						quotationid = ncdresponse.quotationId;
					}

					var marketValueFrom = document.getElementById("inp_ncdvehmarval").value;
					var suminsuredVal = document.getElementById("inp_suminsured").value;
					marketValueFrom = marketValueFrom.split(',').join("").split(".")[0].trim();
					//inp_suminsured, inp_ncdvehmarval
					if(parseFloat(suminsuredVal) < parseFloat(marketValueFrom)){
						agreedValIndicatorFromscroll = "Y";
						marketValIndicatorFromscroll = "";
					}
					else if(marketValueFrom == 0){
						agreedValIndicatorFromscroll = "N";
						marketValIndicatorFromscroll = "N";
					}
					else{
						agreedValIndicatorFromscroll = "";
						marketValIndicatorFromscroll = "Y";
					}
				}
				// add ben data and additional drivers
				var addonlistCustomListD;
				 var addonListRes = [];
				 var addoncustomList = [];
				 var additionalcoverageList = [];
				for(var i=0;i<addonList.length;i++){
					addoncustomList.push(addonList[i]);
				}
				for(var i=0;i < addonList.length;i++){
					if(addonList[i].bencode == "ACER" || addonList[i].bencode == "CART" || addonList[i].bencode == "ACES" || addonList[i].bencode == "PASS" || addonList[i].bencode == "NGVT" || addonList[i].bencode == "WSCR"){
						if(addonList[i].bencode == "ACER"){
							var sumAcer = document.getElementById("sum"+addonList[i].bencode).value;
							if(isEmpty(sumAcer)){
								sumAcer = 0.0;
							}
							else{
								sumAcer = parseFloat(sumAcer);
							}
							var addonobj = {benpremium : parseFloat(0) , cewcommperc: parseFloat(0), suminsured: parseFloat(sumAcer), unit:0};
						}
						else if(addonList[i].bencode == "ACES"){
							var sumAces = document.getElementById("sum"+addonList[i].bencode).value;
							if(isEmpty(sumAces)){
								sumAces = 0.0;
							}
							else{
								sumAces = parseFloat(sumAces);
							}
							var addonobj = {benpremium : parseFloat(0) , cewcommperc: parseFloat(0), suminsured: parseFloat(sumAces), unit:0};
						}
						else if(addonList[i].bencode == "NGVT"){
							var sumgas = document.getElementById("sum"+addonList[i].bencode).value;
							if(isEmpty(sumgas)){
								sumgas = 0.0;
							}
							else{
								sumgas = parseFloat(sumgas);
							}
							var addonobj = {benpremium : parseFloat(0) , cewcommperc: parseFloat(0), suminsured: parseFloat(sumgas), unit:0};
						}
						else if(addonList[i].bencode == "WSCR"){
							var sumbreakage = document.getElementById("sum"+addonList[i].bencode).value;
							if(isEmpty(sumbreakage)){
								sumbreakage = 0.0;
							}
							else{
								sumbreakage = parseFloat(sumbreakage);
							}
							var addonobj = {benpremium : parseFloat(0) , cewcommperc: parseFloat(0), suminsured: parseFloat(sumbreakage), unit:0};
						}
						else if(addonList[i].bencode == "CART"){
							var amountperday = document.getElementById("amtperday"+addonList[i].bencode).value;
							var totaldays = document.getElementById("days"+addonList[i].bencode).value;
							if(isEmpty(amountperday) && isEmpty(totaldays)){
								amountperday = 0.0;
								totaldays = 0;
							}
							else if(isEmpty(totaldays)){
								totaldays = 0;
							}
							else if(isEmpty(amountperday)){
								amountperday = 0.0;
							}
							else{
								amountperday = parseFloat(amountperday);
								totaldays = parseInt(totaldays);
							}
							var addonobj = {benpremium : parseFloat(0) , cewcommperc: parseFloat(0), suminsured: amountperday, unit: totaldays};
						}
						else if(addonList[i].bencode == "PASS"){
							var personalseat = document.getElementById("inp_personalseat").value;
							if(isEmpty(personalseat)){
								personalseat = 0;
							}
							else{
								personalseat = parseInt(personalseat);
							}
							var addonobj = {benpremium : parseFloat(0) , cewcommperc: parseFloat(0), suminsured: parseFloat(0), unit: personalseat};
						}
					}
					else{

						if(addonList[i].bencode == "NAME"){
							var capUnit = 0;
							var numberofDriver = document.getElementById("inp_numberofdrivers");
							if(numberofDriver.value >= 2){
								capUnit = numberofDriver.value-2;
							}
							else{
								capUnit = 0;
							}
							var addonobj = {benpremium : parseFloat(0) , cewcommperc: parseFloat(0), suminsured: parseFloat(0), unit: parseInt(capUnit)};
							if(numberofDriver.value.length == 0){
								// empty
								console.log("Empty part");
							}
							else{
								for(var j=0;j< numberofDriver.value; j++) {
									var childnodesofacc = numberofDriver.nextElementSibling.nextElementSibling.nextElementSibling.nextElementSibling.childNodes;
									console.log(childnodesofacc[j].childNodes[0][0].value);
									console.log(childnodesofacc[j].childNodes[0][1].value);
									console.log(childnodesofacc[j].childNodes[0][2].value);
									console.log(childnodesofacc[j].childNodes[0][3].value);
									console.log(childnodesofacc[j].childNodes[0][4].value);
									console.log(childnodesofacc[j].childNodes[0][5].value);

									var CalculatedDOB = driverdobdatecalculation(childnodesofacc[j].childNodes[0][3].value);
									console.log("went after datecalculation");
									var NewIcNumberAdditonalCov = childnodesofacc[j].childNodes[0][1].value;
									var newIcValue1AddCov = NewIcNumberAdditonalCov.substring(6, 0);
									var newIcValue2AddCov = NewIcNumberAdditonalCov.substring(8, 6);
									var newIcValue3AddCov = NewIcNumberAdditonalCov.substring(12, 8);
									var icValAdditionalNamedData = "";
									if((!isEmpty(newIcValue1AddCov))||(!isEmpty(newIcValue2AddCov))){
										icValAdditionalNamedData = newIcValue1AddCov+"-"+newIcValue2AddCov+"-"+newIcValue3AddCov;
									}
									else{
										icValAdditionalNamedData = "";
									}

									additionalcoverageList.push({
										drvage: "",
										drvdob : CalculatedDOB ,
										drvexp : childnodesofacc[j].childNodes[0][4].value ,
										drvgender : "",
										drvmarital : "",
										drvoccup : childnodesofacc[j].childNodes[0][5].value ,
										drvrel : "",
										icnumber : icValAdditionalNamedData,
										index : j ,
										name : childnodesofacc[j].childNodes[0][0].value,
										oicnumber : childnodesofacc[j].childNodes[0][2].value
									});

								}
							}
						 }
						 else{
							var addonobj = {benpremium : parseFloat(0) , cewcommperc: parseFloat(0), suminsured: parseFloat(0), unit:0};
						 }
					}
					addonlistCustomListD =  objectmerge(addoncustomList[i],addonobj);
					addonListRes.push(addonlistCustomListD);
				}
				console.log(addonListRes);
				console.log(additionalcoverageList);

				//ends
					var request = {
						clientid : clientID,
						addBenDatas : addonListRes,
						addDrvDatas: additionalcoverageList,
						address1: policyholderadd1,
						address2: policyholderadd2,
						address3:"", //No field
						agentid:getItem("agentcode"),
						agentgstregdate:"", // optional (FL get from agent table by EID)
						agentgstregno:"", // optional (FL get from agent table by EID)
						antitheftcode: antitheftcodeVal,
						birthdate: FulldateVirthdate, // optional
						bizregno: bizregno,
						channel:"AXA",
						chassisno: chassisnumberval,
						claimamt:0.0, // optional (FL default zero)
						cncondition: registrationtype,
						commiperc:10.0,
						compcode: ncdcompcode,
						country:"", // optional
						covercode: vehiclecovercode,
						discount:"", // optional
						discountperc:0.0, // optional
						driveexp: parseInt(driverexperience),
						effectivedate: "", // optional (problem)
						effectivetime: "", // optional
						email:"", // optional
						engineno: vehicleenginenum,
						currentpolexpirydate: policyexpirydatefromNCD, // optional
						garage: vehiclegaragecode,
						gender: gender,
						gstclaimperc:0.0, // optional (FLAS default zero)
						gstcode:"T128", // optional (FL default Standard Rate)
						gstpurpose:"I", //optional (GST Purpose of Insurances:Business (C ) or Private (I ))
						isgstregister:"N", // optional (FLAS default as N)
						gstregdate:"", // optional (FLAS default null)
						gstregdateend:"", // optional (FLAS default null)
						gstregno:"", // optional (FLAS default null)
						hirepurchasecode:"", // optional (FLAS to arrive this value) ---------------
						hphoneno:"", // optional
						hirepurchasedesc:"", // optional (FLAS to arrive this value) ---------------
						loadingamt:0.0, // optional (FLAS to arrive this value) ---------------
						loadingperc:0.0, // optional (FLAS to arrive this value) ---------------
						makecode: getItem("vehiclemakecode"), // optional
						// modelcode: ncdresponse.data.ismmodelcode, // optional
						modelcode : getItem("vehiclemodelcode"),
						makeyear: vehiclemakeyear,
						maritalstatus: martialstatus,
						mtcycrider:null, // optional
						marketvalue : vehiclemarketValue.split(',').join("").split(".")[0].trim(),
						name: policyholdername,
						ncdamt: ncdamoluntValueToPremium,  // i dont get ncd amount in ncd res so i put default as 0 and retrive quote response from server
						ncdperc: ncdpercentageValueToPremium,   // giving what i get in NCD Response and if i dint get i give 0 as default
						newic: newic,
						occupationcode: policyholderoccu,
						oldic: oldic,
						ownershiptype: insurertype,  // I=Individual ,C= Corprorate ------------------
						passportno: passportno,
						piamdrvcode: piamdriverVal,
						postcode: policyholderportal,
						preinscode:"",  // option (FL default null)
						preinsname:"", // option (FL default null)
						preinsncd:0.0, // option
						preinspolno:"", // option (FL default null)
						preinsregno: Vehicleregnumber,
						prepoleffdate:"", // option (FL default null)
						prepolexpdate:"", // option (FL default null)
						purchasedate:"", // option (FL default null)
						purchaseprice:0.0, // option (FL default null)
						purpose:"NB", //Mandatory FL default NB
						quoteno:"", // doubt ----------------
						region: policyholderregion,
						regno: Vehicleregnumber,
						renewno:"", // optional
						safety: safetylstVal,
						seatcapacity: vehicleseatingCapacity,
						stampduty:10.0, // doubt --------------
						statecode: policyholderstate,
						suminsured: parseInt(vehiclesuminsured),
						theftclaim:0, // optional (FL default zero)
						thirdclaim:0, // optional (FL default zero)
						towndesc:"", //doubt (capture from address3 , if have post code , next address is towndesc)
						trailerno:"", // optional (FL default as null)
						usecode: vehicleusagecode, // ncd response
						vehbody: getItem("vehiclebodydesc"), //ncd response
						vehbodycode: getItem("vehiclebodycode"), //doubt ----------
						vehcapacity: parseInt(vehiclecapacitycc),
						vehcapacitycode:"CC",
						vehclaim:0, //optional (FL default zero)
						vehtypecode: vehicletypevalue,
						winclaim:0, //optional (FL default zero)
						quotationid: quotationid,
						nvic: nvicnumber,
						marketvalueind: marketValIndicatorFromscroll,
						agreedvalueind: agreedValIndicatorFromscroll,
						datachangeind:"N"
					};
					console.log(request);
					if(isEmpty(editQuoteFormalReq)){
						if(!isEmpty(retrivequoteJSON)){
							if(isNCDRecordChanged == "Y" || ispremiumRecordChanged == "Y"){
								editQuoteFormalReq = request;

								console.log(editQuoteFormalReq);
								var datachangeIndChange;
								if(((retrivequoteJSON.premiumind != "Y") && (retrivequoteJSON.ncdind == "Y") && (retrivequoteJSON.savequoteind != "Y")) && (isNcdCallProceedSucc == true)){
								  datachangeIndChange = {datachangeind:"N"};
								}
								else if(isNcdCallProceedSucc == true){
									datachangeIndChange = {datachangeind:"N"};
								}
								else{
								  	datachangeIndChange = {datachangeind:"Y"};
								}
								request =  objectmerge(request,datachangeIndChange);
								premiumservicecallGenF(true,request);
								ispremiumRecordChanged = "N";
								isNCDRecordChanged = "N";
								isRetriveCanProceedPremium = true;
							}
							else{
								premiumservicecallGenF(false,request);
							}
						}
						else{
							editQuoteFormalReq = request;
							premiumservicecallGenF(true,request);
							ispremiumRecordChanged = "N";
							isNCDRecordChanged = "N";
							isRetriveCanProceedPremium = true;
						}
					}
					else{
						var datachangeIndChange = {datachangeind:"N",quotationid: ""};
						request =  objectmerge(request,datachangeIndChange);
						var datachangeIndChangeRet = {quotationid: ""};
						editQuoteFormalReq =  objectmerge(editQuoteFormalReq,datachangeIndChangeRet);

						delete editQuoteFormalReq.referenceData;
						delete editQuoteFormalReq.esubmissionuserid;

						var editQuoteFormalReqTemp = editQuoteFormalReq;
						delete editQuoteFormalReqTemp.datachangeind;

						var requestTemp = request;
						delete requestTemp.datachangeind;

						var tempClientId = requestTemp.clientid;
						if(isEmpty(tempClientId)){
							tempClientId = "";
						}
						var quotationIdEmptyTemp = { clientid:tempClientId};
						editQuoteFormalReqTemp =  objectmerge(editQuoteFormalReq,quotationIdEmptyTemp);

						console.log(JSON.stringify(editQuoteFormalReqTemp));
						console.log(JSON.stringify(requestTemp));

						if(JSON.stringify(editQuoteFormalReqTemp) === JSON.stringify(requestTemp)){

							if(isNCDRecordChanged == "Y" || ispremiumRecordChanged == "Y"){
								var quotationIdEmpty = { quotationid: "",clientid:"" ,datachangeind:"Y"};
								editQuoteFormalReq =  objectmerge(request,quotationIdEmpty);
								premiumservicecallGenF(true,editQuoteFormalReq);
								isNCDRecordChanged = "N";
								ispremiumRecordChanged = "N";
								isRetriveCanProceedPremium = true;
							}
							else{
								editQuoteFormalReq = request;
								premiumservicecallGenF(false,request);
								isNCDRecordChanged = "N";
								ispremiumRecordChanged = "N";
							}
						}
						else if(isNcdCallProceedSucc == true && (JSON.stringify(editQuoteFormalReqTemp) != JSON.stringify(requestTemp))){

							var quotationIdEmpty = { quotationid: "",clientid:"" ,datachangeind:"Y"};
							editQuoteFormalReq =  objectmerge(request,quotationIdEmpty);
							premiumservicecallGenF(true,editQuoteFormalReq);
							isNCDRecordChanged = "N";
							ispremiumRecordChanged == "N";
							isRetriveCanProceedPremium = true;
						}
						else if(isNcdCallProceedSucc == true){
							var quotationIdNonEmpty = { datachangeind:"N",clientid : clientID,quotationid: quotationid};
							request =  objectmerge(request,quotationIdNonEmpty);
							premiumservicecallGenF(true,request);
							isNCDRecordChanged = "N";
							ispremiumRecordChanged == "N";
							isRetriveCanProceedPremium = true;
							isNcdCallProceedSucc = false;
							var quotationIdNonEmptyTemp = { quotationid: "",clientid:"",datachangeind:"N"};
							editQuoteFormalReq =  objectmerge(request,quotationIdNonEmptyTemp);
						}
						else{

							var quotationIdEmpty = { quotationid: "",clientid:"" ,datachangeind:"Y"};
							editQuoteFormalReq =  objectmerge(request,quotationIdEmpty);
							premiumservicecallGenF(true,editQuoteFormalReq);
							isNCDRecordChanged = "N";
							ispremiumRecordChanged == "N";
							isRetriveCanProceedPremium = true;
						}

					}
			}


			function premiumservicecallGenF(canPremiumProceed,request){

				if(canPremiumProceed){
				if(checkOnline()){
					Apiservicecallp2(function(result)
						{
						if(!isEmpty(result.response)){
							if(result.response.status ==1)
							{
								isPremiumCallOccured = "Y";
								console.log(result.response);
								setItem("premiumresponse",JSON.stringify(result.response));
								console.log(result.response.data);
								var responseVal = result.response;
								quotationfilling(responseVal, "N");
								$("html, body").animate({ scrollTop: 0 }, "slow");
								$("#vehicledetailsdiv").hide();
								$("#page2").hide();
								$("#page3").show();
								$("#page3Li").addClass("is-active");
								retrivequoteJSON = "";
								quotationbtndisable();
								quotationAccordian();
								$("#quotecreateddate_tr").removeClass("p2_quotation_tble_block").addClass("p2_quotation_tble_none");
								$("#quoteexpireddate_tr").removeClass("p2_quotation_tble_block").addClass("p2_quotation_tble_none");
							}
							else {
								editQuoteFormalReq = "";
								ispremiumRecordChanged = "Y";
								showAlert("Transaction fail - " + result.response.message);
								console.log("failure case");
							}
						}
						else{
							ispremiumRecordChanged = "Y";
							console.log("failure case");
							//oops some thing went wrong case
						}
					},p2_getPremium,request);
                  }
				}
				else{
					$("html, body").animate({ scrollTop: 0 }, "slow");
					$("#vehicledetailsdiv").hide();
					$("#page2").hide();
					$("#page3").show();
					$("#page3Li").addClass("is-active");
				//	quotationbtndisable();
					quotationAccordian();
				}
			}

			function isvaluechangepremiumcall(){
				var jsonV = retrivequoteJSON;
				var isallValidated = isretrivepremiumdatachanged(jsonV);
				return isallValidated;
			}

			function quotationfilling(QuotationJSON, isretrive)
			{
				if(isretrive == "N"){
					document.getElementById("lab_traiffpremium").innerHTML = "RM "+currencyformat(QuotationJSON.data.tariffpremium,"");
					document.getElementById("lab_ncdpercentage").innerHTML = "NCD ( "+currencyformat(QuotationJSON.data.ncdperc,"")+" %)";
					document.getElementById("lab_ncdamount").innerHTML = "RM "+currencyformat(QuotationJSON.data.ncdamt,"");
					document.getElementById("lab_commissionpercentage").innerHTML = "Commission ("+currencyformat(QuotationJSON.data.commiperc,"").trim()+"%)";
					document.getElementById("lab_commissionamount").innerHTML ="RM "+ currencyformat(QuotationJSON.data.commiamt,"");
					document.getElementById("lab_netpremium").innerHTML = "RM "+currencyformat(QuotationJSON.data.netprem,"");
					document.getElementById("lab_quoterefno").innerHTML = QuotationJSON.data.flquoteno;
					//new change
					document.getElementById("lab_totalamount").innerHTML = "RM "+(currencyformat(QuotationJSON.data.grossdue,""));
					document.getElementById("lab_ncdserviceTaxPerc").innerHTML = "Service Tax ( "+currencyformat(QuotationJSON.data.servicetaxperc,"")+ " %)";
					document.getElementById("lab_ncdserviceTaxamt").innerHTML ="RM "+ currencyformat(QuotationJSON.data.servicetaxamt,"");
					document.getElementById("lab_ncdstampdutyamt").innerHTML = "RM "+ currencyformat(QuotationJSON.data.stampduty,"");
					if(QuotationJSON.data.covercode=='VPPCO0201')
					{
						$("#lab_compulsoryexcess").attr('style','display:table-cell');
						$("#lab_owndamageexcess").attr('style','display:table-cell');
						$("#lab_compulsoryexcessamt").attr('style','display:block');
						$("#lab_owndamageexcessamt").attr('style','display:block');
						document.getElementById("lab_compulsoryexcessamt").innerHTML = "RM "+ currencyformat(parseInt(QuotationJSON.data.resExtraParam[0].value),"");
						document.getElementById("lab_owndamageexcessamt").innerHTML = "RM "+ currencyformat(parseInt(QuotationJSON.data.excess),"");
					
					}
					else{
					$("#lab_compulsoryexcess").attr('style','display:none');
					$("#lab_owndamageexcess").attr('style','display:none');
					$("#lab_compulsoryexcessamt").attr('style','display:none');
					$("#lab_owndamageexcessamt").attr('style','display:none');
					}
					if(!isEmpty(QuotationJSON.data.regno)){
						document.getElementById("lab_ncdvehiclenumValue").innerHTML = QuotationJSON.data.regno.toUpperCase();
					}
					else{
						document.getElementById("lab_ncdvehiclenumValue").innerHTML = "NEW VEHICLE";
					}
					document.getElementById("lab_ncdsumInsuredamount").innerHTML ="RM "+ currencyformat(QuotationJSON.data.suminsured,"");
					document.getElementById("lab_ncdExtracoverageamt").innerHTML = "RM "+ currencyformat(QuotationJSON.benefitpremium,"");
					agreMarkQuotation(QuotationJSON);
					// loading only load to coverage as private
					document.getElementById("lab_loadingpercentage").innerHTML = "Loading ( "+currencyformat(QuotationJSON.data.loadingperc,"")+" %)";
					document.getElementById("lab_loadingamount").innerHTML = "RM "+currencyformat(QuotationJSON.data.loadingamt,"");
					// loading only load to coverage as private
					if($("#sel_vehiclecoverage option:selected").val() == "VPPTP0201" || $("#sel_vehiclecoverage option:selected").val() == "VPPTP0202") {
						$("#loadingpercentage_tr").removeClass("p2_quotation_tble_none").addClass("p2_quotation_tble_block");
					}
					else{
						$("#loadingpercentage_tr").removeClass("p2_quotation_tble_block").addClass("p2_quotation_tble_none");
					}
					// new change
					if(QuotationJSON.data.refercode!=null && QuotationJSON.data.refercode!=""){
					if(QuotationJSON.referdescnote!=null && QuotationJSON.referdescnote!="" && QuotationJSON.referdescnote!=" "){
				  document.getElementById("lab_referdescnote").innerHTML = "Note : "+QuotationJSON.referdescnote;
				  }
				  }
					if(QuotationJSON.data.refercode!=null && QuotationJSON.data.refercode!=""){
						if(QuotationJSON.data.referdesc!=null && QuotationJSON.data.referdesc!=""){
						var referdesc = QuotationJSON.data.referdesc.split(",");
						var refercaseelementavail = document.getElementById("lab_referdesc0");
                        if(refercaseelementavail){
                            for(var i=0;i<referdesc.length;i++){
                                if(referdesc[i]!=null && referdesc[i]!="" && referdesc[i]!=" "){
                                document.getElementById("lab_referdesc"+i).remove();
                                }                   
                            }
                        }
						for(var i=0;i<referdesc.length;i++){
						if(referdesc[i]!=null && referdesc[i]!="" && referdesc[i]!=" "){
						$("#div_referdesc").append("<span class='p2_autoheight' id='lab_referdesc"+i+"'>"+referdesc[i]+"</span>");
						if(referdesc[i+1]!=null && referdesc[i+1]!="" && referdesc[i+1]!=" "){
						$("#div_referdesc").append(",<br>");
								}
							}					
						}
					}else{
						$("#div_referdesc").append("<span class='p2_referdesc' id='lab_referdesc'>-</span>");
					
					}					
					//document.getElementById("lab_referdesc").innerHTML = referdesc.join(",\n");
				  }
				  
				}
				else{
					document.getElementById("lab_traiffpremium").innerHTML = "RM "+currencyformat(QuotationJSON.tariffpremium,"");
					document.getElementById("lab_ncdpercentage").innerHTML = "NCD ( "+currencyformat(QuotationJSON.ncdperc,"")+" %)";
					document.getElementById("lab_ncdamount").innerHTML = "RM "+currencyformat(QuotationJSON.ncdamount,"");
					document.getElementById("lab_commissionpercentage").innerHTML = "Commission ("+currencyformat(QuotationJSON.commissionperc,"").trim()+"%)";
					document.getElementById("lab_commissionamount").innerHTML ="RM "+ currencyformat(QuotationJSON.commissionamount,"");
					document.getElementById("lab_netpremium").innerHTML = "RM "+currencyformat(QuotationJSON.netpremium,"");
					document.getElementById("lab_quoterefno").innerHTML = QuotationJSON.flasquotationno;
					if(QuotationJSON.coveragecode=='VPPCO0201')
					{
					$("#lab_compulsoryexcess").attr('style','display:table-cell');
						$("#lab_owndamageexcess").attr('style','display:table-cell');
						$("#lab_compulsoryexcessamt").attr('style','display:block');
						$("#lab_owndamageexcessamt").attr('style','display:block');
					document.getElementById("lab_compulsoryexcessamt").innerHTML = "RM "+ currencyformat(QuotationJSON.compulsoryexcess,"");
					document.getElementById("lab_owndamageexcessamt").innerHTML = "RM "+ currencyformat(QuotationJSON.owndamageexcess,"");
					}
					else{
									
					$("#lab_compulsoryexcess").attr('style','display:none');
					$("#lab_owndamageexcess").attr('style','display:none');
					$("#lab_compulsoryexcessamt").attr('style','display:none');
					$("#lab_owndamageexcessamt").attr('style','display:none');
					}
					
					if(QuotationJSON.savequoteind == "Y"){
						if(!isEmpty(QuotationJSON.quotecreationdate) && !isEmpty(QuotationJSON.quotevaliditydate)){
							document.getElementById("lab_quotecreatedate").innerHTML = dateFormatchangeFromRetrive(QuotationJSON.quotecreationdate);
							document.getElementById("lab_quoteexpiredate").innerHTML = dateFormatchangeFromRetrive(QuotationJSON.quotevaliditydate);
						}
						else{
							// Nothing should be done
						}
					}
					//new change
					document.getElementById("lab_totalamount").innerHTML = "RM "+(currencyformat(QuotationJSON.grossdueamt,""));
					document.getElementById("lab_ncdserviceTaxPerc").innerHTML = "Service Tax ( "+currencyformat(QuotationJSON.servicetaxperc,"")+" %)";
					document.getElementById("lab_ncdserviceTaxamt").innerHTML ="RM "+ currencyformat(QuotationJSON.servicetaxamt,"");
					document.getElementById("lab_ncdstampdutyamt").innerHTML = "RM "+ currencyformat(QuotationJSON.stampduty,"");
					if(!isEmpty(QuotationJSON.vehicleregistno)){
						document.getElementById("lab_ncdvehiclenumValue").innerHTML = QuotationJSON.vehicleregistno.toUpperCase();
					}
					else{
						document.getElementById("lab_ncdvehiclenumValue").innerHTML = "NEW VEHICLE";
					}
					document.getElementById("lab_ncdsumInsuredamount").innerHTML ="RM "+ currencyformat(QuotationJSON.suminsured,"");
					document.getElementById("lab_ncdExtracoverageamt").innerHTML = "RM "+ currencyformat(QuotationJSON.benefitpremium,"");
					agreMarkQuotation(QuotationJSON);
					// loading only load to coverage as private
					document.getElementById("lab_loadingpercentage").innerHTML = "Loading ( " +currencyformat(QuotationJSON.loadingperc,"")+ " %)";
					document.getElementById("lab_loadingamount").innerHTML = "RM "+currencyformat(QuotationJSON.loadingamount,"");

					if($("#sel_vehiclecoverage option:selected").val() == "VPPTP0201" || $("#sel_vehiclecoverage option:selected").val() == "VPPTP0202") {
						$("#loadingpercentage_tr").removeClass("p2_quotation_tble_none").addClass("p2_quotation_tble_block");
					}
					else{
						$("#loadingpercentage_tr").removeClass("p2_quotation_tble_block").addClass("p2_quotation_tble_none");
					}
					// loading only load to coverage as private
					// new change
					if(QuotationJSON.refercode!=null && QuotationJSON.refercode!=""){
						if(QuotationJSON.referdescnote!=null && QuotationJSON.referdescnote!="" && QuotationJSON.referdescnote!=" "){
					 document.getElementById("lab_referdescnote").innerHTML = "Note : "+QuotationJSON.referdescnote;
					 }
					 }
						if(QuotationJSON.refercode!=null && QuotationJSON.refercode!=""){
						if(QuotationJSON.referdesc!=null && QuotationJSON.referdesc!=""){
						var referdesc = QuotationJSON.referdesc.split(",");
						var refercaseelementavail = document.getElementById("lab_referdesc0");
                        if(refercaseelementavail){
                            for(var i=0;i<referdesc.length;i++){
                                if(referdesc[i]!=null && referdesc[i]!="" && referdesc[i]!=" "){
                                document.getElementById("lab_referdesc"+i).remove();
                                }                   
                            }
                        }
						for(var i=0;i<referdesc.length;i++){
						if(referdesc[i]!=null && referdesc[i]!="" && referdesc[i]!=" "){
						$("#div_referdesc").append("<span class='p2_referdesc' id='lab_referdesc"+i+"'>"+referdesc[i]+"</span>");
						if(referdesc[i+1]!=null && referdesc[i+1]!="" && referdesc[i+1]!=" "){
						$("#div_referdesc").append(",<br>");
								}
							}					
						}
					}else{
						$("#div_referdesc").append("<span class='p2_referdesc' id='lab_referdesc'>-</span>");
					
					}					
					//document.getElementById("lab_referdesc").innerHTML = referdesc.join(",\n");
					}
				
				}
			}

			 //scroll table
	$(document).ready(function() {
      $('.search-model-table-section').on('scroll', function() {
          if($(this).scrollTop() + $(this).innerHeight() >= $(this)[0].scrollHeight) {
			  if(pagecountstop == false){
				if(checkOnline()){
					pagenumberCount+=1;
					makemodelsearchfn();
				}
			  }
			  else{
				// no records found for this page
			  }
          }
      })
    });

	function resetadditionalnameddreiversReset(){
		showAlertAdditionalnamedDriverreset("Are you sure you want to clear all Additional Named driver fields ?",false);
	}

	function resetadditionalnameddreivers(){
		hide('showpop');
		if($("#sel_piamdriver").val() == 01){
			$('#infoadddri2_acccont1').find('input').val('');
			$('#infoadddri2_acccont1').find('input').removeAttr("disabled","disabled");
			$("#occupation1 option[value=0]").prop('selected', true);
		}
		else{
			$('.accordationToogleUpDownadditional').find('input').val('');
			$('.accordationToogleUpDownadditional').find('input').removeAttr("disabled","disabled");
			var nameddriverVal = document.getElementById("inp_numberofdrivers").value;
			if(!isEmpty(nameddriverVal)){
			for(var i=0; i <= nameddriverVal; i++)
				{
					$("#occupation"+i+" option[value=0]").prop('selected', true);
				}
			}
		}
	}

	function trashadditionalnameddri(CurrentElement){

		if($("#sel_piamdriver").val() == 01){
			console.log(CurrentElement.offsetParent.parentElement.parentElement);
			var currentElementId = CurrentElement.offsetParent.parentElement[1].id;
			var currentElementIdlastDigit = currentElementId[currentElementId.length-1];
			console.log(currentElementId)
			if(currentElementIdlastDigit == 1){
				trashadditionalnameddriverpiam(CurrentElement)
			}
			else{
				showAlert("Named Driver THE POLICY HOLDER cannot be deleted");
			}
		}
		else{
			trashadditionalnameddriverpiam(CurrentElement)
		}
	}

	function trashadditionalnameddriverpiam(CurrentElement){
		CurrentElement.offsetParent.parentElement.parentElement.remove();
		var noofdriversVal = $("#inp_numberofdrivers").val();
		noofdriversVal-=1;
		$("#inp_numberofdrivers").val(noofdriversVal);
	}

	function postcodeviastateloading(){
		if($("#inp_policyholderpostal").val().length == 5){
			var request = {
				agentid : getItem("agentcode"),
				vehicletype :"",
				usagecode :"",
				postcode : $("#inp_policyholderpostal").val()

			};
			console.log(request);
			//premium call
			if(stateloaded == false || $('#inp_policyholderstate option').length == 1)
			{
				Apiservicecall(function(result)
				{
					if(!isEmpty(result.response)){
						if(result.response.status ==1)
						{
							console.log(result.response);
							for(var i=0;i< !isEmpty(result.response.data[0]);i++){
								$('#inp_policyholderstate').empty();
								$('#inp_policyholderstate').append( "<option value='0'>-- Please Select --</option><option value="+result.response.data[0].masteDataCode+">"+result.response.data[0].masterDataDesc.toUpperCase()+"</option>");
								$("#inp_policyholderstate").val(result.response.data[0].masteDataCode).attr("selected","selected");
							}
							if(!isEmpty(retrivequoteJSON)){
								if(statecodesetOnce == true){
									if(retrivequoteJSON.ncdind == "Y" && retrivequoteJSON.premiumind == "Y"){
										$("#inp_policyholderstate").val(retrivequoteJSON.statecode).attr("selected","selected");
										statecodesetOnce = false;
									}
									else{
										$("#inp_policyholderstate").val(result.response.data[0].masteDataCode).attr("selected","selected");
									}
								}
							}
							else{
								statecodesetOnce = false;
							}
							stateloaded = true;
							$("#inp_policyholderstate").removeAttr("disabled","disabled");
						}
						else {
							showAlert("Transaction fail - " + result.response.message);
							$("#inp_policyholderstate").attr("disabled","disabled");
							console.log("failure case");
						}
					}
					else{
						//oops some thing went wrong case
					}
				},p2_stateList,request);
			}
			else{
				// nothing should be done
			}
		}
		else{
			// invalid post code
		}
	}

	function postcodespacetrimothcase(currentElement){
		if (currentElement.value.length > currentElement.maxLength)
			currentElement.value = currentElement.value.slice(0, currentElement.maxLength);
			if($("#inp_policyholderpostal").val().length != 5){
				$('#inp_policyholderstate').empty();
				$('#inp_policyholderstate').append( "<option value='0'>-- Please Select --</option>");
				$("#inp_policyholderstate").attr("disabled","disabled");
			}
			else{
				$("#inp_policyholderstate").removeAttr("disabled","disabled");
			}
	}

	function additionaldriverchangebyPiam(currentElement,isretrive,isretriveFromRetriveQuote){
		console.log(currentElement);
		// 01 -- INSURED + ONE
		// 02 -- SEVERAL NAMED DRIVERS
		// 03 -- ALL DRIVERS
		// 04 -- INSURED NOT DRIVING
		var piamdriverval = $("#"+currentElement.id).val();
		console.log(piamdriverval);
		var sel_vehiclecoverage = $("#sel_vehiclecoverage option:selected").val();
							console.log("selected coverage from piam :",sel_vehiclecoverage);
							if(sel_vehiclecoverage=='VPPCO0201' || sel_vehiclecoverage=='VPPCO0202' || sel_vehiclecoverage=='VPPTF0202' || sel_vehiclecoverage=='VPPTP0202'){
		if(piamdriverval == 01){
			if(document.getElementById("ckNAME").checked){
				if(isretrive == "N"){
					$('#div_noofdriverslist').empty();
				}
				retriveQuoteNoofDriverLoad(isretrive,isretriveFromRetriveQuote,2);
				if(document.getElementById("ckUNAM").checked){
					$('#ckUNAM').removeAttr("disabled","disabled"); // unnamed drivers
					document.getElementById("ckUNAM").click();
					$('#ckUNAM').attr("disabled","disabled"); // unnamed drivers
				}
				else{
					$('#ckUNAM').attr("disabled","disabled"); // unnamed drivers
				}
				$('#ckNAME').attr("disabled","disabled"); // additional named driver
				if(isretrive == "N"){
					accordiangenerateforValueUpdate();
				}
			}
			else{
				$('#ckNAME').removeAttr("disabled","disabled");
				document.getElementById("ckNAME").click();
				checkboxclicked(document.getElementById("ckNAME"));
				document.getElementById("inp_numberofdrivers").value = 2;
				if(document.getElementById("ckUNAM").checked){
					$('#ckUNAM').removeAttr("disabled","disabled"); // unnamed drivers
					document.getElementById("ckUNAM").click();
					$('#ckUNAM').attr("disabled","disabled"); // unnamed drivers
				}
				else{
					$('#ckUNAM').attr("disabled","disabled"); // unnamed drivers
				}
				if(isretrive == "N"){
					accordiangenerateforValueUpdate();
				}
				addonList.push({ bencode : "NAME" ,bendesc: "ADDITIONAL NAMED DRIVER"});
				$('#ckNAME').attr("disabled","disabled"); // additional named driver
			}
			console.log("Before clearing");
			console.log(addonList);
			removefromaddonList("UNAM");
			console.log("After clearing");
			console.log(addonList);
		}
		else if(piamdriverval == 02){
			if(document.getElementById("ckNAME").checked){
				if(isretrive == "N"){
					$('#div_noofdriverslist').empty();
				}
				retriveQuoteNoofDriverLoad(isretrive,isretriveFromRetriveQuote,0);
				if(document.getElementById("ckUNAM").checked){
					$('#ckUNAM').removeAttr("disabled","disabled"); // unnamed drivers
					document.getElementById("ckUNAM").click();
					$('#ckUNAM').attr("disabled","disabled"); // unnamed drivers
				}
				else{
					$('#ckUNAM').attr("disabled","disabled"); // unnamed drivers
				}
				$('#ckNAME').attr("disabled","disabled"); // additional named driver
			}
			else{
				$('#ckNAME').removeAttr("disabled","disabled");
				document.getElementById("ckNAME").click();
				checkboxclicked(document.getElementById("ckNAME"));
				document.getElementById("inp_numberofdrivers").value = 0;
				if(document.getElementById("ckUNAM").checked){
					$('#ckUNAM').removeAttr("disabled","disabled"); // unnamed drivers
					document.getElementById("ckUNAM").click();
					$('#ckUNAM').attr("disabled","disabled"); // unnamed drivers
				}
				else{
					$('#ckUNAM').attr("disabled","disabled"); // unnamed drivers
				}
				$('#ckNAME').attr("disabled","disabled"); // additional named driver
				addonList.push({ bencode : "NAME" ,bendesc: "ADDITIONAL NAMED DRIVER"});
			}
			console.log("Before clearing");
			console.log(addonList);
			removefromaddonList("UNAM");
			console.log("After clearing");
			console.log(addonList);
		}
		else if(piamdriverval == 04){
		// pending part INSURED NOT DRIVING
			if(document.getElementById("ckNAME").checked){
				if(isretrive == "N"){
					$('#div_noofdriverslist').empty();
				}
				retriveQuoteNoofDriverLoad(isretrive,isretriveFromRetriveQuote,0);
				if(document.getElementById("ckUNAM").checked){
					$('#ckUNAM').removeAttr("disabled","disabled"); // unnamed drivers
					document.getElementById("ckUNAM").click();
					$('#ckUNAM').attr("disabled","disabled"); // unnamed drivers
				}
				else{
					$('#ckUNAM').attr("disabled","disabled"); // unnamed drivers
				}
				$('#ckNAME').attr("disabled","disabled"); // additional named driver
			}
			else{
				$('#ckNAME').removeAttr("disabled","disabled");
				document.getElementById("ckNAME").click();
				checkboxclicked(document.getElementById("ckNAME"));
				document.getElementById("inp_numberofdrivers").value = 0;
				if(document.getElementById("ckUNAM").checked){
					$('#ckUNAM').removeAttr("disabled","disabled"); // unnamed drivers
					document.getElementById("ckUNAM").click();
					$('#ckUNAM').attr("disabled","disabled"); // unnamed drivers
				}
				else{
					$('#ckUNAM').attr("disabled","disabled"); // unnamed drivers
				}
				addonList.push({ bencode : "NAME" ,bendesc: "ADDITIONAL NAMED DRIVER"});
				$('#ckNAME').attr("disabled","disabled"); // additional named driver
			}
			console.log("Before clearing");
			console.log(addonList);
			removefromaddonList("UNAM");
			console.log("After clearing");
			console.log(addonList);
		}
		else if(piamdriverval == 03){
			if(document.getElementById("ckUNAM").checked){
				$('#ckUNAM').attr("disabled","disabled"); // unnamed drivers
				if(document.getElementById("ckNAME").checked){
					$('#ckNAME').removeAttr("disabled","disabled");
					retriveQuoteNoofDriverLoad(isretrive,isretriveFromRetriveQuote,0);
					document.getElementById("ckNAME").click();
					if(isretrive == "N"){
						$('#div_noofdriverslist').empty();
					}
					$('#ckNAME').attr("disabled","disabled"); // additional named driver
				}
				else{
					$('#ckNAME').attr("disabled","disabled"); // additional named driver
				}
			}
			else{
				$('#ckUNAM').removeAttr("disabled","disabled");
				document.getElementById("ckUNAM").click();
				if(document.getElementById("ckNAME").checked){
					$('#ckNAME').removeAttr("disabled","disabled");
					retriveQuoteNoofDriverLoad(isretrive,isretriveFromRetriveQuote,0);
					document.getElementById("ckNAME").click();
					if(isretrive == "N"){
						$('#div_noofdriverslist').empty();
					}
					$('#ckNAME').attr("disabled","disabled"); // additional named driver
				}
				else{
					$('#ckNAME').attr("disabled","disabled");
				}
				addonList.push({ bencode : "UNAM" ,bendesc: "ALL DRIVERS"});
				console.log("Before clearing");
				console.log(addonList);
				removefromaddonList("NAME");
				console.log("After clearing");
				console.log(addonList);
				$('#ckUNAM').attr("disabled","disabled");
			}
		}
		else{
			if(document.getElementById("ckNAME").checked){
				$('#ckNAME').removeAttr("disabled","disabled");
				document.getElementById("ckNAME").click();
				checkboxclicked(document.getElementById("ckNAME"));
			}
			if(document.getElementById("ckUNAM").checked){
				$('#ckUNAM').removeAttr("disabled","disabled"); // unnamed drivers
				document.getElementById("ckUNAM").click();
			}
			$('#ckUNAM').removeAttr("disabled","disabled"); // unnamed drivers
			$('#ckNAME').removeAttr("disabled","disabled"); // additional named driver
		}
		}else{
		
	if(document.getElementById("ckUNAM").checked){
			$('#ckUNAM').removeAttr("disabled","disabled"); // unnamed drivers
					document.getElementById("ckUNAM").click();
					$('#ckUNAM').attr("disabled","disabled"); // unnamed drivers
					$('#div_noofdriverslist').empty();
					$('#ckNAME').attr("disabled","disabled");
		}	else{	
						$('#div_noofdriverslist').empty();
					$('#ckNAME').attr("disabled","disabled"); // additional named driver
					$('#ckUNAM').attr("disabled","disabled");
					}
		}
	}

	function removefromaddonList(elementToDelete){
		for( var i = 0; i < addonList.length-1; i++){
			if ( addonList[i].bencode === elementToDelete) {
				addonList.splice(i, 1);
			}
		}
		removefromaddonListUnique(addonList)
	}

	function removefromaddonListUnique(elementForDuplicate) {
		var addonList2 = [];
		var ids = [];
		$.each(addonList, function(index, elementForDuplicate) {
			if($.inArray(elementForDuplicate.bencode, ids) == -1)
			{
				ids.push(elementForDuplicate.bencode);
				addonList2.push(elementForDuplicate);
			}
		});
		addonList = [];
		addonList = addonList2;
	}

	function accordiangenerateforNamedDriverPiam(){
		var numberofDriver = document.getElementById("inp_numberofdrivers").value;
		var driveraccordianlength = $('#div_noofdriverslist').find('.accordianfromlist');
		var totalLength = driveraccordianlength.length-1;
		console.log(driveraccordianlength)
		if(totalLength >= "1"){

		}
		else{
			var todayDate = new Date().getDate();
			for(var i=0;i<numberofDriver;i++){
				if(i==0)
					$("#div_noofdriverslist").append("<div class='accordion-content accordianfromlist accordationToogleUpDownadditional' id='addNamDriv_add_con'><form id='email-form' name='email-form' data-name='Email Form' action='#'><ul class='smk_accordion named-driver-acc'><li class='accordion-toggle'><div class = 'accordationToogleUpDown' id='accordion-idacc"+i+"' onclick='accordianfromlist(this);'><h3 class='add-on-input-sec-acc' style='line-height: 1; margin: 0px 0px 4px 0px; font-size: 93.8%; color: #464545; font-weight: 600; padding: 12px 10px 6px 10px; margin-left: 5px;'><span style='width:5%; text-align: left;float:left;margin-left:0px;margin-right:10px;' class='arrow arrowDown'></span><span style='width:80%;display:inline-block;font-weight:500;'>Information of additional driver</span><a id='accordion-idtrash"+i+"' style='width:8%;text-align: right;float:right;' onclick = 'trashadditionalnameddri(this);'><i style='font-size:21px;float:right;margin-left:5px;color:#333;' class='icon ion-ios-trash'></i></a></h3> </div><div class='accordion-content' id='infoadddri2_acccont"+i+"'><div class='form-group'><label class='axa-form-label'>Driver Name</label><input class='input-form' id='accordion_driverName"+i+"' placeholder='Insured Person'  type='text'  oninput='maxlengthspice(this);' maxlength='25'></div><div class='form-group'><label class='axa-form-label'>New IC</label><input class='input-form' id='inp_newIc"+i+"' oninput='maxdigitrestrict(this);' onblur='newICAdditionalcoverageLst(this)' type = 'number' maxlength = '12'></div><div class='form-group'><label class='axa-form-label'>Other IC</label><input class='input-form' id='accordion_otherIc"+i+"' oninput='maxdigitrestrict(this);' type = 'text' maxlength = '30'></div><div class='form-group'><label class='axa-form-label'>Date of Birth</label><div class='block-input-combined'><input class='axa-input input-form left floating-label startDateExpiryDate"+i+"' id='expiryfromdate"+i+"' type='datepickerVD'  name='location'></div></div><div class='form-group'><label class='axa-form-label'>Driving Experience (years)</label><input class='input-form' pattern='[0-9]*' id='accordion_drivingExper"+i+"' oninput='maxdigitrestrict(this);' type = 'number' maxlength = '2'></div><div class='form-group'><label class='axa-form-label'>Occupation</label><select type='text' id='occupation"+i+"' class='input-form'><option value='0'>-- Please Select --</option></select></div></div></li></ul></form></div>");
				else
					$("#div_noofdriverslist").append("<div class='accordion-content accordianfromlist accordationToogleUpDownadditional' id='addNamDriv_add_con'><form id='email-form' name='email-form' data-name='Email Form' action='#'><ul class='smk_accordion named-driver-acc'><li class='accordion-toggle'><div class = 'accordationToogleUpDown' id='accordion-idacc"+i+"' onclick='accordianfromlist(this);'><h3 class='add-on-input-sec-acc' style='line-height: 1; margin: 0px 0px 4px 0px; font-size: 93.8%; color: #464545; font-weight: 600; padding: 12px 10px 6px 10px; margin-left: 5px;'><span style='width:5%; text-align: left;float:left;margin-left:0px;margin-right:10px;' class='arrow arrowDown'></span><span style='width:80%;display:inline-block;font-weight:500;'>Information of additional driver</span><a id='accordion-idtrash"+i+"' style='width:8%;text-align: right;float:right;' onclick = 'trashadditionalnameddri(this);'><i style='font-size:21px;float:right;margin-left:5px;color:#333;' class='icon ion-ios-trash'></i></a></h3> </div><div class='accordion-content' id='infoadddri2_acccont"+i+"'><div class='form-group'><label class='axa-form-label'>Driver Name</label><input class='input-form' id='accordion_driverName"+i+"' type='text'  oninput='maxlengthspice(this);' maxlength='25'></div><div class='form-group'><label class='axa-form-label'>New IC</label><input class='input-form' id='inp_newIc"+i+"' oninput='maxdigitrestrict(this);' onblur='newICAdditionalcoverageLst(this)' type = 'number' maxlength = '12'></div><div class='form-group'><label class='axa-form-label'>Other IC</label><input class='input-form' id='accordion_otherIc"+i+"' oninput='maxdigitrestrict(this);' type = 'text' maxlength = '30'></div><div class='form-group'><label class='axa-form-label'>Date of Birth</label><div class='block-input-combined'><input class='axa-input input-form left floating-label startDateExpiryDate"+i+"' id='expiryfromdate"+i+"' type='datepickerVD'  name='location'></div></div><div class='form-group'><label class='axa-form-label'>Driving Experience (years)</label><input class='input-form' pattern='[0-9]*' id='accordion_drivingExper"+i+"' oninput='maxdigitrestrict(this);' type = 'number' maxlength = '2'></div><div class='form-group'><label class='axa-form-label'>Occupation</label><select type='text' id='occupation"+i+"' class='input-form'><option value='0'>-- Please Select --</option></select></div></div></li></ul></form></div>");
				//occupation list
				var responseVal = JSON.parse(localStorage.getItem("occupationListJSON"));
				for(var j=0;j<responseVal.length;j++){
					$("#occupation"+i).append( "<option value="+responseVal[j].masteDataCode+">"+responseVal[j].masterDataDesc.toUpperCase()+"</option>");
				}
				$(".startDateExpiryDate"+i).bootstrapMaterialDatePicker({ time:false, maxDate: new Date() }).on('change', function(e, date){});
			}
		}
	}

	function accordiangenerateforValueUpdate(){
		accordiangenerateforNamedDriverPiam();
		var numberofDriver = document.getElementById("inp_numberofdrivers");
		var childnodesofacc = numberofDriver.nextElementSibling.nextElementSibling.nextElementSibling.nextElementSibling.childNodes;
		if(!isEmpty($("#oldicnumber_inp").val())){
			childnodesofacc[0].childNodes[0][2].value = $("#oldicnumber_inp").val();
			var additionalnamedOtherIc = childnodesofacc[0].childNodes[0][2].id;
			$("#"+additionalnamedOtherIc).attr("disabled","disabled");
		}
		else if(!isEmpty($("#newbusnessorpass_inp").val())){
			childnodesofacc[0].childNodes[0][2].value = $("#newbusnessorpass_inp").val();
			var additionalnamedOtherIc = childnodesofacc[0].childNodes[0][2].id;
			$("#"+additionalnamedOtherIc).attr("disabled","disabled");
		}
		else if(!isEmpty($("#inp_newIcNumber").val())){
			childnodesofacc[0].childNodes[0][1].value = $("#inp_newIcNumber").val();
			var dateofbirthformation = JSON.parse(getItem("DOBFromIc"));
			var dateofbirth = dateofbirthformation.day+"/"+dateofbirthformation.month+"/"+dateofbirthformation.year;
			childnodesofacc[0].childNodes[0][3].value = dateofbirth;
			var additionalnamedExpiryDate = childnodesofacc[0].childNodes[0][1].id;
			var additionalnamednewIc = childnodesofacc[0].childNodes[0][3].id;
			$("#"+additionalnamednewIc).attr("disabled","disabled");
			$("#"+additionalnamedExpiryDate).attr("disabled","disabled");
		}
	}

	function EditQuoteQuotation(){
		if(isPremiumCallOccured == "Y"){
			isNCDRecordChanged = "N";
			retrivequoteJSON = "";
			isaddalertocc=false;
		}
		editQuotationRedirection();
	}

	function vehicleinformationAcc(){

		$("html, body").animate({ scrollTop: 0 }, "slow");
		$("#vehicledetailsdiv").show();
		$('#findmyveh_accordian').attr( "style", "display: none !important" );
		$("#accordion-id").click();
		$('#findvehDet_acccont').attr( "style", "display: none" );
		p2AccordianOnLoadBlock();
		$("#page2").hide();
		$("#page3").hide();
		if(isEmpty(retrivequoteJSON)){
			if(!$('#vehinfo_acccont').is(':visible') && !$('#Addvehinfo_acccont').is(':visible') && !$('#ncdInfo_acccont').is(':visible'))
			{
				$("#accordion-id2").click();
				$("#accordion-id3").click();
				$("#accordion-id4").click();
			}
			else{
				//
			}
		}
		else{
			if(!$('#vehinfo_acccont').is(':visible') && !$('#Addvehinfo_acccont').is(':visible') && !$('#ncdInfo_acccont').is(':visible'))
			{
				$("#accordion-id2").click();
				$("#accordion-id3").click();
				$("#accordion-id4").click();
			}
			else{
				//
			}
		}
	}

	function agreMarkQuotation(QuotationJSONObject){
		if(QuotationJSONObject.agreedvalueind == "Y"){
			document.getElementById("lab_ncdsumInsuredAgreedOrMark").innerHTML = "(Agreed Value)";
		}
		else if(QuotationJSONObject.marketvalueind == "Y"){
			document.getElementById("lab_ncdsumInsuredAgreedOrMark").innerHTML = "(Market Value)";
		}
		else if(QuotationJSONObject.marketvalueind == "N" || QuotationJSONObject.agreedvalueind == "N"){
			document.getElementById("lab_ncdsumInsuredAgreedOrMark").innerHTML = "";
		}
		else {
			// nothing should be done
			document.getElementById("lab_ncdsumInsuredAgreedOrMark").innerHTML = "(--)";
		}
	}

	function spaceandmaxlengthspliceIm(currentElementkeyin){
		savedOrPremiumCalled = false;
		spaceandmaxlengthsplice(currentElementkeyin);
	}

	function additionalcoverageheight(content){
  //   console.log(content);
    var element = content[0];
     var height = 0;
     var body = window.document.body;
     if (window.innerHeight) {
       height = window.innerHeight;
     } else if (body.parentElement.clientHeight) {
       height = body.parentElement.clientHeight;
     } else if (body && body.clientHeight) {
       height = body.clientHeight;
     }
     if(height>800)
     {
     height=height-150;
     }
     else {
     height=height-150;
     }
     element.style.maxHeight  = ((height - element.offsetTop) + "px");
  }

			</script>
		</body>
		</html>
