");
//To check if event end date has passed or max participants limit has reached
if ( $('#tfa_1999').val() ) {
var date = new Date();
date.setHours(0,0,0,0);
var eventdate = new Date($('#tfa_1999').val());
if( date>eventdate ){
window.location = 'https://www.jewishedproject.org/event-closed';
}
}
//If max participant count is reached, redirect to event closed page
var max_participant = $('#tfa_1998').val();
var responses = $('#tfa_2000').val();
if ( max_participant && responses ){
if ( parseInt(responses) >= parseInt(max_participant)) {
window.location = 'https://www.jewishedproject.org/event-closed';
}
}
$("#org-form-link").attr("href", 'https://jewishedproject.tfaforms.net/23?contactid='+cid);
function getParameterByName(name, url) {
if (!url) url = window.location.href;
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^]*)|&|#|$)"),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, " "));
}
if(jQuery('.errMsg a:contains("aborted connector execution")').length > 0){
jQuery('.errMsg a:contains("aborted connector execution")').append("
Sorry, are not able to access contact information.");
//window.location = 'https://jewishedproject.tfaforms.net/22';
}
});
function calculateGrandTotal(TotalTcktPrice, donationAmt) {
if (!TotalTcktPrice) TotalTcktPrice = 0;
if (!donationAmt) donationAmt = 0;
var amount = 0;
if (TotalTcktPrice) {
amount += +TotalTcktPrice;
}
if (donationAmt) {
amount += +donationAmt;
}
if (amount == 0) {
//alert('asd');
$('#tfa_1962').removeClass('required');
$('#tfa_518').hide();
$('#tfa_956').removeClass('required');
$('#tfa_957').removeClass('required');
$('#tfa_958').removeClass('required');
$('#tfa_959').removeClass('required');
$('#tfa_1592').removeClass('required');
// $("#tfa_518").hide();
} else {
$('#tfa_1962').addClass('required');
$('#tfa_518').show();
$('#tfa_956').addClass('required');
$('#tfa_957').addClass('required');
$('#tfa_958').addClass('required');
$('#tfa_959').addClass('required');
$('#tfa_1592').addClass('required');
//$("#tfa_518").show();
}
return amount;
}
function calculateAmt(NumTickets,tcktPrice,discCode,promoCode,discount,compCode){
if ( !NumTickets || !tcktPrice) {
return '0';
}
if (!discCode) discCode = '';
if (!promoCode) promoCode = '';
var amt = 0;
amt = NumTickets*tcktPrice;
if (discCode && (discCode == compCode) ) {
$( "#tfa_1952").val("Comp code applied!");
$( "#tfa_1952").css("color", "green");
$( "#tfa_1971").val(discCode+' - CompDiscount');
$( "#tfa_1973").val('$'+amt);
amt = 0;
return amt;
} else if( discCode && promoCode && discount ) {
if ( discCode == promoCode) {
discountedAmt = (amt*discount)/100;
amt -= +discountedAmt;
$( "#tfa_1952").val("Promo code applied!");
$( "#tfa_1952").css("color", "green");
$( "#tfa_1971").val(discCode+' - $'+discountedAmt);
$( "#tfa_1973").val('$'+discountedAmt);
} else {
$( "#tfa_1952").val("Invalid Promo code.");
$( "#tfa_1952").css("color", "red");
$( "#tfa_1971").val('');
$( "#tfa_1973").val('');
}
} else if ( discCode && (!promoCode || !discount)) {
$( "#tfa_1952").val("Invalid Promo code.");
$( "#tfa_1952").css("color", "red");
$( "#tfa_1971").val('');
$( "#tfa_1973").val('');
} else {
$( "#tfa_1952").val("");
}
return amt;
}
function calculateDate(startDate,startTime,endTime) {
if (!startDate){
return;
}
if (!startTime) startTime = '';
if (!endTime) endTime = '';
var eventDate = startDate;
if (startTime) {
eventDate += " "+startTime;
}
if(endTime){
eventDate += " - "+endTime;
}
return eventDate;
}