//http://10.100.6.11:8080/AXA_MOBILE_DEV///dev url
//http://10.100.7.79:8080/AXA_MOBILE_SQA/
//http://10.100.1.88:8080/AXA_MOBILE_UAT/
//http://10.100.7.79:8080/AXA_MOBILE_SQA/
//http://59.144.118.82/AXA_MOBILE_UAT/
//http://121.244.184.79/AXA_MOBILE_SQA/
//http://10.100.3.214:8080/AXA_MOBILE_DEV/ ashok
//http://59.144.118.82/AXA_MOBILE_SQA/
//http://121.244.184.79/AXA_MOBILE_SQA/
//http://10.100.3.42:8081/AXA_MOBILE_DEV/ preeja
//http://10.100.1.210/AXA_MOBILE_SQA/ partiban
//http://10.100.3.182:8080/AXA_MOBILE_DEV/  rajganesh anna
//http://10.100.6.11:8080/AXA_MOBILE_DEV/ tamil
//https://10.100.1.210:444/AXA_MOBILE_IUAT/ iuat
//https://59.144.118.82:444/AXA_MOBILE_IUAT/ iuat mobile check


//url
////Production
 var loginurl = "https://smartpolicy.generali.com.my/SmartPolicy/authenticateuser";
 var dashboard = "https://smartpolicy.generali.com.my/SmartPolicy/dashboardcount";
 var renewalinfo = "https://smartpolicy.generali.com.my/SmartPolicy/policies";
 var renewaldetails = "https://smartpolicy.generali.com.my/SmartPolicy/policyDetails";
 var enquirydetails = "https://smartpolicy.generali.com.my/SmartPolicy/enquiryDetails";
 var payment_details = "https://smartpolicy.generali.com.my/SmartPolicy/payment";
 var unlockaccount = "https://smartpolicy.generali.com.my/SmartPolicy/unlockAccount";
 var forgotpass = "https://smartpolicy.generali.com.my/SmartPolicy/forgotpassword";
 var paid_details = "https://smartpolicy.generali.com.my/SmartPolicy/paymentDetails";
 var updatepass = "https://smartpolicy.generali.com.my/SmartPolicy/updatepassword";
 var manualPayment = "https://smartpolicy.generali.com.my/SmartPolicy/manualPayment";
 var oauthtoken = "https://smartpolicy.generali.com.my/SmartPolicy/oauth/token";
 var backendPayment = "http://smartpolicy.generali.com.my/SmartPolicy/directPayment";
 var sendMail = "https://smartpolicy.generali.com.my/SmartPolicy/sendMail";
 var logoutfunction = "https://smartpolicy.generali.com.my/SmartPolicy/logoff";
 var renewalinfosearch = " https://smartpolicy.generali.com.my/SmartPolicy/search";
 var enquirysearch = "https://smartpolicy.generali.com.my/SmartPolicy/enquirysearch";
 var ipayrequeryurl = "https://smartpolicy.generali.com.my/SmartPolicy/ipayRequery";
 var customerPayment = "https://smartpolicy.generali.com.my/SmartPolicy/generateLink";
 var versioncheck = "https://smartpolicy.generali.com.my/SmartPolicy/checkAppVersion";
 var p2_shareQuote = "https://smartpolicy.generali.com.my/SmartPolicy/shareQuote";
 var p2_master = "https://smartpolicy.generali.com.my/SmartPolicy/commonmasterdata";
  var p2_vehicleusageList = "https://smartpolicy.generali.com.my/SmartPolicy/vehUseCodeList";
  var p2_flashNCD  = "https://smartpolicy.generali.com.my/SmartPolicy/getFlasVixNcd";
  var p2_makemodel = "https://smartpolicy.generali.com.my/SmartPolicy/makeModelSearch";
  var p2_getPremium = "https://smartpolicy.generali.com.my/SmartPolicy/getPremium";
  var p2_savequote = "https://smartpolicy.generali.com.my/SmartPolicy/saveQuotation";
  var p2_coverageList = "https://smartpolicy.generali.com.my/SmartPolicy/coverageList";
  var p2_vehicleusageList = "https://smartpolicy.generali.com.my/SmartPolicy/vehUseCodeList";
  var p2_piamDriverList = "https://smartpolicy.generali.com.my/SmartPolicy/piamDriverList";
  var p2_extracoverageList = "https://smartpolicy.generali.com.my/SmartPolicy/extracoverageList";
  var p2_retrivequote = "https://smartpolicy.generali.com.my/SmartPolicy/retrivequote";
  var p2_stateList = "https://smartpolicy.generali.com.my/SmartPolicy/statelist";
  var videoLinkPayment = "https://smartpolicy.generali.com.my/SmartPolicy/getVideoLink";


