var ajax = new Array();

function getShipMethods(ShippingCountry)
{
	document.getElementById('shipMethod').options.length = 0;	// Empty city select box
	if(ShippingCountry.length>0){
		var index = ajax.length;
		ajax[index] = new sack();
		
		ajax[index].requestFile = 'includes/getshipoptions.php?countryCode='+escape(ShippingCountry);	// Specifying which file to get
		ajax[index].onCompletion = function(){ createShipMethods(index) };	// Specify function that will be executed after file has been found
		ajax[index].runAJAX();		// Execute AJAX function
	}
}

function createShipMethods(index)
{
	var obj = document.getElementById('shipMethod');
	var objsp = document.getElementById('shippingCost');
	var objtp = document.getElementById('totalCost');
	var objtw = document.getElementById('taxWord');
	var objtx = document.getElementById('taxCost');
	eval(ajax[index].response);	// Executing the response from Ajax as Javascript code	
}		

function getShipPrice(sel)
{
	var ShippingMethod = sel.options[sel.selectedIndex].value;
	if(ShippingMethod.length>0){
		var index = ajax.length;
		ajax[index] = new sack();
		
		ajax[index].requestFile = 'includes/getshipoptions.php?shipMethod='+escape(ShippingMethod);	// Specifying which file to get
		ajax[index].onCompletion = function(){ createShipPrice(index) };	// Specify function that will be executed after file has been found
		ajax[index].runAJAX();		// Execute AJAX function
	}
}
function createShipPrice(index)
{
	var objsp = document.getElementById('shippingCost');
	var objtp = document.getElementById('totalCost');
	eval(ajax[index].response);	// Executing the response from Ajax as Javascript code	
}		

