﻿// does vs exist? if not set empty constructor
var vs = vs ? vs : {};
// does vs.bookmarks exist? if not set empty constructor
vs.delivery = vs.delivery ? vs.delivery: { calcuItems: "", qty: 0, HostSite:'LD',CountryCode:'UK'};

// jQuery page set up routines. this function is invoked by default and does not needs speccific invocation.
$(function() {
    $.ajaxSetup({
        beforeSend: function() {
            // set up progress indicator
            $("#progressarea").removeClass("proglargehide").addClass("proglargeshow");
        },
        complete: function() {
            //$("body").unblock();
            $("#progressarea").removeClass("proglargeshow").addClass("proglargehide");
        },
        error: function(xhr, msg) { vs.global.AjaxErrorPopup(xhr, msg) },
        type: "POST",
        url: "../deliveryoptions/DeliveryResponse.aspx"
    });

    $("#GoogleCheckOutBody").livequery('load', function() { vs.delivery.myajax(); });
    $("#ddlCountry").livequery('change', function() { vs.delivery.myajax(); });

});

vs.delivery.myajax = function() {
    $.ajax({
            data: { calcuItems:this.calcuItems, qty:this.qty, hostsite:this.HostSite, countrycode:$("#ddlCountry").val()},
            success: function(msg) { 
                $("div.content").empty().append(msg); 
		    }
        });
    return false;
};

