Ext.ns('HMM', 'HMM.data', 'HMM.form', 'HMM.bag', 'HMM.window');

HMM.bag.colors = {light:'#fdf1de', dark:'#392d2a'};

HMM.window.oElecPost = {
	theAt:String.fromCharCode(63+1),
	domain:'hmpc',
	dot:String.fromCharCode(46),
	type:'com',
	doit: function(user){
		var mwin = window.open('mailto:'+this.getAddress(user), 'mailiwndow');
				if(mwin){
					mwin.close();
				}
		return true;
	},
	getAddress:function(user){
		return user + this.theAt + this.domain + this.dot + this.type;
	}
};


HMM.bag.footer = new Ext.Panel({
//	x:470,
  y:720,
	height:35,
	width :820,
	id:'pnlFooter',
	layout :'column',
	border :false,
	frame  :false,
	bodyStyle:{
		background:'transparent none no-repeat scroll 0 0'
	},
	style:{
	 'margin-top':20,
	  position:'absolute'
	},
	defaults:{
   bodyStyle: {
	 	background:'transparent none no-repeat scroll 0 0'
	},
		style:{
			'padding-left':20,
			'padding-right':10,
			'text-align':'center'
		}
	},
	items:[{
		border:false,
		cls: 'footer',
		columnWidth:0.5,
		html:'<div class="footer">&copy;2009. Huselton, Morgan & Maultsby, P.C.</div>'
	},{
		border:false,
		cls: 'footer',
		columnWidth:0.5,
		html:'<div id="privacy-notice" ext:qtip="Click to Read Privacy Notice." ext:qwidth="150" ext:qclass="qtclass" class="footer">Huselton, Morgan & Maultsby, P.C. Privacy Notice</div>'
	}]
});

var privacyText  = "<p class='privacy bold centered'>Huselton, Morgan & Maultsby, P.C. Privacy and Disclaimer Policy</p>";
    privacyText += "<p class='privacy bold'>Disclaimer Of Liability And Reliability</p>";
    privacyText += "<p class='privacy'>In preparation of the Huselton, Morgan & Maultsby, P.C. (HM&amp;M) website, every effort has been made to offer the most current, correct, and clearly expressed information possible. Nevertheless, inadvertent errors in information may occur. In particular but without limiting anything here, HM&amp;M disclaims any responsibility for typographical errors and accuracy of the information that may be contained on HM&amp;M webpage. The information and data included on HM&amp;M webpage have been compiled by staff from a variety of sources, and are subject to change without notice to the User. HM&amp;M makes no warranties or representations whatsoever regarding the quality, content, completeness, suitability, adequacy, sequence, accuracy, or timeliness of such information and data.</p>";
    privacyText += "<p class='privacy'>In any situation where the official printed publications of HM&amp;M differ from the text contained in this system, the official printed documents take precedence. The services, information, and data made available at the HM&amp;M website are provided 'as is' without warranties of any kind. HM&amp;M makes no representations or warranties regarding the condition or functionality of this Web site, its suitability for use, or that this Web Service will be uninterrupted or error-free.  To the fullest extent permissible pursuant to applicable law, HM&amp;M disclaims all warranties, express or implied.</p>";
    privacyText += "<p class='privacy'>If misleading, inaccurate or otherwise inappropriate information is brought to our attention, a reasonable effort will be made to fix or remove it.</p>";
    privacyText += "<p class='privacy'>The information presented on the HM&amp;M webpage should not be construed as legal, tax, accounting, or any other professional advice or service.  You should consult with Huselton, Morgan & Maultsby, P.C. or other professional advisors familiar with your particular factual situation for advice concerning specific tax or other matters before making any decision.  You should not send confidential information to HM&amp;M until you have received agreement from the firm to perform the services you have requested.</p>";
    privacyText += "<p class='privacy'>The HM&amp;M webpage provide links to services maintained by individuals or organizations over which HM&amp;M has no control.  HM&amp;M makes no representations or warranties regarding the accuracy or any other aspect of the information located on such servers.</p>";
    privacyText += "<p class='privacy bold'>RSS feeds and Podcasting - Terms of Use</p>";
    privacyText += "<p class='privacy'>RSS feeds are free services offered by HM&amp;M to individuals for private, non-commercial use.  The HM&amp;M RSS feed is a means by which HM&amp;M offers article headlines, descriptions and links in XML to individuals who use RSS readers or aggregators.  RSS aggregators may incorporate HM&amp;M feeds into their directories for the benefit of individuals using the aggregator.  Any other use is prohibited, including copying, reproducing, republishing, uploading, posting, transmitting, or distributing our feeds in any way by any means.  HM&amp;M reserves the right to discontinue our feeds at any time.</p>";
    privacyText += "<p class='privacy bold'>Limitation of Liability</p>";
    privacyText += "<p class='privacy'>IN NO EVENT WILL HUSELTON, MORGAN &AMP; MAULTSBY, P.C., ITS AFFILIATES, AGENTS, SUPPLIERS, OR OTHER THIRD PARTIES MENTIONED IN THIS WEBPAGE BE LIABLE FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION, DAMAGES RESULTING FROM LOST PROFITS, LOSS OF PROSPECTIVE ECONOMIC ADVANTAGE, LOST DATA OR BUSINESS INTERRUPTION) RESULTING OR ARISING FROM USE, INABILITY TO USE, OR THE RESULTS OF USE OF THIS WEBPAGE, ANY WEBPAGES LINKED TO THIS WEBPAGE, OR THE CONTENT CONTAINED ON ANY OR ALL SUCH WEBPAGES, WHETHER BASED ON WARRANTY, CONTRACT, TORT (INCLUDING, BUT NOT LIMITED TO, NEGLIGENCE), OR ANY OTHER LEGAL THEORY AND WHETHER OR NOT ADVISED OF THE POSSIBILITY OF SUCH DAMAGES, OR FOR ANY CLAIM BY ANOTHER PARTY. IF YOUR USE OF THE CONTENT ON THIS SITE RESULTS IN THE NEED FOR SERVICING, REPAIR OR CORRECTION OF EQUIPMENT OR DATA, YOU ASSUME ALL COSTS THEREOF.</p>";
    

  
