var ClsDescon=Class.create({
	initialize:function(){
		this.widthLeft=22;
		this.strPad=2;
		this.borderColor='#B8B8B8';
		this.imageDir='../../images/';
		this.colorPrimary=this.borderColor;
		this.colorSecondary='gray';
		this.menuItems=this.getMenuItems();
		this.lightBarCss={'background':'url('+this.imageDir+'template-2.png)','color':'#001526'};
		this.darkBarCss={'background':'url('+this.imageDir+'template-1.png)','color':'#FFFFFF'};
		this.menuItemOn={'text-decoration':'underline'};
		this.menuItemOff={'text-decoration':'none'};
		this.overflowCasingHeight={'height':'500px'};
		this.overflowCasingCss={'overflow':'auto'};
		this.menuBarCss={'background':'url('+this.imageDir+'template-1.png)','margin':'0 '+(this.strPad*3)+'px'};
		this.pageCaptionCss={'background':'url('+this.imageDir+'template-2.png)','margin':'0 '
			+this.strPad+'px','padding':(this.strPad+3)+'px'};
	},
	
	processor:function(){
		this.interfaceStructure();
		this.header();
		cat.signature();
		
		var container=$cat('.overflow-casing');
		return container;
	},
	
	/*
		method: 	 ClsDescon.getMenuItems()
		parameters:  -
		description: generates an xhtml string of menu items for the Descon-Home application.
					 tested and passed.
	*/
	getMenuItems:function(){
		var menuItems=['customers and projects','electrical','layout','mechanical','admin'], output='';
		$cat(menuItems).each(function(){output+='<a href="javascript:" class="menu-item">'+this+'</a>';});
		return output;
	},//ClsDescon.getMenuItems() ends here...
	
	/*
		method: 	 ClsDescon.header()
		parameters:  -
		description: generates a wire-frame structure into the current document, well-styled and classed accordingly.
					 tested and passed.
	*/
	header:function(){
		var container=$cat('.page-header'), imageDir=this.imageDir, strPad=this.strPad, strFontSize=cat.strFontSize,
			borderColor=this.borderColor, menuItems=this.menuItems, colorSecondary=this.colorSecondary, menuBarCss=this.menuBarCss,
			lightBarCss=this.lightBarCss, menuItemOn=this.menuItemOn, menuItemOff=this.menuItemOff, darkBarCss=this.darkBarCss;
		var Header={
			content:{
				logo:function(){
					container.find('.left-panel').html('<div><img src="'+imageDir+'descon_logo.jpg" width="170" height="48" /></div>')
					.find('div').css({'padding':strPad,'text-align':'center'}).hide().fadeIn(cat.fadeTime+2000);
				},//ClsDescon.header().content.logo() ends here...
				
				rightPanel:function(){
					var applicationTitle='<div class="application-title"></div>', menuBar='<div class="menu-bar"></div>';
					applicationTitle=container.find('.right-panel').html(applicationTitle+menuBar).find('.application-title');
					menuBar=container.find('.menu-bar');
					
					function populateApplicationTitleContainer(){
						var strDate='<div class="date-display" style="width:25%;float:left;">'+cat.date()+'</div>';
						cat.divide({container:applicationTitle,widthLeft:60});
						with(applicationTitle){
							css(lightBarCss);
							find('.left-panel').html('<span>Office Software Applications</span>')
								.css({'text-align':'left'});
							find('.right-panel').html('<div class="date-and-time">'+strDate+'</div>')
								.find('.date-and-time').css({'font-size':(strFontSize-1)+'px'});
							css(cat.border({color:borderColor}));
							css({'margin':strPad+'px '+strPad+'px 0 '+strPad+'px'});
							animate({'padding':strPad+3},'slow');
							cat.clock(find('.date-and-time'));
							with(find('.clock-display')){
								css({'float':'right','padding':strPad+'px'});
								css(cat.border({color:colorSecondary}));
								css(darkBarCss);
							}
						}
					}//ClsDescon.header().content.rightPanel()->populateApplicationTitleContainer() ends here...
					
					function populateMenuBarContainer(){
						with(menuBar){
							html(menuItems);
							css(menuBarCss);
							css(cat.border({mode:'left-right',color:colorSecondary}));
							animate({'padding':strPad+4},'slow');
							find('.menu-item').animate({'padding':strPad+4},'slow').css(darkBarCss);
							find('.menu-item').css(cat.border({mode:'right',color:colorSecondary}));
							find('.menu-item').css({'text-decoration':'none'})
								.hover(function(){$cat(this).css(menuItemOn);},
									   function(){$cat(this).css(menuItemOff);});
							find('.menu-item:first').css(cat.border({mode:'left',color:colorSecondary}));
						}
					}//ClsDescon.header().content.rightPanel()->populateApplicationTitleContainer() ends here...
					
					populateApplicationTitleContainer();
					populateMenuBarContainer();
				}//ClsDescon.header().content.rightPanel() ends here...
			},//ClsDescon.header().content ends here...
			
			functionality:{
				menuItems:function(descon){
					$cat('.menu-item').click(function(){
						descon.processMenuItem($cat(this),$cat('.overflow-casing'));
					});
				}//ClsDescon.header().functionality.menuItems() ends here...
			}//ClsDescon.header().functionality ends here...
		};//ClsDescon.header()->Header ends here...
		
		function processor(descon){
			content();
			functionality(descon);
			
			function content(){
				Header.content.logo();
				Header.content.rightPanel();
			}
			function functionality(descon){
				Header.functionality.menuItems(descon);
			}
		}
		
		processor(this);
	},//ClsDescon.header() ends here...
	
	/*
		method: 	 ClsDescon.interfaceStructure()
		parameters:  -
		description: generates a wire-frame structure into the current document, well-styled and classed accordingly.
					 tested and passed.
	*/
	interfaceStructure:function(){
		var borderColor=this.borderColor, strPad=this.strPad, strWidthLeft=this.widthLeft, pageCaptionCss=this.pageCaptionCss;
		$cat(document.body).append('test');
		var objContainer=cat.start(), overflowCasingCss=this.overflowCasingCss, overflowCasingHeight=this.overflowCasingHeight;
		var WireFrame={
			structure:{
				pageHeader:function(){
					cat.divide({
						container:cat.newContainer({container:objContainer,className:'page-header'}),
						widthLeft:strWidthLeft
					});
				},//ClsDescon.interfaceStructure()->WireFrame.structure.pageHeader() ends here...
					
				pageCaption:function(){
					objContainer.append('<div class="page-caption"></div>');
				},//ClsDescon.interfaceStructure()->WireFrame.structure.pageCaption ends here...
					
				pageBody:function(){
					objContainer.append('<div class="page-body"><div class="overflow-casing"></div></div>');
				}//ClsDescon.interfaceStructure()->WireFrame.structure.pageBody ends here...
			},//ClsDescon.interfaceStructure()->WireFrame.structure ends here...
			
			styles:{
				objContainer:function(){
					$cat('.container').css(cat.border({color:borderColor}));
				},//ClsDescon.interfaceStructure()->WireFrame.styles.objContainer() ends here...
				
				pageHeader:function(){
					$cat('.page-header .right-panel').css({'text-align':'center'});
					$cat('.page-header .right-panel').css(cat.border({color:borderColor,mode:'left'}));
				},//ClsDescon.interfaceStructure()->WireFrame.styles.pageHeader() ends here...
				
				pageCaption:function(){
					$cat('.page-caption').css(cat.border({color:borderColor}));
					$cat('.page-caption').css(pageCaptionCss);
				},//ClsDescon.interfaceStructure()->WireFrame.styles.pageCaption() ends here...
				
				pageBody:function(){
					with($cat('.page-body')){
						css(cat.border({color:borderColor,mode:'left-bottom-right'}));
						css({'margin':'0 '+(strPad*2)+'px '+(strPad*2)+'px '+(strPad*2)+'px'});
						find('.overflow-casing').css(overflowCasingCss).animate(overflowCasingHeight,'slow');
					}
				}//ClsDescon.interfaceStructure()->WireFrame.styles.pageBody() ends here...
			}//ClsDescon.interfaceStructure()->WireFrame.styles ends here...
		};//ClsDescon.interfaceStructure()->WireFrame ends here...
		
		function processor(){
			if(structure())stylesheet();
			
			function structure(){
				with(WireFrame.structure){
					pageHeader();
					pageCaption();
					pageBody();
				}
				return true;
			}
			
			function stylesheet(){
				with(WireFrame.styles){
					objContainer();
					pageHeader();
					pageCaption();
					pageBody();
				}
			}
		}//ClsDescon.interfaceStructure()->processor() ends here...
		
		processor();
	},//ClsDescon.interfaceStructure() ends here...
	
	processMenuItem:function(menuItem,workspace){
		$cat('.menu-item').css('background','none');
		menuItem.css('background','url('+this.imageDir+'template-3.png)');
		
		switch(menuItem.text()){
			case 'customers and projects': new ClsCustomersAndProjects(workspace); break;
			case 'electrical': workspace.html('new ClsElectrical() for the electrical department. coming soon...'); break;
			case 'layout': workspace.html('new ClsLayout() for the layout department. coming soon...'); break;
			case 'mechanical': workspace.html('new ClsMechanical() for the mechanical department. coming soon...'); break;
			case 'admin': workspace.html('new ClsAdmin() for the admin department. coming soon...'); break;
		}
	}//ClsDescon.processMenuItem() ends here...
});//ClsDescon ends here...