/*! Map_Plotter_Grunt - v0.0.1 - 2016-05-11 */
var emailFlag = false;
var conEmailFlag = false;
var userProfile = {
  sData: {},
  newData: {},
  userJson: {},
  validationFlag: !0,
  //diabetesType: document.getElementsByName("diabetesType"),
  specialConsideration: document.getElementsByName("specialConsideration"),
  
  DynamiCall: function(a) {
    $.orchestracmsRestProxy.doAjaxServiceRequest("DV_OCMS_UpdateAccountDetail_Service", a, function(a, b, c) {
	document.getElementById("userDataSubmit").disabled = true;
      if (b.success) {
        console.log(b), userProfile.userJson = b, userProfile.userJson.UserDetail.DA_Concession_expiry_Date__c &&
		null !== userProfile.userJson.UserDetail.DA_Concession_expiry_Date__c && "" !== userProfile.userJson.UserDetail.DA_Concession_expiry_Date__c &&
		$("#expDate").val(userProfile.userJson.UserDetail.DA_Concession_expiry_Date__c), 
		userProfile.userJson.UserDetail.DA_Membership_Number__c && $("#davNumber").val(userProfile.userJson.UserDetail.DA_Membership_Number__c), 
		userProfile.userJson.UserDetail.DA_Member_Type__c && $("#MembershipType").val(userProfile.userJson.UserDetail.DA_Member_Type__c),
		userProfile.userJson.UserDetail.Salutation && $("#titleId").val(userProfile.userJson.UserDetail.Salutation), 
		userProfile.userJson.UserDetail.FirstName && $("#firstName").val(userProfile.userJson.UserDetail.FirstName), 
		userProfile.userJson.UserDetail.PersonEmail && $("#emailAdd").val(userProfile.userJson.UserDetail.PersonEmail),
		userProfile.userJson.UserDetail.PersonEmail && $("#coEmailAdd").val(userProfile.userJson.UserDetail.PersonEmail),
		userProfile.userJson.UserDetail.LastName && $("#lastName").val(userProfile.userJson.UserDetail.LastName),
		
	
		userProfile.userJson.UserDetail.BillingStreet && $("#addressOne").val(userProfile.userJson.UserDetail.BillingStreet), 
		userProfile.userJson.UserDetail.BillingCity && $("#cityName").val(userProfile.userJson.UserDetail.BillingCity), 
		userProfile.userJson.UserDetail.BillingCountry && $("#countryName").val(userProfile.userJson.UserDetail.BillingCountry),
		userProfile.userJson.UserDetail.BillingState && $("#stateName").val(userProfile.userJson.UserDetail.BillingState),
		userProfile.userJson.UserDetail.BillingPostalCode && $("#postCode").val(userProfile.userJson.UserDetail.BillingPostalCode), 
		userProfile.userJson.UserDetail.Phone && $("#contact").val(userProfile.userJson.UserDetail.Phone), 
		userProfile.userJson.UserDetail.PersonMobilePhone && $("#mobile").val(userProfile.userJson.UserDetail.PersonMobilePhone), 
		userProfile.userJson.DOB && null !== userProfile.userJson.DOB && "null" !== userProfile.userJson.DOB &&
		"null" !== userProfile.userJson.DOB && $("#dob").val(userProfile.dateFormat(userProfile.userJson.DOB));
       
	   
	   
	   var d = document.getElementById("diabetesTypes");
       console.log('d0----->> '+d);
        if (null !== d){
			console.log('d1----->>');
          if ("" !== userProfile.userJson.DA_Diabetes_Type__c) {
				console.log('d2----->>Length ---->> '+userProfile.userJson.DA_Diabetes_Type__c.length);
				console.log('d3----->>'+JSON.stringify(userProfile.userJson.DA_Diabetes_Type__c));
				for (var h = 0; h < userProfile.userJson.DA_Diabetes_Type__c.length; h++) {
				  var k = document.createElement("option");
				  console.log('d4----->>PicklistVal---->> '+userProfile.userJson.DA_Diabetes_Type__c[h].PicklistVal);
				  k.textContent = userProfile.userJson.DA_Diabetes_Type__c[h].PicklistVal, k.setAttribute("value", userProfile.userJson.DA_Diabetes_Type__c[h].PicklistVal), d.appendChild(k) 
				} 
				var ab=$("#diabetesTypes").val(userProfile.userJson.UserDetail.DA_Diabetes_Type__c) 
				console.log('d5----->>ab---->> '+ab);
				console.log('d6----->>UserDetail---->> '+userProfile.userJson.UserDetail.DA_Diabetes_Type__c);
				userProfile.userJson.UserDetail.DA_Diabetes_Type__c && "" !== userProfile.userJson.UserDetail.DA_Diabetes_Type__c ? $("#diabetesTypes").val(userProfile.userJson.UserDetail.DA_Diabetes_Type__c) : $("#diabetesTypes").val("select card type")
          } 
		}
		 
		     
		var x = document.getElementById("Indigenous");
		console.log('x0----->> '+x);
        if (null !== x){
			console.log('x1----->>');
          if ("" !== userProfile.userJson.ATSI_or_Not__c) {
				console.log('x2----->>Length ---->> '+userProfile.userJson.ATSI_or_Not__c.length);
				console.log('x3----->>'+JSON.stringify(userProfile.userJson.ATSI_or_Not__c));
				for (var h = 0; h < userProfile.userJson.ATSI_or_Not__c.length; h++) {
				  var k = document.createElement("option");
				  console.log('x4----->>PicklistVal---->> '+userProfile.userJson.ATSI_or_Not__c[h].PicklistVal);
				  k.textContent = userProfile.userJson.ATSI_or_Not__c[h].Labels, k.setAttribute("value", userProfile.userJson.ATSI_or_Not__c[h].PicklistVal), x.appendChild(k)
				}
				var ab=$("#Indigenous").val(userProfile.userJson.UserDetail.ATSI_or_Not__c) 
				console.log('x5----->>ab---->> '+ab);
				console.log('x5----->>userProfile---->> '+userProfile);
				console.log('x5----->>userProfile.userJson---->> '+userProfile.userJson);
				console.log('x5----->>userProfile.userJson.UserDetail---->> '+userProfile.userJson.UserDetail);
				console.log('x6----->>UserDetail---->> '+userProfile.userJson.UserDetail.ATSI_or_Not__c);
				userProfile.userJson.UserDetail.ATSI_or_Not__c && "" !== userProfile.userJson.UserDetail.ATSI_or_Not__c ? $("#Indigenous").val(userProfile.userJson.UserDetail.ATSI_or_Not__c) : $("#Indigenous").val("select card type")
          } else $("#Indigenous").val("select card type");
		}
		  
		  var j = document.getElementById("cardsType");
        if (null !== j)
				console.log('x6----->>Concession_Card_Type__c---->> '+userProfile.userJson.UserDetail.Concession_Card_Type__c);
          if ("" !== userProfile.userJson.Concession_Card_Type__c) {
            for (var h = 0; h < userProfile.userJson.Concession_Card_Type__c.length; h++) {
              var k = document.createElement("option");
              k.textContent = userProfile.userJson.Concession_Card_Type__c[h].PicklistVal, k.setAttribute("value", userProfile.userJson.Concession_Card_Type__c[h].PicklistVal), j.appendChild(k)
            }
            userProfile.userJson.UserDetail.Concession_Card_Type__c && "" !== userProfile.userJson.UserDetail.Concession_Card_Type__c ? $("#cardsType").val(userProfile.userJson.UserDetail.Concession_Card_Type__c) : $("#cardsType").val("select card type")
          } else $("#cardsType").val("select card type");
		  
          e = "",
          f = "",
          g = "",
		  t1="",
		  t2="";
        var i = document.getElementById("spcConsiders");
        if (null !== i) {
          for (var h = 0; h < userProfile.userJson.Special_Consideration__c.length; h++) { 
			e = userProfile.userJson.Special_Consideration__c[h].PicklistVal,
			f = userProfile.crtElementCheckbox("input", "type", "checkbox", "name", "specialConsideration[]", "", "value", e, "", "Id", e),
			i.appendChild(f),
			t2 = document.createTextNode("\u00A0\u00A0"),
			i.appendChild(t2),
			g = userProfile.crtElement("label", "", "", "", "", e),
			i.appendChild(g);
			
			if((e.localeCompare('Interpreter required'))==0)
				i.appendChild(document.createElement("br"));
			else {
				t1 = document.createTextNode("\u00A0\u00A0\u00A0"),
				i.appendChild(t1);
			}
		  }

          $.each(userProfile.userJson.SelectedSpCon, function(a, b) {
			  console.log('selected checkbox ---> '+b.SpConSelected);
            $("input:checkbox[name='specialConsideration[]'][value='" + b.SpConSelected + "']").prop("checked", !0)
          })
        }
        userProfile.userJson.Occupation && $("#occupation").val(userProfile.userJson.Occupation);
        //userProfile.userJson.DA_Concession_expiry_Date__c && $("#expDate").val(userProfile.userJson.ExpiryDate);
		
        var l = document.getElementById("languages");
        if (null !== l) {
			console.log('x5----->>ab---->> '+l);
				console.log('x5----->>userProfile---->> '+userProfile);
				console.log('x5----->>userProfile.userJson---->> '+userProfile.userJson);
				console.log('x5----->>userProfile.userJson.UserDetail---->> '+userProfile.userJson.UserDetail);
				console.log('x6----->>Language_Spoken_Home__c---->> '+userProfile.userJson.UserDetail.Language_Spoken_Home__c);
          for (var m = 0; m < userProfile.userJson.Language_Spoken_Home__c.length; m++) e = userProfile.userJson.Language_Spoken_Home__c[m].PicklistVal, k = userProfile.crtElement("option", "value", e, "", "", e), l.appendChild(k);
          userProfile.userJson.UserDetail.Language_Spoken_Home__c || "" !== userProfile.userJson.UserDetail.Language_Spoken_Home__c ? $("#languages").val(userProfile.userJson.UserDetail.Language_Spoken_Home__c) : $("#languages").val("English")
        }
        userProfile.userJson.UserDetail.Concession_Card_Number__c && $("#consCardNum").val(userProfile.userJson.UserDetail.Concession_Card_Number__c), userProfile.userJson.UserDetail.DA_Concession_expiry_Date__c && $("#consExpDate").val(userProfile.dateFormat(userProfile.userJson.UserDetail.DA_Concession_expiry_Date__c)), userProfile.userJson.magazine && "" !== userProfile.userJson.magazine && userProfile.checkedBoxChecked(), 
		userProfile.userJson.optOut && $('input[type="checkbox"][name="optOut"]').prop("checked", "checked");
		//userProfile.userJson.UserDetail.Media__c && $('input[type="checkbox"][name="media"]').prop("checked", "checked")
		
		
		var selectedVal = '';
		if(userProfile.userJson.UserDetail.Media__c)
			selectedVal = 'yes';
		else
			selectedVal = 'no';
		
		console.log('userProfile.userJson.UserDetail.Media__c----->> '+userProfile.userJson.UserDetail.Media__c);
		console.log('selectedVal----->> '+selectedVal);
		$('input[type="radio"][name="media_c"][value="' + selectedVal + '"]').prop("checked", true);
		//userProfile.userJson.UserDetail.Media__c && $('input[type="radio"][name="media"]').prop("checked", "checked")
		console.log('userProfile.userJson.Media__c----->> '+userProfile.userJson.UserDetail.Media__c);
		
      }
    }, null, !0)
  },
  
   
	emailCall: function(){
		if(!conEmailFlag) {
			var d = userProfile.checkNullObj("emailAdd");
			var z = userProfile.checkNullObj("coEmailAdd");
			console.log('d'+d);
			console.log('z'+z);

			if (d !== z && z!=="" && d !== "") {
				emailFlag = true;
				return alert("Email and Confirm Email should be same "), !0;	
			}
		}else{
			conEmailFlag = false;
		}
	},

	confirmEmail: function(){
		if(!emailFlag){
			var d = userProfile.checkNullObj("emailAdd");
			var z = userProfile.checkNullObj("coEmailAdd");
			console.log('d'+d);
			console.log('z'+z);
			if (d !== z && d!=="" ){ 
				conEmailFlag = true;
				return alert("Email and Confirm Email should be same "), !0;
			}
		}else{
			emailFlag = false;
		}
	},
  
  updateUserDetails: function(a) {
    $.orchestracmsRestProxy.doAjaxServiceRequest("DV_OCMS_UpdateAccountDetail_Service", a, function(a, b, c) {
      b.success ? (console.log(b), alert("Profile Updated Successfully.")) : console.log(b), $("#showLoader").hide()
    }, null, !1)
  },
  
  dateFormat: function(a) {
    var b = new Date(a),
      c = ("0" + b.getDate()).slice(-2),
      d = ("0" + (b.getMonth() + 1)).slice(-2);
    return c + "/" + d + "/" + b.getFullYear()
  },
  checkNullObj: function(a) {
    var b = $("#" + a).val();
    return b ? b : ""
  },
  checkedBoxChecked: function() {
    for (var a = userProfile.userJson.magazine.split(";"), b = 0; b < a.length; b++) $('input[type="checkbox"][name="magazine"][value="' + a[b] + '"]').prop("checked", "checked")
  },
  checkboxfordiabetes: function(a) {
    for (var b = [], c = 0; c < a.length; c++) a[c].checked && b.push(a[c].value);
    return b
  }, 
  //("input", "type", "checkbox", "name", "specialConsideration[]", "", "value", e)
  crtElement: function(a, b, c, d, e, f, g, h, i) {
    var j = document.createElement(a);

    if ("" !== b && j.setAttribute(b, c), "" !== d && void 0 !== d && "" !== e && void 0 !== e && j.setAttribute(d, e), void 0 !== f || "" !== f) {
      var k = document.createTextNode(f);
      j.appendChild(k)
    }
    return "" !== g && void 0 !== g && "" !== h && void 0 !== h && j.setAttribute(g, h), "" !== i && void 0 !== i && j.setAttribute(i, "true"), j
  },
  
  crtElementCheckbox: function(a, b, c, d, e, f, g, h, i, x, y) { 
    var j = document.createElement(a);
	console.log('ID i ---> '+i);
	console.log('ID x ---> '+x);
	console.log('ID y ---> '+y);
	if((y.localeCompare('None')==0))
		j.setAttribute("onclick", "noneCheckboxClick()");
	else
		j.setAttribute("onclick", "checkboxClick()");
	j.setAttribute(x, y);
    if ("" !== b && j.setAttribute(b, c), "" !== d && void 0 !== d && "" !== e && void 0 !== e && j.setAttribute(d, e), void 0 !== f || "" !== f) {
      var k = document.createTextNode(f);
      j.appendChild(k)
    }
    return "" !== g && void 0 !== g && "" !== h && void 0 !== h && j.setAttribute(g, h), "" !== i && void 0 !== i && j.setAttribute(i, "true"), j
  },
  phoneValidationGuest: function(a) {
    var b = /[0-9 -()+]+$/;
    a.length > 0 && (10 == a.length && b.test(a) || (userProfile.validationFlag = !1))
  },
  emailValidation: function(a) {
    var b = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i,
      c = b.test(a);
    c || (userProfile.validationFlag = !1)
  },
  initCapital: function(a) {
    var b = $("#" + a).val();
    return b.charAt(0).toUpperCase() + b.slice(1)
  },
  checkRequiredField: function(a) {
    "" === a && (userProfile.validationFlag = !1)
  },
  checkValidation: function(a, b, c, d) {
    "" !== a && "" !== b ? (userProfile.checkRequiredField(a), userProfile.checkRequiredField(b), userProfile.phoneValidationGuest(c), userProfile.phoneValidationGuest(d)) : userProfile.validationFlag = !1
  },
  validateAllUserDetail: function() {
    var a = userProfile.checkNullObj("titleId");
    if ("" === a) return alert("Title is required"), !0;
    var b = userProfile.checkNullObj("firstName");
    if ("" === b) return alert("First Name is required"), !0;
    var c = userProfile.checkNullObj("lastName");
    if ("" === c) return alert("Last Name is required"), !0;
	 var e = userProfile.checkNullObj("davNumber");
    if ("" === c) return alert("Diabetes Number is required"), !0;
    var d = userProfile.checkNullObj("emailAdd");
    if (userProfile.validationFlag = !0, "" === d) return alert("Email is required"), !0;
    if (userProfile.emailValidation(d), !userProfile.validationFlag) return alert("Enter valid Email Address"), !0;
	   var z = userProfile.checkNullObj("coEmailAdd");
	   console.log('d'+d);
	   console.log('z'+z);
if (d !== z) return alert("Email and Confirm Email should be same "), !0;
   /* var e = userProfile.checkNullObj("addressOne");
    if ("" === e) return alert("Address is required"), !0;
    var f = userProfile.checkNullObj("cityName");
    if ("" === f) return alert("City Name is required"), !0;
    var g = userProfile.checkNullObj("countryName");
    if ("" === g) return alert("Country Name is required"), !0;
    var h = userProfile.checkNullObj("stateName");
    if ("" === h) return alert("City Name is required"), !0;
    var i = userProfile.checkNullObj("postCode");
    if ("" === i) return alert("PostCode is required"), !0;
    var j = userProfile.checkNullObj("contact");
    if (userProfile.validationFlag = !0, "" === j) return alert("Contact is required"), !0;
    if (userProfile.phoneValidationGuest(j), !userProfile.validationFlag) return alert("Please enter 10 digit no. - area code and phone number without spaces or brakets"), !0;
    var k = userProfile.checkNullObj("mobile");
    if (userProfile.validationFlag = !0, "" === k);
    else if (userProfile.phoneValidationGuest(k), !userProfile.validationFlag) return alert("Please enter 10 digit no. - area code and phone number without spaces or brakets "), !0;
    var l = userProfile.checkNullObj("dob");
    if ("" === l) return alert("Date of Birth is required"), !0;
    var m = userProfile.checkNullObj("cardsType");
    if (m = m.toLocaleLowerCase(), "select card type" === m || "NA" === m || "" === m);
    else {
      var n = userProfile.checkNullObj("consExpDate"),
        o = userProfile.checkNullObj("consCardNum");
      if ("" === o || "" === n) return alert("Please Enter Card No & Expiry Date"), !0
    }*/
    return !1
  },
  updateUser: function() {
    if ($("#showLoader").show(), userProfile.validateAllUserDetail()) return void $("#showLoader").hide();
    var a = {};
    a.action = "recieveAccountDetails", 
	a.accountid = userProfile.userJson.UserDetail.Id, 
	a.expDate = formatDate($("#expDate").val()),//userProfile.checkNullObj("expDate"), console.log(a), 
	a.devNumber = userProfile.checkNullObj("davNumber"),
	a.MembershipType = userProfile.checkNullObj("MembershipType"), 
	a.title = userProfile.checkNullObj("titleId"),
	a.firstName = userProfile.initCapital("firstName"),
	a.lastName = userProfile.initCapital("lastName"),
	a.contact = userProfile.checkNullObj("contact"), 
	a.mobile = userProfile.checkNullObj("mobile"),
	a.email = userProfile.checkNullObj("emailAdd"),
	a.street = userProfile.checkNullObj("addressOne"), 
	a.cityName = userProfile.checkNullObj("cityName"), 
	a.stateName = userProfile.checkNullObj("stateName"),
	a.countryName = 'VIC',//userProfile.checkNullObj("countryName"),
	a.postCode = userProfile.checkNullObj("postCode"), 
	a.dob = formatDate($("#dob").val());
    for (var b = userProfile.checkboxfordiabetes(userProfile.specialConsideration), c = 0; c < b.length; c++) a["specialConsider" + c] = b[c];
   // a.diabetesType = userProfile.userJson.UserDetail.DA_Diabetes_Type__c, 
	a.occupation = userProfile.checkNullObj("occupation"),
	a.language = userProfile.checkNullObj("languages"), 
	a.spcConOth = userProfile.checkBoxValues("specialConsideration[]");
    var d = userProfile.checkNullObj("cardsType"),
      e = userProfile.checkNullObj("consExpDate"),
      f = userProfile.checkNullObj("consCardNum");
	  g=userProfile.checkNullObj("diabetesTypes");
	  h=userProfile.checkNullObj("Indigenous");
    a.cardType = d, 
	a.consCardNum = f, 
	a.diabetesType = g,
	a.Indigenou=h,
	a.consExpDate = formatDate(e),
	a.magazine = userProfile.checkBoxValues("magazine"), 
	a.optOut = userProfile.checkBoxValues("optOut"),
	console.log("Media00000----------------->>"+userProfile.radioButtonValue("media_c")),	
	a.media = userProfile.radioButtonValue("media_c"), 
	console.log("a.Media000000----------------->>"+a.media), 
	userProfile.updateUserDetails(a)
  },
  
  checkBoxValues: function(a) {
    var b = $("input[type='checkbox'][name='" + a + "']:checked"),
      c = "";
    if (b.length > 0)
      if (b.length > 1)
        for (var d = 0; d < b.length; d++) c = c + b[d].value + ";";
      else c = b.val();
    else c = "";
    return c
  },
  
  radioButtonValue: function(a) {
	var radioValue = $("input[name='media_c']:checked").val(); 
	if(radioValue.localeCompare('yes')==0){
		console.log("true block----------------->>"); 
		return true;
	}else{
		console.log("false block----------------->>"); 
		return false;
	}
  },
  
  checkPhoneValidation: function() {
    this.value = this.value.replace(/[^0-9.]/g, "").substring(0, 10)
  },
  checkPhoneLengthValidation: function() {
    var a = $(this).val();
    a.length > 0 ? 10 == a.length ? $(this).removeClass("required") : ($(this).addClass("required"), alert("Please enter 10 digit no. - area code and phone number without spaces or brakets ")) : $(this).removeClass("required")
  },
  concessionCardValidation: function() {
    var a = $(this).val();
    a.length < 17 ? $(this).removeClass("required") : ($(this).addClass("required"), alert("16 number required"))
  },
  cardNovalidation: function(a) {
    this.value = this.value.replace(/[^0-9.]/g, "").substring(0, 16)
  },
  concessionDateValidation: function() {
    var a = $(this).val(),
      b = new Date(userProfile.userJson.TodaysDate),
      c = new Date(a);
    c.getTime() > b.getTime() ? $(this).removeClass("required") : ($(this).addClass("required"), $(this).val(null), alert("Date should be greater than current date"))
  },
  concessionSelectChange: function() {
    var a = $(this).val();
    "Select card type" != a && "NA" != a ? ($("#consCardNum").parent().show(), $("#consExpDate").parent().show()) : ($("#consCardNum").parent().hide(), $("#consExpDate").parent().hide())
  },
  checkEmailValidation: function() {
    var a = $(this).val(),
      b = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i,
      c = b.test(a);
    c ? $(this).removeClass("required") : (alert("Please enter valid Email Address"), $(this).addClass("required"))
  },
  backBtnHandling: function() {
    $("a#nextBtn").show(), $("a#backBtn").hide(), $("a#secondTab").parent().removeClass("active"), $("a#firstTab").parent().addClass("active")
  },
  validateFirstPart: function() {
    var a = userProfile.checkNullObj("titleId");
    if ("" === a) return alert("Title is required"), !0;
    var b = userProfile.checkNullObj("firstName");
    if ("" === b) return alert("First Name is required"), !0;
    var c = userProfile.checkNullObj("lastName");
    if ("" === c) return alert("Last Name is required"), !0;
    var d = userProfile.checkNullObj("emailAdd");
    if (userProfile.validationFlag = !0, "" === d) return alert("Email is required"), !0;
    if (userProfile.emailValidation(d), !userProfile.validationFlag) return alert("Enter valid Email Address"), !0;
    var e = userProfile.checkNullObj("addressOne");
    if ("" === e) return alert("Address is required"), !0;
    var f = userProfile.checkNullObj("cityName");
    if ("" === f) return alert("City Name is required"), !0;
    var g = userProfile.checkNullObj("countryName");
    if ("" === g) return alert("Country Name is required"), !0;
    var h = userProfile.checkNullObj("stateName");
    if ("" === h) return alert("State is required"), !0;
    var i = userProfile.checkNullObj("postCode");
    if ("" === i) return alert("PostCode is required"), !0;
    var j = userProfile.checkNullObj("contact");
    if (userProfile.validationFlag = !0, "" === j) return alert("Contact is required"), !0;
    if (userProfile.phoneValidationGuest(j), !userProfile.validationFlag) return alert("Please enter 10 digit no. - area code and phone number without spaces or brakets "), !0;
    var k = userProfile.checkNullObj("mobile");
    if (userProfile.validationFlag = !0, "" === k);
    else if (userProfile.phoneValidationGuest(k), !userProfile.validationFlag) return alert("Please enter 10 digit no. - area code and phone number without spaces or brakets "), !0;
    var l = userProfile.checkNullObj("dob");
    return "" === l ? (alert("Date of Birth is required"), !0) : !1
  },
  nextBtnHandling: function(a) {
    return userProfile.validateFirstPart() ? void $("#showLoader").hide() : ($("a#backBtn").show(), $("a#nextBtn").hide(), $("a#secondTab").parent().addClass("active"), $("a#firstTab").parent().removeClass("active"), $("#home").removeClass("active").removeClass("in"), void $("#menu1").addClass("active").addClass("in"))
  },
  dateOfBirthValidation: function() {
    var a = $(this).val(),
      b = new Date(userProfile.userJson.TodaysDate),
      c = new Date(a);
    c.getTime() < b.getTime() ? $(this).removeClass("required") : ($(this).addClass("required"), $(this).val(null), alert("Date should be less than current date"))
  },
  addEventListener: function() {
    var a = new Date;
    $("#dob").datepicker({
      format: "dd/mm/yyyy",
      endDate: a
    }), $("#consExpDate").datepicker({
      format: "dd/mm/yyyy",
      startDate: "+1d"
    }), $(document).on("click", "#userDataSubmit", userProfile.updateUser), $("input[action='phnumber']").unbind("keyup"), $("input[action='phnumber']").bind("keyup", userProfile.checkPhoneValidation), $("input[action='pcodenumber']").unbind("keyup"), $("input[action='pcodenumber']").bind("keyup", userProfile.checkPhoneValidation), $(document).on("keyup", "input[action='phnumber']", userProfile.checkPhoneValidation), $(document).on("focusout", "input[action='phnumber']", userProfile.checkPhoneLengthValidation), $(document).on("focusout", "#emailAdd", userProfile.checkEmailValidation), $("#cardsType").unbind("change"), $("#cardsType").bind("change", userProfile.concessionSelectChange), $("a#backBtn").bind("click", userProfile.backBtnHandling), $("a#nextBtn").bind("click", userProfile.nextBtnHandling), $("a#firstTab").bind("click", function() {
      $("a#backBtn").hide(), $("a#nextBtn").show()
    }), $("a#secondTab").bind("click", function() {
      $("a#nextBtn").hide(), $("a#backBtn").show()
    })
  },
  checkBoxHandler: function() {
    $("input[id='checkHumanFlag']:checked").length ? ($('input[class="ocms-submit-button"]').prop("disabled", !1), $('input[class="ocms-submit-button"]').css("opacity", "1")) : ($('input[class="ocms-submit-button"]').prop("disabled", !0), $('input[class="ocms-submit-button"]').css("opacity", "0.7"))
  }
};

/*$(window).load(function() {
	console.log('user profilelength ---> '+$("#updateProfile").length);
  $("#updateProfile").length > 0 ? (userProfile.sData = { action: "SendAccountDetails" }, userProfile.DynamiCall(userProfile.sData), userProfile.addEventListener(), $("a#backBtn").hide()) : console.log("not a user profile page so i am not working.")
}),*/
$(document).ready(function() {
console.log('user profilelength ---> '+$("#updateProfile").length);
    $(document).ocmsDynamicLoadFinished(function() {
		console.log('user in document redy ---> ');
$("#updateProfile").length > 0 ? (userProfile.sData = { action: "SendAccountDetails" }, userProfile.DynamiCall(userProfile.sData), userProfile.addEventListener(), $("a#backBtn").hide()) : console.log("not a user profile page so i am not working.")

});
})
, setTimeout(function() {
  location.href.match("contact-us") && ($('input[class="ocms-submit-button"]').prop("disabled", !0), $('input[class="ocms-submit-button"]').css("opacity", "0.7"), $("#checkHumanFlag").click(function() {
    userProfile.checkBoxHandler()
  }))
}, 5e3);