// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults

//Increment function
var glineIndex = 1 ;
var Subform = Class.create({
  lineIndex: glineIndex,
  parentElement: "",
  initialize: function(rawHTML, parentElement) {
    this.rawHTML        = rawHTML;
    this.parentElement  = parentElement;
  },
  parsedHTML: function() {
    return this.rawHTML.replace(/INDEX/g, glineIndex++);
  },
  add: function() {
    new Insertion.Bottom($(this.parentElement), this.parsedHTML());
  }
});