//UAT
  // var loginurl = "https://generaliuat.kgisl.com/SmartPolicy/authenticateuser";
  // var dashboard = "https://generaliuat.kgisl.com/SmartPolicy/dashboardcount";
  // var renewalinfo = "https://generaliuat.kgisl.com/SmartPolicy/policies";
  // var renewaldetails = "https://generaliuat.kgisl.com/SmartPolicy/policyDetails";
  // var enquirydetails = "https://generaliuat.kgisl.com/SmartPolicy/enquiryDetails";
  // var payment_details = "https://generaliuat.kgisl.com/SmartPolicy/payment";
  // var unlockaccount = "https://generaliuat.kgisl.com/SmartPolicy/unlockAccount";
  // var forgotpass = "https://generaliuat.kgisl.com/SmartPolicy/forgotpassword";
  // var paid_details = "https://generaliuat.kgisl.com/SmartPolicy/paymentDetails";
  // var updatepass = "https://generaliuat.kgisl.com/SmartPolicy/updatepassword";
  // var manualPayment = "https://generaliuat.kgisl.com/SmartPolicy/manualPayment";
  // var oauthtoken = "https://generaliuat.kgisl.com/SmartPolicy/oauth/token";
  // var backendPayment = "https://generaliuat.kgisl.com/SmartPolicy/directPayment";
  // var sendMail = "https://generaliuat.kgisl.com/SmartPolicy/sendMail";
  // var logoutfunction = "https://generaliuat.kgisl.com/SmartPolicy/logoff";
  // var renewalinfosearch = " https://generaliuat.kgisl.com/SmartPolicy/search";
  // var enquirysearch = "https://generaliuat.kgisl.com/SmartPolicy/enquirysearch";
  // var ipayrequeryurl = "https://generaliuat.kgisl.com/SmartPolicy/ipayRequery";
  // var customerPayment = "https://generaliuat.kgisl.com/SmartPolicy/generateLink";
  // var versioncheck = "https://generaliuat.kgisl.com/SmartPolicy/checkAppVersion";
  // var p2_shareQuote = "https://generaliuat.kgisl.com/SmartPolicy/shareQuote";
  // var p2_master = "https://generaliuat.kgisl.com/SmartPolicy/commonmasterdata";
  // var p2_vehicleusageList = "https://generaliuat.kgisl.com/SmartPolicy/vehUseCodeList";
  // var p2_flashNCD  = "https://generaliuat.kgisl.com/SmartPolicy/getFlasVixNcd";
  // var p2_makemodel = "https://generaliuat.kgisl.com/SmartPolicy/makeModelSearch";
  // var p2_getPremium = "https://generaliuat.kgisl.com/SmartPolicy/getPremium";
  // var p2_savequote = "https://generaliuat.kgisl.com/SmartPolicy/saveQuotation";
  // var p2_coverageList = "https://generaliuat.kgisl.com/SmartPolicy/coverageList";
  // var p2_vehicleusageList = "https://generaliuat.kgisl.com/SmartPolicy/vehUseCodeList";
  // var p2_piamDriverList = "https://generaliuat.kgisl.com/SmartPolicy/piamDriverList";
  // var p2_extracoverageList = "https://generaliuat.kgisl.com/SmartPolicy/extracoverageList";
  // var p2_retrivequote = "https://generaliuat.kgisl.com/SmartPolicy/retrivequote";
  // var p2_stateList = "https://generaliuat.kgisl.com/SmartPolicy/statelist";
  // var videoLinkPayment = "https://generaliuat.kgisl.com/SmartPolicy/getVideoLink";

