MediaPanel = Ext.extend(Ext.Panel, {
    autoHeight: true,
    frame:true,
    collapsible: true,
    cls:'media',

    afterRender : function(){
        MediaPanel.superclass.afterRender.call(this);
        this.tpl.overwrite(this.body, this);
    },

    tpl : new Ext.XTemplate(
        '<dl>',
            '<tpl for="media">',
            '<dt><a href="{url}" title="{description}" target="_blank"><img src="{icon}"/><br/><span>{text}</span></a>',
                '',
            '</dt>',
            '</tpl>',
        '</dl><div style="clear:both"></div>'
    )
});

Ext.EventManager.on(window, 'load', function(){

	var catalog = [
			{title: 'Video End Time ',
		media: [
			{
		    text: 'Diving into the Depths of Daniel, Part One, 2008',
            url: 'video/34_DanielP01/index.html',
            icon: 'audio-images/Daniel.jpg',
			description: 'Who has not heard of Daniel in the Lions’ Den? God used the story form to clothe spiritual principles so that all can remember ..'
		},
		{
		    text: 'Diving into the Depths of Daniel, Part Two, 2008',
            url: 'video/34_DanielP02/index.html',
            icon: 'audio-images/Daniel2.jpg',
			description: 'The Book of Daniel is often called “the spine of Biblical prophecy, it is foundational to any study of the End Times ..'
		},
		{
            text: 'Plumbing the Depths of Revelation, Part 1',
            url: 'video/73_Revelation_P1/index.html',
            icon: 'audio-images/Revelation.jpg',
			description: 'laid out prophetic time-lines given by God, especially in the book of Daniel and the synoptic Gospels'
        },
		{
            text: 'Plumbing the Depths of Revelation, Part 2',
            url: 'video/73_Revelation_P2/index.html',
            icon: 'video/73_Revelation_P2/revelation-horsemen.jpg',
			description: 'Let us get ready to meet the Lord, with “hearts unblamable in holiness before our God and Father at the coming of our Lord” '
        }
		]
		}

	   ,			   
				   {
        title: 'Video',
		media: [
		
		{
		    text: 'Diving into the Book of Zephaniah',
            url: 'http://www.etword.org/media/Zephaniah/index.html',
            icon: 'http://www.etword.org/media/Zephaniah/zephaniah.jpg',
			description: 'his is a book that talks about the End Times which is a time when the judgements of God  ..'
		},
		{
		    text: 'Plumbing the Depths of First Thessalonians, 2008',
            url: 'http://www.etword.org/media/1_Thess/index.html',
            icon: 'http://www.etword.org/media/1_Thess/1_Thess.jpg',
			description: 'Paul had a glorious time of harvest in Thessalonica, for the Thessalonians responded in a way,  ..'
		},
		{
		    text: 'Plumbing the Depths of Second Thessalonians, 2008',
            url: 'http://www.etword.org/media/video/60_2_Thess/index.html',
            icon: 'http://www.etword.org/media/video/60_2_Thess/2Thess-Small.jpg',
			description: 'Second THESSALONIANS IS A BOOK THAT HELPS US KNOW how to live for the Lord,  ..'
		},
		{
		    text: 'Plumbing the Depths of First Peter, 2007',
            url: 'http://www.etword.org/media/1_Peter/index.html',
            icon: 'audio-images/1_Peter.jpg',
			description: 'Peter never forgot his restoration by our Lord and His call to follow Him wholeheartedly ...'
		}
		,
		{
		    text: 'Plumbing the Depths of Second Peter, 2007',
            url: 'http://www.etword.org/media/video/68_2_Peter//index.html',
            icon: 'audio-images/2_Peter.jpg',
			description: 'Peter never forgot his restoration by our Lord and His call to follow Him wholeheartedly ...'
		}
		,
		{
		    text: 'Torah, Exodus',
            url: 'http://etword.org/media/video/torah/02_Exodus/index.html',
            icon: 'audio-images/exodus.jpg',
			description: 'The book of Exodus consists of two distinct portions. The first Exo. 1–19 gives a detailed account of the circumstances and the rest on the giving of law.'
		}
		/*,
		{
		    text: ' Diving into the Depths of Daniel, Part One',
            url: './video/DanielP01/index.html',
            icon: './video/DanielP01/Daniel.jpg',
			description: 'The three chapters of Joel correspond to the three woes of Revelation ....'
		}*/
		]
	   }, 
		{title: 'Video Workshops',
		media: [
		{
            text: 'Basic Inductive Bible study on Jude',
            url: 'http://www.etword.org/media/video/Workshops/IBS_ON_Jude/index.html',
            icon: 'audio-images/ibs.jpg',
			description: 'Basic Inductive Bible study'
        }
		]
		}

	   ,
	   {
		title: 'Audio',
		media: [
		{
            text: 'Marriage Without Regrets, Part 1',
            url: 'http://www.etword.org/media/audio/511_MRW1_2004/index.html',
            icon: 'audio-images/MRW1.jpg',
			description: 'We must recognize and value innate differences of Men and Women... '
        },
		{
            text: 'Marriage Without Regrets, Part 2',
            url: 'http://www.etword.org/media/audio/512_MRW2_2004/index.html',
            icon: 'audio-images/MRW2.jpg',
			description: 'What is your attitude toward sex and your sexuality? Is it a biblical attitude?'
        },
		{
            text: 'How to Deal with the Rapture Question?',
            url: 'http://www.etword.org/media/audio/500_RaptureQuestion/index.htm',
            icon: 'http://www.etword.org/media/audio/511_MRW1_2004/IMAGES/pict4.jpg',
			description: 'Overview of prophecies in Old Testament and new Testament'
        },
		{
            text: 'Treasure in Jars of Clay',
            url: 'http://www.etword.org/media/audio/510_TreasureInJarsOfClay/index.htm',
            icon: 'http://www.etword.org/media/audio/510_TreasureInJarsOfClay/IMAGES/banner.jpg',
			description: 'But we have this treasure in earthen vessels, ... '
        },
		{
            text: 'Genesis Part One',
            url: 'http://www.etword.org/media/audio/01_GenesisP1/index.html',
            icon: 'http://www.etword.org/media/audio/44_Haggai/IMAGES/pict2.jpg',
			description: 'The book of Genesis, has its name from the title it bears in the Septuagint .. '
        }
		,
		{
            text: 'Genesis Part Two',
            url: 'http://www.etword.org/media/audio/01_GenesisP2/index.html',
            icon: 'http://www.etword.org/media/audio/44_Haggai/IMAGES/pict2.jpg',
			description: 'This book contains an account of the creation of the world, and its first inhabitants'
        }
		,
		{
            text: 'Leviticus',
            url: 'http://www.etword.org/media/audio/03_Leviticus/index.htm',
            icon: 'http://www.etword.org/media/audio/44_Haggai/IMAGES/pict1.jpg',
			description: 'The book of Leviticus is God manual for His people on how to approach Him and live pleasing ...'
        }
		,
		{
            text: 'Ruth',
            url: 'http://www.etword.org/media/audio/08_Ruth/index.htm',
            icon: 'audio-images/20071211-DSC06600.jpg',
			description: 'The Book of Ruth is a beautiful love story which reflects the theme of the Bible, which is a book about love too.  ...'
        }
		,
		{
            text: 'Haggai',
            url: 'http://www.etword.org/media/audio/44_Haggai/index.html',
            icon: 'http://www.etword.org/media/audio/44_Haggai/IMAGES/pict.jpg',
			description: 'The Book of Ruth is a beautiful love story which reflects the theme of the Bible, which is a book about love too.  ...'
        },
		
		{
            text: 'Romans Part 1',
            url: 'http://www.etword.org/media/audio/52_RomP1PUP/index.html',
            icon: 'audio-images/Rom1.jpg',
			description: 'It is the constitution of your faith, the foundation for all that you believe, ...'
        },
		{
            text: 'Romans Part 2',
            url: 'http://www.etword.org/media/audio/52_RomP2PUP/index.html',
            icon: 'audio-images/Rom2.jpg',
			description: 'It is the constitution of your faith, the foundation for all that you believe, ...'
        },
		{
            text: 'Romans Part 3',
            url: 'http://www.etword.org/media/audio/52_RomP3PUP/index.html',
            icon: 'audio-images/Rom3.jpg',
			description: 'It is the constitution of your faith, the foundation for all that you believe, ...'
        },
		{
            text: 'Romans Part 4',
            url: 'http://www.etword.org/media/audio/52_RomP4PUP/index.html',
            icon: 'audio-images/Rom4.jpg',
			description: 'It is the constitution of your faith, the foundation for all that you believe, ...'
        },
		{
            text: 'The Letter of Colossians, Part 1',
            url: 'http://www.etword.org/media/audio/58_ColossiansP1/index.html',
            icon: 'audio-images/Col1.jpg',
			description: 'Paul’s letter to the Colossians is a very challenging intellectual letter to people in love with Greek wisdom and rhetoric ...'
        },
		{
            text: 'The Letter of Colossians, Part 2',
            url: 'http://www.etword.org/media/audio/58_ColossiansP2/index.html',
            icon: 'audio-images/Col2.jpg',
			description: 'Paul’s letter to the Colossians is a very challenging intellectual letter to people in love with Greek wisdom and rhetoric ...'
        },
		{
            text: 'The Letter of James',
            url: 'http://www.etword.org/media/audio/66_James/index.html',
            icon: 'http://www.etword.org/media/audio/511_MRW1_2004/IMAGES/pict8.jpg',
			description: 'The book of James is one of those books which hits you right between the eyes and shocks you and I into reality ...'
        }
		 ]
	}
	]
	for(var i = 0, c; c = catalog[i]; i++){
        c.id = 'media-' + i;
        new MediaPanel(c).render('all-media');	
    }
	 
	var tpl = new Ext.XTemplate(
        '<dl><tpl for="."><dt><a href="#{id}">{title:stripTags}</a></dt></tpl></dl>'
    );
    //tpl.overwrite('media-menu', catalog);
	Ext.get('loading').fadeOut({remove: true});
	
});

 