HMM.window.privacy = new Ext.Window({
	x:286,
	y:131,
	width :620,
	height:620,
	modal:true,
	constrain:true,
	html:privacyText,
	bodyStyle: 'padding:10px; background-color:#fdf1de; overflow-y:auto;',
	title:'Huselton, Morgan & Maultsby, P.C. PRIVACY POLICY',
	bbar: ['-','->',{
		  text:'Close', 
			handler:function(){
				this.findParentByType('window').hide();
			}
		},'-']
});




Ext.onReady(function(){
Ext.QuickTips.init();

	var pageCtl = function(){
	  var dh = Ext.DomHelper;
	  var da = Ext.get('data-area'); 
	  var oDom = Ext.getDoc().dom;
	  var strTitle = oDom.title;
	  var strTitlePrefix = 'Welcome to Huselton, Morgan & Maultsby - ';
	
	  function setPageTitle(){
	    if(strTitle.indexOf('&') == -1){
	      oDom.title = strTitlePrefix + strTitle;
	    }
	  }
	  
		function setSectionHeader(){
			try{
				if(strTitle.indexOf('Welcome') == -1){
    			dh.insertBefore('data-area',{ tag:'div', cls:'centered', children:[{tag:'img', src:'images/sub-header/' + strTitle.split(' ')[0].toLowerCase() + '.png'}]});
				}
			}
			catch(e){
				console.log(e.message);
			}

		}
		
	  function setFooter(){
	    if(da){
	     var t = dh.append('data-area',{tag: 'div', id:'footer'});
	      HMM.bag.footer.render(t);
	    }
	  }
	  
	  return {
	    setup:function(){
	      setPageTitle();
				setSectionHeader();
	      setFooter();
	    }
	  }
	  
	}();

pageCtl.setup();

var privacy = Ext.get('privacy-notice').addListener('click', function(e, el, o){
  HMM.window.privacy.show();
});

    
});