//IUAT
//var loginurl="https://axaportaluat.kgisl.com:444/AXA_MOBILE_IUAT/authenticateuser";
//var dashboard="https://axaportaluat.kgisl.com:444/AXA_MOBILE_IUAT/dashboardcount";
//var renewalinfo="https://axaportaluat.kgisl.com:444/AXA_MOBILE_IUAT/policies";
//var renewaldetails="https://axaportaluat.kgisl.com:444/AXA_MOBILE_IUAT/policyDetails";
//var enquirydetails="https://axaportaluat.kgisl.com:444/AXA_MOBILE_IUAT/enquiryDetails";
//var payment_details ="https://axaportaluat.kgisl.com:444/AXA_MOBILE_IUAT/payment";
//var unlockaccount="https://axaportaluat.kgisl.com:444/AXA_MOBILE_IUAT/unlockAccount";
//var forgotpass = "https://axaportaluat.kgisl.com:444/AXA_MOBILE_IUAT/forgotpassword";
//var paid_details = "https://axaportaluat.kgisl.com:444/AXA_MOBILE_IUAT/paymentDetails";
//var updatepass = "https://axaportaluat.kgisl.com:444/AXA_MOBILE_IUAT/updatepassword";
//var manualPayment = "https://axaportaluat.kgisl.com:444/AXA_MOBILE_IUAT/manualPayment";
//var oauthtoken = "https://axaportaluat.kgisl.com:444/AXA_MOBILE_IUAT/oauth/token";
//var backendPayment = "https://axaportaluat.kgisl.com:444/AXA_MOBILE_IUAT/directPayment";
//var sendMail = "https://axaportaluat.kgisl.com:444/AXA_MOBILE_IUAT/sendMail";
//var logoutfunction = "https://axaportaluat.kgisl.com:444/AXA_MOBILE_IUAT/logoff";
//var renewalinfosearch = " https://axaportaluat.kgisl.com:444/AXA_MOBILE_IUAT/search";
//var enquirysearch = "https://axaportaluat.kgisl.com:444/AXA_MOBILE_IUAT/enquirysearch";
//var ipayrequeryurl = "https://axaportaluat.kgisl.com:444/AXA_MOBILE_IUAT/ipayRequery";
//var customerPayment = "https://axaportaluat.kgisl.com:444/AXA_MOBILE_IUAT/generateLink";
//var versioncheck = "https://axaportaluat.kgisl.com:444/AXA_MOBILE_IUAT/checkAppVersion";
//var p2_master = "https://axaportaluat.kgisl.com:444/AXA_MOBILE_IUAT/commonmasterdata";
//var p2_flashNCD  = "https://axaportaluat.kgisl.com:444/AXA_MOBILE_IUAT/getFlasVixNcd";
//var p2_makemodel = "https://axaportaluat.kgisl.com:444/AXA_MOBILE_IUAT/makeModelSearch";
//var p2_getPremium = "https://axaportaluat.kgisl.com:444/AXA_MOBILE_IUAT/getPremium";
//var p2_savequote = "https://axaportaluat.kgisl.com:444/AXA_MOBILE_IUAT/saveQuotation";
//var p2_coverageList = "https://axaportaluat.kgisl.com:444/AXA_MOBILE_IUAT/coverageList";
//var p2_vehicleusageList = "https://axaportaluat.kgisl.com:444/AXA_MOBILE_IUAT/vehUseCodeList";
//var p2_piamDriverList = "https://axaportaluat.kgisl.com:444/AXA_MOBILE_IUAT/piamDriverList";
//var p2_extracoverageList = "https://axaportaluat.kgisl.com:444/AXA_MOBILE_IUAT/extracoverageList";
//var p2_retrivequote = "https://axaportaluat.kgisl.com:444/AXA_MOBILE_IUAT/retrivequote";
//var p2_stateList = "https://axaportaluat.kgisl.com:444/AXA_MOBILE_IUAT/statelist";
//var p2_shareQuote = "https://axaportaluat.kgisl.com:444/AXA_MOBILE_IUAT/shareQuote";
//var p2_shareQuote = "https://axaportaluat.kgisl.com:444/AXA_MOBILE_IUAT/shareQuote";

//SQA
//var loginurl="https://generaliuat.kgisl.com:444/SmartPolicy/authenticateuser";
//var dashboard="https://generaliuat.kgisl.com:444/SmartPolicy/dashboardcount";
//var renewalinfo="https://generaliuat.kgisl.com:444/SmartPolicy/policies";
//var renewaldetails="https://generaliuat.kgisl.com:444/SmartPolicy/policyDetails";
//var enquirydetails="https://generaliuat.kgisl.com:444/SmartPolicy/enquiryDetails";
//var payment_details ="https://generaliuat.kgisl.com:444/SmartPolicy/payment";
//var unlockaccount="https://generaliuat.kgisl.com:444/SmartPolicy/unlockAccount";
//var forgotpass = "https://generaliuat.kgisl.com:444/SmartPolicy/forgotpassword";
//var paid_details = "https://generaliuat.kgisl.com:444/SmartPolicy/paymentDetails";
//var updatepass = "https://generaliuat.kgisl.com:444/SmartPolicy/updatepassword";
//var manualPayment = "https://generaliuat.kgisl.com:444/SmartPolicy/manualPayment";
//var oauthtoken = "https://generaliuat.kgisl.com:444/SmartPolicy/oauth/token";
//var backendPayment = "https://generaliuat.kgisl.com:444/SmartPolicy/directPayment";
//var sendMail = "https://generaliuat.kgisl.com:444/SmartPolicy/sendMail";
//var logoutfunction = "https://generaliuat.kgisl.com:444/SmartPolicy/logoff";
//var renewalinfosearch = "https://generaliuat.kgisl.com:444/SmartPolicy/search";
//var enquirysearch = "https://generaliuat.kgisl.com:444/SmartPolicy/enquirysearch";
//var ipayrequeryurl = "https://generaliuat.kgisl.com:444/SmartPolicy/ipayRequery";
//var customerPayment = "https://generaliuat.kgisl.com:444/SmartPolicy/generateLink";
//var versioncheck = "https://generaliuat.kgisl.com:444/SmartPolicy/checkAppVersion";

 /* Phase 2 Urls */
