$(function () {
var allStates = {};
$('#fileupload').fileupload({
add: function(e, data) {
$('#progress .progress-bar').css('width','0%');
var acceptFileTypes = /^(application\/(pdf|download|x-download)$|^x-unknown\/pdf)|(image\/(gif|jpe?g|png))$/i;
var errorCount = 0;
if(data.originalFiles[0]['type'].length == 0) {
$("#uploaded-files-status").html('Not an accepted file type, please select a valid image file');
$('#addIDstatus').html('');
errorCount++;
}
if(data.originalFiles[0]['type'].length && !acceptFileTypes.test(data.originalFiles[0]['type'])) {
$("#uploaded-files-status").html('The type of file selected cannot be uploaded on this website. Please attempt to upload again using a valid image file.');
$('#addIDstatus').html('');
errorCount++;
}
if(data.originalFiles[0]['size'] > 5242881) {
$("#uploaded-files-status").html('Files greater than 5 MB in size cannot be uploaded on this website. Please attempt to upload again using a smaller file.');
$('#addIDstatus').html('');
errorCount++;
}
if(errorCount == 0) {
data.submit();
$("#uploaded-files-status").text('');
}else {
$("#uploaded-files").hide();
}
},
dataType: 'json',
done: function (e, data) {
$("#uploaded-files").show();
$("#idflashzone").hide();
$("#uploaded-files").show();
$('#upload-table').show();
$("#upload-adoc").html('
Photo ID was uploaded successfully!
');
$('#uploaded-files-status').show();
$('#uploaded-files-status').html('');
$('#addIDstatus').html('
');
$("#addMoreID").show();
$("#imgPreview").empty();
var d = new Date();
$.each(data.result, function (index, file) {
$("#imgFilePath").val(file.filePath);
var acceptImgFileTypes = /^image\/(gif|jpe?g|png)$/i;
if (index == 0 && file.fileName != "undefined") {
if (file.bytes == null) {
$("#imgPreview").append("
");
$("#imgPreview img").attr("src", '../images/wrongfiletype.png');
$("#imgFilePath").val('');
$("#addIDstatus").html('');
$("#upload-adoc").html('An error has occurred while uploading the file. Please click delete button, and attempt to upload this image again.');
}else if (file.fileType.length && !acceptImgFileTypes.test(file.fileType)) {
$("#imgPreview").append("
");
$("#imgPreview img").attr("src", 'uploadfile/fc/thumbnailID/0?' + d.getTime());
$("#imgPreview img").attr("alt",' Loading snapshot of the uploaded file...');
}else {
if ($.browser.msie && parseFloat(jQuery.browser.version) <= 9.0) {
$("#imgPreview").show();
$("#imgPreview")[0].filters.item("DXImageTransform.Microsoft.AlphaImageLoader").src = $(this).val();
}else {
if (typeof (FileReader) != "undefined") {
$("#imgPreview").append("
");
var reader = new FileReader();
reader.onload = function (e) {
var img = new Image();
img.onload = function() {
$("#imgPreview img").attr("src", e.target.result);
};
img.onerror = function() {
$("#imgPreview img").attr("src", '../images/wrongfiletype.png');
$("#imgFilePath").val('');
$("#addIDstatus").html('');
$("#upload-adoc").html('An error has occurred while uploading the file. Please click delete button, and attempt to upload this image again.');
};
img.src = e.target.result;
}
reader.readAsDataURL(data.originalFiles[0]);
} else {
$("#addIDstatus").html('');
$("#uploaded-files-status").html('Image preview failed, please try most recent versions of Mozilla Firefox or Internet Explorer.');
}
}
}
}
});
},
fail: function (e, data) {
$("#uploaded-files-status").html('The type of file selected cannot be uploaded on this website. Please attempt to upload again using a valid image file.');
$("#addIDstatus").html('');
$("#upload-adoc").html('');
$('#progress .progress-bar').css('width','0%');
$("#imgFilePath").val('');
},
progressall: function (e, data) {
var progress = parseInt(data.loaded / data.total * 100, 10);
$('#progress .progress-bar').css(
'width',
progress + '%'
);
},
dropZone: $('#dropzone')
});
$('#fileupload1').fileupload({
add: function(e, data) {
$('#progress1 .progress-bar').css('width','0%');
var acceptFileTypes = /^(application\/(pdf|download|x-download)$|^x-unknown\/pdf)|(image\/(gif|jpe?g|png))$/i;
var errorCount = 0;
if(data.originalFiles[0]['type'].length == 0) {
$("#uploaded-files-status1").html('Not an accepted file type, please select a valid image file');
$('#addIDstatus1').html('');
errorCount++;
}
if(data.originalFiles[0]['type'].length && !acceptFileTypes.test(data.originalFiles[0]['type'])) {
$("#uploaded-files-status1").html('The type of file selected cannot be uploaded on this website. Please attempt to upload again using a valid image file.');
$('#addIDstatus1').html('');
errorCount++;
}
if(data.originalFiles[0]['size'] > 5242881) {
$("#uploaded-files-status1").html('Files greater than 5 MB in size cannot be uploaded on this website. Please attempt to upload again using a smaller file.');
$('#addIDstatus1').html('');
errorCount++;
}
if(errorCount == 0) {
data.submit();
$("#uploaded-files-status1").text('');
}else {
$("#uploaded-files1").hide();
}
},
dataType: 'json',
done: function (e, data) {
$("#uploaded-files1").show();
$("#idflashzone1").hide();
$("#uploaded-files1").show();
$("#upload-adoc1").html('Support document was uploaded successfully!
');
$('#upload-table1').show();
$('#uploaded-files-status1').show();
$('#uploaded-files-status1').html('');
$('#addIDstatus1').html('
');
$("#addMoreID1").show();
$("#imgPreview1").empty();
var d = new Date();
$.each(data.result, function (index, file) {
$("#imgFilePath1").val(file.filePath);
var acceptImgFileTypes = /^image\/(gif|jpe?g|png)$/i;
if (index == 0 && file.fileName != "undefined") {
if (file.bytes == null) {
$("#imgPreview1").append("
");
$("#imgPreview1 img").attr("src", '../images/wrongfiletype.png');
$("#imgFilePath1").val('');
$("#addIDstatus1").html('');
$("#upload-adoc1").html('An error has occurred while uploading the file. Please click delete button, and attempt to upload this image again.');
}else if (file.fileType.length && !acceptImgFileTypes.test(file.fileType)) {
$("#imgPreview1").append("
");
$("#imgPreview1 img").attr("src", 'uploadfile/fc/thumbnailID1/0?' + d.getTime());
$("#imgPreview1 img").attr("alt",' Loading snapshot of the uploaded file...');
}else {
if ($.browser.msie && parseFloat(jQuery.browser.version) <= 9.0) {
$("#imgPreview1").show();
$("#imgPreview1")[0].filters.item("DXImageTransform.Microsoft.AlphaImageLoader").src = $(this).val();
}else {
if (typeof (FileReader) != "undefined") {
$("#imgPreview1").append("
");
var reader = new FileReader();
reader.onload = function (e) {
var img = new Image();
img.onload = function() {
$("#imgPreview1 img").attr("src", e.target.result);
};
img.onerror = function() {
$("#imgPreview1 img").attr("src", '../images/wrongfiletype.png');
$("#imgFilePath1").val('');
$("#addIDstatus1").html('');
$("#upload-adoc1").html('An error has occurred while uploading the file. Please click delete button, and attempt to upload this image again.');
};
img.src = e.target.result;
}
reader.readAsDataURL(data.originalFiles[0]);
} else {
$('#addIDstatus1').html('');
$("#uploaded-files-status1").html('Image preview failed, please try most recent versions of Mozilla Firefox or Internet Explorer.');
}
}
}
}
});
},
fail: function (e, data) {
$("#uploaded-files-status1").html('The type of file selected cannot be uploaded on this website. Please attempt to upload again using a valid image file.');
$("#upload-adoc1").html('');
$('#addIDstatus1').html('');
$('#progress1 .progress-bar').css('width','0%');
$("#imgFilePath1").val('');
},
progressall: function (e, data) {
var progress = parseInt(data.loaded / data.total * 100, 10);
$('#progress1 .progress-bar').css(
'width',
progress + '%'
);
},
dropZone: $('#dropzone1')
});
$('#fileupload2').fileupload({
add: function(e, data) {
$('#progress2 .progress-bar').css('width','0%');
var acceptFileTypes = /^(application\/(pdf|download|x-download)$|^x-unknown\/pdf)|(image\/(gif|jpe?g|png))$/i;
var errorCount = 0;
if(data.originalFiles[0]['type'].length == 0) {
$("#uploaded-files-status2").html('Not an accepted file type, please select a valid image file');
$('#addIDstatus2').html('');
errorCount++;
}
if(data.originalFiles[0]['type'].length && !acceptFileTypes.test(data.originalFiles[0]['type'])) {
$("#uploaded-files-status2").html('The type of file selected cannot be uploaded on this website. Please attempt to upload again using a valid image file.');
$('#addIDstatus2').html('');
errorCount++;
}
if(data.originalFiles[0]['size'] > 5242881) {
$("#uploaded-files-status2").html('Files greater than 5 MB in size cannot be uploaded on this website. Please attempt to upload again using a smaller file.');
$('#addIDstatus2').html('');
errorCount++;
}
if(errorCount == 0) {
data.submit();
$("#uploaded-files-status2").text('');
}else {
$("#uploaded-files2").hide();
}
},
dataType: 'json',
done: function (e, data) {
$("#uploaded-files2").show();
$("#idflashzone2").hide();
$("#uploaded-files2").show();
$('#upload-table2').show();
$("#upload-adoc2").html('Support document was uploaded successfully!
');
$('#uploaded-files-status2').show();
$('#uploaded-files-status2').html('');
$('#addIDstatus2').html('
');
$("#addMoreID2").show();
$("#imgPreview2").empty();
var d = new Date();
$.each(data.result, function (index, file) {
$("#imgFilePath2").val(file.filePath);
var acceptImgFileTypes = /^image\/(gif|jpe?g|png)$/i;
if (index == 0 && file.fileName != "undefined") {
if (file.bytes == null) {
$("#imgPreview2").append("
");
$("#imgPreview2 img").attr("src", '../images/wrongfiletype.png');
$("#imgFilePath2").val('');
$("#addIDstatus2").html('');
$("#upload-adoc2").html('An error has occurred while uploading the file. Please click delete button, and attempt to upload this image again.');
}else if (file.fileType.length && !acceptImgFileTypes.test(file.fileType)) {
$("#imgPreview2").append("
");
$("#imgPreview2 img").attr("src", 'uploadfile/fc/thumbnailID2/0?' + d.getTime());
$("#imgPreview2 img").attr("alt",' Loading snapshot of the uploaded file...');
}else {
if ($.browser.msie && parseFloat(jQuery.browser.version) <= 9.0) {
$("#imgPreview2").show();
$("#imgPreview2")[0].filters.item("DXImageTransform.Microsoft.AlphaImageLoader").src = $(this).val();
}else {
if (typeof (FileReader) != "undefined") {
$("#imgPreview2").append("
");
var reader = new FileReader();
reader.onload = function (e) {
var img = new Image();
img.onload = function() {
$("#imgPreview2 img").attr("src", e.target.result);
};
img.onerror = function() {
$("#imgPreview2 img").attr("src", '../images/wrongfiletype.png');
$("#imgFilePath2").val('');
$("#addIDstatus2").html('');
$("#upload-adoc2").html('An error has occurred while uploading the file. Please click delete button, and attempt to upload this image again.');
};
img.src = e.target.result;
}
reader.readAsDataURL(data.originalFiles[0]);
} else {
$('#addIDstatus2').html('');
$("#uploaded-files-status2").html('Image preview failed, please try most recent versions of Mozilla Firefox or Internet Explorer.');
}
}
}
}
});
},
fail: function (e, data) {
$("#uploaded-files-status2").html('The type of file selected cannot be uploaded on this website. Please attempt to upload again using a valid image file.');
$('#addIDstatus2').html('');
$("#upload-adoc2").html('');
$('#progress2 .progress-bar').css('width','0%');
$("#imgFilePath2").val('');
},
progressall: function (e, data) {
var progress = parseInt(data.loaded / data.total * 100, 10);
$('#progress2 .progress-bar').css(
'width',
progress + '%'
);
},
dropZone: $('#dropzone2')
});
$('#fileupload3').fileupload({
add: function(e, data) {
$('#progress3 .progress-bar').css('width','0%');
var acceptFileTypes = /^(application\/(pdf|download|x-download)$|^x-unknown\/pdf)|(image\/(gif|jpe?g|png))$/i;
var errorCount = 0;
if(data.originalFiles[0]['type'].length == 0) {
$("#uploaded-files-status3").html('Not an accepted file type, please select a valid image file');
$('#addIDstatus3').html('');
errorCount++;
}
if(data.originalFiles[0]['type'].length && !acceptFileTypes.test(data.originalFiles[0]['type'])) {
$("#uploaded-files-status3").html('The type of file selected cannot be uploaded on this website. Please attempt to upload again using a valid image file.');
$('#addIDstatus3').html('');
errorCount++;
}
if(data.originalFiles[0]['size'] > 5242881) {
$("#uploaded-files-status3").html('Files greater than 5 MB in size cannot be uploaded on this website. Please attempt to upload again using a smaller file.');
$('#addIDstatus3').html('');
errorCount++;
}
if(errorCount == 0) {
data.submit();
$("#uploaded-files-status3").text('');
}else {
$("#uploaded-files3").hide();
}
},
dataType: 'json',
done: function (e, data) {
$("#uploaded-files3").show();
$("#idflashzone3").hide();
$("#uploaded-files3").show();
$('#upload-table3').show();
$("#upload-adoc3").html('Support document was uploaded successfully!
');
$('#uploaded-files-status3').show();
$('#uploaded-files-status3').html('');
$('#addIDstatus3').html('
');
if ((($('#selectedType').val() == "BIRTH") && ($('#relationship').val() == "Legal Guardian" || $('#relationship').val() == "Legal Representative")) ||
(($('#selectedType').val() == "DEATH") && ($('#relationshipDecendentDeath').val() == "Legal Guardian" || $('#relationshipDecendentDeath').val() == "Legal Representative"))) {
$("#addMoreID3").hide();
} else {
$("#addMoreID3").show();
}
$("#imgPreview3").empty();
var d = new Date();
$.each(data.result, function (index, file) {
$("#imgFilePath3").val(file.filePath);
var acceptImgFileTypes = /^image\/(gif|jpe?g|png)$/i;
if (index == 0 && file.fileName != "undefined") {
if (file.bytes == null) {
$("#imgPreview3").append("
");
$("#imgPreview3 img").attr("src", '../images/wrongfiletype.png');
$("#imgFilePath3").val('');
$("#addIDstatus3").html('');
$("#upload-adoc3").html('An error has occurred while uploading the file. Please click delete button, and attempt to upload this image again.');
}else if (file.fileType.length && !acceptImgFileTypes.test(file.fileType)) {
$("#imgPreview3").append("
");
$("#imgPreview3 img").attr("src", 'uploadfile/fc/thumbnailID3/0?' + d.getTime());
$("#imgPreview3 img").attr("alt",' Loading snapshot of the uploaded file...');
}else {
if ($.browser.msie && parseFloat(jQuery.browser.version) <= 9.0) {
$("#imgPreview3").show();
$("#imgPreview3")[0].filters.item("DXImageTransform.Microsoft.AlphaImageLoader").src = $(this).val();
}else {
if (typeof (FileReader) != "undefined") {
$("#imgPreview3").append("
");
var reader = new FileReader();
reader.onload = function (e) {
var img = new Image();
img.onload = function() {
$("#imgPreview3 img").attr("src", e.target.result);
};
img.onerror = function() {
$("#imgPreview3 img").attr("src", '../images/wrongfiletype.png');
$("#imgFilePath3").val('');
$("#addIDstatus3").html('');
$("#upload-adoc3").html('An error has occurred while uploading the file. Please click delete button, and attempt to upload this image again.');
};
img.src = e.target.result;
}
reader.readAsDataURL(data.originalFiles[0]);
} else {
$('#addIDstatus3').html('');
$("#uploaded-files-status3").html('Image preview failed, please try most recent versions of Mozilla Firefox or Internet Explorer.');
}
}
}
}
});
},
fail: function (e, data) {
$("#uploaded-files-status3").html('The type of file selected cannot be uploaded on this website. Please attempt to upload again using a valid image file.');
$("#upload-adoc3").html('');
$('#addIDstatus3').html('');
$('#progress3 .progress-bar').css('width','0%');
$("#imgFilePath3").val('');
},
progressall: function (e, data) {
var progress = parseInt(data.loaded / data.total * 100, 10);
$('#progress3 .progress-bar').css(
'width',
progress + '%'
);
},
dropZone: $('#dropzone3')
});
$(".uploadMsgmore").toggle(function(){
$(".uploadMsgcomplete").hide();
$(this).text(" Show (+)").siblings(".uploadMsgteaser").show();
}, function(){
$(".uploadMsgteaser").hide();
$(this).text(" Hide (-)").siblings(".uploadMsgcomplete").show();
});
var rotateidf=0;
$("#imgPreview").click(function(){
if($(this).hasClass('rotated0')){
$(this).removeClass('rotated0');
}
if($(this).hasClass('rotated1')){
$(this).removeClass('rotated1');
}
if($(this).hasClass('rotated2')){
$(this).removeClass('rotated2');
}
if($(this).hasClass('rotated3')){
$(this).removeClass('rotated3');
}
var rotated = "rotated" + (rotateidf++)%4;
$(this).addClass(rotated);
});
var rotateidf1=0;
$("#imgPreview1").click(function(){
if($(this).hasClass('rotated0')){
$(this).removeClass('rotated0');
}
if($(this).hasClass('rotated1')){
$(this).removeClass('rotated1');
}
if($(this).hasClass('rotated2')){
$(this).removeClass('rotated2');
}
if($(this).hasClass('rotated3')){
$(this).removeClass('rotated3');
}
var rotated = "rotated" + (rotateidf1++)%4;
$(this).addClass(rotated);
});
var rotateidf2=0;
$("#imgPreview2").click(function(){
if($(this).hasClass('rotated0')){
$(this).removeClass('rotated0');
}
if($(this).hasClass('rotated1')){
$(this).removeClass('rotated1');
}
if($(this).hasClass('rotated2')){
$(this).removeClass('rotated2');
}
if($(this).hasClass('rotated3')){
$(this).removeClass('rotated3');
}
var rotated = "rotated" + (rotateidf2++)%4;
$(this).addClass(rotated);
});
var rotateidf3=0;
$("#imgPreview3").click(function(){
if($(this).hasClass('rotated0')){
$(this).removeClass('rotated0');
}
if($(this).hasClass('rotated1')){
$(this).removeClass('rotated1');
}
if($(this).hasClass('rotated2')){
$(this).removeClass('rotated2');
}
if($(this).hasClass('rotated3')){
$(this).removeClass('rotated3');
}
var rotated = "rotated" + (rotateidf3++)%4;
$(this).addClass(rotated);
});
var rotateidf4=0;
$("#imgPreview4").click(function(){
if($(this).hasClass('rotated0')){
$(this).removeClass('rotated0');
}
if($(this).hasClass('rotated1')){
$(this).removeClass('rotated1');
}
if($(this).hasClass('rotated2')){
$(this).removeClass('rotated2');
}
if($(this).hasClass('rotated3')){
$(this).removeClass('rotated3');
}
var rotated = "rotated" + (rotateidf4++)%4;
$(this).addClass(rotated);
});
var docrotatef1=0;
$("#ulPreview1").click(function(){
if($(this).hasClass('rotated0')){
$(this).removeClass('rotated0');
}
if($(this).hasClass('rotated1')){
$(this).removeClass('rotated1');
}
if($(this).hasClass('rotated2')){
$(this).removeClass('rotated2');
}
if($(this).hasClass('rotated3')){
$(this).removeClass('rotated3');
}
var rotated = "rotated" + (docrotatef1++)%4;
$(this).addClass(rotated);
});
$('#email').blur(function(e) {
var val = $.trim($(this).val());
var re = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
if (!re.test(val)){
$("#divEmailMessage1").html('Invalid Email');
}else {
$("#divEmailMessage1").html("");
}
});
$('#email').bind("cut copy paste",function(e) {
e.preventDefault();
});
$('#emailConfirm').bind("cut copy paste",function(e) {
e.preventDefault();
});
$('#emailShip').bind("cut copy paste",function(e) {
e.preventDefault();
});
$('#emailConfirmShip').bind("cut copy paste",function(e) {
e.preventDefault();
});
$('#emailShip').blur(function(e) {
var val = $.trim($(this).val());
var re = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
if (!re.test(val) && val!= ""){
$("#divEmailMessageShip1").html('Invalid Email');
}else {
$("#divEmailMessageShip1").html("");
}
});
$('#emailConfirm').blur(function(e) {
var val = $.trim($(this).val());
var re = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
if (!re.test(val)){
$("#divEmailMessage2").html('Invalid Email');
}else {
$("#divEmailMessage2").html("");
}
});
$('#emailConfirmShip').blur(function(e) {
var val = $.trim($(this).val());
var re = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
if (!re.test(val) && val!= ""){
$("#divEmailMessageShip2").html('Invalid Email');
}else {
$("#divEmailMessageShip2").html("");
}
});
$('#ssnDeath').focus(function(e) {
var mask = "999-99-9999";
$(this).mask(mask);
$("#spnSSNMessage1").html('
Please enter numeric number');
});
$('#ssnDeath').on("blur", function(e) {
$("#spnSSNMessage1").html('');
});
$('#fatherFirstNameRegistrant').focus(function(e) {
var val = $.trim($(this).val());
var lval = $.trim($('#fatherLastNameRegistrant').val());
if (val!= "" || lval != "") {
$("#fatherSuffixNameRegistrant").prop("disabled", false);
}else {
if (val == "" && lval == "") {
$("#fatherSuffixNameRegistrant").val('');
$("#fatherSuffixNameRegistrant").prop("disabled", true);
}
}
});
$('#fatherLastNameRegistrant').focus(function(e) {
var val = $.trim($(this).val());
var fval = $.trim($('#fatherFirstNameRegistrant').val());
if (val!= "" || fval != "") {
$("#fatherSuffixNameRegistrant").prop("disabled", false);
}else {
if (val == "" && fval == "") {
$("#fatherSuffixNameRegistrant").val('');
$("#fatherSuffixNameRegistrant").prop("disabled", true);
}
}
});
$('#fatherFirstNameRegistrantDeath').focus(function(e) {
var val = $.trim($(this).val());
var lval = $.trim($('#fatherLastNameRegistrantDeath').val());
if (val!= "" || lval != "") {
$("#fatherSuffixNameRegistrantDeath").prop("disabled", false);
}else {
if (val == "" && lval == "") {
$("#fatherSuffixNameRegistrantDeath").val('');
$("#fatherSuffixNameRegistrantDeath").prop("disabled", true);
}
}
});
$('#fatherLastNameRegistrantDeath').focus(function(e) {
var val = $.trim($(this).val());
var fval = $.trim($('#fatherFirstNameRegistrantDeath').val());
if (val!= "" || fval != "") {
$("#fatherSuffixNameRegistrantDeath").prop("disabled", false);
}else {
if (val == "" && fval == "") {
$("#fatherSuffixNameRegistrantDeath").val('');
$("#fatherSuffixNameRegistrantDeath").prop("disabled", true);
}
}
});
$('#fatherFirstNameRegistrant').blur(function(e) {
var val = $.trim($(this).val());
var lval = $.trim($('#fatherLastNameRegistrant').val());
if (val!= "" || lval != "") {
$("#fatherSuffixNameRegistrant").prop("disabled", false);
}else {
if (val == "" && lval == "") {
$("#fatherSuffixNameRegistrant").val('');
$("#fatherSuffixNameRegistrant").prop("disabled", true);
}
}
});
$('#fatherLastNameRegistrant').blur(function(e) {
var val = $.trim($(this).val());
var fval = $.trim($('#fatherFirstNameRegistrant').val());
if (val!= "" || fval != "") {
$("#fatherSuffixNameRegistrant").prop("disabled", false);
}else {
if (val == "" && fval == "") {
$("#fatherSuffixNameRegistrant").val('');
$("#fatherSuffixNameRegistrant").prop("disabled", true);
}
}
});
$('#fatherFirstNameRegistrantDeath').blur(function(e) {
var val = $.trim($(this).val());
var lval = $.trim($('#fatherLastNameRegistrantDeath').val());
if (val!= "" || lval != "") {
$("#fatherSuffixNameRegistrantDeath").prop("disabled", false);
}else {
if (val == "" && lval == "") {
$("#fatherSuffixNameRegistrantDeath").val('');
$("#fatherSuffixNameRegistrantDeath").prop("disabled", true);
}
}
});
$('#fatherLastNameRegistrantDeath').blur(function(e) {
var val = $.trim($(this).val());
var fval = $.trim($('#fatherFirstNameRegistrantDeath').val());
if (val!= "" || fval != "") {
$("#fatherSuffixNameRegistrantDeath").prop("disabled", false);
}else {
if (val == "" && fval == "") {
$("#fatherSuffixNameRegistrantDeath").val('');
$("#fatherSuffixNameRegistrantDeath").prop("disabled", true);
}
}
});
$('#fatherFirstNameRegistrant').keyup(function(e) {
var val = $.trim($(this).val());
var lval = $.trim($('#fatherLastNameRegistrant').val());
if (val!= "" || lval != "") {
$("#fatherSuffixNameRegistrant").prop("disabled", false);
}else {
if (val == "" && lval == "") {
$("#fatherSuffixNameRegistrant").val('');
$("#fatherSuffixNameRegistrant").prop("disabled", true);
}
}
});
$('#fatherLastNameRegistrant').keyup(function(e) {
var val = $.trim($(this).val());
var fval = $.trim($('#fatherFirstNameRegistrant').val());
if (val!= "" || fval != "") {
$("#fatherSuffixNameRegistrant").prop("disabled", false);
}else {
if (val == "" && fval == "") {
$("#fatherSuffixNameRegistrant").val('');
$("#fatherSuffixNameRegistrant").prop("disabled", true);
}
}
});
$('#fatherFirstNameRegistrantDeath').keyup(function(e) {
var val = $.trim($(this).val());
var lval = $.trim($('#fatherLastNameRegistrantDeath').val());
if (val!= "" || lval != "") {
$("#fatherSuffixNameRegistrantDeath").prop("disabled", false);
}else {
if (val == "" && lval == "") {
$("#fatherSuffixNameRegistrantDeath").val('');
$("#fatherSuffixNameRegistrantDeath").prop("disabled", true);
}
}
});
$('#fatherLastNameRegistrantDeath').keyup(function(e) {
var val = $.trim($(this).val());
var fval = $.trim($('#fatherFirstNameRegistrantDeath').val());
if (val!= "" || fval != "") {
$("#fatherSuffixNameRegistrantDeath").prop("disabled", false);
}else {
if (val == "" && fval == "") {
$("#fatherSuffixNameRegistrantDeath").val('');
$("#fatherSuffixNameRegistrantDeath").prop("disabled", true);
}
}
});
$('#mfileupload1').fileupload({
add: function(e, data) {
$('#mprogress1 .progress-bar').css('width','0%');
var acceptFileTypes = /^(application\/(pdf|download|x-download)$|^x-unknown\/pdf)|(image\/(gif|jpe?g|png))$/i;
var errorCount = 0;
if(data.originalFiles[0]['type'].length == 0) {
$("#muploaded-files-status1").html('Not an accepted file type, please select a valid image file');
$('#addDocstatus1').html('');
errorCount++;
}
if(data.originalFiles[0]['type'].length && !acceptFileTypes.test(data.originalFiles[0]['type'])) {
$("#muploaded-files-status1").html('The type of file selected cannot be uploaded on this website. Please attempt to upload again using a valid image file.');
$('#addDocstatus1').html('');
errorCount++;
}
if(data.originalFiles[0]['size'] > 5242881) {
$("#muploaded-files-status1").html('Files greater than 5 MB in size cannot be uploaded on this website. Please attempt to upload again using a smaller file.');
$('#addDocstatus1').html('');
errorCount++;
}
if(errorCount == 0) {
data.submit();
$("#muploaded-files-status1").text('');
}else {
$("#muploaded-files1").hide();
}
},
dataType: 'json',
done: function (e, data) {
$("#muploaded-files1").show();
$("#muploaded-files-status1").html('');
$('#docflashzone1').hide();
$('#addDocstatus1').html('
');
$("#addMoreDoc1").show();
$("#addDocTitle1").show();
$("#mupload-table1").show();
$("#addMoreID0").show();
$("#upload-sdoc1").html('Support document was uploaded successfully!
');
$("#ulPreview1").empty();
var d = new Date();
$.each(data.result, function (index, file) {
$("#docFilePath1").val(file.filePath);
var acceptImgFileTypes = /^image\/(gif|jpe?g|png)$/i;
if (index == 0 && file.fileName != "undefined") {
if (file.bytes == null) {
$("#ulPreview1").append("
");
$("#ulPreview1 img").attr("src", '../images/wrongfiletype.png');
$("#docFilePath1").val('');
$("#addDocstatus1").html('');
$("#upload-sdoc1").html('An error has occurred while uploading the file. Please click delete button, and attempt to upload this image again.');
}else if (file.fileType.length && !acceptImgFileTypes.test(file.fileType)) {
$("#ulPreview1").append("
");
$("#ulPreview1 img").attr("src", 'uploadfile/fc/thumbnaildoc1/0?' + d.getTime());
$("#ulPreview1 img").attr("alt",' Loading snapshot of the uploaded file...');
}else {
if ($.browser.msie && parseFloat(jQuery.browser.version) <= 9.0) {
$("#ulPreview1").show();
$("#ulPreview1")[0].filters.item("DXImageTransform.Microsoft.AlphaImageLoader").src = $(this).val();
}else {
if (typeof (FileReader) != "undefined") {
$("#ulPreview1").append("
");
var reader = new FileReader();
reader.onload = function (e) {
var img = new Image();
img.onload = function() {
$("#ulPreview1 img").attr("src", e.target.result);
};
img.onerror = function() {
$("#ulPreview1 img").attr("src", '../images/wrongfiletype.png');
$("#docFilePath1").val('');
$("#addDocstatus1").html('');
$("#upload-sdoc1").html('An error has occurred while uploading the file. Please click delete button, and attempt to upload this image again.');
};
img.src = e.target.result;
}
reader.readAsDataURL(data.originalFiles[0]);
} else {
$('#addDocstatus1').html('');
$("#muploaded-files-status1").html('Image preview failed, please try most recent versions of Mozilla Firefox or Internet Explorer.');
}
}
}
}
});
},
fail: function (e, data) {
$("#muploaded-files-status1").html('The type of file selected cannot be uploaded on this website. Please attempt to upload again using a valid image file.');
$('#addDocstatus1').html('');
$("#upload-sdoc1").html('');
$('#mprogress1 .progress-bar').css('width','0%');
$("#docFilePath1").val('');
},
progressall: function (e, data) {
var progress = parseInt(data.loaded / data.total * 100, 10);
$('#mprogress1 .progress-bar').css(
'width',
progress + '%'
);
},
dropZone: $('#mdropzone1')
});
window.addEventListener("dragover",function(e){
e = e || event;
e.preventDefault();
},false);
window.addEventListener("drop",function(e){
e = e || event;
e.preventDefault();
},false);
$('#dropzone').on('dragover', function(e){
var errorMsg = "";
var errorCount = 0;
var idNum = $.trim($('#idNumber').val());
if ($('#idType option:selected').val() == "") {
errorMsg = "The ID Type of your primary proof of identification is required.
";
errorCount++;
}
if (idNum == "") {
errorMsg = errorMsg + "The ID Number of your primary proof of identification is required. If your ID does not have number, simply input N/A.
";
errorCount++;
}
if (( $.trim($('#idDescription').val()) == "") && ($('#idType option:selected').val() == "6") ){
errorMsg = errorMsg + "The ID Description of your primary proof of identification is required.
";
errorCount++;
}
if(errorCount == 0) {
$("#uploaded-files-status").html('');
return true;
}else {
$("#uploaded-files-status").show();
$("#uploaded-files-status").html(errorMsg);
e.preventDefault();
e.stopPropagation();
e.originalEvent.dataTransfer.dropEffect = "none";
return false;
}
});
$('#fileupload').on('click', function (e) {
var errorMsg = "";
var errorCount = 0;
var idNum = $.trim($('#idNumber').val());
if ($('#idType option:selected').val() == "") {
errorMsg = "The ID Type of your primary proof of identification is required.
";
errorCount++;
}
if (idNum == "") {
errorMsg = errorMsg + "The ID Number of your primary proof of identification is required. If your ID does not have number, simply input N/A.
";
errorCount++;
}
if (( $.trim($('#idDescription').val()) == "") && ($('#idType option:selected').val() == "6") ){
errorMsg = errorMsg + "The ID Description of your primary proof of identification is required.
";
errorCount++;
}
if(errorCount == 0) {
$("#uploaded-files-status").html('');
return true;
}else {
$("#uploaded-files-status").show();
$("#uploaded-files-status").html(errorMsg);
e.preventDefault();
e.stopPropagation();
return false;
}
});
$('#dropzone1').on('dragover', function(e){
var errorMsg = "";
var errorCount = 0;
var idNum = $.trim($('#idNumber1').val());
if ($('#idType1 option:selected').val() == "") {
errorMsg = "Please select a ID Type.
";
errorCount++;
}
if (idNum == "") {
errorMsg = errorMsg + "The ID Number is required. If this document does not have number, simply input N/A.
";
errorCount++;
}
if (( $.trim($('#idDescription1').val()) == "") && ($('#idType1 option:selected').val() == "6") ){
errorMsg = errorMsg + "Please enter a ID Description.
";
errorCount++;
}
if(errorCount == 0) {
$("#uploaded-files-status1").html('');
return true;
}else {
$("#uploaded-files-status1").show();
$("#uploaded-files-status1").html(errorMsg);
e.preventDefault();
e.stopPropagation();
e.originalEvent.dataTransfer.dropEffect = "none";
return false;
}
});
$('#fileupload1').on('click', function (e) {
var errorMsg = "";
var errorCount = 0;
var idNum = $.trim($('#idNumber1').val());
if ($('#idType1 option:selected').val() == "") {
errorMsg = "Please select a ID Type.
";
errorCount++;
}
if (idNum == "") {
errorMsg = errorMsg + "The ID Number is required. If this document does not have number, simply input N/A.
";
errorCount++;
}
if (( $.trim($('#idDescription1').val()) == "") && ($('#idType1 option:selected').val() == "6") ){
errorMsg = errorMsg + "Please enter a ID Description.
";
errorCount++;
}
if(errorCount == 0) {
$("#uploaded-files-status1").html('');
return true;
}else {
$("#uploaded-files-status1").show();
$("#uploaded-files-status1").html(errorMsg);
e.preventDefault();
e.stopPropagation();
return false;
}
});
$('#dropzone2').on('dragover', function(e){
var errorMsg = "";
var errorCount = 0;
var idNum = $.trim($('#idNumber2').val());
if ($('#idType2 option:selected').val() == "") {
errorMsg = "Please select a ID Type.
";
errorCount++;
}
if (idNum == "") {
errorMsg = errorMsg + "The ID Number is required. If this document does not have number, simply input N/A.
";
errorCount++;
}
if (( $.trim($('#idDescription2').val()) == "") && ($('#idType2 option:selected').val() == "6") ){
errorMsg = errorMsg + "Please enter a ID Description.
";
errorCount++;
}
if(errorCount == 0) {
$("#uploaded-files-status2").html('');
return true;
}else {
$("#uploaded-files-status2").show();
$("#uploaded-files-status2").html(errorMsg);
e.preventDefault();
e.stopPropagation();
e.originalEvent.dataTransfer.dropEffect = "none";
return false;
}
});
$('#fileupload2').on('click', function (e) {
var errorMsg = "";
var errorCount = 0;
var idNum = $.trim($('#idNumber2').val());
if ($('#idType2 option:selected').val() == "") {
errorMsg = "Please select a ID Type.
";
errorCount++;
}
if (idNum == "") {
errorMsg = errorMsg + "The ID Number is required. If this document does not have number, simply input N/A.
";
errorCount++;
}
if (( $.trim($('#idDescription2').val()) == "") && ($('#idType2 option:selected').val() == "6") ){
errorMsg = errorMsg + "Please enter a ID Description.
";
errorCount++;
}
if(errorCount == 0) {
$("#uploaded-files-status2").html('');
return true;
}else {
$("#uploaded-files-status2").show();
$("#uploaded-files-status2").html(errorMsg);
e.preventDefault();
e.stopPropagation();
return false;
}
});
$('#dropzone3').on('dragover', function(e){
var errorMsg = "";
var errorCount = 0;
var idNum = $.trim($('#idNumber3').val());
if ($('#idType3 option:selected').val() == "") {
errorMsg = "Please select a ID Type.
";
errorCount++;
}
if (idNum == "") {
errorMsg = errorMsg + "The ID Number is required. If this document does not have number, simply input N/A.
";
errorCount++;
}
if (( $.trim($('#idDescription3').val()) == "") && ($('#idType3 option:selected').val() == "6") ){
errorMsg = errorMsg + "Please enter a ID Description.
";
errorCount++;
}
if(errorCount == 0) {
$("#uploaded-files-status3").html('');
return true;
}else {
$("#uploaded-files-status3").show();
$("#uploaded-files-status3").html(errorMsg);
e.preventDefault();
e.stopPropagation();
e.originalEvent.dataTransfer.dropEffect = "none";
return false;
}
});
$('#fileupload3').on('click', function (e) {
var errorMsg = "";
var errorCount = 0;
var idNum = $.trim($('#idNumber3').val());
if ($('#idType3 option:selected').val() == "") {
errorMsg = "Please select a ID Type.
";
errorCount++;
}
if (idNum == "") {
errorMsg = errorMsg + "The ID Number is required. If this document does not have number, simply input N/A.
";
errorCount++;
}
if (( $.trim($('#idDescription3').val()) == "") && ($('#idType3 option:selected').val() == "6") ){
errorMsg = errorMsg + "Please enter a ID Description.
";
errorCount++;
}
if(errorCount == 0) {
$("#uploaded-files-status3").html('');
return true;
}else {
$("#uploaded-files-status3").show();
$("#uploaded-files-status3").html(errorMsg);
e.preventDefault();
e.stopPropagation();
return false;
}
});
$('#dropzone4').on('dragover', function(e){
var errorMsg = "";
var errorCount = 0;
var idNum = $.trim($('#idNumber4').val());
if ($('#idType4 option:selected').val() == "") {
errorMsg = "Please select a ID Type.
";
errorCount++;
}
if (idNum == "") {
errorMsg = errorMsg + "The ID Number is required. If this document does not have number, simply input N/A.
";
errorCount++;
}
if (( $.trim($('#idDescription4').val()) == "") && ($('#idType4 option:selected').val() == "6") ){
errorMsg = errorMsg + "Please enter a ID Description.
";
errorCount++;
}
if(errorCount == 0) {
$("#uploaded-files-status4").html('');
return true;
}else {
$("#uploaded-files-status4").show();
$("#uploaded-files-status4").html(errorMsg);
e.preventDefault();
e.stopPropagation();
e.originalEvent.dataTransfer.dropEffect = "none";
return false;
}
});
$('#fileupload4').on('click', function (e) {
var errorMsg = "";
var errorCount = 0;
var idNum = $.trim($('#idNumber4').val());
if ($('#idType4 option:selected').val() == "") {
errorMsg = "Please select a ID Type.
";
errorCount++;
}
if (idNum == "") {
errorMsg = errorMsg + "The ID Number is required. If this document does not have number, simply input N/A.
";
errorCount++;
}
if (( $.trim($('#idDescription4').val()) == "") && ($('#idType4 option:selected').val() == "6") ){
errorMsg = errorMsg + "Please enter a ID Description.
";
errorCount++;
}
if(errorCount == 0) {
$("#uploaded-files-status4").html('');
return true;
}else {
$("#uploaded-files-status4").show();
$("#uploaded-files-status4").html(errorMsg);
e.preventDefault();
e.stopPropagation();
return false;
}
});
$('#mdropzone1').on('dragover', function(e){
var errorMsg = "";
var errorCount = 0;
var idNum = $.trim($('#idNumberdoc1').val());
if ($('#idTypedoc1 option:selected').val() == "") {
errorMsg = "Please select a ID Type.
";
errorCount++;
}
if (idNum == "") {
errorMsg = errorMsg + "The ID Number is required. If this document does not have number, simply input N/A.
";
errorCount++;
}
if (( $.trim($('#idDescriptiondoc1').val()) == "") && ($('#idTypedoc1 option:selected').val() == "6") ){
errorMsg = errorMsg + "Please enter a ID Description.
";
errorCount++;
}
if(errorCount == 0) {
$("#muploaded-files-status1").html('');
return true;
}else {
$("#muploaded-files-status1").show();
$("#muploaded-files-status1").html(errorMsg);
e.preventDefault();
e.stopPropagation();
e.originalEvent.dataTransfer.dropEffect = "none";
return false;
}
});
$('#mfileupload1').on('click', function (e) {
var errorMsg = "";
var errorCount = 0;
var idNum = $.trim($('#idNumberdoc1').val());
if ($('#idTypedoc1 option:selected').val() == "") {
errorMsg = "Please select a ID Type.
";
errorCount++;
}
if (idNum == "") {
errorMsg = errorMsg + "The ID Number is required. If this document does not have number, simply input N/A.
";
errorCount++;
}
if (( $.trim($('#idDescriptiondoc1').val()) == "") && ($('#idTypedoc1 option:selected').val() == "6") ){
errorMsg = errorMsg + "Please enter a ID Description.
";
errorCount++;
}
if(errorCount == 0) {
$("#muploaded-files-status1").html('');
return true;
}else {
$("#muploaded-files-status1").show();
$("#muploaded-files-status1").html(errorMsg);
e.preventDefault();
e.stopPropagation();
return false;
}
});
$("#accordion").accordion({
heightStyle: "content",
collapsible: true
});
$("#accordiondoc").accordion({
heightStyle: "content"
});
$(".idopener").on("click", function () {
var $this = $(this);
toOpen = $this.data("panel");
if (toOpen == "0"){
$("#uploaddoczone").show();
$("#accordion").accordion({
heightStyle: "content",
collapsible: true,
active: false,
});
}
return false;
});
$(".opener").on("click", function () {
var $this = $(this);
toOpen = $this.data("panel");
if (toOpen == "1"){
$("#addIDTitle1").show();
}
if (toOpen == "2"){
$("#addIDTitle2").show();
}
if (toOpen == "3"){
$("#addIDTitle3").show();
}
if (toOpen == "4"){
$("#addIDTitle4").show();
}
$("#accordiondoc").accordion("option", "active", toOpen);
return false;
});
$('#deletephotoid').on('click', function (e) {
e.preventDefault();
var $link = $(this);
var req = $.ajax({
dataType: 'json',
url: $link.data('url'),
type: 'POST'
});
req.success(function () {
$('#upload-table').hide();
$("#upload-adoc").text('');
$('#uploaded-files-status').text('');
$('#progress .progress-bar').css('width','0%');
$("#imgFilePath").val('');
$("#idType").val('');
$("#idNumber").val('');
$("#idDescription").val('')
$('#idflashzone').show();
$('#addMoreID').hide();
$('#addIDstatus').html('');
$('#divIdDescriptionLabel').hide();
$('#idDescription').hide();
});
});
$("#deletephotoid").qtip({
prerender: true,
content: {
title: 'Click here to delete the uploaded photo ID',
text: ''
},
position: {
target: $("#deletephotoid"),
adjust: {
x: -40,
y: -10
}
},
});
$('#deletephotoid1').on('click', function (e) {
e.preventDefault();
var $link = $(this);
var req = $.ajax({
dataType: 'json',
url: $link.data('url'),
type: 'POST'
});
req.success(function () {
$('#upload-table1').hide();
$("#upload-adoc1").text('');
$('#uploaded-files-status1').text('');
$('#progress1 .progress-bar').css('width','0%');
$("#imgFilePath1").val('');
$("#idType1").val('');
$("#idNumber1").val('');
$("#idDescription1").val('');
$('#idflashzone1').show();
$('#addMoreID1').hide();
$('#addIDstatus1').html('');
$('#divIdDescriptionLabel1').hide();
$('#idDescription1').hide();
});
});
$("#deletephotoid1").qtip({
prerender: true,
content: {
title: 'Click here to delete the uploaded file',
text: ''
},
position: {
target: $("#deletephotoid1"),
adjust: {
x: -40,
y: -10
}
},
});
$('#deletephotoid2').on('click', function (e) {
e.preventDefault();
var $link = $(this);
var req = $.ajax({
dataType: 'json',
url: $link.data('url'),
type: 'POST'
});
req.success(function () {
$('#upload-table2').hide();
$("#upload-adoc2").text('');
$('#uploaded-files-status2').text('');
$('#progress2 .progress-bar').css('width','0%');
$("#imgFilePath2").val('');
$("#idType2").val('');
$("#idNumber2").val('');
$("#idDescription2").val('');
$('#idflashzone2').show();
$('#addMoreID2').hide();
$('#addIDstatus2').html('');
$('#divIdDescriptionLabel2').hide();
$('#idDescription2').hide();
});
});
$("#deletephotoid2").qtip({
prerender: true,
content: {
title: 'Click here to delete the uploaded file',
text: ''
},
position: {
target: $("#deletephotoid2"),
adjust: {
x: -40,
y: -10
}
},
});
$('#deletephotoid3').on('click', function (e) {
e.preventDefault();
var $link = $(this);
var req = $.ajax({
dataType: 'json',
url: $link.data('url'),
type: 'POST'
});
req.success(function () {
$('#upload-table3').hide();
$("#upload-adoc3").text('');
$('#uploaded-files-status3').text('');
$('#progress3 .progress-bar').css('width','0%');
$("#imgFilePath3").val('');
$("#idType3").val('');
$("#idNumber3").val('');
$("#idDescription3").val('');
$('#idflashzone3').show();
$('#addMoreID3').hide();
$('#addIDstatus3').html('');
$('#divIdDescriptionLabel3').hide();
$('#idDescription3').hide();
});
});
$("#deletephotoid3").qtip({
prerender: true,
content: {
title: 'Click here to delete the uploaded file',
text: ''
},
position: {
target: $("#deletephotoid3"),
adjust: {
x: -40,
y: -10
}
},
});
$('#deletephotoid4').on('click', function (e) {
e.preventDefault();
var $link = $(this);
var req = $.ajax({
dataType: 'json',
url: $link.data('url'),
type: 'POST'
});
req.success(function () {
$('#upload-table4').hide();
$("#upload-adoc4").text('');
$('#uploaded-files-status4').text('');
$('#progress4 .progress-bar').css('width','0%');
$("#imgFilePath4").val('');
$("#idType4").val('');
$("#idNumber4").val('');
$("#idDescription4").val('');
$('#idflashzone4').show();
$('#addMoreID4').hide();
$('#addIDstatus4').html('');
$('#divIdDescriptionLabel4').hide();
$('#idDescription4').hide();
});
});
$("#deletephotoid4").qtip({
prerender: true,
content: {
title: 'Click here to delete the uploaded file',
text: ''
},
position: {
target: $("#deletephotoid4"),
adjust: {
x: -40,
y: -10
}
},
});
$('#mdeletefile1').on('click', function (e) {
e.preventDefault();
var $link = $(this);
var req = $.ajax({
dataType: 'json',
url: $link.data('url'),
type: 'POST'
});
req.success(function () {
$('#docflashzone1').show();
$('#mprogress1 .progress-bar').css('width','0%');
$('#mupload-table1').hide();
$("#upload-sdoc1").text('');
$("#addMoreDoc1").hide();
$("#muploaded-files-status1").text('');
$("#ulPreview1").empty();
$('#docFilePath1').val('');
$('#idTypedoc1').val('');
$('#idNumberdoc1').val('');
$('#idDescriptiondoc1').val('');
$('#addDocstatus1').html('');
$('#divdocIdDescriptionLabel1').hide();
$('#idDescriptiondoc1').hide();
$("#addMoreID0").hide();
});
});
$("#mdeletefile1").qtip({
prerender: true,
content: {
title: 'Click here to delete the uploaded file',
text: ''
},
position: {
target: $("#mdeletefile1"),
adjust: {
x: -40,
y: -10
}
},
});
$(".selectbox").chosen({width: '100%'});
$(".selectbox").prop('disabled', false).trigger("liszt:updated");
});