RdProductView = function() {
	return {
		init: function() {
			var el = Ext.get('description-ct');
			var p = Ext.get(el.dom.parentNode);
			if (el.getHeight() > p.getHeight()) {
				var moreInfoEl = Ext.DomHelper.insertAfter(el, {tag: 'div', style: 'padding-top: 5px;', html: '<a href="#" onclick="RdProductView.showDescription();return false;">More info...</a>'}, true);
				el.setStyle('overflow', 'hidden');
				var height = p.getHeight() - moreInfoEl.getHeight();
				height = Math.round(height/14)*14;
				el.setHeight(height);
			}
		},
		showDescription: function() {
			if (!this.descriptionLayer) {
				this.descriptionMask = Ext.DomHelper.append(document.body,
					'<div class="product-view-description-mask">'+
					'</div>' 
				, true);
				this.descriptionLayer = Ext.DomHelper.append(document.body,
					'<div class="product-view-description-layer">'+
						'<div style="font-weight: bold;">Full description</div>'+
						'<div class="product-view-description-layer-content"></div>'+
						'<div style="text-align: center; margin-top: 20px;"><a href="#" onclick="return false;">Click here to close</a></div>'+
					'</div>'
				, true);
			}
			this.descriptionMask.show();
			this.descriptionLayer.child('.product-view-description-layer-content').update(ProductDescription);
			this.descriptionLayer.center();
			this.descriptionLayer.show();
			(function(){
	  		Ext.EventManager.addListener(document.body, 'click', this.hideDescription, this, {single: true});
	  	}).defer(1, this);
			
		},
		hideDescription: function() {
			this.descriptionLayer.hide();
			this.descriptionMask.hide();
		}
	}
}();
Ext.onReady(RdProductView.init, RdProductView);

