You are currently viewing International Shipping Calculator

International Shipping Calculator


.appendTo(‘body’)
.html(‘

‘+$msg+’

‘)
.dialog({
modal: true,
title: ”,
zIndex: 10000,
autoOpen: true,
width: 450,
height: ‘auto’,
resizable: false,
show: {effect: “blind”, duration: 500},
dialogClass: “noTitleBar buttonsCenter customBorders”,
buttons: {
Ok: {
text: “Ok”,
class: ‘btn btn-warning’,
click: function () {
$(this).dialog(“close”);
if(redirectUrl.length > 0) {
window.location.replace(redirectUrl);
}
}
}
}
});
}
function isNumeric(num)
{
var valid=”0123456789.”;
for(var i=0; i priceBlockHeight) {
priceBlockHeight = height;
}
});
$(“.carrier-price”).height(priceBlockHeight);
// Add/Remove Box
$(“a#add-box-link”).on(‘click’, function() {
var box = $(“.box-wrap”).first().clone();
var last_box = $(“.box-wrap”).last();
var box_id = last_box.attr(‘box_id’);
var new_box_id = parseInt(box_id) + 1;

box.find(‘.box-title .box-index’).text(new_box_id);
box.attr(‘box_id’, new_box_id);
box.find(‘input’).val(”);

box.find(‘select’).attr(‘disabled’, ‘disabled’);
box.find(“a.remove-box”).removeAttr(‘hidden’);
box.appendTo(“#boxes-list”);

/*if($(“input[name=’shipfrom’]:checked”).val()==”JP”)
{
$(“select[name=’weight_type’]”).val(‘kgs’);
$(“select[name=’size_type’]”).val(‘cm’);
}*/
if($(“select[name=’weight_type’]”).val()==”kgs”)
{
$(“select[name=’weight_type’]”).val(‘kgs’);
}
if($(“select[name=’size_type’]”).val()==”cm”)
{
$(“select[name=’size_type’]”).val(‘cm’);
}

return false;
});

$(“#boxes-list”).on(‘click’, ‘a.remove-box’, function() {
$(this).parents(“.box-wrap”).fadeOut(‘slow’, function() {
$(this).remove();
$(“.box-wrap”).each(function(index) {
var new_box_id = parseInt(index) + 1;
$(this).attr(‘box_id’, new_box_id);
$(this).find(‘.box-title .box-index’).text(new_box_id);
});
});

return false;
});

