<!--- 
  <CF_ShowMovieCallout> Custom Tag
  Retrieves and displays the given film
  
  Example of Use:
  <CF_ShowMovieCallout
    FilmID="5">
--->

<!--- Tag Attributes --->
<!--- FilmID Attribute is Required --->
<CFPARAM NAME="ATTRIBUTES.FilmID" TYPE="numeric">
<!--- Whether to reveal cost/release dates (optional) --->
<CFPARAM NAME="ATTRIBUTES.ShowCost" TYPE="boolean" DEFAULT="Yes">
<CFPARAM NAME="ATTRIBUTES.ShowReleaseDate" TYPE="boolean" DEFAULT="Yes">
<!--- Optional formatting and placement options --->
<CFPARAM NAME="ATTRIBUTES.TableAlign" TYPE="string" DEFAULT="right">
<CFPARAM NAME="ATTRIBUTES.TableWidth" TYPE="string" DEFAULT="150">
<CFPARAM NAME="ATTRIBUTES.Caption" TYPE="string" DEFAULT="Featured Film">
<!--- Use "ows" datasource by default --->
<CFPARAM NAME="ATTRIBUTES.DataSource" TYPE="string" DEFAULT="ows">

<!--- Get important info about film from database --->
<CFQUERY NAME="GetFilm" DATASOURCE="#ATTRIBUTES.DataSource#">
  SELECT 
    MovieTitle, Summary, 
    AmountBudgeted, DateInTheaters
  FROM Films
  WHERE FilmID = #ATTRIBUTES.FilmID#
</CFQUERY>

<!--- Display error message if record not fetched --->
<CFIF GetFilm.RecordCount NEQ 1>
  <CFTHROW 
    MESSAGE="Invalid FilmID Attribute"
    DETAIL="Film #ATTRIBUTES.FilmID# does not exist!">
</CFIF>


<!--- Format a few queried values in local variables --->
<CFSET ProductCost = Ceiling(Val(GetFilm.AmountBudgeted) / 1000000)>
<CFSET ReleaseDate = DateFormat(GetFilm.DateInTheaters, "mmmm d")>

<!--- Now Display The Specified Movie --->
<CFOUTPUT>
  <!--- Define formatting for film display --->
  <STYLE TYPE="text/css">
    TH.fm {background:RoyalBlue;color:white;text-align:left;
           font-family:sans-serif;font-size:10px}
    TD.fm {background:LightSteelBlue;
           font-family:sans-serif;font-size:12px}
  </STYLE>

  <!--- Show info about featured movie in HTML Table --->
  <TABLE 
    WIDTH="#ATTRIBUTES.TableWidth#" 
    ALIGN="#ATTRIBUTES.TableAlign#" 
    BORDER="0" 
    CELLSPACING="0">
    
    <TR><TH CLASS="fm">
      #ATTRIBUTES.Caption#
    </TH></TR>
    <!--- Movie Title, Summary, Rating --->
    <TR><TD CLASS="fm">
      <B>#GetFilm.MovieTitle#</B><BR>
      #GetFilm.Summary#<BR>
    </TD></TR>
    <!--- Cost (rounded to millions), release date --->
    <CFIF ATTRIBUTES.ShowCost OR ATTRIBUTES.ShowReleaseDate>
      <TR><TH CLASS="fm">
        <!--- Show Cost, if called for --->
        <CFIF ATTRIBUTES.ShowCost>
          Production Cost $#ProductCost# Million<BR>
        </CFIF>
        <!--- Show release date, if called for --->
        <CFIF ATTRIBUTES.ShowReleaseDate>
          In Theaters #ReleaseDate#<BR>
        </CFIF>
      </TH></TR>
    </CFIF>
  </TABLE>
  <BR CLEAR="all">
</CFOUTPUT>
