NsartNameSpace = typeof(NsartNameSpace)=="undefined" ? {} : NsartNameSpace;

NsartNameSpace.Mini = function(id, itemSource, itemSize, rows, columns, idList)
{
  this.id = id;
  this.itemSource = itemSource;
  this.itemSize = itemSize;
  this.rows = rows;
  this.columns = columns;
  this.idList = idList;
}

NsartNameSpace.Mini.prototype = {
  //can add a bit more complicated math here....a bit wider for one column...and narrower additions
  getHeight: function(){return (NsartNameSpace.Mini.config.style[this.itemSize].height * this.rows) + (this.itemSource=="list" ? 30 : 80)},
  
  getWidth: function(){
	if (this.columns == 1 || this.itemSize == 'thumbnail'){  
	  return (NsartNameSpace.Mini.config.style[this.itemSize].width * this.columns + 4)
	}
	else{
	  return (160 * this.columns)	
	}
  
  },
  
  getFlashDimensions: function(){
    var h,w, dimension;
    
    if (this.itemSize=="gallery")
    {
        w = 184;
        h = 184;

        dimension = {width:w*cols-14,height:h*rows-6 };
    }
    else
    {
        w = 94;
        h = 94;

        dimension = {width:w*cols-2,height:h*rows-2};
    }

    return dimension;
  },
  
  getFrameSource : function(){
  
    return     'http://www.nsartonline.com/' + NsartNameSpace.Mini.config.baseUrl +
                '?' + 
                'item_source=' + this.itemSource +
                '&item_size=' + this.itemSize +
                '&item_rows=' + this.rows +
                '&item_columns=' + this.columns +
                //((this.itemSource=='favorites' || this.itemSource=='shop') ? '&user_id=' + this.id : '') +
				((this.itemSource=='shop') ? '&user_id=' + this.id : '') +
                (this.itemSource=='list' ? '&id_list='+this.idList.join() : '')
  },
  
  renderIframe: function(){
    var html = '';
    html += '<iframe ALLOWTRANSPARENCY=true style="width: '+this.getWidth()+'px; ' + 
                'height: '+this.getHeight()+'px;" ' + 
                'src="'+this.getFrameSource()+'" scrolling="no" frameborder="0">' +
                '</iframe>';
    document.write(html);
  }
  
}

NsartNameSpace.Mini.config = {
  style: {
    thumbnail: {height: 93, width: 98}, 
    gallery: {height: 190, width: 175}
  },
  baseUrl: "nsart_mini_both.cfm"
};