// var p2_master = "https://generaliuat.kgisl.com:444/SmartPolicy/commonmasterdata";
// var p2_flashNCD  = "https://generaliuat.kgisl.com:444/SmartPolicy/getFlasVixNcd";
// var p2_makemodel = "https://generaliuat.kgisl.com:444/SmartPolicy/makeModelSearch";
// var p2_getPremium = "https://generaliuat.kgisl.com:444/SmartPolicy/getPremium";
// var p2_savequote = "https://generaliuat.kgisl.com:444/SmartPolicy/saveQuotation";
// var p2_coverageList = "https://generaliuat.kgisl.com:444/SmartPolicy/coverageList";
// var p2_vehicleusageList = "https://generaliuat.kgisl.com:444/SmartPolicy/vehUseCodeList";
// var p2_piamDriverList = "https://generaliuat.kgisl.com:444/SmartPolicy/piamDriverList";
// var p2_extracoverageList = "https://generaliuat.kgisl.com:444/SmartPolicy/extracoverageList";
// var p2_retrivequote = "https://generaliuat.kgisl.com:444/SmartPolicy/retrivequote";
// var p2_stateList = "https://generaliuat.kgisl.com:444/SmartPolicy/statelist";
//var videoLinkPayment = "https://generaliuat.kgisl.com:444/SmartPolicy/getVideoLink";

//ilive
//var loginurl="https://generaliuat.kgisl.com:555/SmartPolicy/authenticateuser";
// var dashboard="https://generaliuat.kgisl.com:555/SmartPolicy/dashboardcount";
// var renewalinfo="https://generaliuat.kgisl.com:555/SmartPolicy/policies";
// var renewaldetails="https://generaliuat.kgisl.com:555/SmartPolicy/policyDetails";
// var enquirydetails="https://generaliuat.kgisl.com:555/SmartPolicy/enquiryDetails";
// var payment_details ="https://generaliuat.kgisl.com:555/SmartPolicy/payment";
// var unlockaccount="https://generaliuat.kgisl.com:555/SmartPolicy/unlockAccount";
// var forgotpass = "https://generaliuat.kgisl.com:555/SmartPolicy/forgotpassword";
// var paid_details = "https://generaliuat.kgisl.com:555/SmartPolicy/paymentDetails";
// var updatepass = "https://generaliuat.kgisl.com:555/SmartPolicy/updatepassword";
// var manualPayment = "https://generaliuat.kgisl.com:555/SmartPolicy/manualPayment";
// var oauthtoken = "https://generaliuat.kgisl.com:555/SmartPolicy/oauth/token";
// var backendPayment = "https://generaliuat.kgisl.com:555/SmartPolicy/directPayment";
// var sendMail = "https://generaliuat.kgisl.com:555/SmartPolicy/sendMail";
// var logoutfunction = "https://generaliuat.kgisl.com:555/SmartPolicy/logoff";
// var renewalinfosearch = "https://generaliuat.kgisl.com:555/SmartPolicy/search";
// var enquirysearch = "https://generaliuat.kgisl.com:555/SmartPolicy/enquirysearch";
// var ipayrequeryurl = "https://generaliuat.kgisl.com:555/SmartPolicy/ipayRequery";
// var customerPayment = "https://generaliuat.kgisl.com:555/SmartPolicy/generateLink";
// var versioncheck = "https://generaliuat.kgisl.com:555/SmartPolicy/checkAppVersion";

