
	function searchSubmission()
	{
		(function($) {
			if($("#search_products").val() == '' || $("#search_products").val() == 'Search...')
			{
				alert("Please enter Name or Description of products.");
				return false;
			}
			else
			{
				$("#webform").attr("action", index() + "shop.search_result");
		    	$("#webform").submit();
			}
		})(jQuery);
	}

	function made_mark_favourite(product_id,catId)
	{
		(function($) {
			var is_mark_favourite = 0;
			if(document.getElementById("mark_"+product_id).checked == true)
				is_mark_favourite = 1;
		    $.ajax({
		        url: index() + "callback/shop.update_mark_favourite",
		        async: false,
		        type: "POST",
		        data: ({
		            'product_id': product_id,
		            'is_mark_favourite':is_mark_favourite,
		            'catId':catId
		        }),
		        dataType: "html",
		        success: function(data){
		            data = $.trim(data);
		            if(data=='OK') {
		            }else {
		                alert("Can't mark as favourite");
		            }
		        }
		    });
		})(jQuery);
	}

	function update_cart(product_id,url)
	{
		(function($) {
			var pathname = window.location.pathname;
			//var quantity = $("#quantity_"+product_id).val();
			var str_data = '';
			var flag = false;
			var message = '';
			//0006466: 11. Minimum Order 
			var totalQuantity = 0;
			$('.check_update_cart_'+product_id).each(function(){
				if($(this).val() != '' && $(this).val() != 0)
				{
					//flag = true;
					var arr = this.name.split('_');
					str_data +=arr[2]+"__"+$("#quantity_"+product_id+"_"+arr[2]).val()+":::";
					//0006466: 11. Minimum Order 
					 $.ajax({
				        url: index() + "callback/shop.ajax",
				        async: false,
				        type: "POST",
				        data: ({
				            'product_id': product_id,
				            'option_value_id':arr[2],
				            'quantity':$("#quantity_"+product_id+"_"+arr[2]).val(),
				            'type':'check_minimum_order_product'
				        }),
				        dataType: "html",
				        success: function(data){
				            data = $.trim(data);
				            if(data=='OK') {
				            	 flag = true;
				            }else {
				                message += "\n - "+data;
				            }
				        }
				    });
					//end
				}
			});
			var catId = $("#catId"+product_id).val();
			if(flag==false && message =='')
			{
				show_popup_add_quantity(product_id,catId);
				return false;
			}
			else if(flag==false && message !='')
			{
				alert(message);
				return false;
			}
			else
			{
				 $.ajax({
			        url: index() + "callback/shop.update_cart",
			        async: false,
			        type: "POST",
			        data: ({
			            'product_id': product_id,
			            'str_data':str_data,
			            'type':'update_cart',
			            'catId':catId
			        }),
			        dataType: "html",
			        success: function(data){
			            data = $.trim(data);
			            if(data=='OK') {
			            	 $('#quick_cart').fadeOut('slow').load(index() +'callback/template.your_order').fadeIn("slow");
			            	 $('.check_update_cart_'+product_id).each(function(){
								$(this).val('');
							});
			            }else {
			                alert("Can't add items to cart.");
			            }
			        }
			    });
			    //0006466: 11. Minimum Order 
			    if(message)
			    	alert(message);
			}
		})(jQuery);
	}

	function isNumberKey(evt)
	{
			 var charCode = (evt.which) ? evt.which : event.keyCode
			 if (charCode > 31 && (charCode < 48 || charCode > 57))
			    return false;

			 return true;
	}

	function add_cart(id, sender) {
		(function($) {
			var pathname = window.location.pathname;
			var str_data = '';
			var flag = false;
			var type_add = id.split('_');
			var productId = '';
			var message = '';
			if(type_add.length ==1 )
			{
				$('.check_update_cart_'+id).each(function(){
					if($(this).val() != '' && $(this).val() != 0)
					{
						//flag = true;
						var arr = this.name.split('_');
						str_data +=arr[2]+"__"+$("#quantity_"+id+"_"+arr[2]).val()+":::";
						
						//0006466: 11. Minimum Order 
						 $.ajax({
					        url: index() + "callback/shop.ajax",
					        async: false,
					        type: "POST",
					        data: ({
					            'product_id': id,
					            'option_value_id':arr[2],
					            'quantity':$("#quantity_"+id+"_"+arr[2]).val(),
					            'type':'check_minimum_order_product'
					        }),
					        dataType: "html",
					        success: function(data){
					            data = $.trim(data);
					            if(data=='OK') {
					            	 flag = true;
					            }else {
					                message += "\n - "+data;
					            }
					        }
					    });
						//end
					}
				});
				productId = id;
			}
			if(type_add.length ==3)
			{
				$('.check_update_cart_order_'+type_add[0]+'_'+type_add[1]+'_'+type_add[2]).each(function(){
					if($(this).val() != '' && $(this).val() != 0)
					{
						//flag = true;
						var arr = this.name.split('_');
						str_data +=arr[2]+"__"+$("#quantity_"+type_add[0]+"_"+arr[2]+"_"+arr[3]).val()+":::";
						
						//0006466: 11. Minimum Order 
						 $.ajax({
					        url: index() + "callback/shop.ajax",
					        async: false,
					        type: "POST",
					        data: ({
					            'product_id': type_add[0],
					            'option_value_id':arr[2],
					            'quantity':$("#quantity_"+type_add[0]+"_"+arr[2]).val(),
					            'type':'check_minimum_order_product'
					        }),
					        dataType: "html",
					        success: function(data){
					            data = $.trim(data);
					            if(data=='OK') {
					            	 flag = true;
					            }else {
					                message += "\n - "+data;
					            }
					        }
					    });
						//end
					}
				});
				productId = type_add[0];
			}
			var catId = $("#catId"+productId).val();
			if(flag==false && message =='')
			{
				show_popup_add_quantity(productId,catId);
				return false;
			}
			else if(flag==false && message !='')
			{
				alert(message);
				return false;
			}
			else
			{
				 $.ajax({
			        url: index() + "callback/shop.update_cart",
			        async: false,
			        type: "POST",
			        data: ({
			            'product_id': productId,
			            'str_data':str_data,
			            'type':'update_cart',
			            'catId':catId
			        }),
			        dataType: "html",
			        success: function(data){
			            data = $.trim(data);
			            if(data=='OK') {
			            	 $('#quick_cart').fadeOut('slow').load(index() +'callback/template.your_order').fadeIn("slow");
			            	 $('.check_update_cart_'+id).each(function(){
								//$(this).val('');
		                         });
		                         $('.clsFavouriteTotalPrice_'+id).each(function(){
		                            $(this).html('');
		                         });
			            }else {
			                alert("Can't add items to cart.");
			            }
			        }
			    });
			    //0006466: 11. Minimum Order 
			    if(message)
			    	alert(message);
			}
			//end 0006466: 11. Minimum Order
		})(jQuery);
	}

	function remove_cart(product_id,size_id)
	{
		(function($) {
			 $.ajax({
			        url: index() + "callback/shop.update_cart",
			        async: false,
			        type: "POST",
			        data: ({
			            'product_id': product_id,
			            'size_id':size_id,
			            'type':'remove_cart'
			        }),
			        dataType: "html",
			        success: function(data){
			            data = $.trim(data);
			            if(data=='OK') {
			            	 $('#quick_cart').fadeOut('slow').load(index() +'callback/template.your_order').fadeIn("slow");
			            	 if(document.getElementById('wicked_order')){
			            	 	window.location.href = index() + "shop.cart";
			            	 	//$('#wicked_order').fadeOut('slow').load(index() +'callback/shop.cart').fadeIn("slow");
			            	 }
			            }else {
			                alert("Can't delete item.");
			            }
			        }
			    });
		})(jQuery);
	}

