/**
 * Copyright(c) 2006-2009, FeyaSoft Inc.
 */
Ext.ns('feyaSoft.oilAccount.share.myCompany.preview');

feyaSoft.oilAccount.share.myCompany.preview.ProductChildNodesPanel = function(config){
    
    this.config = config || {};

    this.itemTpl = new Ext.XTemplate(
        '<tpl for=".">',
        '<div>',
          ' <table width="100%"  border="0">',
              '<tr>',
                '<td width="100" rowspan="4"><img src="{pimagepath}" width="95px" height="85px"/></td>',
               ' <td width="475">Product Name: <b>{productName}</b></td>',
               ' <td width="100" rowspan="4"><img src="{imagepath}" width="95px" height="75px"/></td>',
             ' </tr>',
              '<tr>',
               ' <td>Company Name: <font color="blue"><b>{companyName}</b></font></td>',
             ' </tr>',
             ' <tr>',
               ' <td>Location: {city}, {state}, {country}</td>',
              '</tr>',
               ' <tr>',
               ' <td>&nbsp;</td>',
              '</tr>',
               '</table>',
        '</div>',
        '</tpl>'
    );
    //this.itemTpl.compile();
    this.aboutPanel = new Ext.Panel({
        autoScroll:false,
        height:100,
        collapseMode:'mini',
        split:true,
        region:'north',
        border:true,
        html: 'My panel....'
    });

    this.aboutInfoPanel = new Ext.Panel({
        border:false,
        region:'center',

        layout:'fit',
        items:[{
                xtype:'iframepanel',
                loadMask:{
                    msg:'<center>Loading</center>'
                },
                defaultSrc: this.config.dataProducts.webpage,
                border: false,
                closable:false
            }]
    });

    //call super
    feyaSoft.oilAccount.share.myCompany.preview.ProductChildNodesPanel.superclass.constructor.call(this, {
        layout: 'fit',
        border: false,
        items:[{layout:'border',
                border:false,
                items:[this.aboutInfoPanel]
            }]
    });
    
    this.on('afterlayout',this.onAfterlayoutFn,this,{single:true});
};

Ext.extend(feyaSoft.oilAccount.share.myCompany.preview.ProductChildNodesPanel, Ext.Panel, {

   onAfterlayoutFn:function(){
          params={};
          params.pimagepath = this.config.dataProducts.imagepath;
          params.productName = this.config.dataProducts.productName;
          params.country = this.config.data.conCountry;
          params.city = this.config.data.conCity
          params.state = this.config.data.conState
          params.imagepath = this.config.data.imagepath;
          params.companyName = this.config.data.name;
          this.itemTpl.overwrite(this.aboutPanel.body, params);
     }
});