//// /* Phase 2 Urls */
// var p2_master = "https://generaliuat.kgisl.com:555/SmartPolicy/commonmasterdata";
// var p2_flashNCD  = "https://generaliuat.kgisl.com:555/SmartPolicy/getFlasVixNcd";
// var p2_makemodel = "https://generaliuat.kgisl.com:555/SmartPolicy/makeModelSearch";
// var p2_getPremium = "https://generaliuat.kgisl.com:555/SmartPolicy/getPremium";
// var p2_savequote = "https://generaliuat.kgisl.com:555/SmartPolicy/saveQuotation";
// var p2_coverageList = "https://generaliuat.kgisl.com:555/SmartPolicy/coverageList";
// var p2_vehicleusageList = "https://generaliuat.kgisl.com:555/SmartPolicy/vehUseCodeList";
// var p2_piamDriverList = "https://generaliuat.kgisl.com:555/SmartPolicy/piamDriverList";
// var p2_extracoverageList = "https://generaliuat.kgisl.com:555/SmartPolicy/extracoverageList";
// var p2_retrivequote = "https://generaliuat.kgisl.com:555/SmartPolicy/retrivequote";
// var p2_stateList = "https://generaliuat.kgisl.com:555/SmartPolicy/statelist";
//var videoLinkPayment = "https://generaliuat.kgisl.com:555/SmartPolicy/getVideoLink";
// /* Phase 2 Urls */

//var loginurl = "http://172.25.50.86:8080/SmartPolicy/authenticateuser";
//var dashboard = "http://172.25.50.86:8080/SmartPolicy/dashboardcount";
//var renewalinfo = "http://172.25.50.86:8080/SmartPolicy/policies";
//var renewaldetails = "http://172.25.50.86:8080/SmartPolicy/policyDetails";
//var enquirydetails = "http://172.25.50.86:8080/SmartPolicy/enquiryDetails";
//var payment_details = "http://172.25.50.86:8080/SmartPolicy/payment";
//var unlockaccount = "http://172.25.50.86:8080/SmartPolicy/unlockAccount";
//var forgotpass = "http://172.25.50.86:8080/SmartPolicy/forgotpassword";
//var paid_details = "http://172.25.50.86:8080/SmartPolicy/paymentDetails";
//var updatepass = "http://172.25.50.86:8080/SmartPolicy/updatepassword";
//var manualPayment = "http://172.25.50.86:8080/SmartPolicy/manualPayment";
//var oauthtoken = "http://172.25.50.86:8080/SmartPolicy/oauth/token";
//var backendPayment = "http://172.25.50.86:8080/SmartPolicy/directPayment";
//var sendMail = "http://172.25.50.86:8080/SmartPolicy/sendMail";
//var logoutfunction = "http://172.25.50.86:8080/SmartPolicy/logoff";
//var renewalinfosearch = " http://172.25.50.86:8080/SmartPolicy/search";
//var enquirysearch = "http://172.25.50.86:8080/SmartPolicy/enquirysearch";
//var ipayrequeryurl = "http://172.25.50.86:8080/SmartPolicy/ipayRequery";
//var customerPayment = "http://172.25.50.86:8080/SmartPolicy/generateLink";
//var versioncheck = "http://172.25.50.86:8080/SmartPolicy/checkAppVersion";
//var p2_shareQuote = "http://172.25.50.86:8080/SmartPolicy/shareQuote";
//var p2_master = "http://172.25.50.86:8080/SmartPolicy/commonmasterdata";
// var p2_vehicleusageList = "http://172.25.50.86:8080/SmartPolicy/vehUseCodeList";
// var p2_flashNCD  = "http://172.25.50.86:8080/SmartPolicy/getFlasVixNcd";
// var p2_makemodel = "http://172.25.50.86:8080/SmartPolicy/makeModelSearch";
// var p2_getPremium = "http://172.25.50.86:8080/SmartPolicy/getPremium";
// var p2_savequote = "http://172.25.50.86:8080/SmartPolicy/saveQuotation";
// var p2_coverageList = "http://172.25.50.86:8080/SmartPolicy/coverageList";
// var p2_vehicleusageList = "http://172.25.50.86:8080/SmartPolicy/vehUseCodeList";
// var p2_piamDriverList = "http://172.25.50.86:8080/SmartPolicy/piamDriverList";
// var p2_extracoverageList = "http://172.25.50.86:8080/SmartPolicy/extracoverageList";
// var p2_retrivequote = "http://172.25.50.86:8080/SmartPolicy/retrivequote";
// var p2_stateList = "http://172.25.50.86:8080/SmartPolicy/statelist";
// var videoLinkPayment = "http://172.25.50.86:8080/SmartPolicy/getVideoLink";

