EtsyNameSpace = typeof(EtsyNameSpace)=="undefined" ? {} : EtsyNameSpace;

EtsyNameSpace.Mini = function(id, itemSource, itemSize, rows, columns, idList, ref)
{
  this.id = id;
  this.itemSource = itemSource;
  this.itemSize = itemSize;
  this.rows = rows;
  this.columns = columns;
  this.idList = idList;
  this.ref    = (typeof ref == 'undefined')?'':ref;
}

EtsyNameSpace.Mini.prototype = {
  
	getHeight: function()
	{
		return 450
		//return (EtsyNameSpace.Mini.config.style[this.itemSize].height * this.rows) + (this.itemSource=="list" || this.itemSource=="storque" || this.itemSource=="storque_shop" ? 30 : 80)
	}
	
	,getWidth: function()
	{
		return 751
		//return (EtsyNameSpace.Mini.config.style[this.itemSize].width * 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.etsy.com/' + EtsyNameSpace.Mini.config.baseUrl +
					'?' + 
					'item_source=' + this.itemSource +
					'&item_size=' + this.itemSize +
					'&item_rows=' + this.rows +
					'&item_columns=' + this.columns +
					'&ref=' + this.ref +
					((this.itemSource=='favorites' || this.itemSource=='shop' || this.itemSource=='storque_shop') ? '&user_id=' + this.id : '') +
					((this.itemSource=='list' || this.itemSource=='storque') ? '&id_list='+this.idList.join() : '') +
					(this.itemSource=='guide' ? '&guide_id=' + this.id : '')
	  }
	  
	  ,renderIframe: function()
	  {
		var html = '';
		html += '<iframe ALLOWTRANSPARENCY=true style="width: '+this.getWidth()+'px; ' + 
					'height: '+this.getHeight()+'px;" ' + 
					'src="'+this.getFrameSource()+'" scrolling="yes" frameborder="0">' +
					'</iframe>';
		document.write(html);
	  }
}

EtsyNameSpace.Mini.config = {
  style: {
    thumbnail: {height: 93, width: 98}, 
    gallery: {height: 180, width: 184}
  },
  baseUrl: "etsy_mini_both.php"
};

