// vim: sw=4:ts=4:nu:nospell:fdc=4

 
Ext.BLANK_IMAGE_URL = 'js/ext/resources/images/default/s.gif';
Ext.ns('Application', 'Application.Index');
 


// application main entry point
Ext.onReady(function() {
	Ext.QuickTips.init();




//Main (Tabbed) Panel
var tabPanel = new Ext.TabPanel({
	deferredRender:false,
	autoScroll: true, 
	margins:'0 4 4 0',
	activeTab:0,
	hidden: true,
	items:[{
		id:'tab1',
		items: {xtype: 'indexadvertiserform'},
		title: 'Я - рекламодатель',
		closable:false,
		autoScroll:true
	},{
		id:'tab2',
		items: {xtype: 'publisherform'},
		title: 'Я - держатель сайта',
		closable:false,
		autoScroll:true
	},{
		id:'tab3',
		html: 'Я хочу свою ВБН',
		title: 'Я хочу свою ВБН',
		html: 'В настоящее время регистрация новых ВБН не производится',
		closable:false,
		autoScroll:true
	}]
});


              

var t1 = new Ext.Panel({
	border: false,
	html: 'Добро Пожаловать в сеть 24z.ru!<br>\
		- Сеть принимает сайты в качестве рекламоносителей.<br>\
		- Сеть размещает вашу рекламу на сайтах-участниках сети. '

});


var reportPanel = new Ext.Panel({
	border: false,
	items: [{xtype:'indexbannersizegrid'}, {xtype:'indexmonthgrid'}],
	hidden: true
});





var pp = new Ext.Panel({
    region:'west',
    margins: '5 0 0 5',
    width: 175,
    html: '<a class="examplelink" href="#">Главная</a><br/>\
    	<a class="examplelink" href="#">Регистрация</a><br>\
    	<a class="examplelink" href="#">Общий отчет</a>',
    items: {xtype: 'indexloginform'}


});   

function hide_all(){
	t1.hide();
	tabPanel.hide();
	reportPanel.hide();
}
function onLinkClick(e, t) {
	 hide_all();
	if (t.innerHTML == 'Главная'){
	 	 t1.show();
	 }else if (t.innerHTML == 'Регистрация'){
		 tabPanel.show();
	 }else if (t.innerHTML == 'Общий отчет'){
		 reportPanel.show();
	 }
}

pp.on({
	 render:function(){
	    pp.body.on({
		click: onLinkClick,
    	delegate:'a.examplelink',
	    stopEvent:true
	    })
	}
});



var viewport = new Ext.Viewport({
layout:'border',
defaults: {
    collapsible: false,
    split: false,
    bodyStyle: 'padding:15px'
},
items: [{
    region: 'south',
    bodyStyle: 'padding:0px',
    height: 20,
    html: '<center>A4B (c) 2005-2009</center>',
    margins: '0 5 5 5'
},pp,{
    collapsible: false,
    region:'center',
    margins: '5 5 0 0',
    items: [t1, tabPanel, reportPanel]
}]
            });
    // code here


}); // eo function onReady
 
// eof