
$(document).ready(function() {
      if($('#loopedSlider').length)
      {
          $(function(){
                    $('#loopedSlider').loopedSlider({
                        'autoStart' : 10000,
                        'fadespeed' : 500
                    });
          });
      }
     

      $('input[name=websitbuilder_package]').click(function() {
                 if($('#ws_dialog').length )
                     {
                        $('#ws_dialog').dialog('close');
                     }



                 var $dialog = $('<div id="ws_dialog"></div>')
		.html('<p>'
                       +      'Please be aware that Website Builder products require both Domain and Hosting to work with<br/><br/><br/>'
                       +      '<span style=\'float: right;\'>'
                       +      '   <a style=\'font-family: Arial,Helvetica,sans-serif; color: rgb(51, 51, 51); text-decoration: none;\' href=\'https://www.letshostbilling.com/cart.php?a=add&pid=13&systpl=default&carttpl=web20cart\'><img height=\'11\' width=\'10\' src=\'/images/arrow-rt.png\'>I dont have domain & hosting</a><br/><br/>'
                       +      '   <a style=\'font-family: Arial,Helvetica,sans-serif; color: rgb(51, 51, 51); text-decoration: none;\' href=\'https://www.letshostbilling.com/cart.php?a=add&pid='+ $(this).val() +'&systpl=default&carttpl=web20cart'+  '\'><img height="11" width="10" src="/images/arrow-rt.png">I already own domain & hosting</a> '
                       +      '</span>'
                       +      '</p>')
		.dialog({
			autoOpen: false,
			title: 'Please note :'
		});
		$dialog.dialog('open');
		// prevent the default action, e.g., following a link
		return false;
	});


        



});
//eof


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/websitebuilder/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/websitebuilder/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/websitebuilder/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







