<?xml version="1.0" encoding="utf-8"?>
<s:Group xmlns:fx="http://ns.adobe.com/mxml/2009"
         xmlns:s="library://ns.adobe.com/flex/spark"
         xmlns:mx="library://ns.adobe.com/flex/mx"
         creationComplete="creationComplete()"  accessibilityEnabled="true"
         xmlns:shell="com.afi.estimator.views.shell.*"
         xmlns:paging="com.afi.estimator.views.paging.*">
    
    <fx:Declarations>
        
    </fx:Declarations>
    
    
    <fx:Script>
        <![CDATA[
            import com.afi.estimator.model.ContactModel;
            import com.afi.estimator.model.Model;
            import com.afi.estimator.model.PagesModel;
            import com.afi.estimator.model.State;
            import com.afi.estimator.views.paging.*;
            import com.afi.estimator.views.shell.*;
            import com.tracking.TrackingManager;
            
            import spark.components.Application;
            
            public static var instance:View;
            
            public var nextprevious:NextPrevious;
            public var footer:com.afi.estimator.views.shell.footer;
            public var backgrnd:background;
            public var head:header;
            
            [Bindable]private var state:State = Model.instance.state;
            
            private var trackingXML:XML;
            
            private function creationComplete():void {
                state.view = this;
                View.instance = this;
                if(ContactModel.instance == null) new ContactModel();
                var loader:URLLoader = new URLLoader(new URLRequest('com/afi/estimator/assets/xml/tracking.xml'));
                loader.addEventListener(Event.COMPLETE, onLoadTracking);
            }
            
            private function onLoadTracking(e:Event):void
            {
                trackingXML = XML(e.target.data);
                TrackingManager.getInstance().init(trackingXML,this);
                backgrnd= new background();
                //PagesModel.bg.id = "backGround";
                //bg.anim.play();
                addElement(backgrnd);
                
                addElement(new body());
                head = new header();
                addElement(head);
                
                footer = new com.afi.estimator.views.shell.footer();
                footer.bottom = 0;
                addElement(footer);
                
                nextprevious = new NextPrevious();
                nextprevious.bottom = 100;
                addElement(nextprevious);
            }
        ]]>
    </fx:Script>
    
</s:Group>