////Working local url
//var loginurl = "http://172.25.50.49:8080/SmartPolicy/authenticateuser";
//var dashboard = "http://172.25.50.49:8080/SmartPolicy/dashboardcount";
//var renewalinfo = "http://172.25.50.49:8080/SmartPolicy/policies";
//var renewaldetails = "http://172.25.50.49:8080/SmartPolicy/policyDetails";
//var enquirydetails = "http://172.25.50.49:8080/SmartPolicy/enquiryDetails";
//var payment_details = "http://172.25.50.49:8080/SmartPolicy/payment";
//var unlockaccount = "http://172.25.50.49:8080/SmartPolicy/unlockAccount";
//var forgotpass = "http://172.25.50.49:8080/SmartPolicy/forgotpassword";
//var paid_details = "http://172.25.50.49:8080/SmartPolicy/paymentDetails";
//var updatepass = "http://172.25.50.49:8080/SmartPolicy/updatepassword";
//var manualPayment = "http://172.25.50.49:8080/SmartPolicy/manualPayment";
//var oauthtoken = "http://172.25.50.49:8080/SmartPolicy/oauth/token";
//var backendPayment = "http://172.25.50.49:8080/SmartPolicy/directPayment";
//var sendMail = "http://172.25.50.49:8080/SmartPolicy/sendMail";
//var logoutfunction = "http://172.25.50.49:8080/SmartPolicy/logoff";
//var renewalinfosearch = " http://172.25.50.49:8080/SmartPolicy/search";
//var enquirysearch = "http://172.25.50.49:8080/SmartPolicy/enquirysearch";
//var ipayrequeryurl = "http://172.25.50.49:8080/SmartPolicy/ipayRequery";
//var customerPayment = "http://172.25.50.49:8080/SmartPolicy/generateLink";
//var versioncheck = "http://172.25.50.49:8080/SmartPolicy/checkAppVersion";
//var p2_shareQuote = "http://172.25.50.49:8080/SmartPolicy/shareQuote";
//var p2_master = "http://172.25.50.49:8080/SmartPolicy/commonmasterdata";
//var p2_vehicleusageList = "http://172.25.50.49:8080/SmartPolicy/vehUseCodeList";
//var p2_flashNCD  = "http://172.25.50.49:8080/SmartPolicy/getFlasVixNcd";
//var p2_makemodel = "http://172.25.50.49:8080/SmartPolicy/makeModelSearch";
//var p2_getPremium = "http://172.25.50.49:8080/SmartPolicy/getPremium";
//var p2_savequote = "http://172.25.50.49:8080/SmartPolicy/saveQuotation";
//var p2_coverageList = "http://172.25.50.49:8080/SmartPolicy/coverageList";
//var p2_vehicleusageList = "http://172.25.50.49:8080/SmartPolicy/vehUseCodeList";
//var p2_piamDriverList = "http://172.25.50.49:8080/SmartPolicy/piamDriverList";
//var p2_extracoverageList = "http://172.25.50.49:8080/SmartPolicy/extracoverageList";
//var p2_retrivequote = "http://172.25.50.49:8080/SmartPolicy/retrivequote";
//var p2_stateList = "http://172.25.50.49:8080/SmartPolicy/statelist";
//var videoLinkPayment = "http://172.25.50.49:8080/SmartPolicy/getVideoLink";


var policylist;
var pass_iv = "axarpa256ivSpec1";
var pass_salt = "axarpa256encryption";
var pass_keySize = 256;
var pass_iterationCount = 10;
var pass_Phrase = "axa@5432";
//currency format change
function currencyformat(n, currency) {
    if(!isEmpty(n))
    {
      return currency + " " + n.toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, "$1,");
    }
    else
    {
        return 0;
    }
}
//logout
function logout() {
  var logoutdeviceid = {loginlogid:getItem("logindeviceid"),agentcode:getItem("agentcode")};
   Apilogoutservicecall(logoutfunction,logoutdeviceid);
}
//check isempty
function isEmpty(value)
{
  return typeof value == 'string' && !value.trim() || typeof value == 'undefined' || value === null;
}
//Email validation
function validateEmail(email) {
  /*Primary check for email*/
  var mail=email.split(",");
  var result = true;
  var re = /^([a-zA-Z0-9_.-])+@([a-zA-Z0-9_.-])+\.([a-zA-Z])+\.[a-zA-Z]{2,3}$/;
  var re1 = /^([a-zA-Z0-9_.-])+@([a-zA-Z0-9_.-])+\.[a-zA-Z]{2,3}$/;
  for(var i=0;i<mail.length;i++){
    if(re1.test(mail[i].trim())==false){
      if(re.test(mail[i].trim()) == false) {
        result=false;
      }
    }
  }
  if(!result){
    return false;
  }
  /*Additional validation for multiple email addresses*/
  var regexat = /[@]/gi;
  var regexcomma = /[,]/gi;
  var regexdot = /[.]/gi;
  var atcount = 0;
  if(email.match(regexat)){
    atcount = email.match(regexat).length;
  }
  var commacount = 0;
  if(email.match(regexcomma)){
    commacount = email.match(regexcomma).length;
  }
  var dotcount = 0;
  dotcount = email.match(regexdot).length;
  /*Checking for valid delimeter(,) existence*/
  if(atcount >1 ) {
    if(atcount != commacount + 1) {
      //return false;
    }
  }
  /*Checking for full stop at starting and ending position*/
  if(dotcount > 1) {
    if((email.indexOf(".") == 0) || (email.lastIndexOf(".")+3 >= email.length)) {
      //return false;
    }
  }
  return result;
}

