 function process_download(control, byQty) 
{
    var ddl_id = '#' +control;
    var mage_ddl = $(ddl_id).get(0);
   
    if (byQty == 1) 
    {
        if(mage_ddl.selectedIndex > 0) 
        {
            var ddl_index=mage_ddl.selectedIndex;
            if(mage_ddl.selectedIndex > 10) ddl_index = ddl_index-10; 
            var ddl_options = mage_ddl.options;
            for(var i=0; i<ddl_options.length; i++) 
            {
                if(ddl_options[i].selected == true) 
                {
                    var pid = ddl_options[i].value;
                    var redir_url = 'https://shop.rebit.com/checkout/cart/add?product=' + pid + '&qty=' + ddl_index;
                    window.location=redir_url;
                }
            }
        }
    } else if (byQty == 2) {

        var pid = mage_ddl.value;
        var redir_url = 'https://shop.rebit.com/checkout/cart/add?product=' + pid + '&qty=1';
        window.location=redir_url;
    } else {
            var ddl_options = mage_ddl.options;
            for(var i=0; i<ddl_options.length; i++) 
            {
                if(ddl_options[i].selected == true) 
                {
                    var pid = ddl_options[i].value;
                    var redir_url = 'https://shop.rebit.com/checkout/cart/add?product=' + pid + '&qty=1';
                    window.location=redir_url;
                }
            }
    }
    return 0;
}

function process_harddrive(rad1, rad2, drop1, drop2) {
	var radio1 = $("#" + rad1);
	var radio2 = $("#" + rad2);
	var ddl1 = $("#" + drop1).get(0);
	var ddl2 = $("#" + drop2).get(0);
            //alert(ddl1.attr("id"));
	if(radio1.attr("checked")) {
            for(var i=0; i<ddl1.options.length; i++) 
            {
                if (ddl1.options[i].selected == true)
                {
                    var pid = ddl1.options[i].value;
                    var redir_url = 'https://shop.rebit.com/checkout/cart/add?product=' + pid + '&qty=1';
                    window.location=redir_url;
                }
            }
	} else {
            for(var i=0; i<ddl2.options.length; i++) 
            {
                if (ddl2.options[i].selected == true)
                {
                    var pid = ddl2.options[i].value;
                    var redir_url = 'https://shop.rebit.com/checkout/cart/add?product=' + pid + '&qty=1';
                    window.location=redir_url;
                }
            }
	}
    return 0;
};

