<?php
if (isset($tpl['status']))
{
	$status = __('status', true);
	switch ($tpl['status'])
	{
		case 2:
			pjUtil::printNotice(NULL, $status[2]);
			break;
	}
} else {
	$titles = __('error_titles', true);
	$bodies = __('error_bodies', true);
	if (isset($_GET['err']))
	{
		pjUtil::printNotice(@$titles[$_GET['err']], @$bodies[$_GET['err']]);
	}
	$week_start = isset($tpl['option_arr']['o_week_start']) && in_array((int) $tpl['option_arr']['o_week_start'], range(0,6)) ? (int) $tpl['option_arr']['o_week_start'] : 0;
	$jqDateFormat = pjUtil::jqDateFormat($tpl['option_arr']['o_date_format']);
	
	$yesno_arr = __('_yesno', true);
	
	if($controller->isAdmin())
	{
		include_once PJ_VIEWS_PATH . 'pjAdminJobs/elements/menu.php';
	}
	?>
	<style type="text/css">
	/*.ui-widget-content{
		border: medium none;
	}
	.ui-tabs .ui-tabs-nav li a {
		padding: 0.5em 0.8em;
	}*/
	.mceEditor > table{
		width: 570px !important;
	}
	.ui-menu{
		height: 230px;
		overflow-y: scroll;
	}
	.ui-tabs .ui-tabs-panel{
		overflow: visible;
	}
	</style>
	<form action="<?php echo $_SERVER['PHP_SELF']; ?>?controller=pjAdminJobs&amp;action=pjActionUpdate" method="post" id="frmUpdateJob" class="form pj-form" >
		<input type="hidden" name="job_update" value="1" />
		<input type="hidden" name="csrf_token" value="<?php echo pjAppController::getCsrfToken(); ?>" />
		<input type="hidden" name="id" value="<?php echo $tpl['arr']['id']; ?>" />
		<input type="hidden" name="tab_id" value="<?php echo isset($_GET['tab_id']) && !empty($_GET['tab_id']) ? $_GET['tab_id'] : 'tabs-1'; ?>" />
		<?php $locale = isset($_GET['locale']) && (int) $_GET['locale'] > 0 ? (int) $_GET['locale'] : $controller->getLocaleId(); ?>
		<input type="hidden" name="locale" value="<?php echo $locale; ?>" />
		
		<div id="tabs">
			<ul>
				<li><a href="#tabs-1"><?php __('lblJobSummary'); ?></a></li>
				<li><a href="#tabs-2"><?php __('lblJobDetails'); ?></a></li>
				<li><a href="#tabs-3"><?php __('lblEmployerDetails'); ?></a></li>
				<li><a href="#tabs-4"><?php __('lblSEO'); ?></a></li>
			</ul>
			<div id="tabs-1">
				<p>
					<label class="title"><?php __('lblAddedon'); ?></label>
					<span class="left"><?php echo pjUtil::formatDate(date("Y-m-d", strtotime($tpl['arr']['created'])), 'Y-m-d', $tpl['option_arr']['o_date_format']) . ' ' . pjUtil::formatTime(date("H:i:s", strtotime($tpl['arr']['created'])), 'H:i:s', $tpl['option_arr']['o_time_format']); ?></span>
				</p>
				<p>
					<label class="title"><?php __('lblLastUpdatedOn'); ?></label>
					<span class="left"><?php echo pjUtil::formatDate(date("Y-m-d", strtotime($tpl['arr']['modified'])), 'Y-m-d', $tpl['option_arr']['o_date_format']) . ' ' . pjUtil::formatTime(date("H:i:s", strtotime($tpl['arr']['modified'])), 'H:i:s', $tpl['option_arr']['o_time_format']); ?></span>
				</p>
				<p>
					<label class="title"><?php __('lblViews'); ?></label>
					<span class="left"><?php echo !empty($tpl['arr']['views']) ? intval($tpl['arr']['views']) : 0; ?></span>
				</p>
				<p>
					<label class="title"><?php __('menuApplications'); ?></label>
					<span class="left"><a class="no-decor" href="<?php echo $_SERVER['PHP_SELF']; ?>?controller=pjAdminApplications&amp;action=pjActionIndex&amp;job_id=<?php echo $_GET['id'];?>"><?php echo intval($tpl['num_apps']); ?></a></span>
				</p>
				<p>
					<label class="title"><?php __('lblReferenceID'); ?></label>
					<span class="inline_block">
						<input type="text" name="job_refid" id="job_refid" value="<?php echo pjSanitize::html($tpl['arr']['job_refid']);?>" class="pj-form-field w250 required" />
					</span>
				</p>
				<?php
				if(!$controller->isEmployer())
				{ 
					?>
					
					<p>
						<label class="title"><?php __('lblIsPublished'); ?></label>
						<span class="inline_block">
							<select name="status" id="status" class="pj-form-field w200 required">
								<option value="">-- <?php __('lblChoose'); ?> --</option>
								<?php
								foreach (__('publish_status', true) as $k => $v)
								{
								    ?><option value="<?php echo $k; ?>" <?php echo $tpl['arr']['status'] == $k ? 'selected="selected"' : null; ?>><?php echo pjSanitize::html($v); ?></option><?php
								}
								?>
							</select>
							<a href="#" class="pj-form-langbar-tip listing-tip" title="<?php __('lblStatusTip'); ?>"></a>
						</span>
					</p>
					
					<p class="expiredWrapper" style="display:<?php echo $tpl['arr']['status'] == 'E' ? '' : 'none';?>;">
						<label class="title"><?php __('lblExpirationDate'); ?></label>
						<span class="pj-form-field-custom pj-form-field-custom-after">
							<input type="text" name="expired" id="expired" class="pj-form-field pointer w80 datepick<?php echo $tpl['arr']['status'] == 'E' ? ' required' : NULL;?>" value="<?php echo $tpl['arr']['status'] == 'E' ? pjUtil::formatDate($tpl['arr']['expired'], "Y-m-d", $tpl['option_arr']['o_date_format']) : NULL; ?>" readonly="readonly" rel="<?php echo $week_start; ?>" rev="<?php echo $jqDateFormat; ?>" />
							<span class="pj-form-field-after"><abbr class="pj-form-field-icon-date"></abbr></span>
							<a href="#" class="pj-form-langbar-tip listing-tip" title="<?php __('lblExpireOnTip'); ?>"></a>
						</span>
					</p>
					<p class="expiredWrapper" style="display:<?php echo $tpl['arr']['status'] == 'E' ? '' : 'none';?>;">
						<label class="title">&nbsp;</label>
						<span class="inline_block">
							<input type="checkbox" id="expired_show" name="expired_show" <?php echo $tpl['arr']['expired_show'] == 'T' ? 'checked="checked"' : null; ?> value="T"/>
							<label for="expired_show"><?php __('lblShowOn');?></label>
						</span>
					</p>
					<p>
						<label class="title"><?php __('lblMakeFeatured'); ?></label>
						<span class="left">
						<?php
						foreach (__('_yesno', true) as $k => $v)
						{
							?>
							<label class="r5"><input type="radio" name="is_featured" value="<?php echo $k; ?>"<?php echo $tpl['arr']['is_featured'] == $k ? ' checked="checked"' : NULL; ?> /> <?php echo $v; ?></label>
							<?php
						}
						?>
						<a href="#" class="pj-form-langbar-tip listing-tip" title="<?php echo pjSanitize::clean(__('lblFeaturedTip', true)); ?>"></a>
						<?php
						?>
						</span>
					</p>
					<?php
				}else{
					if($tpl['arr']['status'] == 'E')
					{
						?>
						<p>
							<label class="title"><?php __('lblExpirationDate'); ?></label>
							<span class="left float_left"><?php echo pjUtil::formatDate(date("Y-m-d", strtotime($tpl['arr']['expired'])), 'Y-m-d', $tpl['option_arr']['o_date_format']); ?></span>
							<a class="pj-button float_left l10" href="<?php echo $_SERVER['PHP_SELF']; ?>?controller=pjAdminJobs&amp;action=pjActionPayment&amp;id=<?php echo $tpl['arr']['id']; ?>"><?php __('lblJobExtend'); ?></a>
						</p>
						<?php
					}else if($tpl['arr']['status'] == 'T'){
						?>
						<p>
							<label class="title"><?php __('lblExpirationDate'); ?></label>
							<span class="left float_left"><?php __('lblUnlimited'); ?></span>
						</p>
						<?php
						
					}
				} 
				?>
				<p>
					<label class="title">&nbsp;</label>
					<input type="submit" value="<?php __('btnSave'); ?>" class="pj-button" />
					<input type="button" value="<?php __('btnCancel'); ?>" class="pj-button" onclick="window.location.href='<?php echo PJ_INSTALL_URL; ?>index.php?controller=pjAdminJobs&action=pjActionIndex';" />
				</p>
			</div><!-- tabs-1 -->
			<div id="tabs-2">
				<?php if ((int) $tpl['option_arr']['o_multi_lang'] === 1 && count($tpl['lp_arr']) > 1) : ?>
				<div class="multilang b10"></div>
				<?php endif;?>
				<div class="clear_both">
					<?php
					foreach ($tpl['lp_arr'] as $v)
					{
						?>
						<p class="pj-multilang-wrap" data-index="<?php echo $v['id']; ?>" style="display: <?php echo (int) $v['is_default'] === 0 ? 'none' : NULL; ?>">
							<label class="title"><?php __('lblJobTitle'); ?></label>
							<span class="inline_block">
								<input type="text" name="i18n[<?php echo $v['id']; ?>][job_title]" class="pj-form-field w400<?php echo (int) $v['is_default'] === 0 ? NULL : ' required'; ?>" value="<?php echo pjSanitize::html(@$tpl['arr']['i18n'][$v['id']]['job_title']); ?>" />
								<?php if ((int) $tpl['option_arr']['o_multi_lang'] === 1 && count($tpl['lp_arr']) > 1) : ?>
								<span class="pj-multilang-input"><img src="<?php echo PJ_INSTALL_URL . PJ_FRAMEWORK_LIBS_PATH . 'pj/img/flags/' . $v['file']; ?>" alt="" /></span>
								<?php endif;?>
							</span>
						</p>
						<?php
					}
					?>
					<p>
						<label class="title"><?php __('lblJobSalary'); ?></label>
						<span class="inline_block">
							<input type="text" name="job_salary" id="job_salary" value="<?php echo pjSanitize::html($tpl['arr']['job_salary']);?>" class="pj-form-field w150" />
						</span>
					</p>
					<p>
						<label class="title"><?php __('lblType'); ?></label>
						<span class="inline_block" id="boxType">
							<select name="type_id" id="type_id" class="pj-form-field w200 required">
								<option value="">-- <?php __('lblChoose');?> --</option>
								<?php
								foreach ($tpl['type_arr'] as $v)
								{
									?><option value="<?php echo $v['id'];?>"<?php echo $tpl['arr']['type_id'] == $v['id'] ? ' selected="selected"' : NULL;?>><?php echo pjSanitize::html($v['name']);?></option><?php
								} 
								?>
							</select>
						</span>
					</p>
					<p style="overflow: visible">
						<label class="title"><?php __('lblCategory'); ?></label>
						<span class="inline_block" id="boxCategory">
							<select name="category_id" id="category_id" class="pj-form-field w400 required">
								<option value="">-- <?php __('lblChoose');?> --</option>
								<?php
								foreach ($tpl['category_arr'] as $v)
								{
									?><option value="<?php echo $v['id'];?>"<?php echo $tpl['arr']['category_id'] == $v['id'] ? ' selected="selected"' : NULL;?>><?php echo pjSanitize::html($v['name']);?></option><?php
								} 
								?>
							</select>
						</span>
					</p>
					<div class="t10">
                        <label class="title l5"><?php __('lblFilters');?></label>
                        <div class="overflow">
                        	<?php
                        	$filter_types = __('filter_types', true);
                        	foreach($filter_types as $k => $v)
                        	{
                        		?>
                        		<ul style="display: block; float: left; overflow: hidden;margin-top: 4px; margin-bottom: 6px;">
                        			<li class="bold b5"><?php echo $v;?></li>
                        			<?php
                        			if(isset($tpl['filter_arr'][$k]))
                        			{
										foreach($tpl['filter_arr'][$k] as $filter)
										{
											?>
											<li class="b5 w270 float_left pointer"><label class="pointer"><input name="filter_id[]"<?php echo in_array($filter['id'], $tpl['filter_id_arr']) ? ' checked="checked"' : NULL;?> value="<?php echo $filter['id'];?>" type="checkbox" class="float_left r5"><?php echo $filter['name'];?></label></li>
											<?php
										}                        				
                        			} 
                        			?>
                        		</ul>
                        		<?php
                        	} 
                        	?>
                        </div>
                    </div>
                    <div class="clear_both"></div>
					<?php
					foreach ($tpl['lp_arr'] as $v)
					{
						?>
						<p class="pj-multilang-wrap" data-index="<?php echo $v['id']; ?>" style="display: <?php echo (int) $v['is_default'] === 0 ? 'none' : NULL; ?>">
							<label class="title"><?php __('lblJobDescription'); ?></label>
							<span class="inline_block">
								<textarea name="i18n[<?php echo $v['id']; ?>][job_description]" class="mceEditor" style="width: 570px; height: 400px"><?php echo pjSanitize::html(@$tpl['arr']['i18n'][$v['id']]['job_description']); ?></textarea>
								<?php if ((int) $tpl['option_arr']['o_multi_lang'] === 1 && count($tpl['lp_arr']) > 1) : ?>
								<span class="pj-multilang-input"><img src="<?php echo PJ_INSTALL_URL . PJ_FRAMEWORK_LIBS_PATH . 'pj/img/flags/' . $v['file']; ?>" alt="" /></span>
								<?php endif;?>
							</span>
						</p>
						<?php
					}
					?>
					<p>
						<label class="title">&nbsp;</label>
						<input type="submit" value="<?php __('btnSave'); ?>" class="pj-button" />
						<input type="button" value="<?php __('btnCancel'); ?>" class="pj-button" onclick="window.location.href='<?php echo PJ_INSTALL_URL; ?>index.php?controller=pjAdminJobs&action=pjActionIndex';" />
					</p>
				</div>
			</div><!-- tabs-2 -->
			<div id="tabs-3">
				<?php if ((int) $tpl['option_arr']['o_multi_lang'] === 1 && count($tpl['lp_arr']) > 1) : ?>
				<div class="multilang b10"></div>
				<?php endif;?>
				<div class="clear_both">
					<p>
						<label class="title"><?php __('lblShowEmployer'); ?></label>
						<input type="checkbox" name="employer_show" id="employer_show" class="t5" value="T" <?php echo $tpl['arr']['employer_show'] == 'T' ? 'checked="checked"' : null;?>/>
					</p>
					<?php
					if(!$controller->isEmployer())
					{
						?>
						<p>
							<label class="title"><?php __('lblEmployer'); ?></label>
							<select name="employer_id" id="employer_id" class="pj-form-field w300">
								<option value="">-- <?php __('lblChoose'); ?> --</option>
								<?php
								foreach ($tpl['employer_arr'] as $v)
								{
									if ($tpl['arr']['employer_id'] == $v['id'])
									{
									    ?><option value="<?php echo $v['id']; ?>" selected="selected"><?php echo pjSanitize::html($v['company_name']); ?></option><?php
									} else {
									    ?><option value="<?php echo $v['id']; ?>"><?php echo pjSanitize::html($v['company_name']); ?></option><?php
									}
								}
								?>
							</select>
							<a href="<?php echo $_SERVER['PHP_SELF']; ?>?controller=pjAdminEmployers&amp;action=pjActionUpdate&amp;id=<?php echo $tpl['arr']['employer_id']; ?>" class="pj-edit pjJLEditEmployer" style="display: <?php echo !empty($tpl['arr']['employer_id']) ? 'inline-block' : 'none';?>"></a>
						</p>
						<?php
					} 
					?>
					<p>
						<label class="title">&nbsp;</label>
						<span class="inline_block bold">
							<?php __('lblJobOfferAddress');?>
						</span>
					</p>
					<p>
						<label class="title"><?php __('lblZipCode'); ?></label>
						<input type="text" name="address_postcode" id="address_postcode" value="<?php echo pjSanitize::html($tpl['arr']['address_postcode']); ?>" class="pj-form-field" />
					</p>
					
					<?php
					foreach ($tpl['lp_arr'] as $v)
					{
						?>
						<p class="pj-multilang-wrap" data-index="<?php echo $v['id']; ?>" style="display: <?php echo (int) $v['is_default'] === 0 ? 'none' : NULL; ?>">
							<label class="title"><?php __('lblAddress'); ?></label>
							<span class="inline_block">
								<input type="text" name="i18n[<?php echo $v['id']; ?>][address_content]" class="pj-form-field w400" value="<?php echo !empty($tpl['arr']['i18n'][$v['id']]['address_content']) ? pjSanitize::html(@$tpl['arr']['i18n'][$v['id']]['address_content']) : pjSanitize::html($tpl['arr']['address_content']); ?>" />
								<?php if ((int) $tpl['option_arr']['o_multi_lang'] === 1 && count($tpl['lp_arr']) > 1) : ?>
								<span class="pj-multilang-input"><img src="<?php echo PJ_INSTALL_URL . PJ_FRAMEWORK_LIBS_PATH . 'pj/img/flags/' . $v['file']; ?>" alt="" /></span>
								<?php endif;?>
							</span>
						</p>
						<?php
					}
					?>
					
					</p>
					<p style="overflow: visible">
						<label class="title"><?php __('lblCountry'); ?></label>
						<select name="country_id" id="country_id" class="pj-form-field w300">
							<option value="">-- <?php __('lblChoose'); ?> --</option>
							<?php
							foreach ($tpl['country_arr'] as $v)
							{
								if ($tpl['arr']['country_id'] == $v['id'])
								{
									?><option value="<?php echo $v['id']; ?>" selected="selected"><?php echo pjSanitize::html($v['name']); ?></option><?php
								} else {
								    ?><option value="<?php echo $v['id']; ?>"><?php echo pjSanitize::html($v['name']); ?></option><?php
								}
							}
							?>
						</select>
					</p>
					<?php
					foreach ($tpl['lp_arr'] as $v)
					{
						?>
						<p class="pj-multilang-wrap" data-index="<?php echo $v['id']; ?>" style="display: <?php echo (int) $v['is_default'] === 0 ? 'none' : NULL; ?>">
							<label class="title"><?php __('lblState'); ?></label>
							<span class="inline_block">
								<input type="text" name="i18n[<?php echo $v['id']; ?>][address_state]" class="pj-form-field w200" value="<?php echo !empty($tpl['arr']['i18n'][$v['id']]['address_state']) ? pjSanitize::html(@$tpl['arr']['i18n'][$v['id']]['address_state']) : pjSanitize::html($tpl['arr']['address_state']); ?>" />
								<?php if ((int) $tpl['option_arr']['o_multi_lang'] === 1 && count($tpl['lp_arr']) > 1) : ?>
								<span class="pj-multilang-input"><img src="<?php echo PJ_INSTALL_URL . PJ_FRAMEWORK_LIBS_PATH . 'pj/img/flags/' . $v['file']; ?>" alt="" /></span>
								<?php endif;?>
							</span>
						</p>
						<?php
					}
					?>
					<?php
					foreach ($tpl['lp_arr'] as $v)
					{
						?>
						<p class="pj-multilang-wrap" data-index="<?php echo $v['id']; ?>" style="display: <?php echo (int) $v['is_default'] === 0 ? 'none' : NULL; ?>">
							<label class="title"><?php __('lblCity'); ?></label>
							<span class="inline_block">
								<input type="text" name="i18n[<?php echo $v['id']; ?>][address_city]" class="pj-form-field w200" value="<?php echo !empty($tpl['arr']['i18n'][$v['id']]['address_city']) ? pjSanitize::html(@$tpl['arr']['i18n'][$v['id']]['address_city']) : pjSanitize::html($tpl['arr']['address_city']); ?>" />
								<?php if ((int) $tpl['option_arr']['o_multi_lang'] === 1 && count($tpl['lp_arr']) > 1) : ?>
								<span class="pj-multilang-input"><img src="<?php echo PJ_INSTALL_URL . PJ_FRAMEWORK_LIBS_PATH . 'pj/img/flags/' . $v['file']; ?>" alt="" /></span>
								<?php endif;?>
							</span>
						</p>
						<?php
					}
					?>
					<p>
						<label class="title">&nbsp;</label>
						<input type="submit" value="<?php __('btnSave'); ?>" class="pj-button" />
						<input type="button" value="<?php __('btnCancel'); ?>" class="pj-button" onclick="window.location.href='<?php echo PJ_INSTALL_URL; ?>index.php?controller=pjAdminJobs&action=pjActionIndex';" />
					</p>
				</div>
			</div><!-- tabs-3 -->
			<div id="tabs-4">
				<?php
				pjUtil::printNotice(__('infoListingSEOTitle', true), __('infoListingSEOBody', true));  
				?>
				<?php if ((int) $tpl['option_arr']['o_multi_lang'] === 1 && count($tpl['lp_arr']) > 1) : ?>
				<div class="multilang b10"></div>
				<?php endif;?>
				<div class="clear_both">
					<?php
					foreach ($tpl['lp_arr'] as $v)
					{
						?>
						<p class="pj-multilang-wrap" data-index="<?php echo $v['id']; ?>" style="display: <?php echo (int) $v['is_default'] === 0 ? 'none' : NULL; ?>">
							<label class="title"><?php __('lblListingMetaTitle'); ?></label>
							<span class="inline_block">
								<input type="text" name="i18n[<?php echo $v['id']; ?>][meta_title]" class="pj-form-field w500" value="<?php echo pjSanitize::html(@$tpl['arr']['i18n'][$v['id']]['meta_title']); ?>" />
								<?php if ((int) $tpl['option_arr']['o_multi_lang'] === 1 && count($tpl['lp_arr']) > 1) : ?>
								<span class="pj-multilang-input"><img src="<?php echo PJ_INSTALL_URL . PJ_FRAMEWORK_LIBS_PATH . 'pj/img/flags/' . $v['file']; ?>" alt="" /></span>
								<?php endif;?>
							</span>
						</p>
						<?php
					}
					foreach ($tpl['lp_arr'] as $v)
					{
						?>
						<p class="pj-multilang-wrap" data-index="<?php echo $v['id']; ?>" style="display: <?php echo (int) $v['is_default'] === 0 ? 'none' : NULL; ?>">
							<label class="title"><?php __('lblListingMetaKeywords'); ?></label>
							<span class="inline_block">
								<input type="text" name="i18n[<?php echo $v['id']; ?>][meta_keywords]" class="pj-form-field w500" value="<?php echo pjSanitize::html(@$tpl['arr']['i18n'][$v['id']]['meta_keywords']); ?>" />
								<?php if ((int) $tpl['option_arr']['o_multi_lang'] === 1 && count($tpl['lp_arr']) > 1) : ?>
								<span class="pj-multilang-input"><img src="<?php echo PJ_INSTALL_URL . PJ_FRAMEWORK_LIBS_PATH . 'pj/img/flags/' . $v['file']; ?>" alt="" /></span>
								<?php endif;?>
							</span>
						</p>
						<?php
					}
					foreach ($tpl['lp_arr'] as $v)
					{
						?>
						<p class="pj-multilang-wrap" data-index="<?php echo $v['id']; ?>" style="display: <?php echo (int) $v['is_default'] === 0 ? 'none' : NULL; ?>">
							<label class="title"><?php __('lblListingMetaDesc'); ?></label>
							<span class="inline_block">
								<input type="text" name="i18n[<?php echo $v['id']; ?>][meta_description]" class="pj-form-field w500" value="<?php echo pjSanitize::html(@$tpl['arr']['i18n'][$v['id']]['meta_description']); ?>" />
								<?php if ((int) $tpl['option_arr']['o_multi_lang'] === 1 && count($tpl['lp_arr']) > 1) : ?>
								<span class="pj-multilang-input"><img src="<?php echo PJ_INSTALL_URL . PJ_FRAMEWORK_LIBS_PATH . 'pj/img/flags/' . $v['file']; ?>" alt="" /></span>
								<?php endif;?>
							</span>
						</p>
						<?php
					}
					?>
					<p>
						<label class="title">&nbsp;</label>
						<input type="submit" value="<?php __('btnSave'); ?>" class="pj-button pj-button-save" />
					</p>
				</div>
			</div><!-- tabs-4 -->
		</div>
	</form>
	<script type="text/javascript">
		var myLabel = myLabel || {};
		myLabel.address_not_found = "<?php __('jl_address_not_found'); ?>";
		myLabel.field_required = "<?php __('jl_field_required'); ?>";
		myLabel.same_refid = "<?php __('jl_same_refid'); ?>";
		myLabel.localeId = "<?php echo $controller->getLocaleId(); ?>";
		(function ($) {
			$(function() {
				$(".multilang").multilang({
					langs: <?php echo $tpl['locale_str']; ?>,
					flagPath: "<?php echo PJ_FRAMEWORK_LIBS_PATH; ?>pj/img/flags/",
					select: function (event, ui) {
						$("input[name='locale']").val(ui.index);
						$.get("index.php?controller=pjAdminJobs&action=pjActionGetLocale", {
							"locale" : ui.index
						}).done(function (data) {
							tid = <?php echo !empty($tpl['arr']['type_id']) ? $tpl['arr']['type_id'] : ''; ?>;
							$("#boxType").html(data.type);
							$("#type_id").find("option[value='"+tid+"']").prop("selected", true);

							cat_id = <?php echo !empty($tpl['arr']['category_id']) ? $tpl['arr']['category_id'] : ''; ?>;
							$("#boxCategory").html(data.category);
							$("#category_id").find("option[value='"+cat_id+"']").prop("selected", true);
							$("#category_id").chosen();
							
						});
					}
				});
				$(".multilang").find("a[data-index='<?php echo $locale; ?>']").trigger("click");
			});
		})(jQuery_1_8_2);
	</script>
	<?php
	if (isset($_GET['tab_id']) && !empty($_GET['tab_id']))
	{
		$tab_id = explode("-", $_GET['tab_id']);
		$tab_id = (int) $tab_id[1] - 1;
		$tab_id = $tab_id < 0 ? 0 : $tab_id;
		?>
		<script type="text/javascript">
		(function ($) {
			$(function () {
				$("#tabs").tabs("option", "active", <?php echo $tab_id; ?>);
			});
		})(jQuery_1_8_2);
		</script>
		<?php
	}
}
?>