var pakey = "";
var resellerKey = '';
var packageStr = '';
;(function($){
var signup = function() {
var why = checkWholeForm();
if(why != "") {
//alert(why);
if(why.indexOf("-Please enter") > -1) {
//showMessageBox("Please fill out all required fields", 1);
jAlert("Please fill out all required fields");
} else if (why.indexOf("500 character") > -1) {
//showMessageBox("Please enter a valid Email", 1);
jAlert("All fields must be less than 500 characters!");
} else if (why.indexOf("Email address must be less than 250 characters") > -1) {
//showMessageBox("Please enter a valid Email", 1);
jAlert("Email address must be less than 250 characters!");
$("#submit_form #EmailAddress_label").addClass("invalid");
} else if (why.indexOf("a valid Email") > -1) {
//showMessageBox("Please enter a valid Email", 1);
jAlert("Please enter a valid Email");
$("#submit_form #EmailAddress_label").addClass("invalid");
} else if (why.indexOf("between 6 and 20 characters") > -1) {
//showMessageBox("Please enter a valid Email", 1);
jAlert("Password must be between 6 and 20 characters");
$("#submit_form #Password_label").addClass("invalid");
} else if (why.indexOf("its confirmation") > -1) {
//showMessageBox("Password and its confirmation do not match", 1);
jAlert("Password and its confirmation do not match");
$("#submit_form #PasswordConfirm_label").addClass("invalid");
} else if(why.indexOf("-Please enter Password not contain") > -1) {
jAlert("-Please enter Password not contain " + keyParse);
$("#submit_form #Password_label").addClass("invalid");
}
return false;
}
return true;
}
function singUp() {
// billingAddress = $("#submit_form #BillingAddressNumber").val();
// if('undefined' != billingAddress && billingAddress.trim() != '') {
// billingAddress += " " + $("#submit_form #BillingStreet").val();
// } else {
// billingAddress = $("#submit_form #BillingStreet").val();
// }
// $("#submit_form #BillingAddress").val(billingAddress);
var param_capcha = '';
if(isVersion(TURN_ON_CAPCHA)) {
param_capcha = "&g-recaptcha-response=" + grecaptcha.getResponse();
}
$.ajax({
url: '/signupfreetrail?pakey=' + pakey + '&resellerkey=' + resellerKey + '&package=' + packageStr,
dataType: 'json',
type: 'POST',
data: $("#submit_form input, #submit_form select").serialize() + param_capcha,
cache: false,
complete: function()
{
$('.btnGetFreeTrial').prop('disabled', false);
},
success: function(response, status)
{
if(null != response && 'OK' == response.status) {
$(".page1").addClass(CONST_CSS_CLASS_HIDE_SESSION);
$(".page2").removeClass(CONST_CSS_CLASS_HIDE_SESSION);
$("#content").addClass(animateType + ' animated')
.one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function () {
$(this).removeClass();
});
//set cookies for login after regist success.
console.log("login-email : " + $("#submit_form #EmailAddress").val());
storeData("login-email", $("#submit_form #EmailAddress").val(), { expires: 365, path:"/" });
storeData("login-account", response.WebsiteName, { expires: 365, path:"/" });
console.log("login-email : " + getStoreData("login-email"));
//submit form to BC
// $("#submit_form1 #FirstName1").val($("#submit_form #FirstName").val());
// $("#submit_form1 #LastName1").val($("#submit_form #LastName").val());
// $("#submit_form1 #EmailAddress1").val($("#submit_form #EmailAddress").val());
// $("#submit_form1 #Password1").val($("#submit_form #Password").val());
// $("#submit_form1 #WorkPhone1").val($("#submit_form #WorkPhone").val());
// $("#submit_form1 #CAT_Custom_353739_1189961").val($("#submit_form #CAT_Custom_353739_118996").val());
// $("#submit_form1 #CAT_Custom_353741_1189961").val($("#submit_form #CAT_Custom_353741_118996").val());
// $("#submit_form1 #BillingZip1").val($("#submit_form #BillingZip").val());
//
// $("#submit_form1 #Username1").val($("#submit_form #EmailAddress").val());
// $("#submit_form1 #PasswordConfirm1").val($("#submit_form #Password").val());
// $("#submit_form1 #CAT_Custom_379029").val(response.WebsiteName);
//
// $("#submit_form1").submit();
var isSendToBCWebService = $("#isSendToBCWebService").val();
if(isSendToBCWebService && isSendToBCWebService == CONST_VALUE_TRUE_STR){
}else{
var link = "/doforms/purchase/trial/submit_page.html?";
link += "FirstName=" + $("#submit_form #FirstName").val().replace(/&/g,keyParse);
link += "&LastName=" + $("#submit_form #LastName").val().replace(/&/g,keyParse);
link += "&EmailAddress=" + $("#submit_form #EmailAddress").val();
link += "&Password=" + $("#submit_form #Password").val().replace(/&/g,keyParse);
link += "&WorkPhone=" + $("#submit_form #WorkPhone").val();
// link += "&CAT_Custom_353739_118996=" + $("#submit_form #CAT_Custom_353739_118996").val().replace(/&/g,keyParse);
// link += "&CAT_Custom_353741_118996=" + $("#submit_form #CAT_Custom_353741_118996").val();
// link += "&BillingCity=" + $("#submit_form #BillingCity").val();
// link += "&BillingState=" + $("#submit_form #BillingState").val();
// link += "&BillingCountry=" + $("#submit_form #BillingCountry").val();
// link += "&BillingZip=" + $("#submit_form #BillingZip").val();
// link += "&BillingAddress=" + $("#submit_form #BillingAddress").val();
link += "&WebsiteName=" + response.WebsiteName;
console.log("link : " + link);
$("#iframe_div").attr("src",link);
}
// var undefinedParam = '';
// $('body').append(undefinedParam);
//
// var remarketingCode = '\n' +
// '\n' +
// '\n' +
// '\n' +
// '\n';
// $('body').append(remarketingCode);
// var googleAnalyticsCode = "";
//// '\n';
// setTimeout(function(){
// $('body').append(googleAnalyticsCode);
// }, 500);
//
// var adWordsConversionTrackingCode = '\n'
// + '\n'
// + '\n'
// + '\n';
// setTimeout(function(){
// $('body').append(adWordsConversionTrackingCode);
// }, 1500);
// // Track conversion
// var google_conversion_id = 979536669;
// var google_custom_params = window.google_tag_params;
// var google_remarketing_only = true;
// // save old document.write
// var oldDocumentWrite = document.write
//
// // change document.write temporary
// document.write = function(node){
// $("body").append(node)
// }
//
// // get script
// $.getScript( "http://www.googleadservices.com/pagead/conversion.js", function() {
// var noScript = '\n';
// document.write(noScript);
//
// var googleAnalyticsCode = '\n';
// document.write(googleAnalyticsCode);
//
// var google_conversion_id = 979536669;
// var google_custom_params = window.google_tag_params;
// var google_conversion_language = "en";
// var google_conversion_format = "1";
// var google_conversion_color = "ffffff";
// var google_conversion_label = "1i8qCKPezgYQnZaK0wM";
// var google_conversion_value = 1.00;
// var google_conversion_currency = "USD";
// var google_remarketing_only = false;
//
// // get script
// $.getScript( "http://www.googleadservices.com/pagead/conversion.js", function() {
// var noScript2 = '';
// document.write(noScript2);
// // replace the temp document.write with the original version
// setTimeout(function() {
// document.write = oldDocumentWrite
// }, 100)
// });
// });
/*$("#page_success_google_code").empty().append("");
$("#page_success_google_code").append("");
$("#page_success_google_code").append(
"");*/
//$('body').load("googlecode_success.html");
$("#iframe_googlecode_success").attr("src","googlecode_success.html");
} else {
//alert('Error unknow.');
//showMessageBox("Error unknow.", 1);
jAlert("Unknown error.");
}
},
error: function(request, status, error)
{
/*if(request.status == 908) {
showMessageBox("Sorry, this email address is already in use with a different password."
+ " Please check the password entered and try again. If you need to recover"
+ " your password please click the button below. If you continue having"
+ " problems, please contact us at " + CONST_SUPPORT_MAIL_DOFORMS + ". ", 14);
$("#message_box #message_box_forgotpassword_btn").off('click').click(function(){
if(jQuery.trim($('#submit_form #EmailAddress').val()) == ''){
return;
}
hideMessageBox();
$.ajax({
url: '/user/resetpassword',
dataType: 'json',
type: 'POST',
data: {"forgot_password_email":$('#submit_form #EmailAddress').val()},
cache: false,
complete: function()
{
},
success: function(response, status)
{
//showMessageBox("A password recovery email has been sent. Please check your inbox.", 1);
jAlert("A password recovery email has been sent. Please check your inbox.");
},
error: function(request, status, error)
{
// showMessageBox("Sorry, we encountered a problem setting up your account."
// + " Please try again in a few minutes. If you continue to encounter"
// + " this problem please contact us at " + CONST_SUPPORT_MAIL_DOFORMS + ".", 1);
jAlert("Sorry, we encountered a problem setting up your account."
+ " Please try again in a few minutes. If you continue to encounter"
+ " this problem please contact us at " + CONST_SUPPORT_MAIL_DOFORMS + ".");
}
})
});
$("#message_box #message_box_cancel_btn").off('click').click(function(){
//hideMessageBox();
top.location.replace("/");
});
} else*/
if(request.status == 958) {
// showMessageBox("Sorry, this email address previously signed up for a Free Trial."
// + " You may only sign up once. If you wish to continue using doForms,"
// + " please upgrade to a paid account. You can do this by logging into"
// + " your old Free Trial account at " + CONST_DOMAIN_DOFORMS + " and clicking the \"Buy Now\" button.",1);
jAlert("Sorry, this email address previously signed up for a Free Trial."
+ " You may only sign up once. If you wish to continue using doForms,"
+ " please upgrade to a paid account. You can do this by logging into"
+ " your old Free Trial account at " + CONST_DOMAIN_DOFORMS + " and clicking the \"Buy Now\" button.");
} else if(request.status == 915) {
jAlert("Please click the checkbox in the reCAPTCHA control.");
} else {
//alert('Error unknow.');
// showMessageBox("Error unknow.", 1);
jAlert("Unknown error.");}
}
});
}
// var animateType = "lightSpeedIn";
// var animateType = "bounceInRight";
// var animateType = "fadeInRight";
var animateType = "fadeInLeft";
$('.btnGetFreeTrial').click(function () {
$('.btnGetFreeTrial').prop('disabled', 'disabled');
if(!signup()) {
$('.btnGetFreeTrial').prop('disabled', false);
return;
}
singUp();
// ga('send', 'event', 'free trial', 'completion');
//for test==================
/*$(".page1").addClass(CONST_CSS_CLASS_HIDE_SESSION);
$(".page2").removeClass(CONST_CSS_CLASS_HIDE_SESSION);
$("#content").addClass(animateType + ' animated').one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function () {
$(this).removeClass();
});*/
//========================
});
$('.btnGooglePlay').click(function () {
$(".page2").addClass(CONST_CSS_CLASS_HIDE_SESSION);
$(".page_android").removeClass(CONST_CSS_CLASS_HIDE_SESSION);
$("#content").addClass(animateType + ' animated').one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function () {
$(this).removeClass();
});
downLoadPageAndroid();
});
$('.btnAppStore').click(function () {
$(".page2").addClass(CONST_CSS_CLASS_HIDE_SESSION);
$(".page_ios").removeClass(CONST_CSS_CLASS_HIDE_SESSION);
$("#content").addClass(animateType + ' animated').one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function () {
$(this).removeClass();
});
downLoadPageIOS();
});
$('.btn-primary-2').click(function () {
top.location.replace("/login");
});
$('.btnBack').click(function () {
$(".page2").removeClass(CONST_CSS_CLASS_HIDE_SESSION);
$(".page_android").addClass(CONST_CSS_CLASS_HIDE_SESSION);
$(".page_ios").addClass(CONST_CSS_CLASS_HIDE_SESSION);
$("#content").addClass('fadeInRight animated').one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function () {
$(this).removeClass();
});
});
// CO-3065
$('#billingCountry').unbind().change(function(e) {
if('US' == $(this).val()){
$('.billingState_row').removeClass('hideSession');
} else{
$('.billingState_row').addClass('hideSession');
$('#billingState').val('');
}
});
//$(":input[placeholder]").placeholder();
//loadIndustry();
//window.load("message_box.html");
$('#message_box_content').load("message_box.html");
function downLoadPageAndroid() {
$("#android_google_code").empty().append(
""
);
// $("#android_google_code").append(
// "");
}
function downLoadPageIOS() {
$("#ios_google_code").empty().append(
""
);
// $("#ios_google_code").append(
// "