{include file="../head.tpl"}
<script language="JavaScript" type="text/javascript">
{literal}
<!--

function redirtodel(area){
	var theid = document.getElementById('thegal').value;
	if(theid!=0){
		var theurl = 'gallery.php?del=1&area=' + area +'&galid=' + theid;
		
		if(confirm('{/literal}{$lang.confirmdelgal}{literal}')){
		
			location.href = theurl;
		}
	} else {
		alert('{/literal}{$lang.pselgal}{literal}');
	}
}

function redirtoedit(area){
	var theid = document.getElementById('thegal').value;
	if(theid!=0){
		var theurl = 'gallery.php?edit=1&area=' + area +'&galid=' + theid;
		location.href = theurl;
	}
}


function multiform_option(mfid,area)
	{
	dothis = 1;
	confirmaction = 0;
		if (mfid == ''){
			return;
		}
		else if (typeof(document.kform.multiform_id) != 'undefined'){
			action = document.kform.controls.options[document.kform.controls.selectedIndex].value;
		}
		else{
			action = eval("document.kform.mf" + mfid + ".options[document.kform.mf" + mfid + ".selectedIndex].value");
		}
		if (action != ''){
			switch (action)
			{	
				case '0': confirmaction = 1; page = "gallery.php?area=" + area + "&del=1&galid="; break;
				case '1': page = "gallery.php?area=" + area + "&subgal=1&galid="; break;
				case '2': page = "gallery.php?area=" + area + "&action=showpics&galid="; break;
				case '3': page = "gallery.php?area=" + area + "&action=newpics&galid="; break;
				case '4': page = "gallery.php?area=" + area + "&edit=1&galid="; break;
				case '5': page = "gallery.php?area=" + area + "&action=showcomments&galid="; break;
				}
			document.kform.reset();
			jumpform = page + mfid;
			if(confirmaction == 1)
			{
			if(!confirm('{/literal}{$lang.confirmdelgal}{literal}')){
				dothis = 0
				}
			}
			if(dothis!=0){
			window.location = jumpform;
			}
			
		}
		
	}
//-->
{/literal}
   </script>
   

<form action="gallery.php?action=save_posi" method="post" enctype="multipart/form-data" name="kform" id="kform">
  <table width="100%"  border="0" cellpadding="4" cellspacing="1" class="tableborder">
    <tr>
      <td colspan="5" class="header">{$lang.menue_gallery_overview}</td>
    </tr>
    {foreach from=$gallery item=item} {if $item->parent_id == 0}
    <tr>
      <td class="firstrow">{$lang.thegalname}</td>
	  
      <td width="5%" class="firstrow"><div align="center">{$lang.picsonce}</div></td>
      <td width="5%" class="firstrow"><div align="center">{$lang.active}</div></td>
      <td width="5%" class="firstrow"><div align="center">{$lang.pos}</div></td>
      <td width="5%" class="firstrow"><div align="right">{$lang.settings}</div></td>
    </tr>
    <tr>
      <td class="firstrow">{$item->visible_title}</td>
      <td nowrap="nowrap" class="firstrow"><div align="center">{if $item->pics > 0}<a href="gallery.php?area={$area}&action=showpics&galid={$item->id}" class="pnav">{$item->pics}</a>{else}-{/if}</div></td>
      <td nowrap="nowrap" class="firstrow">&nbsp;
        <select name="active[{$item->id}]">
          <option value="1" {if $item->active == 1} selected{/if}>{$lang.active}</option>
          <option value="0" {if $item->active == 0} selected{/if}>{$lang.inactive}</option>
        </select>
&nbsp; </td>
      <td class="firstrow"><div align="center">
          <input type="text" value="{$item->posi}" name="posi[{$item->id}]" size="5" maxlength="5" />
        </div></td>
      <td nowrap="nowrap" class="firstrow"><div align="right">&nbsp;
          <select onchange="multiform_option({$item->id},{$area});" name="mf{$item->id}">
            <option value="4">{$lang.galedit}</option>
            <option value="0">{$lang.galdel}</option>
            <option value="1">{$lang.adsubgal}</option>
            <option value="2">{$lang.showpicsingal} ({$item->pics})</option>
            <option value="3">{$lang.adgalpics}</option>
          </select>
          <input onclick="multiform_option({$item->id},{$area});" type="button" class="button" value="{$lang.go}" />
&nbsp; </div></td>
    </tr>
    {else}
    <tr>
      <td class="{cycle name="c0" values="c1,c2"}">{$item->visible_title}</td>
      <td class="{cycle name="c1" values="c1,c2"}"><div align="center">{if $item->pics > 0}<a href="gallery.php?area={$area}&action=showpics&galid={$item->id}" class="pnav">{$item->pics}</a>{else}-{/if}</div></td>
      <td class="{cycle name="c2" values="c1,c2"}">&nbsp;
        <select name="active[{$item->id}]">
          <option value="1" {if $item->active == 1} selected{/if}>{$lang.active}</option>
          <option value="0" {if $item->active == 0} selected{/if}>{$lang.inactive}</option>
        </select>
&nbsp; </td>
      <td class="{cycle name="c3" values="c1,c2"}"><div align="center">
          <input type="text" value="{$item->posi}" name="posi[{$item->id}]" size="5" maxlength="5" />
        </div></td>
      <td nowrap="nowrap" class="{cycle name="c4" values="c1,c2"}"><div align="right">&nbsp;
          <select onchange="multiform_option({$item->id},{$area});" name="mf{$item->id}">
            <option value="4">{$lang.galedit}</option>
            <option value="0">{$lang.galdel}</option>
            <option value="1">{$lang.adsubgal}</option>
            <option value="2">{$lang.showpicsingal} ({$item->pics})</option>
            <option value="3">{$lang.adgalpics}</option>
          </select>
          <input onclick="multiform_option({$item->id},{$area});" type="button" class="button" value="{$lang.go}" />
&nbsp; </div></td>
    </tr>
    {/if} {/foreach}
    <tr>
      <td colspan="5" class="firstrow" style="text-align: center;"><input name="area" type="hidden" id="area" value="{$area}" />
        <input name="Senden" type="submit" class="button" value="{$lang.orderposi}" />
        <input onclick="location.href = 'gallery.php?area={$area}'" type="button" class="button" value="{$lang.buttonnewgal}" />
      </td></tr>
  </table>
</form>