function insertNode(i, x, y, last) {
	    var p = new Node(i, x, y);
	
	    if (!last) {
	        p.prev = p;
	        p.next = p;
	
	    } else {
	        p.next = last.next;
	        p.prev = last;
	        last.next.prev = p;
	        last.next = p;
	    }
	    return p;
	}
// create a node and optionally link it with previous one (in a circular doubly linked list)
create a node and optionally link it with previous one (in a circular doubly linked list)
create a node and optionally link it with previous one ( in a circular doubly linked list )
function insertNode(i, x, y, last) {
	    var p = new Node(i, x, y);
	    if (!last) {
	        p.prev = p;
	        p.next = p;
	    } else {
	        p.next = last.next;
	        p.prev = last;
	        last.next.prev = p;
	        last.next = p;
	    }
	    return p;
	}
function insertNode ( i , x , y , last ) { var p = new Node ( i , x , y ) ; if ( ! last ) { p . prev = p ; p . next = p ; } else { p . next = last . next ; p . prev = last ; last . next . prev = p ; last . next = p ; } return p ; }
create a node and optionally link it with previous one (in a circular doubly linked list)
create a node and optionally link it with previous one ( in a circular doubly linked list )