<div id="content">
    <div class="left span-630">
        <h1>{$game.title|escape:'html'}</h1>
        <div id="player">{if !$is_friend}This game is private! You must be friends with <a href="{$relative}/users/{$game.username}">{$game.username}</a> to play it!{/if}</div>
        {if $is_friend}
        <script type='text/javascript' src="{$relative_tpl}/js/swfobject.js"></script>
        <script type='text/javascript'>
        var s1 = new SWFObject('{$relative}/media/games/swf/{$game.GID}.swf','player','630','500','9');
        s1.addParam('allowfullscreen','true');
        s1.addParam('allowscriptaccess','always');
        s1.write('player');
        </script>
        {/if}
        <div class="video_actions">
            <div class="video_rating">
                <input name="current_rating" type="hidden" value="{$game.rate}" id="current_rating" />
                <div id="rating">
                    {insert name=rating assign=game_rating rating=$game.rate ratedby=$game.ratedby type='game' item_id=$game.GID}
                    {$game_rating}                                        
                </div>
                <div id="rating_text">
                    {$game.ratedby} ratings
                </div>
                <div class="clear"></div>
            </div>
            <div class="video_links">
                {if isset($smarty.session.uid)}
                <div id="flag_game"><a href="#flag_game">Flag</a></div>
                <div id="favorite_game"><a href="#favorite_game" id="favorite_game_{$game.GID}">Favorite</a></div>
                {/if}
                <div id="share_game"><a href="#share_game">Share</a></div>
                <div class="clear_right"></div>
            </div>
            <div class="clear"></div>
        </div>
        <div id="response_message" class="response" style="display: none;"></div>
        <div id="share_game_box" style="display: none;">
            <div class="box">
                
                <div class="btitle"><h2>SHARE GAME</h2></div>
                <div class="blink"><a href="#close_share" id="close_share">close</a></div>
                <div class="clear_right"></div>
                <div id="share_game_response" class="response" style="display: none;"></div>
                <div id="share_game_form">
                    <form name="share_game_form" method="post" action="#share_game">
                    <div class="video_box_left">
                        <div class="separator">
                            From: <br />
                            <input name="from" type="text" value="{if isset($smarty.session.uid)}{if $smarty.session.fname != ''}{$smarty.session.fname}{else}{$smarty.session.username}{/if}{/if}" maxlength="50" id="share_from" /><br />
                            <span id="share_from_error" class="font-11 font-bold" style="color: red; display: none;"></span>
                        </div>
                        <div class="separator">
                            To: <br />
                            <textarea name="to" cols="30" rows="5" id="share_to"></textarea><br />
                            <span id="share_to_error" class="font-11 font-bold" style="color: red; display: none;"><br /></span>
                            <span class="font-11">Enter E-mails or {$site_name} usernames<br />comma or space separated).</span>
                        </div>
                    </div>
                    <div class="video_box_right">
                        <div class="separator">
                            Message (optional):
                            <textarea name="message" cols="30" rows="8" id="share_message"></textarea>
                        </div>
                    </div>
                    <div class="clear"></div>
                    <div style="width: 100%; text-align: center; padding-bottom: 5px;">
                        <input name="submit_share" type="button" value=" Share Game " id="send_share_game_{$game.GID}" class="button" />
                    </div>
                    </form>
                </div>
            </div>
        </div>
        {if isset($smarty.session.uid)}
        <div id="flag_game_box" style="display: none;">
            <div class="box">
                
                <div class="btitle"><h2>FLAG GAME</h2></div>
                <div class="blink"><a href="#close_flag" id="close_flag">close</a></div>
                <div class="clear_right"></div>
                <div id="flag_game_response" class="posting" style="display: none;"></div>
                <div id="flag_game_form">
                    <div class="video_box_left">
                        <input name="flag_reason" type="radio" value="inappropriate" checked="yes" />&nbsp; Inappropriate (rape, incest, etc.)<br />
                        <input name="flag_reason" type="radio" value="underage" />&nbsp; Underage<br />
                        <input name="flag_reason" type="radio" value="copyrighted" />&nbsp; Copyrighted Material<br />
                        <input name="flag_reason" type="radio" value="not_playing" />&nbsp; Video Not Playing<br />
                        <input name="flag_reason" type="radio" value="other" />&nbsp; Other<br />
                        <span id="flag_reason_error" class="font-11 font-bold" style="color: red; display: none;"></span>
                    </div>
                    <div class="video_box_right">
                        <div class="separator">
                            Reason (optional):<br />
                            <textarea name="flag_message" cols="30" rows="4" id="flag_message"></textarea>
                        </div>
                    </div>
                    <div class="clear"></div>
                    <div style="width: 100%; text-align: center; padding-bottom: 5px;">
                        <input name="submit_flag" type="button" value=" Flag Game " id="submit_flag_game_{$game.GID}" class="button" />
                    </div>
                </div>
            </div>
        </div>
        {/if}
        <div class="video_info">
            <div class="video_username">
                From: <a href="{$relative}/user/{$game.username}">{$game.username}</a><br />
            </div>
            <div class="video_views">
                {$game.total_plays} plays
            </div>
            <div class="clear"></div>
            <div class="video_tags" id="video_tags">
                Tags:
                {assign var='keywords' value=$game.tags}
                {section name=i loop=$keywords}
                <a href="{$relative}/search?search_query={$keywords[i]}&search_type=games">{$keywords[i]}</a>,
                {/section}
            </div>
            <div class="video_addtime">
                {insert name=time_range assign=addtime time=$game.addtime}
                {$addtime}
            </div>
            <div class="clear"></div>
        </div>
    </div>
    <div class="right span-320">
        {insert name=adv assign=adv group='game_right'}
        {if $adv}<br /><div class="ads">{$adv}</div><br />{/if}
        {insert name=adv assign=adv group='game_right_second'}
        {if $adv}<br /><div class="ads">{$adv}</div><br />{/if}
    </div>
    <div class="clear"></div>
    <div class="box">
        
        <div class="bmenu">
            <div class="bmenul">
                <h2>
                    <a href="#related_games" id="show_related_games">RELATED GAMES ({$games_total})</a> <strong>&middot;</strong>
                    <a href="#comments" id="show_comments">COMMENTS ({$comments_total})</a>
                </h2>
            </div>
            <div class="bmenur">
                <div class="center_related" style="display: none;"><img src="{$relative_tpl}/images/ajax_loader_bar.gif" alt="Ajax Loader" /></div>
            </div>
            <div class="clear"></div>
        </div>
        <div id="related_games">
            {if $games}
            <input name="current_page_related_games" type="hidden" value="1" id="current_page_related_games" />
            <div class="bar_space_related_left">
                <a href="#prev_related_games" id="prev_related_games_{$game.GID}" class="prev_bar_related" style="display: none;"></a>
            </div>
            <div id="related_games_container">
            {section name=i loop=$games}
            <div class="video_box_related">
                <a href="{$relative}/game/{$games[i].GID}/{$games[i].title|clean}"><span class="font-13 font-bold">{$games[i].title|truncate:20:' ...':true|escape:'html'}</span><br /><img src="{$relative}/media/games/tmb/{$games[i].GID}.jpg" title="{$games[i].title|escape:'html'}" alt="{$games[i].title|escape:'html'}" width="160" /><br />{if $games[i].type == 'private'}<img alt="" style="position: absolute; left: 0px; top: +15px; width: 160px; height: 120px;" src="{$relative_tpl}/images/private-video.png"/>{/if}</a>
                <div class="vbox_rel_left">
                    {insert name=time_range assign=addtime time=$games[i].addtime}
                    {$addtime}
                </div>
                <div class="vbox_rel_right">
                    {insert name=rating_small assign=game_rating rating=$games[i].rate}
                    {$game_rating}
                    <div class="clear_right"></div>
                    {$games[i].total_plays} plays
                </div>
                <div class="clear"></div>                                                                                                                                                                                                                                                                
            </div>
            {/section}
            </div>
            <div class="bar_space_related_right">
                <a href="#next_related_games" id="next_related_games_{$game.GID}" class="next_bar_related"></a>
            </div>
            <div class="clear"></div>
            {else}
            <div class="no_comments">No related games found!</div>
            {/if}
            <br />
        </div>
        <div id="game_comments" style="display: none;">
            {if isset($smarty.session.uid) && $game_comments == '1'}
            <div id="post_comment">
                <form name="postGameComment" id="postGameComment" method="post" action="#">
                    <textarea name="game_comment" id="game_comment" cols="100" rows="5" class="game_comment"></textarea>
                    <div id="post_message" class="post_message" style="display: none;">Please enter your comment!</div>
                    <div class="action" id="chars_left">1000 characters left</div>
                    <div class="action">
                        <input name="submit_comment" type="button" value=" Post " id="post_game_comment_{$game.GID}" class="button" />
                    </div>
                    <div class="clear_left"></div>
                </form>
                <div id="game_response" class="response" style="display: none;"></div>
            </div>
            {/if}
            <div id="game_comments_{$game.GID}">
                <div class="blinkp">
                    Showing <span>{$start_num}</span> to <span>{$end_num}</span> of <span>{$comments_total}</span> comments.
                </div>
                <div class="pagination"><ul>{$page_link_comments}</ul></div>
                <div id="comments_delimiter" style="display:none;"></div>
                {if $comments}
                {section name=i loop=$comments}
                <div id="game_comment_{$game.GID}_{$comments[i].CID}">
                <div id="delete_response_{$comments[i].CID}" class="response" style="display: none;"></div>
                    <div class="comment">
                        <div class="comment_left">
                            <a href="{$relative}/user/{$comments[i].username}"><img src="{$relative}/media/users/{if $comments[i].photo != ''}{$comments[i].photo}{else}nopic.gif{/if}" width="60" title="{$comments[i].username}'s avatar" alt="{$comments[i].username}'s avatar" /></a>
                        </div>
                        <div class="comment_right_video">
                            <div class="comment_info_video">
                                {insert name=time_range assign=addtime time=$comments[i].addtime}
                                <a href="{$relative}/user/{$comments[i].username}">{$comments[i].username}</a>&nbsp;<strong>-</strong>&nbsp;<span class="font-10">{$addtime}</span>
                            </div>
                            <p class="comment_body_video">{$comments[i].comment|escape:'html'|nl2br}</p>
                            {if isset($smarty.session.uid)}
                            <div class="comment_actions_video">
                                {if $smarty.session.uid == $comments[i].UID}
                                <a href="#delete_comment" id="delete_comment_game_{$comments[i].CID}_{$game.GID}">Delete</a> <strong>&middot;</strong>
                                {/if}
                                <span id="reported_spam_{$comments[i].CID}_{$game.GID}"><a href="#report_spam" id="report_spam_game_{$comments[i].CID}_{$game.GID}">Report Spam</a></span>
                            </div>
                            {/if}
                        </div>
                        <div class="clear"></div>
                    </div>
                </div>
                {/section}
                <div class="pagination"><ul>{$page_link_comments_bottom}</ul></div>
                {else}
                <div class="no_comments">No comments yet. Be first to comment!</div>
                {/if}
            </div>
            <br />
        </div>
    </div>
    <div class="span-100">
        <div class="box">
    {insert name=adv assign=adv group='game_bottom'}
    {if $adv}<br /><div class="ads">{$adv}</div><br />{/if}
        </div>
    </div>
</div>
