<?php /* Smarty version 2.6.25, created on 2012-07-15 10:34:57
         compiled from DefaultAdmin/dir_links_edit.tpl */ ?>
<?php require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
smarty_core_load_plugins(array('plugins' => array(array('modifier', 'cat', 'DefaultAdmin/dir_links_edit.tpl', 1, false),array('modifier', 'escape', 'DefaultAdmin/dir_links_edit.tpl', 12, false),array('modifier', 'trim', 'DefaultAdmin/dir_links_edit.tpl', 74, false),array('modifier', 'count', 'DefaultAdmin/dir_links_edit.tpl', 537, false),array('function', 'formtool_count_chars', 'DefaultAdmin/dir_links_edit.tpl', 147, false),array('function', 'html_options', 'DefaultAdmin/dir_links_edit.tpl', 162, false),array('function', 'html_options2', 'DefaultAdmin/dir_links_edit.tpl', 164, false),)), $this); ?>
<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => ((is_array($_tmp=@ADMIN_TEMPLATE)) ? $this->_run_mod_handler('cat', true, $_tmp, "/validation.tpl") : smarty_modifier_cat($_tmp, "/validation.tpl")), 'smarty_include_vars' => array('form_id' => 'edit_link_form','validators' => $this->_tpl_vars['validators'])));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>

<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => "messages.tpl", 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>


<?php if (( isset ( $this->_tpl_vars['error'] ) && $this->_tpl_vars['error'] > 0 ) || ! empty ( $this->_tpl_vars['sql_error'] )): ?>
   <div class="error block">
      <h2>Error</h2>
      <p>An error occured while saving.</p>
      <?php if (! empty ( $this->_tpl_vars['errorMsg'] )): ?>
         <p><?php echo ((is_array($_tmp=$this->_tpl_vars['errorMsg'])) ? $this->_run_mod_handler('escape', true, $_tmp) : smarty_modifier_escape($_tmp)); ?>
</p>
      <?php endif; ?>
      <?php if (! empty ( $this->_tpl_vars['sql_error'] )): ?>
         <p>The database server returned the following message:</p>
         <p><?php echo ((is_array($_tmp=$this->_tpl_vars['sql_error'])) ? $this->_run_mod_handler('escape', true, $_tmp) : smarty_modifier_escape($_tmp)); ?>
</p>
      <?php endif; ?>
   </div>
<?php endif; ?>

<?php if ($this->_tpl_vars['posted']): ?>
   <div class="success block">
      Link saved.
   </div>
<?php endif; ?>

<?php if (isset ( $this->_tpl_vars['AllowedFeat'] ) && $this->_tpl_vars['AllowedFeat'] != 1): ?>
   <div class="error block">
      <p>Maximum number of featured links for this category exceeded!</p>
      <p>Please review link preferences.</p>
   </div>
<?php endif; ?>

<div class="block">
	<form method="post" action="" id="edit_link_form" enctype="multipart/form-data">
	<table class="formPage">
		<?php if (isset ( $this->_tpl_vars['action'] ) && ( $this->_tpl_vars['action'] == 'N' || $this->_tpl_vars['action'] == 'E' )): ?>
		<thead>
		<tr>
			<th colspan="2">
	            <?php if ($this->_tpl_vars['action'] == 'N'): ?>
	               Create new link
	            <?php elseif ($this->_tpl_vars['action'] == 'E'): ?>
	               Edit link
	            <?php endif; ?>
			</th>
		</tr>
		</thead>
		<?php endif; ?>

		<tbody>
		<tr>
			<td class="label"><label for="LINK_TYPE">Link Type:</label></td>
			<td class="smallDesc">
				<select name="LINK_TYPE" id="LINK_TYPE">
                                <?php $_from = $this->_tpl_vars['link_types']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['k'] => $this->_tpl_vars['v']):
?>
                		<option value="<?php echo $this->_tpl_vars['k']; ?>
" <?php if ($this->_tpl_vars['linktypeid'] == $this->_tpl_vars['k']): ?> selected="selected" <?php endif; ?>><?php echo $this->_tpl_vars['v']['NAME']; ?>
</option>
				<?php endforeach; endif; unset($_from); ?>
                </select>
    		</td>
    	</tr>
    	</tbody>
    </table>

	<?php if ($this->_tpl_vars['submit_items']): ?>
	<div id="add_items">
		<table class="formPage">
			<?php $_from = $this->_tpl_vars['submit_items']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }$this->_foreach['submit_items'] = array('total' => count($_from), 'iteration' => 0);
if ($this->_foreach['submit_items']['total'] > 0):
    foreach ($_from as $this->_tpl_vars['item']):
        $this->_foreach['submit_items']['iteration']++;
