simple inertial drag

I am use this script for simple drag:

private var screenPoint: Vector3;
private var offset: Vector3;
private var curScreenPoint : Vector3;
private var curPosition : Vector3;
    
function Start () {
}

function Update () {
}

function OnMouseDown () {
	screenPoint = Camera.main.WorldToScreenPoint(gameObject.transform.position);
	offset = gameObject.transform.position - Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenPoint.z));
	Screen.showCursor = false;
	}
	
function OnMouseDrag() { 
    curScreenPoint = new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenPoint.z);
	curPosition = Camera.main.ScreenToWorldPoint(curScreenPoint) + offset;
    transform.position = curPosition;
	}

function OnMouseUp(){
    Screen.showCursor = true;
    }

Does anyone have any suggestions on how to add an inertia effect as that of iPad?
Thanks.

using UnityEngine;

public class Drag : MonoBehaviour
{

private Vector3 _screenPoint;
private Vector3 _offset;
private Vector3 _curScreenPoint;
private Vector3 _curPosition;

private Vector3 _velocity;
private bool _underInertia;
private float _time = 0.0f;
public float SmoothTime;

void Update()
{
    if(_underInertia && _time <= SmoothTime)
    {
        transform.position += _velocity;
        _velocity = Vector3.Lerp(_velocity, Vector3.zero, _time);
        _time += Time.smoothDeltaTime;
    }
    else
    {
        _underInertia = false;
        _time = 0.0f;
    }
}

void OnMouseDown()
{
    _screenPoint = Camera.main.WorldToScreenPoint(gameObject.transform.position);
    _offset = gameObject.transform.position - Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, _screenPoint.z));
    Screen.showCursor = false;
    _underInertia = false;
}

void OnMouseDrag()
{
    Vector3 _prevPosition = _curPosition;
    _curScreenPoint = new Vector3(Input.mousePosition.x, Input.mousePosition.y, _screenPoint.z);
    _curPosition = Camera.main.ScreenToWorldPoint(_curScreenPoint) + _offset;
    _velocity = _curPosition - _prevPosition;
    transform.position = _curPosition;
}

void OnMouseUp()
{
    _underInertia = true;
    Screen.showCursor = true;
}
}

This should do what you want it to do. Sorry for the C# it shouldn’t be too hard to convert it back to JS. The publicly exposed SmoothTime is the amount of time after dragging that the object will take to come back to rest.
I hope this helps.