//user selecting
var userlist;
function switchuser(){
  hide('showpop');
  hide('showpop1');
if(checkOnline()){
  getItem("emailid");
  getItem("pass");
  userlist= JSON.parse(getItem("userlist"));
  console.log(userlist);
  $('#showpop').empty();
  $('#showpop').append("<form onsubmit='return false' autocomplete='off'><h5 class='text-center'>Select Agent Code</h5><input type='text' placeholder='Please enter your agent code' class='axa-input input-form agent-sel' id='agentSelect' onkeyup='commonFilter(true)' ontouchend='commonFilter(false)'><ul id='selectAgentDiv' class='formUL'></ul><h6 id='invalidmsg' style='display:none'></h6><button class='popup-btn' id='btn_switchagentid' onclick='userselected()'>OK</button><button class='popup-btn' onclick='dismiss()'>CANCEL</button></form>");
  userlist.sort( function(a,b) { return a.agentcode - b.agentcode; });
  for(var i=0;i<userlist.length;i++){
      $("#selectAgentDiv").append($("<li>").text(userlist[i].agentcode));
  }
  show('showpop');
}
}
//selecting user
function userselected(){
  var usrAvail = true;
  var agentCode = document.getElementById("agentSelect").value;
  if(agentCode != "")
  {
    for(var i=0;i<userlist.length;i++){
      if(userlist[i].agentcode == agentCode){
        document.getElementById('agentSelect').value="";
        usrAvail = false;
        if(userlist[i].piamcode==null || userlist[i].piamcode=="" || userlist[i].piamcode== undefined){
            hide('showpop');
            showalertnormalswitchuser("PIAM code is not available!");
        }
        else{
          setItem("agentcode", userlist[i].agentcode);
          setItem("agentname", userlist[i].agentname);
          setItem("smartpolicyind", userlist[i].smartpolicyind);
          setItem("smartpolicymotorind", userlist[i].smartpolicymotorind);
          setItem("policytype", 1);
          hide('showpop');
        if(checkOnline()){
          location.href='dashboard.html';
        }
       }
      }
    }
    if(usrAvail){
      document.getElementById('invalidmsg').innerHTML = "Please enter valid agent code";
      document.getElementById('invalidmsg').style.display = 'block';
    }
  }
  else{
    document.getElementById('invalidmsg').innerHTML = "Please enter your agent code";
    document.getElementById('invalidmsg').style.display = 'block';
  }
}
function commonFilter(isTouch){
  console.log(isTouch)
  var input, filter, a, i,div;
  input = document.getElementById("agentSelect");
  filter = input.value.toUpperCase();
  div = document.getElementById("showpop");
  a = div.getElementsByTagName("li");
  document.getElementById('invalidmsg').style.display = 'none';
  var searchValue = document.getElementById('agentSelect').value;
  if(isTouch == true){
  if( searchValue != ""){
  $("#selectAgentDiv").css('display','block');
    var count=0;
    for (i = 0; i < a.length; i++) {
        if (a[i].innerHTML.toUpperCase().indexOf(filter) > -1) {
            a[i].style.display = "";
        } else {
          count+=1;
          if(count == a.length){
              $("#selectAgentDiv").css('display','none');
          }
            a[i].style.display = "none";
        }
    }
  }
  else{
    for (i = 0; i < a.length; i++) {
        a[i].style.display = "block";
      }
    if(a.length>0){
    $("#selectAgentDiv").css('display','block');
    }
  }
}
else{
  if( searchValue == ""){
      $("#selectAgentDiv").css('display','block');
  }
}
}
function showalertnormalswitchuser(message){
  $('#showpop1').empty();
  $('#showpop1').innerHTML = "";
  $('#showpop1').append("<h5>Message</h5><p>" + message + "</p><button class='popup-btn' onclick='switchuser();'>OK</button>");
  show('showpop1');
}
//dismiss select user
function dismiss(){
  hide('showpop');
}
var keySize = 256;
var ivSize = 128;
var iterations = 10;
function encrypt (msg, pass) {
  var salt = CryptoJS.lib.WordArray.random(128/8);
  var key = CryptoJS.PBKDF2(pass, salt, {
      keySize: keySize/32,
      iterations: iterations
    });

  var iv = CryptoJS.lib.WordArray.random(128/8);
  var encrypted = CryptoJS.AES.encrypt(msg, key, {
    iv: iv,
    padding: CryptoJS.pad.Pkcs7,
    mode: CryptoJS.mode.CBC
  });
  var transitmessage = salt.toString()+ iv.toString() + encrypted.toString();
  return transitmessage;
}

