	
	function processOrder(processUrl)
	{

	    var options = { 
	    	url:processUrl,
	    	type:'post',
	    	dataType:'json',
	        beforeSubmit:  function()
	        {
	        	$('#dialog').jqmShow();	        	
	        },
	        success: function(json)
	        {
	        	if(typeof(json.error) == 'undefined')
	        	{
	        		$('#dialog').jqmHide();
	        		alert('Unexpected errors, please refresh your browser and try again.');       		
	        	}else if(json.error != '')
	        	{
	        		$('#dialog').jqmHide();
	        		alert(json.error);       		
	        	}else
	        	{
	        		document.location.href = document.location.href=json.url;
	        	}
	        	
	        },
	        error:function()
	        {
	        		$('#dialog').jqmHide();
	        		alert('Unexpected errors, please refresh your browser and try again.');  	        		        	
	        }

	    }; 
	 
	    // bind form using 'ajaxForm' 
	    $('#frmCheckout2').ajaxSubmit(options);		
		return false;
	}
	
	
	function sendToFriend(processUrl)
	{

	    var options = { 
	    	url:processUrl,
	    	type:'post',
	    	dataType:'json',
	        beforeSubmit:  function()
	        {
	        	$('#frmSendToFriend').hide();
	        	$('div.processing').show();
	        },
	        success: function(json)
	        {
	        	if(typeof(json.error) == 'undefined')
	        	{
	        		$('#sendToFriend').jqmHide();
	        		alert('Unexpected errors, please refresh your browser and try again.');       		
	        	}else if(json.error != '')
	        	{
	        		//$('#sendToFriend').jqmHide();
	        		$('#frmSendToFriend').show();
	        		$('div.processing').hide();
	        		alert(json.error);       		
	        	}else
	        	{
	        	    $('div.processing').html('Thank you, your friend will receive an email shortly.');
	        	}
	        	
	        },
	        error:function()
	        {
	        		$('#sendToFriend').jqmHide();
	        		alert('Unexpected errors, please refresh your browser and try again.');  	        		        	
	        }

	    }; 
	 
	    // bind form using 'ajaxForm' 
	    $('#frmSendToFriend').ajaxSubmit(options);		
		return false;
	}
