<?xml version="1.0" encoding="utf-8"?>
<ui:TitleForm xmlns:fx="http://ns.adobe.com/mxml/2009" 
              xmlns:s="library://ns.adobe.com/flex/spark" 
              xmlns:mx="library://ns.adobe.com/flex/mx" 
              xmlns:form="com.afi.estimator.views.form.*" 
              xmlns:ui="com.afi.estimator.views.ui.*" creationComplete="init()"
              addedToStage="callTracking()">
    
    <fx:Script>
        <![CDATA[
            import com.afi.estimator.model.EstimatorModel;
            import com.afi.estimator.model.TextModel;
            import com.afi.estimator.views.View;
            import com.afi.estimator.views.shell.header;
            import com.afi.estimator.views.vo.ResultsVO;
            import com.tracking.TrackingManager;
            
            [Bindable]public var pageName:String = "premiumResults";
            
            [Bindable]public var resultVO:ResultsVO = new ResultsVO();
            
            [Bindable]public var columnText1:String;
            
            [Bindable]public var columnText2:String;
            
            public var view:View;
            
            private function callTracking():void{
                TrackingManager.trackOmniture("Your Payout Results");
            }
            
            public function init():void{
                columnText1 = (EstimatorModel.instance.estimatorVO.genderValue? "Male":"Female") + " - " + EstimatorModel.instance.age;
                var nicotine:String = EstimatorModel.instance.estimatorVO.usedNicotineValue? "Nicotine":"Non Nicotine";
                var waiver:String = EstimatorModel.instance.estimatorVO.waiverPremiumValue? "with Waiver":"without Waiver";
                columnText2 = nicotine + " - " + waiver;
                    
                view = this.parentApplication.getElementAt(0) as View;
                view.head.printVisibility = true;
            }
            
        ]]>
    </fx:Script>
    <fx:Declarations>
        <!-- Place non-visual elements (e.g., services, value objects) here -->
        <fx:Number id="padding">50</fx:Number>
        
    </fx:Declarations>
    <s:Label id="formTitle" text="{TextModel.get(pageName).title}" styleName="formTitle" /> 
    
    <s:Group>
        <ui:Formbackground width="500" height="350" />
        
        <s:VGroup id="results" width="406" height="355" accessibilityEnabled="true" paddingTop="{padding}" 
                  paddingBottom="{padding}" paddingLeft="{padding}" paddingRight="{padding}">
            
            <s:VGroup>
                <s:HGroup paddingLeft="10">
                    <s:Label text="{columnText1}" fontSize="14" fontFamily="allerBold" width="100" color="0x86b815"/>
                    <s:Label text="{TextModel.get(pageName).level_10Year}" fontSize="14" fontFamily="allerBold" width="90" color="0x86b815"/>
                    <s:Label text="{TextModel.get(pageName).level_20Year}" fontSize="14" fontFamily="allerBold"  width="90" color="0x86b815"/>
                    <s:Label text="{TextModel.get(pageName).level_30Year}" fontSize="14" fontFamily="allerBold" width="90" color="0x86b815"/>
                </s:HGroup>
                <s:HGroup paddingLeft="10">
                    <s:Label text="{columnText2}" fontSize="14" fontFamily="allerBold" width="100" color="0x86b815"/>
                    <s:Label text="{TextModel.get(pageName).levelTermPremium}" fontSize="14" fontFamily="allerBold" width="90" color="0x86b815"/>
                    <s:Label text="{TextModel.get(pageName).levelTermPremium}" fontSize="14" fontFamily="allerBold"  width="90" color="0x86b815"/>
                    <s:Label text="{TextModel.get(pageName).levelTermPremium}" fontSize="14" fontFamily="allerBold" width="90" color="0x86b815"/>
                </s:HGroup>
                <s:Line xFrom="0" xTo="390">
                    <s:stroke>
                        <s:SolidColorStroke color="0x777777" weight="2" />
                    </s:stroke>
                </s:Line>
                <mx:Spacer height="10" />
                <s:DataGroup id="bby" dataProvider="{EstimatorModel.instance.resultsList}" itemRenderer="com.afi.estimator.views.pages.ResultsRenderer" accessibilityEnabled="true" >
                    <s:layout>
                        <s:VerticalLayout paddingRight="10" />
                    </s:layout>
                </s:DataGroup>
                
            </s:VGroup>
        </s:VGroup>
    </s:Group>
    
    <mx:Spacer height="10" />
    
    <s:VGroup width="500" paddingLeft="10">
        <s:Label text="{TextModel.get(pageName).footer}" width="500" textAlign="left"/> 
    </s:VGroup>
</ui:TitleForm>