MiiduuNameSpace = typeof(MiiduuNameSpace)=="undefined" ? {} : MiiduuNameSpace;
MiiduuNameSpace.Mini = function (obj) {
	this.options = {product_id:0,width:0,height:0,RT:false,itemSize:'single',button:'buynow',ref:escape(location.href),host:'www.miiduu.com'};
	for(var name in this.options) {
		if(typeof(obj[name]) !== 'undefined') this.options[name] = obj[name];
	}
}
MiiduuNameSpace.Mini.prototype = {
	getWidth: function (){return this.options.width? this.options.width : MiiduuNameSpace.Mini.config.style[this.options.itemSize].width;},
	getHeight: function (){return this.options.height? this.options.height : MiiduuNameSpace.Mini.config.style[[this.options.itemSize]].height;},
	getFrameSource: function () {
		return 'http://' + this.options.host + '/' + MiiduuNameSpace.Mini.config.baseUrl + '&' + 
			   '&product_id=' + this.options.product_id +
			   '&button=' + this.options.button +
			   '&width=' + this.getWidth() +
			   '&height=' + this.getHeight() +
			   '&ref=' + this.options.ref ;
	},
	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>';
		if(this.options.RT) return html;
	document.write(html);
	}
}

MiiduuNameSpace.Mini.config = {
  style: {
    thumbnail: {height: 93, width: 98}, 
    gallery: {height: 180, width: 184},
	single: {height: 200, width:200}
  },
  baseUrl: "index.php?route=product/mini"
};