function update_view_cart(uid,type,product_id,size_id,order_id)
{
  (function($) {
    var param = type+":::::"+product_id+":::::"+size_id+":::::"+order_id;
    if (type != 'update_cart') {
      __dopostback(uid,param);
    } else {
    	
    	//0006466: 11. Minimum Order 
		 $.ajax({
	        url: index() + "callback/shop.ajax",
	        async: false,
	        type: "POST",
	        data: ({
	            'product_id': product_id,
	            'option_value_id':size_id,
	            'quantity':$("#quantity_"+product_id+"_"+size_id).val(),
	            'type_update':type,
	            'type':'check_minimum_order_product'
	        }),
	        dataType: "html",
	        success: function(data){
	            data = $.trim(data);
	            if(data=='OK') {
	            	 var f = document.forms[0];
				      f.__EVENTTARGET.value = uid;
				      f.__EVENTARGUMENT.value = param;
				      var form_data = {};
				      $('input[type=text], input[type=hidden], input[type=radio]:checked', $(f)).each(function() {
				        form_data[$(this).attr('name')] = $(this).val();
				      });
				      $.post(index() + 'callback/shop.update_quantity/' + order_id, form_data, function(response){
				        $('#cart_content').html(response);
				        // Update "Your Order" quick cart
				        var time = new Date();
				        $.get(index() + 'callback/template.your_order/' + time.getTime() , function(response){
				          $('#quick_cart').html(response);
				        })
				      });
	            }else {
	                alert(data);
	                return false;
	            }
	        }
	    });
		//end
    }
  })(jQuery);
}

	function check_reward_points(current_points,cash_old_order)
	{
		(function($) {
			var cash_points = $('#cash_points').val();
			if(cash_old_order != -1)
				cash_points = cash_old_order;
				
			var coupon_fee = $('#coupon_fee').val();
			var subtotal = $('#subtotal').val();
			var gst_total = $('#gst_total').val();
			if((cash_points =='' || cash_points>current_points) && cash_old_order == -1)
			{
				alert("Please enter Cash in Points greater than 0 and less than Current Points.")
				$('#cash_points').val('');
				$('#cash_points').focus();
				return false;
			}
			else
			{
				 $.ajax({
			        url: index() + "callback/shop.ajax",
			        async: false,
			        type: "POST",
			        data: ({
			            'cash_points': cash_points,
			            'coupon_fee': coupon_fee,
			            'subtotal': subtotal,
			            'gst_total': gst_total,
			            'type':'cash_points'
			        }),
			        dataType: "html",
			        success: function(data){
			            data = $.trim(data);
			            data = data.split(":::::");
			            if(data[0]=='OK' && data[1] > 0) {
			            	$('#reward_point').val(data[1]);
			            	$('#coupon_reward').html('-$'+data[2]);
			            	$('#total_amount').html('$'+data[3]);
			            	$('#show_coupon_reward').show();
			            }
			            else if(data[0]=='OK' && data[1] == 0) {
			            	$('#show_coupon_reward').hide();
			            }
			            else if(data[0]=='REWARD_POINTS_ERROR')
			            {
			            	$('#cash_points').val('');
			            	$('#reward_point').val(0);
			            	$('#coupon_reward').html('-$'+data[2]);
			            	$('#total_amount').html('$'+data[3]);
			            	$('#cash_points').focus();
			            	$('#show_coupon_reward').hide();
			            	alert("The amount of reward points you have entered exceeds to the checkout total. Please lower the amount of reward points to equal or below "+data[1]);
			            }
			            else {
			                alert("Cash in Points is invalid.");
			            }
			        }
			    });
			}
		})(jQuery);
	}

	function check_counpon_fee()
	{
		(function($) {
			var reward_point = $('#reward_point').val();
			var coupon_number = $('#coupon_number').val();
			var subtotal = $('#subtotal').val();
			var gst_total = $('#gst_total').val();
			if(coupon_number =='')
			{
				alert("Please enter Coupon Number.")
				$('#coupon_number').val('');
				$('#coupon_number').focus();
				return false;
			}
			else
			{
				 $.ajax({
			        url: index() + "callback/shop.ajax",
			        async: false,
			        type: "POST",
			        data: ({
			            'reward_point': reward_point,
			            'coupon_number': coupon_number,
			            'subtotal': subtotal,
			            'gst_total': gst_total,
			            'type':'coupon_fee'
			        }),
			        dataType: "html",
			        success: function(data){
			            data = $.trim(data);
			            data = data.split(":::::");
			            if(data[0]=='OK') {
			            	$('#coupon_name').html(data[1]);
			            	$('#coupon_fee').val(data[2]);
			            	$('#coupon_reward').html('-$'+data[3]);
			            	$('#total_amount').html('$'+data[4]);
			            	$('#show_coupon_reward').show();
			            }
			            else if(data[0] == 'Coupon Number error')
			            {
			            	alert(data[1]);
			            	$('#coupon_number').val('');
			            	$('#coupon_number').focus();
			            }
			            else {
			                alert("Cash in Points is invalid.");
			                $('#coupon_number').focus();
			            }
			        }
			    });
			}
		})(jQuery);
	}

	function check_make_payment()
	{
		(function($) {
			var how_peoples = $('#how_peoples').val();
			var delivery_date = $('#delivery_date').val();
			var order_name = $('#order_name').val();

			/*if($("#complimentary_checked :checked").size()>0 && how_peoples == '')
			{
				alert("Please enter how many people.");
				$('#how_peoples').focus();
				return false;
			}*/
			if($("#address_checked :checked").size() == 0)
			{
				alert("Please select a delivery address.");
				return false;
			}
			else if(delivery_date == '' )
			{
				alert("Please select delivery times.");
				$('#delivery_date').focus();
				return false;
			}
			else if($('#delivery_hours').val() == '' || $('#delivery_minutes').val() == '')
			{
				$('#delivery_hours').focus();
				alert("Please select delivery times.");
				return false;
			}
			else
			{
				$.ajax({
			        url: index() + "callback/shop.ajax",
			        async: false,
			        type: "POST",
			        data: ({
			            'delivery_date': delivery_date,
			            'delivery_hours': $('#delivery_hours').val(),
			            'delivery_minutes': $('#delivery_minutes').val(),
			            'type':'check_deliver_times'
			        }),
			        dataType: "html",
			        success: function(data){
			            data = $.trim(data);
                                    if (data == 'off') {
                                        alert('Weekends by arrangement only - call 9420 5333. Or please choose another date');
                                        $('#delivery_date').focus();
                                        return;
                                    }
			            data = data.split(":::::");
			            if(data[0]=='OK') {
			            	delivery_times_submit();
			            }
			            else {
			                alert("The time or date you have selected has already passed. Please choose another date or time.");
			            }
			        }
			    });

			}
		})(jQuery);
	}
	function make_payment_submit()
	{
		(function($) {
			var flag = true;
			$('.cls_input_payment').each(function(){
				if($(this).val() == '')
				{
					flag = false;
					alert('Please fill full information.');
					$(this).focus();
					return false;
				}
			});
			var checked = $('input[name=chkAgree]').is(':checked');
			if(flag == false)
				return false;
			else if(!checked) 
			{ //0006464: 8. Terms and Conditions 
				flag == false;
				alert('You must agree to the Wicked Terms and Conditions');
        		return false;
			}
			else
			{
				 $.post(index() + "callback/shop.payment", {
			            card_type: $('#card_type_selectbox').val(),
			            card_holder_name: $('#card_holder_name').val(),
			            card_number: $('#card_number').val(),
			            expiring_month: $('#month_selectbox').val(),
			            expiring_year: $('#year_selectbox').val(),
			            cvc: $('#checkout_cvc').val(),
			            type: 'make_payment',
			            order_id: $("#order_id").val()
			        }, function(response) {

			            if (response.payment_status) {
			            	$("#payment_error").dialog("destroy");
			                if (response.payment_status == 1) {
			                    // Success
			                    $("#payment_error").dialog({
			                        bgiframe: true,
			                        modal: true,
			                        buttons: {
			                            Ok: function() {
			                                $(this).dialog('close');
			                            }
			                        },
			                        close: function () {
			                            // Redirect....
			                            window.location.href = index() + "shop.invoice";
			                        }
			                    });
			                    $('#payment_erorr_msg').html(response.msg);
			                    $("#payment_error").dialog('open');
			                } else if(response.payment_status == -1) {
			                    // Fail
			                    $("#payment_error").dialog({
			                        bgiframe: true,
			                        modal: true,
			                        buttons: {
			                            Ok: function() {
			                                $(this).dialog('close');
			                            }
			                        },
			                        close: function () {
			                            // Redirect....
			                            /*if (response.payment_status == -2)
			                                window.location.href = index() + "callback/shop.payment";*/
			                        }
			                    });
			                    $('#payment_erorr_msg').html(response.msg);
			                    $("#payment_error").dialog('open');
			                }
			            } else {
			                alert('Error Checkout');
			            }
			        }, 'json');

			}
		})(jQuery);
	}


	function addAllOrder(order_id)
	{
		(function($) {
		    var tmpNoItemAdded = true;
		    $(".clsAddAllOrder"+order_id).each(function(){
		        var tmpQuantity = $(this).val();
		        if($.trim(tmpQuantity)!="") {
		            tmpNoItemAdded = false;
		        }
		    });
		    if(tmpNoItemAdded==true) {
		        alert("No item is added to cart. Please make sure the product quantity is entered before adding to cart.");
		    }
		    else {
		        $(".clsAddAllItems"+order_id).each(function(){
		            var tmpProductID = $(this).attr("product_id");
		            var size_id = $(this).attr("size_id");
		            tmpNoItemAdded = true
		            $(".check_update_cart_order_"+tmpProductID+"_"+size_id+'_'+order_id).each(function(){
		                var tmpQuantity = $(this).val();
		                if($.trim(tmpQuantity)!="") {
		                    tmpNoItemAdded = false;
		                }
		            });
		            if(tmpNoItemAdded==false) {
		                add_cart(tmpProductID+'_'+size_id+'_'+order_id, 'drop');
		            }
		        });
		    }
		})(jQuery);
	}


	//check login offline order
	function login_offline_order(uid)
	{
		(function($) {
			var flag = true;
			$('.cls_input_login').each(function(){
				if($(this).val()=='')
				{
					$("#error_login").html('Please enter username/password');
					flag = false;
					return false;
				}
			});
			if(flag == false)
				return false;
			else
				__dopostback(uid);
		})(jQuery);
	}

	//check add new offline order
	function add_new_offline_order(typeEnter)
	{
		(function($) {
			var client_name = $('#client_order').val();
			var how_peoples = $('#how_peoples').val();
			var delivery_date = $('#delivery_date').val();
			var order_name = $('#order_name').val();
			//0006470: 12. Offline Quotes / CMS Quote Managment Module 
			var order_type = $('#order_type').val();
			var flag_product_name = false;
			var flag_product_qty = false;
			var flag = true;
			$('.TxtProductName').each(function(){
				if($(this).val() != '')
				{
					flag_product_name = true;
					//$(this).focus();
				}
			});
			$('.TxtInputQuantity').each(function(){
				if($(this).val() != '')
					flag_product_qty = true;
			});
			//0006470: 12. Offline Quotes / CMS Quote Managment Module 
			if(order_type == '')
			{
				$('#order_type').focus();
				flag = false;
			}
			if(client_name == '')
			{
				$('#client_order').focus();
				flag = false;
			}
			/*if($("#complimentary_checked :checked").size()>0 && (how_peoples == '' || how_peoples == 0))
			{
				$('#how_peoples').focus();
				flag = false;
			}*/
			if($("#info_address_client :checked").size() == 0)
			{
				flag = false;
			}
			else if(delivery_date == '' )
			{
				$('#delivery_date').focus();
				flag = false;
			}
			/*else if(order_name == '' )
			{
				$('#order_name').focus();
				flag = false;
			}*/
			if(flag ==false || flag_product_name == false || flag_product_qty == false)
			{
				$('#err').html('Please fill full information.');
				return false;
			}
			else
			{
				$.ajax({
			        url: index() + "callback/offline/offline.ajax",
			        async: false,
			        type: "POST",
			        data: ({
			            'delivery_date': delivery_date,
			            'delivery_hours': $('#delivery_hours').val(),
			            'delivery_minutes': $('#delivery_minutes').val(),
			            'type':'check_deliver_times'
			        }),
			        dataType: "html",
			        success: function(data){
			            data = $.trim(data);
			            data = data.split(":::::");
			            if(data[0]=='OK') {
			            	save_offline_order(typeEnter);
			            }
			            else {
			                $('#err').html('Delivery times is invalid.');
			            }
			        }
			    });
			}
		})(jQuery);

	}

	/**popup add quantity product*/
	function open_popup_add_quantity()
	{
		(function($) {
		    var w = screen.width;
		    var lefts = (w - 750)/2;
		    $.blockUI({message: $('div#address_edit'),css:{
		            top:  '115px',
		            left: lefts + 'px',
		            width: '550px'}});
		})(jQuery);
	}

	function close_popup_add_quantity(){
		(function($) {
			$.unblockUI();
		})(jQuery);
	}

	function get_form_add_quantity(productId,catId)
	{
		(function($) {
		    $.ajax(
		    {
		        url: index() + "callback/shop.popup_add_quantity",
		        async: false,
		        type: "POST",
		        data: ({
		            'productId':productId,
		            'catId':catId
		        }),
		        dataType: "html",
		        success: function(data)
		        {
		            $('#address_edit').html(data);
		        }
		    });
		})(jQuery);
	}

	function show_popup_add_quantity(productId,catId)
	{
		(function($) {
			get_form_add_quantity(productId,catId);
			open_popup_add_quantity();
		})(jQuery);

	}

	/** confirm quantity*/
	function confirm_quantity(product_id,catId)
	{
		(function($) {
			var flag = false;
			var str_data ='';
			var message = '';
			//0006466: 11. Minimum Order 
			$('.cls_add_quantity'+product_id).each(function(){
				if($(this).val() != '' && $(this).val() != 0)
				{
					//flag = true;
					var arr = this.name.split('_');
					var qty = $("#addQuantity_"+product_id+"_"+arr[2]).val();
					$("#quantity_"+product_id+"_"+arr[2]).val(qty);
					str_data +=arr[2]+"__"+$("#addQuantity_"+product_id+"_"+arr[2]).val()+":::";
					//0006466: 11. Minimum Order 
					 $.ajax({
				        url: index() + "callback/shop.ajax",
				        async: false,
				        type: "POST",
				        data: ({
				            'product_id': product_id,
				            'option_value_id':arr[2],
				            'quantity':$("#quantity_"+product_id+"_"+arr[2]).val(),
				            'type':'check_minimum_order_product'
				        }),
				        dataType: "html",
				        success: function(data){
				            data = $.trim(data);
				            if(data=='OK') {
				            	 flag = true;
				            }else {
				                message += "\n - "+data;
				            }
				        }
				    });
					//end
				}
			});
			if(flag==false && message =='')
				return false;
			else if(flag==false && message !='')
			{
				alert(message);
				return false;
			}
			else
			{
				$.unblockUI();
				 $.ajax({
			        url: index() + "callback/shop.update_cart",
			        async: false,
			        type: "POST",
			        data: ({
			            'product_id': product_id,
			            'str_data':str_data,
			            'type':'update_cart',
			            'catId':catId
			        }),
			        dataType: "html",
			        success: function(data){
			            data = $.trim(data);
			            if(data=='OK') {
			            	 $('#quick_cart').fadeOut('slow').load(index() +'callback/template.your_order').fadeIn("slow");
			            }else {
			                alert("Can't add items to cart.");
			            }
			        }
			    });
			    //0006466: 11. Minimum Order 
			    if(message)
			    	alert(message);
			}
			//end 0006466: 11. Minimum Order 
		})(jQuery);
	}

	//define for offline order
	function OfflineOrder_handleEnter(e,uid)
	{
		    var charCode;
		    if(e && e.which){
		        charCode = e.which;
		    }else if(window.event){
		        e = window.event;
		        charCode = e.keyCode;
		    }

		    if(charCode == 13) {
		        login_offline_order(uid);
		    }
	}



