<?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="init();">
    
    <fx:Script><![CDATA[
        import com.google.maps.*;
        import com.google.maps.overlays.GroundOverlay;
        import com.sharewithagent.map.MapMarker;
        
        private function init():void {
            arrow.top = Math.ceil(infoPopupContent.height)-1;
            infoPopupContent.top = -(infoPopupContent.height+arrow.height+19);
            arrow.top = infoPopupContent.top + infoPopupContent.height - 1;
            closeButton.buttonMode = true;
            closeButton.addEventListener(MouseEvent.CLICK, function():void {
                visible = false;
            });
        }
        
        public function show(agent:Object, marker:MapMarker, map:Map):void {
            nameField.text = agent.firstName + " " + agent.lastName;
            address.text = agent.address;
            cityZip.text = agent.city + ", "+agent.state+" "+agent.zip;
            phone.text = agent.phoneNumber;
        }
        
    ]]></fx:Script>
    
    <s:Group id="infoPopupContent" width="200" left="-30">
        <s:Rect width="100%" height="100%" radiusX="5">
            <s:fill>
                <s:SolidColor color="0" alpha="1" />
            </s:fill>
            <s:stroke>
                <s:SolidColorStroke color="0xFFFFFF" alpha="0.85" />
            </s:stroke>
            <s:filters>
                <s:DropShadowFilter alpha=".3" color="0" distance="0" blurX="15" blurY="15" />
            </s:filters>
        </s:Rect>
        
        <s:VGroup paddingBottom="15" paddingLeft="15" paddingRight="15" paddingTop="15">
            <s:Label width="100%" color="0xFFFFFF" id="nameField">Milton Rodriguez</s:Label>
            <s:Label lineHeight="14" width="180" color="0xFFFFFF" id="address">752 W 36th St</s:Label>
            <s:Label width="100%" color="0xFFFFFF" id="cityZip">Chicago, IL 60616</s:Label>
            <s:Label width="100%" color="0xFFFFFF" id="phone">(733) 247-2900</s:Label>
        </s:VGroup>
        <mx:Image id="closeButton" top="-10" left="180" source="@Embed('/com/afi/estimator/assets/images/small-close-button.png')" />
    </s:Group>
    
    <s:Group id="arrow" top="0" left="-12">
        <s:Path data="M -1 -1 L 20 20 L 20 -1 Z">
            <s:fill>
                <s:SolidColor color="0" alpha="1" />
            </s:fill>
        </s:Path>
        
        <s:Line xFrom="-1" xTo="20" yFrom="0" yTo="20">
            <s:stroke>
                <s:SolidColorStroke color="0xFFFFFF" weight="1" />
            </s:stroke>
        </s:Line>
        
        <s:Line xFrom="20" xTo="20" yFrom="20" yTo="0" left="20">
            <s:stroke>
                <s:SolidColorStroke color="0xFFFFFF" weight="1" />
            </s:stroke>
        </s:Line>
    </s:Group>
    
</s:Group>