<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:t="http://www.participatorypolitics.org/"
      xmlns:i18n="http://www.participatoryculture.org/i18n"
      eventCookie="@@@eventCookie@@@" dtvPlatform="@@@dtvPlatform@@@">

    <head>
        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
        <link href="resource:css/main.css" rel="stylesheet" type="text/css" />
        <t:include filename="dynamic.js" />
        <script type="text/javascript" src="resource:templates/search.js" />

    <t:execOnLoad><![CDATA[
searchFeed = views.feeds.filterWithIndex(indexes.feedsByURL, 'dtv:search')
feed = searchFeed[0]

searchItems = views.items.filterWithIndex(indexes.itemsByFeed, feed.getID())


]]>
    </t:execOnLoad>

    </head>

    <body>
        <div id="main-titlebar">
        	<div id="main-titlebar-avatar" style="border:0px;"><img src="resource:images/search-icon.png" /></div>
        	<div id="main-titlebar-channelname">
        		<h1 i18n:translate="">Video Search</h1>
        	</div>
        	<div id="main-titlebar-tasks" style="width:100%; text-align:center;">
                <form name="search" onsubmit="return false;">
                    <select name="engines" onChange="updateLastSearchEngine()">
                        <option t:hideIf="not feed.lastEngine == 'yahoo'" value="yahoo" selected="selected">Yahoo!</option>
                        <option t:hideIf="feed.lastEngine == 'yahoo'" value="yahoo">Yahoo!</option>
                        <option t:hideIf="not feed.lastEngine == 'blogdigger'" selected="selected" value="blogdigger">Blogdigger</option>
                        <option t:hideIf="feed.lastEngine == 'blogdigger'" value="blogdigger">Blogdigger</option>
                    </select>
                    <input type="search" name="query" value="@@@feed.lastQuery@@@" placeholder="" 
                           class="main-titlebar-tasks-search" style="margin:35px 55px 0px 0px; width:200px; font-size: 120%;" 
                           onKeyUp="fillSearch()" onKeyPress="validateSearch(event)" />
                </form>
        	</div>
        </div>

        <div id="main-container">
            <div t:updateForView="searchFeed">
                <div class="search-message" t:hideIf="feed.getStatus() != 'idle-empty'">
                    <span i18n:translate="">Nothing to display.<br />
                    Enter a query in the search field above.</span>
                </div>
                <div class="search-message" t:hideIf="feed.getStatus() != 'searching'">
                    <span i18n:translate="">Searching...</span>
                </div>
            </div>
            
            <div id="search-results">
                <span t:repeatForView="searchItems">
                    <t:includeTemplate filename="download-item" />
                </span>
            </div>
        </div>
    </body>

</html>
