{include file="$admintemplatepath/header.template"}
{include file="$admintemplatepath/navigation.template" showOpt=editAdBlocks title=$locale->tr("editAdBlocks")}
<script type="text/javascript" src="js/ui/common.js"></script>
 <form name="newAdBlock" method="post" action="admin.php" onSubmit="Lifetype.Forms.List.selectAll('blogList');return true">
  <fieldset class="inputField">
   <legend>{$locale->tr("newAdBlock")}</legend>
   {include file="$admintemplatepath/formvalidate.template"}   
   
   <div class="field">
    <label for="adBlockName">{$locale->tr("name")}</label>
    <span class="required">*</span>
    <div class="formHelp">{$locale->tr("adblock_name_help")}</div>
    <input type="text" value="{$adBlockName}" id="adBlockName" name="adBlockName" />
    {include file="$admintemplatepath/validate.template" field=adBlockName message=$locale->tr("error_empty_name")}
   </div>

   <div class="field">
    <label for="adBlockMode">{$locale->tr("adblock_mode")}</label>
    <span class="required">*</span>
    <div class="formHelp">{$locale->tr("adblock_mode_help")}</div>
	<select name="adBlockMode" {literal}onChange="elem=document.getElementById('blogListBlock');if(this.selectedIndex!=0){elem.style.display='block';}else{elem.style.display='none';}"{/literal}>
	  <option value="1" {if $adBlockMode==1}selected="selected"{/if}>{$locale->tr("ad_blogs_all")}</option>
	  <option value="2" {if $adBlockMode==2}selected="selected"{/if}>{$locale->tr("ad_blogs_include_list")}</option>
	  <option value="3" {if $adBlockMode==3}selected="selected"{/if}>{$locale->tr("ad_blogs_exclude_list")}</option>
	</select>
   </div>

 <div class="field" id="blogListBlock" {if $adBlockMode==1 || $adBlockMode==""}style="display:none"{/if}>
	<label for="adBlogList">{$locale->tr("ad_blogs_list")}</label>
	<span class="required">*</span>
	<div class="formHelp">{$locale->tr("ad_blogs_list_help")}</div>
		<select name="adBlogsList[]" id="blogList" multiple="multiple" style="width:40%" size="5">
		{foreach from=$blogs item=blog}
		   <option value="{$blog->getId()}">{$blog->getBlog()}</option>
		{/foreach}
		</select>
		<br />
		<input type="button" class="button" onClick="window.open('?op=siteBlogsChooser&mode=2','BlogChooser','scrollbars=yes,resizable=yes,toolbar=no,height=450,width=600');" value="{$locale->tr("add")}" />	
		<input type="button" class="button" onClick="Lifetype.Forms.List.removeSelected('blogList');" value="{$locale->tr("remove_selected")}" />
 </div>

   <div class="field">
    <label for="categoryName">{$locale->tr("adblock_position")}</label>
    <span class="required">*</span>
    <div class="formHelp">{$locale->tr("adblock_position_help")}</div>
	<select name="adBlockPosition">
	  <option value="1" {if $adBlockPosition==1}selected="selected"{/if}>{$locale->tr("ad_position_top")}</option>
	  <option value="2" {if $adBlockPosition==2}selected="selected"{/if}>{$locale->tr("ad_position_bottom")}</option>
	  <option value="3" {if $adBlockPosition==3}selected="selected"{/if}>{$locale->tr("ad_position_custom")}</option>
	</select>
   </div>

   <div class="field">
    <label for="adBlockCode">{$locale->tr("adblock_code")}</label>
    <span class="required">*</span>
    <div class="formHelp">{$locale->tr("adblock_code_help")}</div>
	<textarea rows="10" name="adBlockCode" style="width:100%">{$adBlockCode}</textarea>
    {include file="$admintemplatepath/validate.template" field=adBlockCode message=$locale->tr("error_empty_adblock_code")}
   </div>   
   
  </fieldset>
  <div class="buttons">
   <input type="hidden" name="op" value="updateAdBlock" />
   <input type="reset" name="Reset" value="{$locale->tr("reset")}" />
   <input type="submit" name="Add" value="{$locale->tr("update")}" />
   <input type="hidden" name="adBlockId" value="{$adBlockId}" />
  </div> 
 </form>
{include file="$admintemplatepath/footernavigation.template"}
{include file="$admintemplatepath/footer.template"}
