var ajaxResponse =	new Object();
$(document).on('click','.ajaxOrderDetails',function()
{
	var orderID 	= $(this).attr('rel');
	$('.ajaxOrderDetailsDiv').not($(this)).slideUp();
	if ($(this).hasClass("active")) 
	{
	   $('.plus').removeClass("active");
	   $('.ajaxOrderDetailsDiv').slideUp();
	}
	else
	{
    	$('.plus').removeClass("active");
    	var data		= new Object();
    	data.orderID	= orderID;
    	var key			= 'ajaxOrderDetails_'+orderID;
    	if (typeof ajaxResponse[key] == 'undefined' || ajaxResponse[key] == 'empty')
    	{
    		var response='';
			var thisVar = $(this);
    		$.ajax({
    			type: "POST",
    			url: GLOBAL_BASE_PATH + "/user/ajaxGetOrderItems/",
    			data: data,
    			success: function (data) {
    				ajaxResponse[key]=data;
    				response = data;
					$("#ajaxOrderDetails_"+orderID).empty();
					$("#ajaxOrderDetails_"+orderID).html(response);
					$("#ajaxOrderDetails_"+orderID).slideDown();
					thisVar.addClass("active");
    			}
    		});
    	}
    	else
    	{
    		var response	=	ajaxResponse[key];
			$("#ajaxOrderDetails_"+orderID).empty();
			$("#ajaxOrderDetails_"+orderID).html(response);
			$("#ajaxOrderDetails_"+orderID).slideDown();
			$(this).addClass("active");
    	}
    	
	}
});