?>
						<?php if ($this->_tpl_vars['item']['FIELD_NAME'] == 'TITLE'): ?>
				<tr>
					<td class="label required"><label for="TITLE">Title:</label></td>
					<td class="smallDesc">
						<input type="text" id="TITLE" name="TITLE" value="<?php echo ((is_array($_tmp=((is_array($_tmp=$this->_tpl_vars['data']['TITLE'])) ? $this->_run_mod_handler('escape', true, $_tmp) : smarty_modifier_escape($_tmp)))) ? $this->_run_mod_handler('trim', true, $_tmp) : trim($_tmp)); ?>
" maxlength="<?php echo @TITLE_MAX_LENGTH; ?>
" class="text" />
	            		<?php if ($this->_tpl_vars['SEO_URL'] != ''): ?>
	            			<a class="admin_action" href="<?php if (! @ENABLE_REWRITE): ?>
	                                                <?php echo @DOC_ROOT; ?>
/detail.php?id=<?php echo $this->_tpl_vars['ID']; ?>

	                                             <?php else: ?>
	                                                <?php echo @DOC_ROOT; ?>
/<?php echo $this->_tpl_vars['SEO_URL']; ?>
<?php endif; ?>" title="Preview Link on the Front End" target="_blank">
	            				<img src="<?php echo @TEMPLATE_ROOT; ?>
/images/outbox.png"/>
	            			</a>
	            		<?php endif; ?>
	         		</td>
	      		</tr>
			<?php elseif ($this->_tpl_vars['item']['FIELD_NAME'] == 'CATEGORY_ID'): ?>
				<tr>
					<td class="label required"><label for="CATEGORY_ID">Category:</label></td>
					<td class="smallDesc">
												<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => ((is_array($_tmp=@ADMIN_TEMPLATE)) ? $this->_run_mod_handler('cat', true, $_tmp, "/admin_category_select.tpl") : smarty_modifier_cat($_tmp, "/admin_category_select.tpl")), 'smarty_include_vars' => array('selected' => $this->_tpl_vars['data']['CATEGORY_ID'],'selected_parent' => $this->_tpl_vars['data']['PARENT_ID'])));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
						<?php if ($this->_tpl_vars['link_type_details']['MULTIPLE_CATEGORIES'] != ''): ?>
							<?php $_from = $this->_tpl_vars['add_categs']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }$this->_foreach['additional'] = array('total' => count($_from), 'iteration' => 0);
if ($this->_foreach['additional']['total'] > 0):
    foreach ($_from as $this->_tpl_vars['categ']):
        $this->_foreach['additional']['iteration']++;
?>
	                            <?php if (($this->_foreach['additional']['iteration']-1) < $this->_tpl_vars['link_type_details']['MULTIPLE_CATEGORIES']): ?>
									<div>
										<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => ((is_array($_tmp=@ADMIN_TEMPLATE)) ? $this->_run_mod_handler('cat', true, $_tmp, "/admin_category_select.tpl") : smarty_modifier_cat($_tmp, "/admin_category_select.tpl")), 'smarty_include_vars' => array('categ_id' => $this->_tpl_vars['categ']['CATEGORY_ID'],'additional_categs' => true)));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>&nbsp;
										<a href="#" onclick="removeCateg(this); return false;">remove</a>
										<div style="float: none; clear: both; height: 8px;"></div>
									</div>
								<?php endif; ?>
							<?php endforeach; endif; unset($_from); ?>
						<?php endif; ?>
						<div id="categ" style="display: none;">
							<br />
							<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => ((is_array($_tmp=@ADMIN_TEMPLATE)) ? $this->_run_mod_handler('cat', true, $_tmp, "/admin_category_select.tpl") : smarty_modifier_cat($_tmp, "/admin_category_select.tpl")), 'smarty_include_vars' => array('additional_categs' => true)));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>&nbsp;
						</div>
						<a href="" class="formDelCateg" id="fileDelCateg" onclick="removeCateg(this); return false;" style="display: none">remove</a>
  						<div class="clear"></div>
  						<br />
	   					<a onclick="plusCateg();return false;" href="" id="plusCategLink" class="formSmall" style="border-width: 0;">+ additional categ</a>
					</td>
      			</tr>
			<?php elseif ($this->_tpl_vars['item']['FIELD_NAME'] == 'OWNER_NAME'): ?>
				<tr>
					<td class="label"><label for="OWNER_NAME">Owner Name:</label></td>
					<td class="smallDesc">
						<input type="text" id="OWNER_NAME" name="OWNER_NAME" value="<?php echo ((is_array($_tmp=((is_array($_tmp=$this->_tpl_vars['data']['OWNER_NAME'])) ? $this->_run_mod_handler('escape', true, $_tmp) : smarty_modifier_escape($_tmp)))) ? $this->_run_mod_handler('trim', true, $_tmp) : trim($_tmp)); ?>
