/************************************************************************************************************
(C) www.dhtmlgoodies.com, March 2006

This is a script from www.dhtmlgoodies.com. You will find this and a lot of other scripts at our website.	

Terms of use:
You are free to use this script as long as the copyright message is kept intact. However, you may not
redistribute, sell or repost it without our permission.

Version:
	1.0	Released	March. 3rd 2006

Thank you!

www.dhtmlgoodies.com
Alf Magne Kalleland

************************************************************************************************************/

var url_getDeliveryTypes = 'delivery.asp';
var ajaxObjects = new Array();

function updateDeliveryTypes(ajaxIndex) {    
    var deliveries = document.getElementsByName('delivery_value');
    var list = ajaxObjects[ajaxIndex].response;
    for (var i = 0; i < deliveries.length; i++) {     
        if (list.indexOf(deliveries[i].id) < 0) {
            deliveries[i].disabled = true;
            deliveries[i].checked = false;
        } else {
            deliveries[i].disabled = false;
        } // else
    } // for loop
    
    var deliveries2 = document.getElementsByName('delivery_txt');
    var list = ajaxObjects[ajaxIndex].response;
    for (var i = 0; i < deliveries2.length; i++) {     
        if (list.indexOf(deliveries2[i].id) < 0) {
            deliveries2[i].disabled = true;
        } else {
            deliveries2[i].disabled = false;
        } // else
    } // for loop
    
} //end function

function getDeliveryTypesByPaymentId(paymentId,landskode,kilo,totHandel) {
		
    //Collection values:	
		
	//alert ('paymentId: ' + paymentId + ' landskode: ' + landskode + ' kilo: ' + kilo + ' totHandel: ' + totHandel);
		
    var url = url_getDeliveryTypes + '?paymentId=' + paymentId + '&totHandel=' + totHandel + '&landskode='+ landskode + '&kilo=' + kilo;
        
    var ajaxIndex = ajaxObjects.length;
	ajaxObjects[ajaxIndex] = new sack();
	ajaxObjects[ajaxIndex].requestFile = url;	// Saving product in this file
	ajaxObjects[ajaxIndex].onCompletion = function(){ updateDeliveryTypes(ajaxIndex); };  // Specify function that will be executed after file has been found
	ajaxObjects[ajaxIndex].runAJAX();		// Execute AJAX function	
	
} //end function


