var lang = 'en';
var loc = 'boeken_faq';
var book_type = 'boek';
function make_dialog_fullscreen()
{
var dh = $(document).height();
var dw = $(window).width();
$('#dialog_wrapper').height(dh).width(dw);
}
function formaat_wijzigt(btn)
{
var v = $(btn).val();
$('#voorbeeld_image').attr('src','/images/schema_'+v+'.png');
}
function close_dialog()
{
$('#videoframe').remove();
$('#dialog_wrapper').hide();
}
function papier_soort_info()
{
var v = $('#papier_soort').val();
if (v == 'roman_wit') show_dialog(" White Bulk", "80 g / m2 Special white bulk (natural white) )\n\n This type of paper is very suitable for books with text, without high-quality photos or detailed images. \n The paper is also less white, which makes reading more comfortable.");
else if (v == 'roman_geel') show_dialog(" Ivory Bulk", "80 g/m2 Bulk ivory \n\ This type of paper is very suitable for books with text, without high-quality photos or detailed images.\n The paper is also less white, which makes reading more comfortable.");
else if (v == 'cursus') show_dialog(" Course paper","80 g/m² Wood-free offset paper. \n\ This paper will not discolor as it ages because it does not contain a lot of wood fibers. \n This type of paper is very suitable for books with text and color illustrations.");
else if (v == 'kunstdruk_90') show_dialog("90 g / m² coated paper","90 g/m² machine-coated. \n\n This paper is smoother than course paper. \ Because of its smooth surface, this coated paper is very suitable for printing books and brochures containing detailed text (e.g., diacritics) or color images.");
else if (v == 'kunstdruk_115') show_dialog("115 g / m² coated paper","115 g/m² machine-coated. \n\n This paper is smoother than course paper. \ Because of its smooth surface, this coated paper is very suitable for printing books and brochures containing detailed text (e.g., diacritics) or color images.");
}
function formaat_info()
{
var v = $('#formaat').val();
if (v == '148x210') show_dialog("size 148 x 210 mm", " A5 - novels ");
else if (v == "160x240") show_dialog("size 160 x 240 mm", " academic - theses / PhD ");
else if (v == "170x250") show_dialog("size 170 x 250 mm", " academic - theses / PhD ");
else if (v == "206x276") show_dialog("size 206 x 276 mm", " academic – journals ");
else if (v == "210x297") show_dialog("size 210 x 297 mm", " A4 – journals ");
}
function show_dialog_with_load(title, url)
{
$('#dialog_body').html('');
$.get(url, function(res) {
show_dialog(title, res);
});
return false;
}
function show_dialog(title, content)
{
var s = $(document).scrollTop();
$('#dialog_content').css('top',s);
if (title.length > 0)
{
$('#dialog_title').html(title).show();
$('#dialog_close').show();
$('#dialog_hoofding').hide();
$('#dialog_body').css('overflow-y','scroll');
}
else
{
$('#dialog_title').hide();
$('#dialog_close').hide();
$('#dialog_hoofding').show();
$('#dialog_body').css('overflow-y','hidden');
}
$('#dialog_body').html(content);
$('#dialog_wrapper').show();
return false;
}
function dummy()
{
$('#aantal_blz').val(25);
$('#aantal_blz_kleur').val(5);
$('#oplage').val(100);
$('#email').val('jeroen.clarysse@telenet.be');
herbereken();
}
function upload_klaar()
{
var offer_id = $('#email_container #offer_id').val();
var url = '/upload_klaar.php?offer_id=' + encodeURIComponent(offer_id);
url += '&lang='+lang;
$.get(url, function(res)
{
if (res == 'ok')
{
if ($('#wiz_results').length > 0)
{
$('#wiz_results').html(" Thank you for uploading your files.
Before continuing with the order, we will check your files for formatting, embedded fonts, resolution, and the number of pages. Within 10 minutes you will receive an email telling you whether your file is compliant or what you need to do to fix it. The email will also detail the next steps to proceed with your order.
Regards,
Nicebooks.digital");
}
else
{
$('#uw_gegevens_box').slideUp();
$('#upload_klaar_box').slideDown();
}
}
else
alert(res);
})
}
function stap2_email_en_data(wizard)
{
$('#herbereken_gif').show();
var aantal_blz = $('#aantal_blz').val();
var aantal_blz_kleur = $('#aantal_blz_kleur').val();
var oplage = $('#oplage').val();
var formaat = $('#formaat').val();
var boek_type = $('#boek_type').val();
var papier_soort = $('#papier_soort').val();
if (! $.isNumeric(aantal_blz))
{
alert(" incorrect number of pages ");
$('#herbereken_gif').hide();
return;
}
if (aantal_blz > 750 && loc != 'kopie')
{
alert(" the maximum number of pages is 750.Contact us for a customized quote");
$('#herbereken_gif').hide();
return;
}
if (! $.isNumeric(oplage))
{
alert("incorrect print run");
$('#herbereken_gif').hide();
return;
}
if (oplage > 300 && loc != 'kopie')
{
alert(" Maximum print run is 300. Contact us for a customized quote.");
$('#herbereken_gif').hide();
return;
}
/* if ($('#radio_kleur').is(':checked') && ! $.isNumeric(aantal_blz_kleur))
{
alert('incorrect aantal bladzijden-kleur');
return;
}
if ( parseInt(aantal_blz_kleur) > parseInt(aantal_blz) )
{
alert('aantal bladzijden in kleur moet minder dan of gelijk zijn aan totaal aantal bladzijden');
return;
}*/
params = new Object();
params['aantal_blz'] = aantal_blz;
params['aantal_blz_kleur'] = aantal_blz; //aantal_blz_kleur;
params['oplage'] = oplage;
params['formaat'] = formaat;
params['papier_soort'] = papier_soort;
if ($('#radio_kleur').is(':checked'))
params['kleur_of_zwartwit'] = 'kleur';
else
params['kleur_of_zwartwit'] = 'zwartwit';
params['type'] = 'verder';
params['lang'] = lang;
params['boek_type'] = boek_type;
if ($('#isbn_check').length > 0)
params['isbn'] = $('#isbn_check').is(':checked');
else
params['isbn'] = $('#wiz_isbn_yes').is(':checked');
var url = '/calculate_offer.php';
$.post(url, params, function(res)
{
$('#herbereken_gif').hide();
json = eval('('+res+')');
if (json.error)
alert(json.error);
else
{
if (wizard == true)
{
$('#wiz_results').html(json.result);
}
else
{
$('#uw_gegevens_box').html(json.result);
$('#uw_boek_box, #verder_button').slideUp();
$('#uw_gegevens_box').slideDown();
}
}
});
}
function herbereken()
{
$('#herbereken_gif').show();
var aantal_blz = $('#aantal_blz').val();
var aantal_blz_kleur = $('#aantal_blz_kleur').val();
var oplage = $('#oplage').val();
var formaat = $('#formaat').val();
var papier_soort = $('#papier_soort').val();
var boek_type = $('#boek_type').val();
if (! $.isNumeric(aantal_blz))
{
alert(" incorrect number of pages ");
$('#herbereken_gif').hide();
return;
}
if (aantal_blz > 750 && loc != 'kopie')
{
alert(" the maximum number of pages is 750.Contact us for a customized quote");
$('#herbereken_gif').hide();
return;
}
if (! $.isNumeric(oplage))
{
alert("incorrect print run");
$('#herbereken_gif').hide();
return;
}
if (oplage > 300 && loc != 'kopie')
{
alert(" Maximum print run is 300. Contact us for a customized quote.");
$('#herbereken_gif').hide();
return;
}
/*
if ($('#radio_kleur').is(':checked') && ! $.isNumeric(aantal_blz_kleur))
{
alert('incorrect aantal bladzijden-kleur');
return;
}
if ( parseInt(aantal_blz_kleur) > parseInt(aantal_blz) )
{
alert('aantal bladzijden in kleur moet minder dan of gelijk zijn aan totaal aantal bladzijden');
return;
}*/
params = new Object();
params['aantal_blz'] = aantal_blz;
params['aantal_blz_kleur'] = aantal_blz; //aantal_blz_kleur;
params['oplage'] = oplage;
params['formaat'] = formaat;
params['papier_soort'] = papier_soort;
params['boek_type'] = boek_type;
if ($('#radio_kleur').is(':checked'))
params['kleur_of_zwartwit'] = 'kleur';
else
params['kleur_of_zwartwit'] = 'zwartwit';
params['type'] = 'quick';
params['lang'] = lang;
if ($('#isbn_check').length > 0)
params['isbn'] = $('#isbn_check').is(':checked');
else
params['isbn'] = $('#wiz_isbn_yes').is(':checked');
var url = '/calculate_offer.php';
$.post(url, params, function(res)
{
$('#herbereken_gif').hide();
json = eval('('+res+')');
if (json.error)
alert(json.error);
else
{
$('#overzicht_table').html(json.result);
}
});
}
function toggle_kleur()
{
if ($('#radio_kleur').is(':checked'))
$('[enkel_kleur]').show();
else
$('[enkel_kleur]').hide();
}
function validateEmail(email)
{
var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
return re.test(String(email).toLowerCase());
}
function confirm_email()
{
var em = $('#email').val();
if (!validateEmail(em))
{
alert(" This is not a valid email address.");
return;
}
var offer_id = $('#email_container #offer_id').val();
var url = '/confirm_email.php?email='+encodeURIComponent(em);
url += '&offer_id='+encodeURIComponent(offer_id);
$.get(url, function(res)
{
if (res == 'ok')
{
$('#email_container').slideUp();
$('#upload_box').slideDown();
prepare_upload();
}
else
alert(res);
});
}
// code for uploading :
function escapeTags( str ) {
return String( str )
.replace( /&/g, '&' )
.replace( /"/g, '"' )
.replace( /'/g, ''' )
.replace( //g, '>' );
}
function prepare_upload()
{
var btn = document.getElementById('uploadBtn'),
progressBar = document.getElementById('progressBar'),
progressOuter = document.getElementById('progressOuter'),
msgBox = document.getElementById('msgBox');
var uploader = new ss.SimpleUpload({
button: btn,
url: '/upload_pdf.php',
name: 'uploadfile',
multipart: true,
hoverClass: 'hover',
focusClass: 'focus',
multiple: true,
allowedExtensions: ['pdf'],
maxSize: 1024*96,
responseType: 'json',
data:{'id':$('#offer_id').val()},
startXHR: function()
{
progressOuter.style.display = 'block'; // make progress bar visible
this.setProgressBar( progressBar );
},
onSubmit: function()
{
// msgBox.innerHTML = ''; // empty the message box
btn.innerHTML = 'Uploading...'; // change button text to "Uploading..."
},
onSubmit2: function(filename, extension)
{
//msgBox.innerHTML = ''; // empty the message box
btn.innerHTML = 'Uploading...'; // change button text to "Uploading..."
// Create the elements of our progress bar
var progress = document.createElement('div'), // container for progress bar
bar = document.createElement('div'), // actual progress bar
fileSize = document.createElement('div'), // container for upload file size
wrapper = document.createElement('div'), // container for this progress bar
//declare somewhere:
'; overzicht_params['adres'] = $('table#levering_adres input#adres1').val() + '\n'; overzicht_params['adres'] += $('table#levering_adres input#adres2').val() + '\n'; overzicht_params['adres'] += $('table#levering_adres input#adres3').val() + '\n'; overzicht_params['adres'] += $('table#levering_adres input#adres4').val() + ', '; overzicht_params['adres'] += $('table#levering_adres input#adres5').val(); overzicht += overzicht_params['adres'].replace(/\n/g,''; } else if (overzicht_params['levering'] == 'drukkerij') { overzicht += "
'); overzicht += '
'; overzicht_params['adres'] = $('#afhaal_adres_drukkerij').html(); overzicht += $('#afhaal_adres_drukkerij').html(); overzicht += ''; } else if (overzicht_params['levering'] == 'winkel') { overzicht += "
'; overzicht_params['adres'] = $('#afhaal_adres_winkel').html(); overzicht += $('#afhaal_adres_winkel').html(); overzicht += ''; } overzicht_params['isbn_check'] = $('#isbn_check').is(':checked'); if (overzicht_params['isbn_check']) { overzicht += "