" maxlength="<?php echo @USER_NAME_MAX_LENGTH; ?>
" class="text" />
					</td>
				</tr>
			<?php elseif ($this->_tpl_vars['item']['FIELD_NAME'] == 'OWNER_EMAIL'): ?>
				<tr>
					<td class="label"><label for="OWNER_EMAIL">Owner Email:</label></td>
					<td class="smallDesc">
						<input type="text" id="OWNER_EMAIL" name="OWNER_EMAIL" value="<?php echo ((is_array($_tmp=((is_array($_tmp=$this->_tpl_vars['data']['OWNER_EMAIL'])) ? $this->_run_mod_handler('escape', true, $_tmp) : smarty_modifier_escape($_tmp)))) ? $this->_run_mod_handler('trim', true, $_tmp) : trim($_tmp)); ?>
" maxlength="255" class="text" />
					</td>
				</tr>
			<?php elseif ($this->_tpl_vars['item']['FIELD_NAME'] == 'META_KEYWORDS'): ?>
				<?php if (@ENABLE_META_TAGS == 1): ?>
				<tr class="thead">
					<th colspan="2">META tags</th>
				</tr>
				<tr class="thead">
					<td colspan="2" class="info notice">Define custom META tags for detail pages. Leave blank to use default tags defined for your directory.</td>
				</tr>
				<tr>
					<td class="label"><label for="META_KEYWORDS">META Keywords:</label></td>
					<td class="smallDesc">
						<input type="text" id="META_KEYWORDS" name="META_KEYWORDS" value="<?php echo ((is_array($_tmp=((is_array($_tmp=$this->_tpl_vars['data']['META_KEYWORDS'])) ? $this->_run_mod_handler('escape', true, $_tmp) : smarty_modifier_escape($_tmp)))) ? $this->_run_mod_handler('trim', true, $_tmp) : trim($_tmp)); ?>
" class="text" />
						<p class="msg notice info">Separate keywords by comma.</p>
					</td>
				</tr>
				<?php endif; ?>
			<?php elseif ($this->_tpl_vars['item']['FIELD_NAME'] == 'META_DESCRIPTION'): ?>
				<?php if (@ENABLE_META_TAGS == 1): ?>
				<tr>
					<td class="label"><label for="META_DESCRIPTION">META Description:</label></td>
					<td class="smallDesc">
						<textarea id="META_DESCRIPTION" name="META_DESCRIPTION" rows="3" cols="30" class="text" <?php echo smarty_function_formtool_count_chars(array('name' => 'META_DESCRIPTION','limit' => @META_DESCRIPTION_MAX_LENGTH,'alert' => true), $this);?>
><?php echo ((is_array($_tmp=((is_array($_tmp=$this->_tpl_vars['data']['META_DESCRIPTION'])) ? $this->_run_mod_handler('trim', true, $_tmp) : trim($_tmp)))) ? $this->_run_mod_handler('escape', true, $_tmp) : smarty_modifier_escape($_tmp)); ?>
</textarea>
						<p class="limitDesc">Limit: <input type="text" name="META_DESCRIPTION_limit" class="limit_field" readonly="readonly" value="<?php echo $this->_tpl_vars['MetaDescriptionLimit']; ?>
" /></p>
					</td>
				</tr>
				<?php endif; ?>
						<?php else: ?>
				<tr>
				   	<td class="label"><label for="<?php echo $this->_tpl_vars['item']['FIELD_NAME']; ?>
"><?php echo $this->_tpl_vars['item']['NAME']; ?>
:</label></td>
				   	<td class="smallDesc">
						<?php if ($this->_tpl_vars['item']['TYPE'] == 'STR'): ?>
							<input type="text" name="<?php echo $this->_tpl_vars['item']['FIELD_NAME']; ?>