(function($) {
    //template offline order
    $(".banner_offline_order").addClass("hand");
    $(".banner_offline_order").click(function() {
        document.location = index();
    });
})(jQuery);

//make unselect weekends day by vietnguyen
	function check_weekends_day(date) {
		 if(date.getDay() == 0 || date.getDay() == 6)
		 	return true;
		 else
		 	return false;

	}
	
//calculate delivery charges
function check_delivery_charges(address_id,subtotal,gst_total,order_id)
{
	(function($) { 
		$.ajax({
	        url: index() + "callback/shop.ajax",
	        async: false,
	        type: "POST",
	        data: ({
	            'address_id': address_id,
	            'subtotal': subtotal,
	            'gst_total': gst_total,
	            'order_id': order_id,
	            'type':'check_delivery_charges'
	        }),
	        dataType: "html",
	        success: function(data)
	        {
	           	data = $.trim(data);
	            data = data.split(":::::");
	            $('#delivery_charges').html('$'+data[1]);
	            $('#total_gst').html('$'+data[2]);
            	$('#gst_inclusive_total').html('$'+data[3]);
            	$('#total_amount').html('$'+data[4]);
            	$('#gst_total').val(data[2]);
	            if(data[0]=='OK')
	            {
	            	if(data[1]>0)
	            	{
	            		//	0006460: 3. Delivery Charge 
	            		$('#delivery_charge_text').html('Delivery Charges <br/>$'+data[1]);
	            	}
	            	else
	            		$('#delivery_charge_text').html('Free Delivery');
	            	$('#btn_make_payment').show();
	            }
	            else
	            {
	                $('#delivery_charge_text').html('Sorry, we do not deliver to this location');
	                $('#btn_make_payment').hide();
	            }
	        }
	    });
		
	})(jQuery); 
}

function get_form_list_users_login(email)
{
	(function($) {
	    $.ajax(
	    {
	        url: index() + "callback/modules.register.list_users_login",
	        async: false,
	        type: "POST",
	        data: ({
	            'email':email
	        }),
	        dataType: "html",
	        success: function(data)
	        {
	            $('#address_edit').html(data);
	        }
	    });
	})(jQuery);
}

function show_popup_list_users_login(email)
{
	(function($) {
		get_form_list_users_login(email);
		open_popup_list_users_login();
	})(jQuery);

}
function open_popup_list_users_login()
{
	(function($) {
	    var w = screen.width;
	    var lefts = (w - 334)/2;
	    $.blockUI({message: $('div#address_edit'),css:{
	            top:  '115px',
	            left: lefts + 'px',
	            width: '334px'}});
	})(jQuery);
}
function close_popup_list_users_login(){
	(function($) {
		$.unblockUI();
	})(jQuery);
}