//OnChange Events
$(“input[name=’shipfrom’]”).change(function() {
var value = $(this).val();
var ship_to = $(“select[name=’country’]”).val();

$(“select[name=’weight_type’] option”).removeAttr(‘selected’);
$(“select[name=’size_type’] option”).removeAttr(‘selected’);

if(value == ‘JP’) {
$(“select[name=’weight_type’]”).val(‘kgs’);
$(“select[name=’size_type’]”).val(‘cm’);
$(“#insurance-amount-currency-usd”).hide();
$(“#insurance-amount-currency-jpy”).show();
}
else {
$(“select[name=’weight_type’]”).val(‘lbs’);
$(“select[name=’size_type’]”).val(‘inch’);
$(“#insurance-amount-currency-usd”).show();
$(“#insurance-amount-currency-jpy”).hide();
}

if(ship_to == ‘US’ && value == ‘US’) {
$(“#us_state”).fadeIn(‘slow’);
$(“#us_state .select2”).css(‘width’, ‘100%’);
$(“#us_state select”).attr(‘required’, ‘true’);
} else {
$(“#us_state”).fadeOut(‘slow’);
$(“#us_state select”).removeAttr(‘required’);
}
});

$(“input[name=’itemtype’]”).change(function() {
var value = $(this).val();

if(value == ‘document’)
{
$(“.box-wrap[box_id!=’1′]”).fadeOut(‘slow’);
$(“.box-wrap .box-size”).fadeOut(‘slow’);
$(“#consolidation-options”).fadeOut(‘slow’);
$(“#insurance-options”).fadeOut(‘slow’);
$(“#insurance-amount-wrap”).fadeOut(‘slow’);
$(“#add-box-link-wrap”).fadeOut(‘slow’);

$(“.box-wrap[box_id!=’1′] input”).attr(‘disabled’, ‘disabled’);
$(“.box-wrap[box_id!=’1′] select”).attr(‘disabled’, ‘disabled’);
$(“.box-wrap .box-size input”).attr(‘disabled’, ‘disabled’);
$(“.box-wrap .box-size select”).attr(‘disabled’, ‘disabled’);

$(“#consolidation-options input”).attr(‘disabled’, ‘disabled’);
$(“#insurance-options input”).attr(‘disabled’, ‘disabled’);
$(“#insurance-amount-wrap input”).attr(‘disabled’, ‘disabled’);
}
else
{
$(“.box-wrap”).fadeIn(‘slow’);
$(“.box-wrap .box-size”).fadeIn(‘slow’);
$(“#consolidation-options”).fadeIn(‘slow’);
$(“#insurance-options”).fadeIn(‘slow’);
$(“#add-box-link-wrap”).fadeIn(‘slow’);
$(“.box-wrap .box-size input”).removeAttr(‘disabled’);
$(“.box-wrap .box-size select”).removeAttr(‘disabled’);
$(“.box-wrap[box_id!=’1′] input”).removeAttr(‘disabled’);
$(“.box-wrap[box_id!=’1′] select”).removeAttr(‘disabled’);
$(“.box-wrap .box-size input”).attr(‘required’, ‘true’);
$(“.box-wrap .box-size select”).attr(‘required’, ‘true’);
$(“.box-wrap[box_id!=’1′] input”).attr(‘required’, ‘true’);
$(“.box-wrap[box_id!=’1′] select”).attr(‘required’, ‘true’);

$(“#consolidation-options input”).removeAttr(‘disabled’);
$(“#insurance-options input”).removeAttr(‘disabled’);
if($(“#insurance-options input[name=’check_ins’]”).is(“:checked”)) {
$(“#insurance-amount-wrap”).fadeIn(‘slow’);
$(“#insurance-amount-wrap input”).removeAttr(‘disabled’);
}
}
});

$(“select[name=’country’]”).change(function() {
var ship_to = $(this).val();
var ship_from = ‘US’;

if(ship_to == ‘US’ && ship_from == ‘US’) {
$(“#us_state”).fadeIn(‘slow’);
$(“#us_state .select2”).css(‘width’, ‘100%’);
$(“#us_state select”).attr(‘required’, ‘true’);
} else {
$(“#us_state”).fadeOut(‘slow’);
$(“#us_state select”).removeAttr(‘required’);
}
});

$(“input[name=’check_ins’]”).change(function() {
var is_checked = $(this).is(“:checked”);

if(is_checked) {
$(“#insurance-amount-wrap”).fadeIn(‘slow’);
$(“#insurance-amount-wrap input”).attr(‘required’, ‘true’);
$(“#insurance-amount-wrap input”).removeAttr(‘disabled’);
} else {
$(“#insurance-amount-wrap”).fadeOut(‘slow’);
$(“#insurance-amount-wrap input”).removeAttr(‘required’);
$(“#insurance-amount-wrap input”).attr(‘disabled’, ‘disabled’);
}
});

$(“select[name=’weight_type’]”).change(function() {
var value = $(this).val();
$(“select[name=’weight_type’]”).val(value);
});
$(“select[name=’size_type’]”).change(function() {
var value = $(this).val();
$(“select[name=’size_type’]”).val(value);
});

$(“a#view-ship-chart”).click(function() {
var ship_from = ‘US’;
var ship_to = $(“select[name=’country’]”).val();
var us_state = $(“select[name=’us_state’]”).val();
var itemtype = $(“input[name=’itemtype’]:checked”).val();
var width = 800;
var plantype = 1;
//validation
if(parseInt(ship_to.length) !== 0) {
if(ship_from == “US”)
{
if(ship_to == “US”) {
width = 650;
if(parseInt(us_state.length) === 0) {
jquery_alert(“Please select a state.”);
return false;
}
}
} else {
width = 340;
}
if(itemtype == ‘document’) {
plantype = 2;
}

window.open(‘shipping_rates.php?from=’+ship_from+’&to=’+ship_to+’&to2=’+us_state+’&plantype=’+plantype+’&itemtype=’+itemtype,’_new’,’width=’+width+’,height=400,scrollbars=yes’);
} else {
jquery_alert(“Please select a Ship To.”);
}

return false;
});
//Estimate Form
$(“#display-form-btn button”).click(function() {
var is_visible = $(“#shipping-calc-form-wrap”).is(“:visible”);
if(is_visible) {
$(“#shipping-calc-form-wrap”).slideUp(‘slow’);
} else {
$(“#shipping-calc-form-wrap”).slideDown(‘slow’);
}
});
//Breakdown
$(“.breakdown-content .row:even”).css( “background-color”, “#f9f9f9” );
$(“.breakdown-link a”).click(function() {
var isVisible = $(this).parents(‘.breakdown-wrap’).find(‘.breakdown-content’).is(‘:visible’);
var view_text = $(this).attr(‘view_text’);
var hide_text = $(this).attr(‘hide_text’);
var element = $(this);
if(isVisible) {
$(this).parents(‘.breakdown-wrap’).find(‘.breakdown-content’).slideUp(‘slow’);
$(this).find(‘.img-up’).hide();
$(this).find(‘.img-down’).show();
$(this).find(‘.link-title’).text(view_text);
} else {
$(‘.breakdown-wrap’).find(‘.breakdown-content’).slideUp(‘slow’);
$(this).parents(‘.breakdown-wrap’).find(‘.breakdown-content’).slideDown(‘slow’);
$(this).find(‘.img-up’).show();
$(this).find(‘.img-down’).hide();
$(this).find(‘.link-title’).text(hide_text);
}

return false;
});

//Copy Shared link
$(“#share-link”).click(function() {
var is_visible = $(“#share-link-area textarea”).is(“:visible”);

if(is_visible) {
$(“#share-link-area textarea”).slideUp();
} else {
$(“#hidden-text-area-div”).css(‘background-color’, ‘#f5f5f5’);
$(“#hidden-text-area-div”).show();

var text_height = $(“#hidden-text-area-div”).height();
$(“#hidden-text-area-div”).hide();
$(“#share-link-textarea”).css(‘height’, ‘auto’).css(‘height’, text_height+30);
$(“#share-link-area textarea”).slideDown();
$(“#share-link-area textarea”).select();
}

return false;
});

$(“#share-link-area textarea”).click(function() {
$(this).select();
});

//FIXED Header
var isNewEstimateBtn = $(“#display-form-btn”).is(“:visible”);
var isFormVisible = $(“#shipping-calc-form-wrap”).is(“:visible”);
var stickyOffset = $(‘.sticky’).offset().top;
var shipCalcFormHeight = $(“#shipping-calc-form-wrap”).height();

if(isNewEstimateBtn && isFormVisible) {
stickyOffset = parseInt(stickyOffset) + parseInt(shipCalcFormHeight);
}

$(window).resize(function() {
var windowWidth = $(this).width();
var containerWidth = $(“#ship-calc-results”).width() – 10;
var carrierPriceWidth = $(“.carrier-price”).width();
stickyOffset = $(‘.sticky’).offset().top;

$(‘.sticky’).css(‘width’, containerWidth);
$(‘.sticky’).find(“#membership-name-wrap.col-lg-3”).css(‘width’, (parseInt(carrierPriceWidth)+26));
$(‘.sticky’).find(“#membership-name-wrap.col-lg-6”).css(‘width’, (parseInt(carrierPriceWidth)+21));

if(windowWidth > 750) {
$(“#shipping-calc-form-wrap”).css(‘display’, ”);
}
});

$(window).scroll(function(){
var sticky = $(‘.sticky’);
var scroll = $(window).scrollTop();
var containerWidth = $(“#ship-calc-results”).width();
var carrierPriceWidth = $(“.carrier-price”).width();
var carrierHeaderHeight = $(“#carrier-header-wrap .row”).height();
var paddingTop = parseInt(carrierHeaderHeight)+23;
var stickyOffsetFinal = stickyOffset;

isNewEstimateBtn = $(“#display-form-btn”).is(“:visible”);
isFormVisible = $(“#shipping-calc-form-wrap”).is(“:visible”);
shipCalcFormHeight = $(“#shipping-calc-form-wrap”).height();

if(isNewEstimateBtn && isFormVisible && stickyOffsetFinal = stickyOffsetFinal) {
sticky.addClass(‘fixed’);
sticky.css(‘width’, containerWidth);
sticky.find(“#membership-name-wrap.col-lg-3”).css(‘width’, (parseInt(carrierPriceWidth)+26));
sticky.find(“#membership-name-wrap.col-lg-6”).css(‘width’, (parseInt(carrierPriceWidth)+21));
$(“#carriers-list”).css(‘padding-top’, paddingTop);
}
else {
sticky.removeClass(‘fixed’);
$(“#carriers-list”).css(‘padding-top’, 0);
}
});
});
second_row_cel_height2) { second_row_height = second_row_cel_height1; } else { second_row_height = second_row_cel_height2; } $(“#footer .row .col-xs-6:nth-child(3)”).height(second_row_height+70); $(“#footer .row .col-xs-6:nth-child(4)”).height(second_row_height+70); } var footer_wrapper_height = $(“#footer-wrapper”).height(); $(“#footer”).height(footer_wrapper_height+60); $(“body”).css(‘margin-bottom’, footer_wrapper_height+110+’px’); }); }); ]]>

Source