" id="<?php echo $this->_tpl_vars['item']['FIELD_NAME']; ?>
" value="<?php echo ((is_array($_tmp=((is_array($_tmp=$this->_tpl_vars['data'][$this->_tpl_vars['item']['FIELD_NAME']])) ? $this->_run_mod_handler('escape', true, $_tmp) : smarty_modifier_escape($_tmp)))) ? $this->_run_mod_handler('trim', true, $_tmp) : trim($_tmp)); ?>
" size="40" class="text" />
						<?php elseif ($this->_tpl_vars['item']['TYPE'] == 'TXT'): ?>	
							<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => ((is_array($_tmp=@ADMIN_TEMPLATE)) ? $this->_run_mod_handler('cat', true, $_tmp, "/rte.tpl") : smarty_modifier_cat($_tmp, "/rte.tpl")), 'smarty_include_vars' => array('NAME' => $this->_tpl_vars['item']['FIELD_NAME'],'VALUE' => ((is_array($_tmp=((is_array($_tmp=$this->_tpl_vars['data'][$this->_tpl_vars['item']['FIELD_NAME']])) ? $this->_run_mod_handler('escape', true, $_tmp) : smarty_modifier_escape($_tmp)))) ? $this->_run_mod_handler('trim', true, $_tmp) : trim($_tmp)))));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
						<?php elseif ($this->_tpl_vars['item']['TYPE'] == 'BOOL'): ?>
							<?php echo smarty_function_html_options(array('options' => $this->_tpl_vars['yes_no'],'selected' => $this->_tpl_vars['data'][$this->_tpl_vars['item']['FIELD_NAME']],'name' => $this->_tpl_vars['item']['FIELD_NAME'],'id' => $this->_tpl_vars['item']['FIELD_NAME']), $this);?>

						<?php elseif ($this->_tpl_vars['item']['TYPE'] == 'DROPDOWN'): ?>
							<?php echo smarty_function_html_options2(array('options' => $this->_tpl_vars['item']['OPTIONS'],'selected' => $this->_tpl_vars['data'][$this->_tpl_vars['item']['FIELD_NAME']],'name' => $this->_tpl_vars['item']['FIELD_NAME'],'id' => $this->_tpl_vars['item']['FIELD_NAME']), $this);?>

						<?php elseif ($this->_tpl_vars['item']['TYPE'] == 'CAT'): ?>
							<?php echo smarty_function_html_options(array('options' => $this->_tpl_vars['categs'],'selected' => $this->_tpl_vars['data'][$this->_tpl_vars['item']['FIELD_NAME']],'name' => $this->_tpl_vars['item']['FIELD_NAME'],'id' => $this->_tpl_vars['item']['FIELD_NAME']), $this);?>

						<?php elseif ($this->_tpl_vars['item']['TYPE'] == 'FILE'): ?>
							<input type="file" name="<?php echo $this->_tpl_vars['item']['FIELD_NAME']; ?>
" id="<?php echo $this->_tpl_vars['item']['FIELD_NAME']; ?>
" class="text"/><br />
							Allowed files: .pdf, .xls, .xlsx, .doc, .docx, .zip, .rar, .txt, .rtf, .csv. Files of other types will not be uploaded at all.
							<br/>
							<?php if ($this->_tpl_vars['data'][$this->_tpl_vars['item']['FIELD_NAME']] != ''): ?>
								Current: <br/><a href="../uploads/<?php echo $this->_tpl_vars['data'][$this->_tpl_vars['item']['FIELD_NAME']]; ?>
" target="_blank"><?php echo $this->_tpl_vars['data'][$this->_tpl_vars['item']['FIELD_NAME']]; ?>
</a> <a href="<?php echo @DOC_ROOT; ?>
/rm_si.php?id=<?php echo $this->_tpl_vars['item']['ID']; ?>
&lid=<?php echo $this->_tpl_vars['data']['ID']; ?>
">Remove</a>
							<?php endif; ?>
						<?php elseif ($this->_tpl_vars['item']['TYPE'] == 'IMAGE'): ?>
							<input type="file" name="<?php echo $this->_tpl_vars['item']['FIELD_NAME']; ?>
" id="<?php echo $this->_tpl_vars['item']['FIELD_NAME']; ?>
" class="text"/><br/>
							Allowed files: .gif, .png, .jpg, .jpeg. Files of other types will not be uploaded at all.
							<br />
							<?php if ($this->_tpl_vars['data'][$this->_tpl_vars['item']['FIELD_NAME']] != ''): ?>
								Current: <br/><img src="../uploads/thumb/<?php echo $this->_tpl_vars['data'][$this->_tpl_vars['item']['FIELD_NAME']]; ?>
"/> <a href="<?php echo @DOC_ROOT; ?>
/rm_si.php?id=<?php echo $this->_tpl_vars['item']['ID']; ?>
&lid=<?php echo $this->_tpl_vars['data']['ID']; ?>
">Remove</a>
							<?php endif; ?>
                        <?php elseif ($this->_tpl_vars['item']['TYPE'] == 'VIDEO'): ?>
                            <input type="file" name="<?php echo $this->_tpl_vars['item']['FIELD_NAME']; ?>
" id="<?php echo $this->_tpl_vars['item']['FIELD_NAME']; ?>
" class="text"/><br/>
                            Allowed files: .avi, .mpg, .wmv, .mov Files of other types will not be uploaded at all.
                            <br />
                            <?php if ($this->_tpl_vars['data'][$this->_tpl_vars['item']['FIELD_NAME']] != ''): ?>
                                Current: <br/><img src="../uploads/thumb/<?php echo $this->_tpl_vars['data'][$this->_tpl_vars['item']['FIELD_NAME']]; ?>
