jQuery( function( $ ){
//alert("test");
$('.single-education-center p').each(function() {
var $this = $(this);
if($this.html().replace(/\s| /g, '').length == 0)
$this.remove();
});
$(document).on('click','.ht-action',function(e) {
e.preventDefault();
if($(this).hasClass('consent')) {
if(jQuery('#consent:checked').length == 0) {
alert("You must read and accept terms and conditions before continuing.");
return false;
}
}
ofs = $('.ht-diagnose-container').offset().top - 150;
$("html, body").stop().animate({scrollTop:ofs}, '500', 'swing' );
$('.steps').addClass('hide');
setTimeout(function() {
$('.steps').hide();
var opt = $('.option:checked').val();
var dtype = $('.dtype').val();
if(typeof opt == 'undefined') { opt = 'agreement'; }
if(typeof dtype == 'undefined') { if($('.ht-action').hasClass('htstart')) { dtype = 'works'; } else { dtype = 'agreement'; } }
$.ajax({
type:'POST',
url:htajax.ajaxurl,
data:{action:'ht_process', option: opt, diagtype: dtype}
}).done(function( data, status, xhr ) {
$('.ht-wizard').removeClass('working');
$('.steps').html(data).show().removeClass('hide');
});;
},400);
$('.ht-wizard').addClass('working');
});
$(document).on('click','.option',function(e) {
e.preventDefault();
ofs = $('.ht-diagnose-container').offset().top - 150;
$("html, body").stop().animate({scrollTop:ofs}, '500', 'swing' );
$('.steps').addClass('hide');
_this = $(this);
setTimeout(function() {
$('.steps').hide();
var opt = _this.val();
var dtype = $('.dtype').val();
if(typeof opt == 'undefined') { opt = 'agreement'; }
if(typeof dtype == 'undefined') { dtype = 'agreement'; }
$.ajax({
type:'POST',
url:htajax.ajaxurl,
data:{action:'ht_process', option: opt, diagtype: dtype}
}).done(function( data, status, xhr ) {
$('.ht-wizard').removeClass('working');
$('.steps').html(data).show().removeClass('hide');
});;
},400);
$('.ht-wizard').addClass('working');
});
// Registration field validation
$( "form.checkout input,form.checkout select" ).change(function() {
var email = $("#billing_email").val();
if( /(.+)@(.+){2,}\.(.+){2,}/.test(email) ){
email_valid = true;
// valid email
} else {
email_valid = false;
// invalid email
}
var country = $("#billing_country").val();
var state = $("#billing_state").val();
var age = $("#ccf_5abdd90d2c44e").val();
if(email_valid == true && country != '' && state != '' && age != '')
{
$('input').removeClass('rg-required');
$('select').removeClass('rg-required');
$("#wpmc-next").attr("disabled", false);
}
else
{
$(this).addClass('rg-required');
$("#wpmc-next").attr("disabled", true);
}
});
$(document).on('click','.ht-back',function(e) {
e.preventDefault();
ofs = $('.ht-diagnose-container').offset().top - 150;
$("html, body").stop().animate({scrollTop:ofs}, '500', 'swing' );
$('.steps').addClass('hide');
setTimeout(function() {
$('.steps').hide();
$.ajax({
type:'POST',
url:htajax.ajaxurl,
data:{action:'ht_back'}
}).done(function( data, status, xhr ) {
$('.ht-wizard').removeClass('working');
$('.steps').html(data).show().removeClass('hide');
});;
},400);
$('.ht-wizard').addClass('working');
});
$(document).on('click','.change-option',function(e) {
e.preventDefault();
ofs = $('.ht-diagnose-container').offset().top - 150;
$("html, body").stop().animate({scrollTop:ofs}, '500', 'swing' );
$('.steps').addClass('hide');
diag = $(this).data('diag');
setTimeout(function() {
$('.steps').hide();
$.ajax({
type:'POST',
url:htajax.ajaxurl,
data:{action:'change_option', type: diag}
}).done(function( data, status, xhr ) {
$('.ht-wizard').removeClass('working');
$('.steps').html(data).show().removeClass('hide');
});;
},400);
$('.ht-wizard').addClass('working');
});
$(document).on('click','.ht-again',function(e) {
e.preventDefault();
ofs = $('.ht-diagnose-container').offset().top - 150;
$("html, body").stop().animate({scrollTop:ofs}, '500', 'swing' );
$('.steps').addClass('hide');
setTimeout(function() {
$('.steps').hide();
$.ajax({
type:'POST',
url:htajax.ajaxurl,
data:{action:'ht_again'}
}).done(function( data, status, xhr ) {
$('.ht-wizard').removeClass('working');
$('.steps').html(data).show().removeClass('hide');
$('.htstartagain').click();
$('.htstart').click();
});;
},300);
$('.ht-wizard').addClass('working');
});
//jQuery('.rg-gender').prop('checked', false);
$(".close").on('click', function() {
$('.ht-wizard').removeClass('working');
$('.steps').show().removeClass('hide');
});
$("#mfes_identity_protection_widget-cimg").on('click', function() {
window.location = "https://virtualheadachespecialist.com/";
});
$("#server_msg_modal #billing_country").on('change', function() {
var cntry = $(this).children("option:selected").val();
$.ajax({
type:'POST',
url:htajax.ajaxurl,
data:{action:'getbillingstate',country:cntry,mode:'custom'}
}).done(function( data, status, xhr ) {
if(data != '1')
{
$('#server_msg_modal #billing_state').html(data);
}
else
{
$('#server_msg_modal #billing_state').html('
');
}
});
});
});
jQuery(document).ready(function($){
//jQuery('.rg-gender').prop('checked', false);
$("#ccf_5abdd742af5a2_Male").prop("checked", true);
var forum = $("#bbpress-forums").find('ul').size();
if(forum > 0)
{
$('.login_section').hide();
}
else if(forum == 0)
{
$('.bbp-search-form').hide();
}
$("#bbp_topic_tags").parent().hide();
$(".flag-dropdown").click(function(){
var country = $('#uwp_account_country_code').val();
$.ajax({
type:'POST',
url:htajax.ajaxurl,
data:{action:'getstate', country: country}
}).done(function( data, status, xhr ) {
$('#uwp_account_state1 option').each(function() {
$(this).remove();
});
if(data != 1)
{
data = JSON.parse(data);
$.each(data, function(key, value) {
$('#uwp_account_state1')
.append($("
")
.attr("value",key)
.text(value));
})
}
else
{
$('#uwp_account_state1')
.append($("
")
.attr("value",'other')
.text('OTHER'));
}
});;
});
var data = {
action: 'is_user_logged_in'
};
/*$.post(htajax.ajaxurl, data, function(response) {
if(response == 'yes') {
$(".menu-item-1423 a").html('
Logout');
//alert("Successfully Login!! ");
// user is logged in, do your stuff here
} else {
//alert("Sorry! Your Username and Password are invalid!!");
// user is not logged in, show login form here
}
});*/
$("input#bbp_topic_title").after('
');
$("input#bbp_topic_title").remove();
$(".post-type-archive-topic .container h1").text('Discussion Forum');
$(".bbp-topic-permalink").after('
');
$(".page-id-1421 form.uwp-login-form").attr('action','https://virtualheadachespecialist.com');
$(".page-id-1241 form.uwp-login-form").attr('action','https://virtualheadachespecialist.com/free-headache-and-facial-pain-forums/');
});
jQuery(window).ready(function($) {
"use strict";
var tabs = $(".wpmc-tab-item");
var sections = $(".wpmc-step-item");
var buttons = $(".wpmc-nav-buttons .button");
var checkout_form = $("form.woocommerce-checkout");
var coupon_form = $("#checkout_coupon");
$(".wpmc-step-item:first").addClass("current");
function currentIndex() {
return sections.index(sections.filter(".current"))
}
$("#wpmc-next, #wpmc-skip-login").on("click", function() {
switchTab(currentIndex() + 1)
});
$("#wpmc-prev").on("click", function() {
switchTab(currentIndex() - 1)
});
$(document).on("checkout_error", function() {
var section_class = $(".woocommerce-invalid-required-field").closest(".wpmc-step-item").attr("class");
$(".wpmc-step-item").each(function(i) {
if ($(this).attr("class") === section_class) {
switchTab(i)
}
})
});
function switchTab(theIndex) {
$(".woocommerce-checkout").trigger("wpmc_before_switching_tab");
if (theIndex < 0 || theIndex > sections.length - 1) return false;
var diff = $(".wpmc-tabs-wrapper").offset().top - $(window).scrollTop();
if (diff < -40) {
$("html, body").animate({
scrollTop: $(".wpmc-tabs-wrapper").offset().top - 70
}, 800)
}
$("html, body").promise().done(function() {
tabs.removeClass("previous").filter(".current").addClass("previous");
sections.removeClass("previous").filter(".current").addClass("previous");
tabs.removeClass("current", {
duration: 500
});
tabs.eq(theIndex).addClass("current", {
duration: 500
});
sections.removeClass("current", {
duration: 500
});
sections.eq(theIndex).addClass("current", {
duration: 500
});
buttons.removeClass("current");
checkout_form.addClass("processing");
coupon_form.hide();
if (theIndex < sections.length - 1) $("#wpmc-next").addClass("current");
if (theIndex === 0 && $(".wpmc-step-login").length > 0) {
$("#wpmc-skip-login").addClass("current");
$("#wpmc-next").removeClass("current")
}
if (theIndex === sections.length - 1) {
$("#wpmc-prev").addClass("current");
$("#wpmc-submit").addClass("current");
checkout_form.removeClass("processing").unblock()
}
if (theIndex != 0) $("#wpmc-prev").addClass("current");
if ($(".wpmc-order.current").length > 0) {
coupon_form.show()
}
$(".woocommerce-checkout").trigger("wpmc_after_switching_tab")
})
}
if ($(".the_champ_sharing_container").length > 0) {
$(".the_champ_sharing_container").insertAfter($(this).parent().find("#checkout_coupon"))
}
$(".woocommerce-checkout").keydown(function(e) {
if (e.which === 13) {
e.preventDefault();
return false
}
});
var user_id= $("#user_id").val();
// alert(user_id);
var query = window.location.search.substring(1);
if(query == "create_account")
{
$("#virtual_home_register").show();
$("#virtual_home_login").hide();
// window.location = "https://virtualheadachespecialist.com/service-checkout/";
}
else
{
$("#virtual_home_login").show();
$("#virtual_home_register").hide();
}
});
jQuery(function(){
jQuery(window).load(function() {
jQuery('.application-work-start').click();
});
});
jQuery(document).ready(function($){
if(document.getElementsByClassName('aff-placeholder').length > 0) {
$(window).on('scroll', function () {
var wh = $(window).height() * 2;
var st = $(document).scrollTop()
$('.aff-placeholder').not('.loaded').each(function(i, obj) {
if($(this).offset().top < wh + st) {
$(this).addClass('loaded');
var ad = '';
if($(window).width() < 990) {
ad = "
"
} else {
ad = "
"
}
$(this).append(ad)
}
});
});
}
})