Ext.ns('main');

Ext.onReady(function(){
	// reference local blank image
	Ext.BLANK_IMAGE_URL = 'website/images/s.gif';

	//Ext.QuickTips.init();

	var Main_App_Viewport = new Ext.Viewport({
		border		:false,
		closable	:false,
		autoScroll	:true,
		draggable	:false,
		maximized	:true,
		layout		:'vbox',
		layoutConfig:{align:'stretch'},
		listeners	:{
			move		:function(thisViewport, x, y){
				Ext.Msg.alert('Message', "move");
			},
			resize		:function(thisViewport, adjWidth, adjHeight, rawWidth, rawHeight){
				//Ext.Msg.alert('Message', "resize");
				//var windowPosition = main.MainAppWindow.getPosition();
				//console.log(windowPosition);
			},
			show		:function(){
				load_home();
			}
		},
		items: [{
			//north region
			height		:25,
			border		:false,
			layout		:'fit'
		},{
			//center region
			height		:750,
			border		:false,
			layout		:'fit',
			items		:[
			{
				xtype		:'panel',
				layout		:'hbox',
				border		:false,
				layoutConfig:{align:'stretch'},
				items		:[
				{
					//west region
					flex		:1,
					border		:false,
					layout		:'fit'
				},{
					//center region
					xtype		:'panel',
					width		:1000,
					layout		:'table',
					border		:false,
					layoutConfig:{columns:3},
					items		:[
					{
						width		:6,
						height		:20,
						border		:false,
						baseCls		:'border_top_left'
					},{
						width		:986,
						height		:20,
						border		:false,
						baseCls		:'border_mid_top'
					},{
						width		:6,
						height		:20,
						border		:false,
						baseCls		:'border_top_right'
					},{
						width		:6,
						height		:720,
						border		:false,
						baseCls		:'border_mid_left'
					},{
						//==================center===============
						width		:986,
						height		:720,
						border		:false,
						layout		:'border',
						items		:[{
							//north region render background problem.
							region		:'north',
							xtype		:'container',
							height		:152,
							border		:false,
							layout		:'fit',
							items		:[{
								xtype		:'panel',
								bodyCssClass:'tiled_background',
								border		:false,
								layout		:'border',
								items		:[{
									region		:'west',
									xtype		:'panel',
									border		:false,
									width		:289,
									margins		:'5 0 0 55',
									layout		:'fit',
									baseCls		:'tiled_background2',
									html		:'<img src="website/images/logo.png" /></br><img src="website/images/logoname2.png"/>'
								},{
									region		:'center',
									xtype		:'panel',
									id			:'main_header_panel',
									margins		:'4 15 0 0',
									border		:false,
									borderStyle	:'padding:5px 0px 0px 5px',
									layout		:'fit',
									baseCls		:'header_background',
									html		:'<div class="header_image"><img src="website/images/header/background_img2.jpg" /></div>'
								}]
							}]
						},{
							region		:'south',
							xtype		:'panel',
							margins		:'0 0 0 0',
							border		:false,
							height		:30,
							layout		:'fit',
							baseCls		:'tiled_background',
							html		:"<div align='center' class='footer_text'>Anthony-Seaman Ltd. <img src='website/images/dot.png' /> #300-1460 Main Street, North Vancouver, BC, Canada, V7J 1C8 <img src='website/images/dot.png' /> Ph 604 986 6241 <img src='website/images/dot.png' /> Fax 604 984 3150 <img src='website/images/dot.png' /> asl@asltd.com</div>"
						},{
							region		:'west',
							xtype		:'panel',
							margins		:'0 0 0 0',
							border		:false,
							width		:15,
							layout		:'fit',
							baseCls		:'tiled_background',
							items		:[]
						},{
							region		:'east',
							xtype		:'panel',
							margins		:'0 0 0 0',
							border		:false,
							width		:15,
							layout		:'fit',
							baseCls		:'tiled_background',
							items		:[]
						},{
							region		:'center',
							xtype		:'panel',
							id			:'Center_Div',
							border		:true,
							layout		:'fit',
							tbar		:{height:35, defaults:{scale:'medium'}, items:[
								{width:120, text:'Home', handler:function(){load_home();}},
								{width:120, text:'Services', handler:function(){load_services();}},
								//{width:120, text:'Services', menu:[
								//	{text:'Conceptual Design', handler:function(){load_conceptualdesign();}},
								//	{text:'Engineering', handler:function(){load_engineering();}},
								//	{text:'Drafting', handler:function(){load_drafting();}}
								//	]
								//},
								{width:120, text:'Resources', menu:[
									{text:'Blog',
									    handler:function()
									    {
									        window.location="http://www.asltd.com/keithblog/index.php";
									    }
									},
									{text:'Client Login',
									    handler:function()
									    {
									        window.location="http://174.7.64.231/clientlogin.asp";
									    }
									}
									]
								},
								{width:120, text:'Featured Projects',
								    handler:function(){load_featuredprojects();}},
								{width:120, text:'Contacts', handler:function(){load_contacts();}}
							]},
							items		:[{
								//center view port
								xtype		:'panel',
								layout		:'fit',
								border		:true
							}]
						}]
					},{
						width		:6,
						height		:720,
						border		:false,
						baseCls		:'border_mid_right'
					},{
						width		:6,
						height		:6,
						border		:false,
						baseCls		:'border_bot_left'
					},{
						width		:986,
						height		:6,
						border		:false,
						baseCls		:'border_mid_bot'
					},{
						width		:6,
						height		:6,
						border		:false,
						baseCls		:'border_bot_right'
					}]
				},{
					//east region
					border		:false,
					flex		:1,
					layout		:'fit'
				}]
			}]
		},{
			//south region
			border		:false,
			flex		:1,
			layout		:'fit'
		}]
	});

	Main_App_Viewport.show();
});