.jpg"/> <a href="<?php echo @DOC_ROOT; ?>
/rm_si.php?id=<?php echo $this->_tpl_vars['item']['ID']; ?>
&lid=<?php echo $this->_tpl_vars['data']['ID']; ?>
">Remove</a>
                            <?php endif; ?>
						<?php elseif ($this->_tpl_vars['item']['TYPE'] == 'IMAGEGROUP'): ?>


															<?php if ($this->_tpl_vars['group_image_details']): ?>
															<table width="100%">
															<tr><td>
																<?php $_from = $this->_tpl_vars['group_image_details']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['image']):
?>
																	<div class="link-detail-image" id="<?php echo $this->_tpl_vars['image']['IMAGEID']; ?>
">
																	<div><img src="../uploads/thumb/<?php echo $this->_tpl_vars['image']['IMAGE']; ?>
"/></div>
																	<div style="clear:both;width:100%;text-align:center;margin-top:5px;"><a onclick="javascript:deleteImage(<?php echo $this->_tpl_vars['image']['IMAGEID']; ?>
);">Delete</a></div>
																	</div>
																<?php endforeach; endif; unset($_from); ?>

																<div class="link-detail-image" id="imagelistcopyto" style="display: none;">
																	<div class="imageinto"></div>
																	<div style="clear:both;width:100%;text-align:center;margin-top:5px;" class="deletelinkcontainer"><a href="" class="deletelink">Delete</a></div>
																</div>

																<div id="imageuploadajaxcontainer">
																</div>
															</td></tr>
															</table>
																<?php echo '
																<script>
																curr_count = 0;
																function deleteImage(image_id){

																	if(confirm(\'Are you sure you want to delete this image?\')){
																		jQuery.ajax({
																		url:"'; ?>
<?php echo @DOC_ROOT; ?>
/admin-delete-images.php<?php echo '",
																		type:"get",
																		dataType:"json",
																		success:imgDeleteSuccess,
																		error:imgDeleteError,
																		data:{
																			"image_id":image_id

																			}
																		});
																	}
																}
																function imgDeleteSuccess(Obj){

																	//remove the image\'s parent div
																	var id = \'#\'+Obj.image_id;
																	jQuery(id).empty().remove();
																	curr_count = curr_count-1;
																	jQuery(".qq-upload-button").show();
																}
																function imgDeleteError(Obj, message){
																	alert(message);
																}
																</script>
																'; ?>

															<?php endif; ?>

						                                <?php 
						                                        // assign a uniqid to this field so we can find the files on submit
						                                        $this->assign('imagegroupid',uniqid());
						                                 ?>

						                                <input type="hidden" name="<?php echo $this->_tpl_vars['item']['FIELD_NAME']; ?>
" id="<?php echo $this->_tpl_vars['item']['FIELD_NAME']; ?>
" value="<?php echo $this->_tpl_vars['imagegroupid']; ?>
"/>
						                                <?php echo '
						                                        <div id="file-uploader-admin">
						                                                <noscript>
						                                                        <p>Please enable JavaScript to use file uploader.</p>
						                                                        <!-- or put a simple form for upload here -->
						                                                </noscript>
						                                        </div>
											<input type="hidden" id="curr_count" value="1" />
						                                        <script src="../javascripts/fileuploader.js" type="text/javascript"></script>
						                                             <script>
												curr_count = 0;
												'; ?>

												<?php if ($this->_tpl_vars['ctn_img']): ?>
												ctn_img = parseInt('<?php echo $this->_tpl_vars['ctn_img']; ?>
');
												
												<?php else: ?>
												ctn_img = 0;
												<?php endif; ?>

												<?php echo '
						                                                function createUploader(){
						                                                    var uploader = new qq.FileUploader({
						                                                        element: document.getElementById(\'file-uploader-admin\'),
						                                                        action: \'../uploadimg.php\',
													onSubmit: function(id, fileName, responseJSON){
													curr_count = curr_count+1;
													if(curr_count+ctn_img>=parseInt("'; ?>
<?php echo $this->_tpl_vars['link_types'][$this->_tpl_vars['linktypeid']]['COUNT_IMAGES']; ?>
<?php echo '"))
													 jQuery(".qq-upload-button").hide();
													       },
						                                                        params: {
						                                '; ?>

						                                                                imagegroupid: "<?php echo $this->_tpl_vars['imagegroupid']; ?>
",
														imagegroupidnbr: "<?php echo $this->_tpl_vars['data']['IMAGEGROUP']; ?>
",
						                                <?php echo '
													       
						                                                        }
						                                                    });
												    if(curr_count+ctn_img>=parseInt("'; ?>
<?php echo $this->_tpl_vars['link_types'][$this->_tpl_vars['linktypeid']]['COUNT_IMAGES']; ?>
<?php echo '") || isNaN(parseInt("'; ?>
<?php echo $this->_tpl_vars['link_types'][$this->_tpl_vars['linktypeid']]['COUNT_IMAGES']; ?>
<?php echo '")) || parseInt("'; ?>
<?php echo $this->_tpl_vars['link_types'][$this->_tpl_vars['linktypeid']]['COUNT_IMAGES']; ?>
<?php echo '")==\'0\')
													 {
													   jQuery(".qq-upload-button").hide();
													 }
						                                                }
						                                                 window.onload = createUploader;
												
						                                          </script>

						                                '; ?>

						<?php endif; ?>
						<?php if ($this->_tpl_vars['item']['DESCRIPTION']): ?>
							<p class="msg notice info"><?php echo $this->_tpl_vars['item']['DESCRIPTION']; ?>
</p>
						<?php endif; ?>
					</td>
				</tr>
			<?php endif; ?>
			<?php endforeach; endif; unset($_from); ?>    
		</table>
	</div>
	<?php endif; ?>
	
	<?php if ($this->_tpl_vars['link_type_details']['DEEP_LINKS'] > 0): ?>
	<table class="formPage">
		<tbody>
		<tr>
			<td class="label required"><label>Deep Links:</label></td>
			<td class="smallDesc">
				<table id="additional_links" border="0" cellpadding="0" cellspacing="0">
					<tr>
						<td align="center">Titles</td>
						<td align="center">URLs</td>
					</tr>
					
					<?php unset($this->_sections['i']);
$this->_sections['i']['name'] = 'i';
$this->_sections['i']['start'] = (int)0;
$this->_sections['i']['loop'] = is_array($_loop=$this->_tpl_vars['link_type_details']['DEEP_LINKS']) ? count($_loop) : max(0, (int)$_loop); unset($_loop);
$this->_sections['i']['show'] = true;
$this->_sections['i']['max'] = $this->_sections['i']['loop'];
$this->_sections['i']['step'] = 1;
if ($this->_sections['i']['start'] < 0)
    $this->_sections['i']['start'] = max($this->_sections['i']['step'] > 0 ? 0 : -1, $this->_sections['i']['loop'] + $this->_sections['i']['start']);
else
    $this->_sections['i']['start'] = min($this->_sections['i']['start'], $this->_sections['i']['step'] > 0 ? $this->_sections['i']['loop'] : $this->_sections['i']['loop']-1);
if ($this->_sections['i']['show']) {
    $this->_sections['i']['total'] = min(ceil(($this->_sections['i']['step'] > 0 ? $this->_sections['i']['loop'] - $this->_sections['i']['start'] : $this->_sections['i']['start']+1)/abs($this->_sections['i']['step'])), $this->_sections['i']['max']);
    if ($this->_sections['i']['total'] == 0)
        $this->_sections['i']['show'] = false;
} else
    $this->_sections['i']['total'] = 0;
if ($this->_sections['i']['show']):

            for ($this->_sections['i']['index'] = $this->_sections['i']['start'], $this->_sections['i']['iteration'] = 1;
                 $this->_sections['i']['iteration'] <= $this->_sections['i']['total'];
                 $this->_sections['i']['index'] += $this->_sections['i']['step'], $this->_sections['i']['iteration']++):
$this->_sections['i']['rownum'] = $this->_sections['i']['iteration'];
$this->_sections['i']['index_prev'] = $this->_sections['i']['index'] - $this->_sections['i']['step'];
$this->_sections['i']['index_next'] = $this->_sections['i']['index'] + $this->_sections['i']['step'];
$this->_sections['i']['first']      = ($this->_sections['i']['iteration'] == 1);
$this->_sections['i']['last']       = ($this->_sections['i']['iteration'] == $this->_sections['i']['total']);
?>
					<tr>
						<td><input type="text" name="ADD_LINK_TITLE[]" value="<?php echo $this->_tpl_vars['add_links'][$this->_sections['i']['index']]['TITLE']; ?>
" class="text" style="width: 130px;" /></td>
						<td><input type="text" name="ADD_LINK_URL[]"   value="<?php echo $this->_tpl_vars['add_links'][$this->_sections['i']['index']]['URL']; ?>
"   class="text" style="width: 130px;" /></td>
					</tr>
					<?php endfor; endif; ?>
				</table>
				
				<div class="clear"></div>
			</td>
		</tr>
		</tbody>
	</table>
	<?php endif; ?>


	<table class="formPage">
		<tbody>
		<?php if (@REQUIRE_REGISTERED_USER): ?>
		<tr>
			<td class="label"><label for="OWNER_ID">Assign Owner:</label></td>
			<td class="smallDesc">
				<?php echo smarty_function_html_options(array('options' => $this->_tpl_vars['ActiveUsersList'],'selected' => $this->_tpl_vars['data']['OWNER_ID'],'name' => 'OWNER_ID','id' => 'OWNER_ID'), $this);?>

				<p class="msg notice info">Use with care!! Selected user details will overwrite link owner name, email address and id!!</p>
			</td>
		</tr>
		<?php else: ?>
			<?php if ($this->_tpl_vars['data']['OWNER_ID'] != ''): ?>
				<input type="hidden" name="OWNER_ID" value="<?php echo $this->_tpl_vars['data']['OWNER_ID']; ?>
" />
			<?php endif; ?>
		<?php endif; ?>
		
		<tr>
			<td class="label required"><label for="OWNER_EMAIL_CONFIRMED">Owner Email Confirmed:</label></td>
			<td class="smallDesc">
				<?php echo smarty_function_html_options(array('options' => $this->_tpl_vars['econfirm'],'selected' => $this->_tpl_vars['data']['OWNER_EMAIL_CONFIRMED'],'name' => 'OWNER_EMAIL_CONFIRMED','id' => 'OWNER_EMAIL_CONFIRMED'), $this);?>

			</td>
		</tr>
		
		<tr>
			<td class="label required"><label for="semail">Send Email On Edit:</label></td>
			<td class="smallDesc">
				<input type="checkbox" id="semail" name="semail" value="1" <?php if ($this->_tpl_vars['semail']): ?>checked="checked"<?php endif; ?> />
				<p class="msg notice info">Check this to send an email to the link owner to let them know you have edited the link.</p>
			</td>
		</tr>
		
		<tr>
			<td class="label required"><label for="STATUS">Status:</label></td>
			<td class="smallDesc">
				<?php echo smarty_function_html_options(array('options' => $this->_tpl_vars['stats'],'selected' => $this->_tpl_vars['data']['STATUS'],'name' => 'STATUS','id' => 'STATUS'), $this);?>

			</td>
		</tr>
		
		<tr>
			<td class="label"><label for="EXPIRY_DATE">Link Expires:</label></td>
			<td class="smallDesc">
				<input type="text" id="EXPIRY_DATE" name="EXPIRY_DATE" value="<?php echo $this->_tpl_vars['data']['EXPIRY_DATE']; ?>
" maxlength="40" class="text" />
			</td>
		</tr>
		
		<?php if (@ENABLE_PAGERANK): ?>
		<tr>
			<td class="label"><label for="PAGERANK">Pagerank:</label></td>
			<td class="smallDesc">
            	<input type="text" id="PAGERANK" name="PAGERANK" value="<?php echo $this->_tpl_vars['data']['PAGERANK']; ?>
" maxlength="2" class="text" />
            	<p class="msg notice info">Leave the field blank for automatic Google Pagerank calculation or give value of "-1" for no Pagerank.</p>
			</td>
		</tr>
		<?php endif; ?>
		
		<tr>
			<td class="label"><label for="HITS">Hits:</label></td>
			<td class="smallDesc">
				<input type="text" id="HITS" name="HITS" value="<?php echo $this->_tpl_vars['data']['HITS']; ?>
" maxlength="15" class="text" />
			</td>
		</tr>
		</tbody>
	</table>
	
	<table class="formPage">
	<tfoot>
		<tr>
			<input type="hidden" value="<?php echo $this->_tpl_vars['linktypeid']; ?>
" ID="LINK_TYPE_H" name="LINK_TYPE_H"/>
			<input type="hidden" value="<?php echo $this->_tpl_vars['data']['ID']; ?>
" ID="ID" name="id"/>
			<input type="hidden" value="<?php echo $this->_tpl_vars['data']['ID']; ?>
" ID="ID" name="ID"/>
			<td><input type="reset" id="reset-link-submit" name="reset" value="Reset" alt="Reset form" title="Reset form" class="button" /></td>
			<td><input type="submit" id="send-link-submit" name="save" value="Save" alt="Save form" title="Save link" class="button" /></td>
		</tr>
	</tfoot>
	</table>
	<input type="hidden" name="formSubmitted" value="1" />
	<input type="hidden" name="submit_session" value="<?php echo $this->_tpl_vars['submit_session']; ?>
" />
   </form>
</div>

<?php echo '
<script type="text/javascript">
jQuery(function($) {
	$(document).ready(function(){
		var allowed_fields 	= new Array;
		
		'; ?>

		<?php $_from = $this->_tpl_vars['link_types']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }$this->_foreach['link_types'] = array('total' => count($_from), 'iteration' => 0);
if ($this->_foreach['link_types']['total'] > 0):
    foreach ($_from as $this->_tpl_vars['link_type_id'] => $this->_tpl_vars['link_type']):
        $this->_foreach['link_types']['iteration']++;
?>
			allowed_fields[<?php echo $this->_tpl_vars['link_type_id']; ?>
] = [
				<?php $_from = $this->_tpl_vars['link_type']['FIELDS']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }$this->_foreach['fields'] = array('total' => count($_from), 'iteration' => 0);
if ($this->_foreach['fields']['total'] > 0):
    foreach ($_from as $this->_tpl_vars['field_name']):
        $this->_foreach['fields']['iteration']++;
?>
					"<?php echo $this->_tpl_vars['field_name']; ?>
"<?php if (! ($this->_foreach['fields']['iteration'] == $this->_foreach['fields']['total'])): ?>,<?php endif; ?>
				<?php endforeach; endif; unset($_from); ?>
			];
			
		<?php endforeach; endif; unset($_from); ?>
		<?php echo '

		'; ?>

				<?php echo '
		
		$("#LINK_TYPE").change(function(){
			//update_form(); // albert: seems useless, we are making a refresh when the user changes the link type
			var lt = getUrlVars()["LINK_TYPE"];
			if (lt) {
				var url = location.href.replace("LINK_TYPE="+lt, "LINK_TYPE="+$("#LINK_TYPE").val());
				location.href= url;
			} else {
				var url = location.href+"&LINK_TYPE="+$("#LINK_TYPE").val();
				location.href= url;
			}
		});
		
		$("#proccess_add_items").click(function(){
			$("#add_items").slideToggle();
		});
		
		$("#submitForm").submit(function() {
			$(\'#categ\').remove();
			return true;
		});
	});
});

function getUrlVars()
{
    var vars = [], hash;
    var hashes = window.location.href.slice(window.location.href.indexOf(\'?\') + 1).split(\'&\');
    for(var i = 0; i < hashes.length; i++)
    {
        hash = hashes[i].split(\'=\');
        vars.push(hash[0]);
        vars[hash[0]] = hash[1];
    }
    return vars;
}

Array.prototype.in_array = function(p_val) {
	for(var i = 0, l = this.length; i < l; i++) {
		if(this[i] == p_val) {
			return true;
		}
	}
	return false;
}

function plusFile()
{
	var div = $(\'file\');
	var newDiv = div.cloneNode(true);
	newDiv.id = \'\'
	//newDiv.style.display = \'none\';

	//newDiv.find(\'*.smallText\').val("");

	var delLink = $(\'fileDelLink\');
	var a = delLink.cloneNode(true);
	a.id = \'\';
	a.style.display = "inline";
	newDiv.appendChild(a);
	delLink.parentNode.insertBefore(newDiv, delLink);

}

function removeFile(elem)
{
	elem.parentNode.remove(elem.previousSibling);
}

function removeSize(elem)
{
	elem.parentNode.parentNode.removeChild(elem.parentNode);
}

var maxCats = '; ?>
<?php if ($this->_tpl_vars['link_type_details']['MULTIPLE_CATEGORIES'] == ''): ?>1<?php else: ?><?php echo $this->_tpl_vars['link_type_details']['MULTIPLE_CATEGORIES']; ?>
<?php endif; ?><?php echo ';
var numCats = '; ?>
1 + <?php echo count($this->_tpl_vars['add_categs']); ?>
<?php echo ';
if (numCats >= maxCats) {
	$(\'plusCategLink\').style.display = \'none\'; 
}

function plusCateg()
{
	var div = $(\'categ\');
	var newDiv = div.cloneNode(true);
	newDiv.id = \'\'
	newDiv.style.display = \'block\';

	//newDiv.find(\'*.smallText\').val("");

	var delLink = $(\'fileDelCateg\');
	var a = delLink.cloneNode(true);
	a.id = \'\';
	a.style.display = "inline";
	newDiv.appendChild(a);
	delLink.parentNode.insertBefore(newDiv, delLink);

	numCats++;
	if (numCats >= maxCats) {
		$(\'plusCategLink\').style.display = \'none\'; 
	} 
}

function removeCateg(elem)
{
	elem.parentNode.remove(elem.previousSibling);
	
	numCats--;
	if (numCats < maxCats) {
		$(\'plusCategLink\').style.display = \'block\'; 
	} 
}

function removeSize(elem)
{
	elem.parentNode.parentNode.removeChild(elem.parentNode);
}

</script>
'; ?>

