CoriandrNamespace = typeof(CoriandrNamespace)=="undefined" ? {} : CoriandrNamespace;

CoriandrNamespace.Seedling = function(id, source, columns, rows, random, shortname) {
   this.id = id;
   this.source = source;
   this.columns = columns;
   this.rows = rows;
   this.random = random;
   this.shortname = shortname;
}

CoriandrNamespace.Seedling.prototype = {
   getHeight: function(){
      return CoriandrNamespace.Seedling.config.image.mini.height*this.rows+99;
   },
   
   getWidth: function(){
      return CoriandrNamespace.Seedling.config.image.mini.width*this.columns; // + padding for the body element
   },
   
   getURL: function(){
      return 'http://www.coriandr.com/'+CoriandrNamespace.Seedling.config.url+
             '?seller_id='+this.id+
             '&source='+this.source+
             '&columns='+this.columns+
             '&rows='+this.rows+
             '&random='+this.random+
             '&shortname='+this.shortname+
             '&body_width='+this.getWidth();
   },
   
   draw: function(){
      var html = '<iframe id="seedling_iframe" name="seedling_iframe" allowtransparency=true style="width:100%;height:'+this.getHeight()+'px" src="'+this.getURL()+'" scrolling="no" frameborder="0"></iframe>';
      document.write(html);
   }
}

CoriandrNamespace.Seedling.config = {
   url: 'coriandr_seedling',
   image: {
      mini: {height: 99, width: 99}
   }
}