<Popup>
	<ViewController>
		<View	Name		=	"PopupStock"
				Type		=	"PopupView"
				WindowTitle	=	"AOL Communicator Stock Details"
				Caption		=	"yes"
				Width		=	"582"
				Height		=	"488"
				>
			<Layout lf="popupstock.lyt" default="yes" gf="http" xv="1" r="t"/>

			<ChildViews>
				<View Type="PopupButtonChrome" Name="ChildButtonChrome" Container="ButtonChrome"/>
			</ChildViews>

			<StartAction>
				<InitAction/>
			</StartAction>

			<XMLEventSubscription Name="PersFetchXML"/>

			<XMLGlyphs>
				<Glyph Name="Details"/>
			</XMLGlyphs>

			<ViewActions>
				<ViewAction Name="InitAction">
					<GlyphCommand Glyph="Details">
						<Open path="[@$exe_dir$]details\details.swf"/>
					</GlyphCommand>

					<xsl:choose>
						<xsl:when expr="[[@$smartscreen$] $eq$ y]">
							<Symbol Name="$ss_stockpopup$" Value="T" />
						</xsl:when>
						<xsl:otherwise>
							<Symbol Name="$ss_stockpopup$" Value="F" />
						</xsl:otherwise>
					</xsl:choose>

				</ViewAction>
				
				<ViewAction Name="GetDetailsItem">
					<GlyphCommand Glyph="Details" >
						<Commands>
							<WaitForVariable Var="xmlChanged" Value="0"/>
							<SetXML Var="xmlData" Expand="yes" >
								<Data mode="DetailsItem">
									<DetailsItem OpenTo="[@$details_type$]" />
								</Data>
							</SetXML>
							<SetVar Var="xmlChanged" Value="1"/>
						</Commands>
					</GlyphCommand>
				</ViewAction>

				<ViewAction Name="OpenTo" >
					<DbgMsg Msg="OpenTo [@Type]" />
					<Symbol Name="$details_type$" Value="@Type" />
					<GetDetailsItem />
				</ViewAction>

				<ViewAction Name="GetTree">
					<DbgMsg Msg="[Main]: GetTree([@id])" />
					<SetTable XR="Details">
						<MetaQuery>
							<Commands>
								<WaitForVariable Var="xmlChanged" Value="0"/>
								<SetXML Var="xmlData" Expand="yes" >
									<Data mode="Tree">
										<Query Model="OTModel" Get="TreeCount" />
									</Data>
								</SetXML>
								<SetVar Var="xmlChanged" Value="1"/>
							</Commands>
						</MetaQuery>
					</SetTable>
				</ViewAction>

				<ViewAction Name="GetContent">
					<DbgMsg Msg="[@mode]: GetContent([@id])" />
					<SetTable XR="Details">
						<MetaQuery>
							<Commands>
								<WaitForVariable Var="xmlChanged" Value="0"/>
								<SetXML Var="xmlData" Expand="yes" >
									<Data mode="@mode">
										<xsl:choose>
											<xsl:when expr="[@type $eq$ Tree]">
												<Query Model="OTModel" Get="Tree" />
											</xsl:when>
											<xsl:when expr="[@type $eq$ Subtree]">
												<Query Model="OTModel" Get="Tree" Id="@id"/>
											</xsl:when>
											<xsl:when expr="[@id $eq$ tc_netwatch_any_keys]">
												<Query Model="OTModel" Get="Loc" Flat="yes" Id="@id" Sort="MODIFY_TIMET" Max="5"/>
											</xsl:when>
											<xsl:when expr="[@id $eq$ tc_sports_photo]">
												<Query Model="OTModel" Get="Loc" Id="@id" Max="8" />
											</xsl:when>
											<xsl:when expr="[@id $eq$ tc_scores]">
												<Query Model="OTModel" Get="Loc" Flat="yes" Id="@id" Sort="MODIFY_TIMET" Max="40"/>
											</xsl:when>
											<xsl:when expr="[@id $eq$ sc_photos]">
												<Query Model="OTModel" Get="Loc" Id="@id" Max="20" />
											</xsl:when>
											<xsl:when expr="[@id $contains$ tc_games_]">
												<Query Model="OTModel" Get="Loc" Age="24" Id="@id" />
											</xsl:when>
											<xsl:when expr="[@id $contains$ tc_sports_]">
												<Query Model="OTModel" Get="Loc" Age="48" Id="@id" />
											</xsl:when>
											<xsl:when expr="[@id $eq$ tc_usnews]">
												<Query Model="OTModel" Get="Loc" Age="24" Id="@id" />
											</xsl:when>
											<xsl:when expr="[@id $eq$ tc_worldnews]">
												<Query Model="OTModel" Get="Loc" Age="24" Id="@id" />
											</xsl:when>
											<xsl:when expr="[@id $eq$ tc_mkt_news]">
												<Query Model="OTModel" Get="Loc" Age="24" Id="@id" />
											</xsl:when>
											<xsl:when expr="[@id $eq$ tc_weather_summary]">
												<Query Model="OTModel" Get="Loc" Age="24" Id="@id" />
											</xsl:when>
											<xsl:when expr="[@id $eq$ tc_alertswatcher]">
												<Query Model="OTModel" Get="Loc" Flat="yes" Id="sc_alerts" Sort="MODIFY_TIMET" Max="100"/>
											</xsl:when>
											<xsl:when expr="[@id $eq$ sc_portfolios]">
												<Query Model="OTModel" Get="Loc" Flat="yes" Id="sc_portfolios" Sort="MODIFY_TIMET" Max="100"/>
											</xsl:when>
											<xsl:when expr="[@id $eq$ mail_buddies]">
												<Query Model="PhotonModel" />
											</xsl:when>
											<xsl:when expr="[@id $eq$ screenname]">
												<Result Screenname="[@$user$]" />
											</xsl:when>
											<xsl:otherwise>
												<Query Model="OTModel" Get="Loc" Id="@id" />
											</xsl:otherwise>
										</xsl:choose>
									</Data>
								</SetXML>
								<SetVar Var="xmlChanged" Value="1"/>
							</Commands>
						</MetaQuery>
					</SetTable>
				</ViewAction>

				<ViewAction Name="ShowBrowser">
					<g-ShowBrowser URL="@URL"/>
				</ViewAction>

				<ViewAction Name="search">
					<g-ShowURL URL="http://search.aol.com/search?invocationType=communicator&query=[@string]"/>
				</ViewAction>

				<ViewAction Name="ShowURL" SaveHistory="Details">
					<Action Type="ShowPopup" Popup="PopupDetails">
						<ShowURL URL="@URL"/>
					</Action>
				</ViewAction>		

				<ViewAction Name="FetchStock">
					<Action Type="FetchTable">
						<FetchTable Name="PNWFetchStock">
							<FetchItem Name="FetchStock" Url="http://$siteserver$/util/client/stockdata.php?symbol=[@symbol]">
								<FetchHandler Name="XMLEvent" Target="PNWFetchStockDatom" />
							</FetchItem>
						</FetchTable>
					</Action>
				</ViewAction>

				<ViewAction Name="FetchWeather">
					<Action Type="FetchTable">
						<FetchTable Name="PNWFetchStock">
							<FetchItem Name="FetchStock" Url="http://$siteserver$/util/client/weatherdata.php?city=[@city]">
								<FetchHandler Name="XMLEvent" Target="PNWFetchWeatherDatom" />
							</FetchItem>
						</FetchTable>
					</Action>
				</ViewAction>

				<ViewAction Name="PersRequest">
					<g-PersURL URL="@URL"/>
				</ViewAction>

				<ViewAction Name="ShowFloater" >
					<DbgMsg Msg="ShowFloater [@name] x=[@x] y=[@y] w=[@width] h=[@height] url=[@url]"/>
					<DbgMsg Msg="@html" />
					<AddGlyph Container="Details" Subscribe="y">
						<Glyph Type='IEGlyph' Name='@name' ActiveX='{8856F961-340A-11D0-A96B-00C04FD705A2}' Scroll="@scroll"/>
					</AddGlyph>
					<GlyphCommand Glyph="@name">
						<SetRect x="@x" y="@y" width="@width" height="@height" />
						<SetHTML str="@html" />
					</GlyphCommand>
					<ShowGlyph Glyph="@name" />
				</ViewAction>

				<ViewAction Name="HideFloater" >
					<RemoveGlyph Glyph="@name"/>
				</ViewAction>

				<ViewAction Name="ResizeFloater" >
					<GlyphCommand Glyph="@name">
						<SetRect x="@x" y="@y" width="@width" height="@height" />
					</GlyphCommand>
				</ViewAction>

				<ViewAction Name="NavFloater" >
					<GlyphCommand Glyph="@name">
						<Navigate URL="@url"/>
					</GlyphCommand>
				</ViewAction>

				<ViewAction Name="SaveData">
					<DbgMsg Msg="SaveData: [@$user_data$][@name]"/>
					<WriteToFile File="[@$user_data$][@name].xml">
						<xsl:first-child>
							<xsl:copy />
						</xsl:first-child>
					</WriteToFile>
				</ViewAction>

				<ViewAction Name="RetrieveData">
					<DbgMsg Msg="RetrieveData: [@mode] [@name]"/>					
					<SetTable XR="Details">
						<MetaQuery>
							<Commands>
								<WaitForVariable Var="xmlChanged" Value="0"/>
								<SetXML Var="xmlData" Expand="yes" >
									<Data mode="@mode" >
										<Query File="[@$user_data$][@name].xml" />
									</Data>
								</SetXML>
								<SetVar Var="xmlChanged" Value="1"/>
							</Commands>
						</MetaQuery>
					</SetTable>
				</ViewAction>

				<ViewAction Name="FetchXML">
					<Action Type="FetchTable">
						<FetchTable Name="FetchXML">
							<FetchItem Name="FetchStock" Url="@url">
								<FetchHandler Name="XMLEvent" >
									<PersFetchXML mode="@mode"/>
								</FetchHandler>
							</FetchItem>
						</FetchTable>
					</Action>
				</ViewAction>

				<ViewAction Name="PersFetchXML" >
					<GlyphCommand Glyph="Details">
						<Commands>
							<WaitForVariable Var="xmlChanged" Value="0"/>
							<SetXML Var="xmlData" Expand="yes" >
								<Data mode="@mode" >
									<xsl:first-child>
										<xsl:copy />
									</xsl:first-child>
								</Data>
							</SetXML>
							<SetVar Var="xmlChanged" Value="1"/>
						</Commands>
					</GlyphCommand>
				</ViewAction>  

				<ViewAction Name="PersXML">
					<ModelCommand Name="UploadXML">
						<AddBlock Block="Pers">
							<xsl:first-child>
								<xsl:copy />
							</xsl:first-child>
						</AddBlock>
					</ModelCommand>
					<SetTable XR="Details">
						<MetaQuery>
							<Commands>
								<WaitForVariable Var="xmlChanged" Value="0"/>
								<SetXML Var="xmlData" Expand="yes" >
									<Data mode="UploadTest" >
										<Query Model="UploadXML" Action="Get" Block="Pers"/>
									</Data>
								</SetXML>
								<SetVar Var="xmlChanged" Value="1"/>
							</Commands>
						</MetaQuery>
					</SetTable>
					<PersEvent/>
				</ViewAction>

			</ViewActions>
		</View>
	</ViewController>
</Popup>