function decrypt (transitmessage, pass) {
if(transitmessage!=null)
{
  var salt = CryptoJS.enc.Hex.parse(transitmessage.substr(0, 32));
  var iv = CryptoJS.enc.Hex.parse(transitmessage.substr(32, 32))
  var encrypted = transitmessage.substring(64);
  var key = CryptoJS.PBKDF2(pass, salt, {
      keySize: keySize/32,
      iterations: iterations
    });
  var decrypted = CryptoJS.AES.decrypt(encrypted, key, {
    iv: iv,
    padding: CryptoJS.pad.Pkcs7,
    mode: CryptoJS.mode.CBC
  })
  return decrypted;
  }
}
function setItem(key,value)
{
    var encrypted = encrypt(""+value,key);
    localStorage.setItem(key,encrypted);
}
function getItem(key)
{
var result="";
  var encrypted =localStorage.getItem(key);
  var decrypted = decrypt(encrypted, key);
  	if(!isEmpty(decrypted))
  	{
  	    result=decrypted.toString(CryptoJS.enc.Utf8);
  	}
  return result;
}
//keypress Common
function handlespace(e){
var commonInputFieldUppercase;
var commonInputFieldTrim;
var keyspace = e.selectionEnd;
var commonId = e.id;
var commonInputField = document.getElementById(commonId);
var commonInputFieldValue = commonInputField.value;
commonInputFieldTrim = commonInputFieldValue.replace(/\s/g, '');
document.getElementById(commonId).value = commonInputFieldTrim;
var commonInputFieldPosition = commonInputFieldTrim.length;
if(keyspace!=commonInputFieldPosition){
  commonInputField.focus();
  commonInputField.setSelectionRange(keyspace, keyspace);
}
else if (commonInputField.setSelectionRange) {
commonInputField.focus();
commonInputField.setSelectionRange(commonInputFieldPosition, commonInputFieldPosition);
}
}

function redirectionpage(value){
    if(checkOnline()){
      window.location.href = value;
    }
}
function stringToHex (str) {
  var hex = '';
  	for(var i=0;i<str.length;i++) {
  		hex += ''+str.charCodeAt(i).toString(16);
  	}
  	return hex;
}
function passEncrypt(plain)
{
  var plainText=plain.toString();
  var aesUtil = new AesUtil(keySize, pass_iterationCount);
  var encrypt = aesUtil.encrypt(stringToHex(pass_salt),stringToHex(pass_iv), pass_Phrase, plainText);
  return encrypt;
}
function passDecrypt(cipherText)
{
  var aesUtil = new AesUtil(keySize, pass_iterationCount);
  var decrypt = aesUtil.decrypt(stringToHex(pass_salt),stringToHex(pass_iv), pass_Phrase, cipherText);
  return decrypt;
}

function localstorageclearMotor(isRetriveCheck){
  if(isRetriveCheck == "N"){
    localstorageclearmotorcommon();
  }
  else{
    localstorageclearmotorcommon();
    localStorage.removeItem("retrivequoteReqJSON");
  }
}
function localstorageclearmotorcommon(){
  localStorage.removeItem("vehiclemakecode");
  localStorage.removeItem("vehiclemodelcode");
  localStorage.removeItem("vehiclebodydesc");
  localStorage.removeItem("vehiclebodycode");
  localStorage.removeItem("retrivequoteRes");
  localStorage.removeItem("genderlist");
  localStorage.removeItem("martialstatusList");
  localStorage.removeItem("DOBFromIc");
  localStorage.removeItem("searchmodeltable");
  localStorage.removeItem("ncdresponse");
  localStorage.removeItem("premiumresponse");
  localStorage.removeItem("retrivequoteclicked");
  localStorage.removeItem("occupationListJSON");
  localStorage.removeItem("clientIdNCDRes");
  localStorage.removeItem("policyExpiryDate");
  localStorage.removeItem("vehiclenviccode");
  
}

function redirectionpagevehicledet(value){
  localstorageclearMotor("Y");
  window.location.href = value;
}

function keypadclose(){
  $("input").blur();
}