{include file="$gentemplates/$header_tpl"}

{if $form.upload_type eq 'f'}
	<script language="JavaScript" type="text/javascript" src="{$site_root}{$template_root}/js/class.gallery.js"></script>
	{literal}
		<script>
			$(document).ready(function(){
				gallery = new gallery({
					id: 'gallery_ajax',
					url: SERVER+'/ajax_backend.php',
					gallery_url: SERVER+'/gallary.php',
					button_title: '{/literal}{$lang.button.view_more}{literal}',
					load_on_scroll: 1,
					id_category: '{/literal}{$category.id}{literal}'
				});
				gallery.init().loadLines();
			});
		</script>
	{/literal}
{/if}

<div class="profile_general_table">
{strip}
	
	<div style="margin: 0px; padding: 7px;">
		<h3 class="p-b5">
			{if $form.from_search}
				{$lang.button.search}
			{else}
				{if $form.upload_type eq 'v'}{$lang.gallary.videos_in}{else}{$lang.gallary.photos_in}{/if}&nbsp;{$category.name}
			{/if}
			
			<span class="gallery_icon_container">
			{if $form.upload_type eq 'v'}
				<span class="add_video_icon_cat">
					<ins onclick="javascript:location.href='{$site_root}/{$seo.myprofile}?sel=4&sub=8';" class="video-icon gallary_sub_icon" title="{$lang.gallary.my_videos}">&nbsp;</ins>
				</span>
			{/if}
			
			{if $form.upload_type eq 'f'}
				<span class="add_video_icon_cat">
					<ins onclick="javascript:location.href='{$site_root}/{$seo.myprofile}?sel=4&sub=8';" class="photo-icon gallary_sub_icon" title="{$lang.gallary.my_photos}">&nbsp;</ins>
				</span>
			{/if}
			
			{if $group_adult_allow}
				<span class="adult_gallery_check_span float_right">
					<label for="adult_content_check">{$lang.adult_content_check}</label>&nbsp;&nbsp;
					<input id="adult_content_check" type="checkbox" {if $user_adult_allow}checked{/if} onclick="changeAdultAllow(this, {literal}function(resp){if(resp.status == 1){location.reload();}}{/literal})" />
				</span>
			{/if}
			</span>
		</h3>
		
		{if $form.from_search}
			<div>
				<form class="gallery_search_form" method="POST" action="{$server}/{$seo.gallery}">
					<input type="hidden" name="upload_type" value="{$form.upload_type}" />
					<input type="hidden" name="id_category" value="{$form.id_category}" />
					<input type="hidden" name="sel" value="search" />
					<input type="text" name="search_kw" value="{$form.search_kw}" placeholder="{$lang.gallary.keyword}" />
					<input type="submit" value="{$lang.button.search}" />
				</form>
			</div>
		{/if}

		{if $form.upload_type eq 'f'}
			<div id="gallery_ajax" class="photo_gallery_cont"></div>
		{else}
			<div style="overflow:hidden;">
				{section name=s loop=$uploads}
				<div class="float_left gallery_video_item" style="padding: 8px;">
					<div>
						<a class="imgcanvas_container" {if $uploads[s].is_adult}href="javascript:void(0);" onclick="launchWindow('{$uploads[s].view_link}','',800,580);"{else}href="{$uploads[s].view_link}"{/if}>						
							{if $uploads[s].upload_path eq 'default'} 
								<div class="one_video_icon"></div>
							{else}
								<img class="imgcanvas" src="{$uploads[s].upload_path}" border="0" class="icon" alt="">
							{/if}
						</a>
					</div>
					<div style="padding-top: 3px;">
						{if $uploads[s].upload_title}<div class="text-overflow">{$uploads[s].upload_title}</div>{/if}
						<div class="text-overflow">
							<span>{$lang.gallary.author}:&nbsp;</span>
							<a href="{$uploads[s].profile_link}" target="_blank">{$uploads[s].author_login}</a>
						</div>					
						<div class="text-overflow">
							<span>{$lang.gallary.views}:&nbsp;{$uploads[s].views}</span>
						</div>
					</div>
				</div>
				{/section}
			</div>
		{/if}
	</div>	
		
	{if $form.upload_type ne 'f'}
		<div style="overflow: hidden; padding-top: 10px;">
			<div class="float_right">
				{include file="$gentemplates/pager.tpl"}				
			</div>		
		</div>
	{/if}
</div>
{/strip}
{include file="$gentemplates/$footer_tpl"}