<div id="seladvertisement">
	<h2 class="clsVideoAdvertisement"><span>{$LANG.page_title}</span></h2>
	<div id="selLeftNavigation">
		{include file='information.tpl'}
		{if $myobj->isShowPageBlock('advertisement_upload_form')}
			<div id="selUpload">
				<form name="advertisement_upload_form" id="advertisement_upload_form" method="post" action="{$myobj->getCurrentUrl()}" autocomplete="off" enctype="multipart/form-data">
					<div id="selUploadBlock">
						<table summary="{$LANG.advertisement_tbl_summary}" id="selUploadTbl" class="clsCommonTable clsUploadBlock">
							<tr>
							  <td class="{$myobj->getCSSFormLabelCellClass('advertisement_name')}">
								<label for="advertisement_name">{$LANG.advertisement_name}<span>*</span></label> </td>
							  <td class="{$myobj->getCSSFormFieldCellClass('advertisement_name')}">
								<input type="text" class="clsTextBox" name="advertisement_name" id="advertisement_name" tabindex="{smartyTabIndex}" value="{$myobj->getFormField('advertisement_name')}" />
								{$myobj->getFormFieldElementErrorTip('advertisement_name')}
							  </td>
							</tr>
							<tr>
							  <td class="{$myobj->getCSSFormLabelCellClass('advertisement_description')}">
								<label for="advertisement_description">{$LANG.advertisement_description}</label> </td>
							  <td class="{$myobj->getCSSFormFieldCellClass('advertisement_description')}">
								<textarea name="advertisement_description" id="advertisement_description" tabindex="{smartyTabIndex}">{$myobj->getFormField('advertisement_description')}</textarea>
								{$myobj->getFormFieldElementErrorTip('advertisement_description')}
							</td>
							</tr>
							<tr>
							  <td class="{$myobj->getCSSFormLabelCellClass('advertisement_url')}">
								<label for="advertisement_url">{$LANG.advertisement_url}</label> </td>
							  <td class="{$myobj->getCSSFormFieldCellClass('advertisement_url')}">
								<input type="text" class="clsTextBox" name="advertisement_url" id="advertisement_url" tabindex="{smartyTabIndex}" value="{$myobj->getFormField('advertisement_url')}" />({$LANG.url_example})&nbsp;{$myobj->getFormFieldElementErrorTip('advertisement_url')}
							  </td>
							</tr>
							<tr>
							  <td class="{$myobj->getCSSFormLabelCellClass('advertisement_duration')}">
								<label for="advertisement_duration">{$LANG.advertisement_duration}<span>*</span></label> </td>
							  <td class="{$myobj->getCSSFormFieldCellClass('advertisement_duration')}">
								<input type="text" class="clsTextBox {$myobj->getCSSFormFieldElementClass('advertisement_duration')}" name="advertisement_duration" id="advertisement_duration" tabindex="{smartyTabIndex}" value="{$myobj->getFormField('advertisement_duration')}" />({$CFG.admin.ans_videos.advertisement_max_time} {$LANG.list_seconds})&nbsp;{$myobj->getFormFieldElementErrorTip('advertisement_duration')}</td>
							</tr>
							{if $CFG.admin.ans_video_advertisement_impressions}
								<tr>
									<td class="{$myobj->getCSSFormLabelCellClass('month')}">
										<label for="month">{$LANG.advertisement_expiry_date}</label>
									</td>
									<td class="{$myobj->getCSSFormFieldCellClass('advertisement_expiry_date')}">
										<!--<input type="text" class="clsTextBox" name="advertisement_expiry_date" id="advertisement_expiry_date" tabindex="{smartyTabIndex}" value="{$myobj->getFormField('advertisement_expiry_date')}" />&nbsp;(YYYY-MM-DD HH:MM:SS)-->
										<select name="month" id="month" tabindex="{smartyTabIndex}">
											  <option value="">{$LANG.select_month}</option>
											  {$myobj->populateBWNumbers(1, 12, $myobj->getFormField('month'))}

										</select>
										<select name="day" id="day" tabindex="{smartyTabIndex}">
											  <option value="">{$LANG.select_day}</option>
											   {$myobj->populateBWNumbers(1, 31, $myobj->getFormField('day'))}
										</select>
										<select name="year" id="year" tabindex="{smartyTabIndex}">
											<option value="">{$LANG.select_year}</option>
											{$myobj->populateBWNumbers($myobj->advertisement_upload_form.populateBWNumbers_arg1,$myobj->advertisement_upload_form.populateBWNumbers_arg2,$myobj->getFormField('year'))}
										</select>
									  {$myobj->getFormFieldElementErrorTip('month')}
									</td>
								</tr>
								<tr>
									<td class="{$myobj->getCSSFormLabelCellClass('advertisement_impressions')}">
										<label for="advertisement_impressions">{$LANG.advertisement_impressions}</label>
									</td>
									<td class="{$myobj->getCSSFormFieldCellClass('advertisement_impressions')}">
										<input type="text" class="clsTextBox" name="advertisement_impressions" id="advertisement_impressions" tabindex="{smartyTabIndex}" value="{$myobj->getFormField('advertisement_impressions')}" />{$myobj->getFormFieldElementErrorTip('advertisement_impressions')}</td>
								</tr>
							{/if}
							<tr>
							  <td class="{$myobj->getCSSFormLabelCellClass('advertisement_show_at')}">
								<label for="advertisement_show_at">{$LANG.advertisement_show_at}</label> </td>
							  <td class="{$myobj->getCSSFormFieldCellClass('advertisement_show_at')}">
								<input type="radio" class="clsCheckRadio" name="advertisement_show_at" id="advertisement_show_at1" tabindex="{smartyTabIndex}" value="Beginning" {$myobj->isCheckedRadio('advertisement_show_at', 'Beginning')} />&nbsp;<label for="advertisement_show_at1">{$LANG.begining}</label>
								<input type="radio" class="clsCheckRadio" name="advertisement_show_at" id="advertisement_show_at2" tabindex="{smartyTabIndex}" value="Ending" {$myobj->isCheckedRadio('advertisement_show_at', 'Ending')} />&nbsp;<label for="advertisement_show_at2">{$LANG.ending}</label>
								<input type="radio" class="clsCheckRadio" name="advertisement_show_at" id="advertisement_show_at3" tabindex="{smartyTabIndex}" value="Both" {$myobj->isCheckedRadio('advertisement_show_at', 'Both')} />&nbsp;<label for="advertisement_show_at3">{$LANG.both}</label>
								{$myobj->getFormFieldElementErrorTip('advertisement_show_at')}
							  </td>
							</tr>
							<tr>
							  <td class="{$myobj->getCSSFormLabelCellClass('advertisement_file')}">
								<label for="advertisement_file">{$LANG.advertisement_file}<span>*</span></label> </td>
							  <td class="{$myobj->getCSSFormFieldCellClass('advertisement_file')}">
							 {if $myobj->chkIsEditMode()}
								<div id="selLeftPlainImage">
									<p id="selImageBorder">
										<span id="selPlainCenterImage">
											<img src="{$myobj->advertisement_upload_form.getAdsDetailsImage}" alt="{$LANG.advertisement}" width="66px" height="66px" />
										</span>
									</p>
								</div>
							 {/if}
							   <input type="file" class="clsFileBox" accept="image/{$myobj->advertisement_upload_form.implode_ans_videos}" name="advertisement_file" id="advertisement_file" tabindex="{smartyTabIndex}" />{$myobj->getFormFieldElementErrorTip('advertisement_file')}
								({$LANG.maximum_allowed_size} {$CFG.admin.ans_videos.advertisement_max_size} {$LANG.kb})</td>
							</tr>
							<tr>
							  <td class="{$myobj->getCSSFormLabelCellClass('advertisement_status')}">
								<label for="advertisement_status">{$LANG.common_status}</label> </td>
							  <td class="{$myobj->getCSSFormFieldCellClass('advertisement_status')}">
								<select name="advertisement_status" id="advertisement_status" tabindex="{smartyTabIndex}">
									{$myobj->generalPopulateArray($myobj->advertisement_status_array, $myobj->getFormField('advertisement_status'))}
								</select>{$myobj->getFormFieldElementErrorTip('advertisement_status')}</td>
							</tr>
							<tr>
								<td></td>
							  <td class="">
								{if $myobj->chkIsEditMode()}
									{$myobj->populateHidden($myobj->chkIsEditMode.hidden_array)}
									<input type="submit" class="clsSubmitButton" name="update" id="update" tabindex="{smartyTabIndex}" value="{$LANG.common_update}" />
								{else}
									<input type="submit" class="clsSubmitButton" name="add" id="add" tabindex="{smartyTabIndex}" value="{$LANG.common_add}" />
								{/if}
									<input type="submit" class="clsCancelButton" name="cancel" id="cancel" tabindex="{smartyTabIndex}" value="{$LANG.common_cancel}" />
							  </td>
							</tr>
					  </table>
					</div>
				  </form>
			</div>
			{literal}
			<script language="javascript" type="text/javascript">
					needLiveValidation('advertisement_duration',Array('Presence','Numericality'));
					needLiveValidation('advertisement_name',Array('Presence'));
			</script>
			{/literal}
		{/if}
		{if $myobj->isShowPageBlock('advertisement_list')}
			{if $myobj->advertisement_list.RecordCount}
				<div id="selMsgConfirm" class="clsMsgConfirm" style="display:none;position:absolute;">
					<p id="selMsgText"></p>
					<form name="actionForm" id="actionForm" method="post" action="{$myobj->getCurrentUrl()}"  >
						<table summary="{$LANG.advertisement_tbl_summary}">
							<tr>
								<td>
									<input type="submit" class="clsSubmitButton" name="yes" id="yes" value="{$LANG.common_yes_option}" tabindex="{smartyTabIndex}" /> &nbsp;
									<input type="button" class="clsCancelButton" name="no" id="no" value="{$LANG.common_no_option}" tabindex="{smartyTabIndex}" onClick="return hideAllBlocks();" />
									<input type="hidden" name="aid" id="aid" />
									<input type="hidden" name="act" id="act" />
									{$myobj->populateHidden($myobj->advertisement_list.hidden_array)}
								</td>
							</tr>
						</table>
					</form>
				</div>
				<div id="advertisementListBlock">
					<form name="listAddForm" id="listAddForm" method="post" action="{$myobj->getCurrentUrl()}" autocomplete="off">
						{if $CFG.admin.navigation.top}
								{include file='pagination.tpl'}
						{/if}
						<table summary="{$LANG.advertisement_tbl_summary}">
							<tr>
								<th class="clsSelectAllItems"><input type="checkbox" class="clsCheckRadio" name="check_all" tabindex="{smartyTabIndex}" onclick="CheckAll(document.listAddForm.name, document.listAddForm.check_all.name)" /></th>
								<th>{$LANG.advertisement_name}</th>
								<th>{$LANG.advertisement_show_at}</th>
								<th>{$LANG.advertisement_duration}</th>
								{if $CFG.admin.ans_video_advertisement_impressions }
									<th>{$LANG.advertisement_impressions}</th>
									<th>{$LANG.advertisement_current_impressions}</th>
									<th>{$LANG.advertisement_expiry_date}</th>
								{/if}
								<th>{$LANG.add_type}</th>
								<th>{$LANG.common_status}</th>
								<th>{$LANG.common_action}</th>
							</tr>
							{foreach key=inc item=value from=$myobj->advertisement_list.populateAdvertisementList}
								<tr>
									<td><input type="checkbox" class="clsCheckRadio" name="aid[]"  value="{$value.record.advertisement_id}" tabindex="{smartyTabIndex}" /></td>
									<td>{$value.record.advertisement_name}</td>
									<td>{$value.record.advertisement_show_at}</td>
									<td>{$value.record.advertisement_duration}&nbsp;{$LANG.list_seconds}</td>
									{if $CFG.admin.ans_video_advertisement_impressions}
										<td>{$value.record.advertisement_impressions}</td>
										<td>{$value.record.advertisement_current_impressions}</td>
										<td>{$value.record.advertisement_expiry_date}</td>
									{/if}
									<td>{$value.record.add_type}</td>
									<td>{$value.option}</td>
									<td><a href="{$value.ansVideoAdvertisement_url}">{$LANG.common_edit}</a></td>
								</tr>
							{/foreach}
							<tr>
								<td class="{$myobj->getCSSFormFieldCellClass('privacy_status')}" colspan="15">
									<a href="#" id="{$myobj->advertisement_list.anchor}"></a>
									<input type="button" class="clsSubmitButton" name="delete_submit" id="delete_submit" tabindex="{smartyTabIndex}" value="{$LANG.common_delete}" onClick="if(getMultiCheckBoxValue('listAddForm', 'check_all', '{$LANG.common_check_atleast_one}')){$myobj->advertisement_list.delete_Confirmation}" />
									<input type="button" class="clsSubmitButton" name="activate_submit" id="activate_submit" tabindex="{smartyTabIndex}" value="{$LANG.common_activate}" onClick="if(getMultiCheckBoxValue('listAddForm', 'check_all', '{$LANG.common_check_atleast_one}')){$myobj->advertisement_list.activate_Confirmation}" />
									<input type="button" class="clsSubmitButton" name="inactivate_submit" id="inactivate_submit" tabindex="{smartyTabIndex}" value="{$LANG.common_inactivate}" onClick="if(getMultiCheckBoxValue('listAddForm', 'check_all', '{$LANG.common_check_atleast_one}')){$myobj->advertisement_list.inactivate_Confirmation}" />
								</td>
							</tr>
						</table>
						{if $CFG.admin.navigation.bottom}
							 {include file='pagination.tpl'}
						{/if}
					</form>
				</div>
			{else}
				<div id="selMsgAlert">
					<p>{$LANG.common_no_records_found}</p>
				</div>
			{/if}
		{/if}
	</div>
</div>