﻿/*!
 * Ext JS Library 3.0.0
 * Copyright(c) 2006-2009 Ext JS, LLC
 * licensing@extjs.com
 * http://www.extjs.com/license
 */
var MX_THE_PROMO = Ext.extend(Ext.util.Observable, {
    constructor: function(config){
        this.addEvents('finished'); // specify the events we're going to fire
        MX_THE_PROMO.constructor.call(this, config);
    },
	
    create: function(pid, i, value){
		var inner = '';
		var type = value.substring(0,1);
		value = value.substring(1);
		if (value.length > 0){
			var images = value.split('|||');
			var j = 0;
			while (j < images.length){
				if (type == 1){
					var imageInfo = images[j].split('+++');
					var url = 'http://'+window.location.hostname+'/'+imageInfo[0];
					var title = imageInfo[1];
					inner += '<img src="'+url+'" title="'+title+'">';
					}
				else if (type == 2){
					inner += '<div class="mt_promo_block_mx_the_label">'+images[j]+'</div>';
				}
				j++;
			}
		}
		
		this.panel = new Ext.Panel({ 
			id: 'mt_promo_block_mx_the-'+i,
			cls: 'mt_promo_block_mx_the mt_promo_block_field',
			hideLabel: true,
			layout:'form',
			width:'auto',
			html: inner
		});
		
		this.fireEvent('finished', this.panel);
	}	
});