/*
website/
						region		:'north',
						xtype		:'panel',
						border		:false,
						height		:152,
						layout		:'fit',
						baseCls		:'tiled_background2',
						items		:[{
							xtype		:'panel',
							margins 	:'10 0 0 0',
							border		:false,
							layout		:'border',
							items		:[{
								region		:'west',
								xtype		:'panel',
								border		:false,
								width		:289,
								margins		:'5 0 0 55',
								layout		:'fit',
								baseCls		:'tiled_background',
								html		:'<img src="images/logo.png" /></br><img src="images/logoname2.png" />'
							},{
								region		:'center',
								xtype		:'panel',
								id			:'main_header_panel',
								margins		:'4 15 0 0',
								border		:false,
								layout		:'fit',
								baseCls		:'header_background'
							}]
						}]
					},{
						region		:'south',
						xtype		:'panel',
						margins		:'0 0 0 0',
						border		:false,
						height		:30,
						layout		:'fit',
						baseCls		:'tiled_background',
						html		:"<div align='center' class='footer_text'>Anthony-Seaman Ltd. <img src='images/dot.png' /> #300-1460 Main Street, North Vancouver, BC, Canada, V7J 1C8 <img src='images/dot.png' /> Ph 604 986 6241 <img src='images/dot.png' /> Fax 604 984 3150 <img src='images/dot.png' /> asl@asltd.com</div>"
					},{
						region		:'west',
						xtype		:'panel',
						margins		:'0 0 0 0',
						border		:false,
						width		:15,
						layout		:'fit',
						baseCls		:'tiled_background2',
						items		:[]
					},{
						region		:'east',
						xtype		:'panel',
						margins		:'0 0 0 0',
						border		:false,
						width		:15,
						layout		:'fit',
						baseCls		:'tiled_background2',
						items		:[]
					},{
						region		:'center',
						xtype		:'panel',
						id			:'Center_Div',
						border		:true,
						layout		:'fit',
						tbar		:{height:35, defaults:{scale:'medium'}, items:[
							{width:120, text:'Home', handler:function(){load_home();}}, '-',
							{width:120, text:'Services', menu:[
								{text:'Conceptual Design'},
								{text:'Engineering'},
								{text:'Drafting'}
								]
							}, '-',
							{width:120, text:'Resources', menu:[
								{text:'Blog'},
								{text:'Client Login'}
								]
							}, '-',
							{width:120, text:'Featured Projects'}, '-',
							{width:120, text:'Contacts', handler:function(){load_contacts();}}, '-'
						]},
						items		:[{
							//center view port
							xtype		:'panel',
							bodyStyle	:'background-color:#dddddd',
							border		:true,
							bodyBorder	:true,
							frame		:false,
							items		:[
							{	xtype		:'panel',
								border		:true,
								title		:'item'
							}]
						}]
						*/
