/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

function add_product_to_cart(the_product_id)
{

    $('span[name=hosting_package_ticker]').css('display', 'none');
    $('#hosting_package_ticker_'+the_product_id).show();  //css('display', '');
    $('select[name=hosting_product_billingcycle]').css('display','none');
    $('#hosting_product_billingcycle_'+the_product_id).show();
    $('div[name=product_addons]').css('display', 'none');
    $('#product_addons_'+the_product_id).show();
    $('div[name=product_addons_billingcycle]').hide();
    $('#product_addons_billingcycle_'+the_product_id).show();
    $('div[name=hosting_product_desc]').hide();
    $('#hosting_product_desc_'+the_product_id).show();

    if($('#cart_summary_progress_sign').length)
        {
            $('#cart_summary_progress_sign').show();
        }

    $.post(
        '/order/hosting/do_add_product' ,     //
        {
            'the_product_id' : the_product_id ,
            'the_billingcycle' :  $('#hosting_product_billingcycle_'+the_product_id).val()
        },
        function(data)
        {
            $('#lh_cart').empty();
            $('#lh_cart').html(data);
        }
    );


}
//function add_product_to_cart

function change_hosting_billingcycle(the_product_id, the_billing_cycle)
{
    if($('#cart_summary_progress_sign').length)
        {
            $('#cart_summary_progress_sign').show();
        }
    $.post(
        '/order/hosting/do_add_product' ,     //
        {
            'the_product_id' : the_product_id ,
            'the_billingcycle' :  $('#hosting_product_billingcycle_'+the_product_id).val()
        },
        function(data)
        {
            $('#lh_cart').empty();
            $('#lh_cart').html(data);
        }
    );
}
//eof function

function add_product_addon(the_product_id, the_addon_id, is_checked)
{
    if($('#cart_summary_progress_sign').length)
        {
            $('#cart_summary_progress_sign').show();
        }
    var action = 'remove';
    if(is_checked == true)
        {
            action = 'add';
        }
        else
            {
                action = 'remove';
            }

    $.post(
        '/order/hosting/do_add_addon' ,     //
        {
            'the_action' : action,
            'the_product_id' : the_product_id ,
            'the_billingcycle' :  $('#hosting_product_billingcycle_'+the_product_id).val(),
            'the_addon_id' : the_addon_id
        },
        function(data)
        {
            $('#lh_cart').empty();
            $('#lh_cart').html(data);
        }
    );   
}
//eof function add_product_addon


