<?
### Версия ПО (ДМ) 1.0.0.0 ( (c)2018 MISOFT Продукт защищен регистрацией патента и авторских прав! www.misoft.studio )
######################################################################################################################

if ( $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest' ) {
    define( 'ROOT_DIR', $_SERVER['DOCUMENT_ROOT'] );
    session_start();
    header( 'Content-type: text/html; charset=windows-1251' );
    include_once ROOT_DIR . '/engine/config.php';
    include_once ROOT_DIR . '/engine/function.php';
} else {
    if ( !defined( 'MISOFT' ) ) { exit(); }
}

if ( !isset( $_SESSION['iduser'] ) ) {
    echo '<div style="margin-left: -10px;" class="alert alert-info alert-dismissible fade in" role="alert">
			<button type="button" class="close" data-dismiss="alert" aria-label="Close">
				<span aria-hidden="true">&times;</span>
			</button>
			<h5 class="alert-heading"><i class="fa fa-exclamation-triangle" aria-hidden="true"></i> Внимание!</h5>
			<p style="font-size: 14px;">Вы не авторизованы. Доступ к этой странице разрешен только авторизованным пользователям. <br>Пожалуйста, воспользуйтесь формой авторизации.</p>
			<p style="font-size: 14px;" class="m-b-0">Для перехода в форму авторизации нажмите <a class="a_link" href="/login" >назад</a>.</p>
		  </div>';
} else {
    $proverka = mysql_query( "SELECT * FROM dynlink WHERE iduser = '" . $_SESSION['iduser'] . "' and id = '" . ( int ) $_GET['id'] . "'" );
    $pr_row = mysql_fetch_array( $proverka );
    
    if ( mysql_num_rows( $proverka ) == 0 ) {
        echo '<div style="margin-left: -10px;" class="alert alert-info alert-dismissible fade in" role="alert">
				<button type="button" class="close" data-dismiss="alert" aria-label="Close">
					<span aria-hidden="true">&times;</span>
				</button>
				<h5 class="alert-heading">Ошибка!</h5>
				<p style="font-size: 14px;">Рекламная площадка не существует или удалена. </p>
				<p style="font-size: 14px;" class="m-b-0">Для возврата на предыдущую страницу нажмите <a class="a_link" href="/mdyn" >назад</a>.</p>
			  </div>';
    } else
    if ( $pr_row['paused'] == 1 ) {
        echo '<div style="margin-left: -10px;" class="alert alert-info alert-dismissible fade in" role="alert">
				<button type="button" class="close" data-dismiss="alert" aria-label="Close">
					<span aria-hidden="true">&times;</span>
				</button>
				<h5 class="alert-heading">Внимание!</h5>
				<p style="font-size: 14px;">Перед редактированием необходимо приостановить рекламную площадку, а затем уже приступать к редактированию.</p>
				<p style="font-size: 14px;" class="m-b-0">Для возврата на предыдущую страницу нажмите <a class="a_link" href="/mdyn" >назад</a>.</p>
			  </div>';
    } else {
        switch ( $pr_row['timer'] ) {
            case 0: $timer = 'dyn10'; break;
            case 1: $timer = 'dyn20'; break;
            case 2: $timer = 'dyn30'; break;
            case 3: $timer = 'dyn40'; break;
            case 4: $timer = 'dyn50'; break;
            case 5: $timer = 'dyn60'; break;
            case 6: $timer = 'dyn70'; break;
            case 7: $timer = 'dyn80'; break;
            case 8: $timer = 'dyn90'; break;
            case 9: $timer = 'dyn100'; break;
            case 10: $timer = 'dyn125'; break;
            case 11: $timer = 'dyn150'; break;
            case 12: $timer = 'dyn200'; break;
            case 13: $timer = 'dyn250'; break;
            case 14: $timer = 'dyn300'; break;
        }
        ?>
        <script type="text/javascript">
        $(document).ready(function(){
            $('.help_input').tipTip({defaultPosition:'right'});
            
            $('select, input').styler({width:'290', 'maxHeight':160});
			
			$('#geo_ru').styler();
			$('#geo_ua').styler();
			$('#geo_by').styler();
			$('#geo_kz').styler();
			$('#geo_ge').styler();
			$('#geo_md').styler();
			$('#geo_am').styler();
			$('#geo_tj').styler();
			$('#geo_az').styler();
			$('#geo_uz').styler();
			$('#geo_pt').styler();
			$('#geo_es').styler();
			$('#geo_ee').styler();
			$('#geo_lv').styler();
			$('#geo_lt').styler();
			$('#geo_us').styler();
			$('#geo_gb').styler();
			$('#geo_fr').styler();
			$('#geo_de').styler();
			$('#geo_cn').styler();
			$('#geo_all').styler();
			$('#geo_it').styler();
        });
        
        function PlanChange() {
            var lprice = 0;
            if ($('#timer').val() == 0) { lprice = <?=$config['dyn10']?>; } else
            if ($('#timer').val() == 1) { lprice = <?=$config['dyn20']?>; } else
            if ($('#timer').val() == 2) { lprice = <?=$config['dyn30']?>; } else
            if ($('#timer').val() == 3) { lprice = <?=$config['dyn40']?>; } else
            if ($('#timer').val() == 4) { lprice = <?=$config['dyn50']?>; } else
            if ($('#timer').val() == 5) { lprice = <?=$config['dyn60']?>; } else
            if ($('#timer').val() == 6) { lprice = <?=$config['dyn70']?>; } else
            if ($('#timer').val() == 7) { lprice = <?=$config['dyn80']?>; } else
            if ($('#timer').val() == 8) { lprice = <?=$config['dyn90']?>; } else
            if ($('#timer').val() == 9) { lprice = <?=$config['dyn100']?>; } else
            if ($('#timer').val() == 10) { lprice = <?=$config['dyn125']?>; } else
            if ($('#timer').val() == 11) { lprice = <?=$config['dyn150']?>; } else
            if ($('#timer').val() == 12) { lprice = <?=$config['dyn200']?>; } else
            if ($('#timer').val() == 13) { lprice = <?=$config['dyn250']?>; } else
            if ($('#timer').val() == 14) { lprice = <?=$config['dyn300']?>; } 
            if ($('#obper').val() == 1) { lprice += <?=$config['obper']?>; }
            if ($('#active_window').val() == 1) { lprice += <?=$config['active_window']?>; }
            if ($('#vip').val() == 1) { lprice += <?=$config['vipdyn']?>; }
            $('#summa').html(number_format(lprice, 3, '.', ''));
        }
        
        function number_format(number, decimals, dec_point, thousands_sep) {
            var i, j, kw, kd, km;
            if (isNaN(decimals = Math.abs(decimals))) { decimals = 2; }
            if (dec_point == undefined) { dec_point = ","; }
            if (thousands_sep == undefined) { thousands_sep = "."; }
            i = parseInt(number = (+number || 0).toFixed(decimals)) + "";
            if ((j = i.length) > 3) { j = j % 3; } else { j = 0; }
            km = (j ? i.substr(0, j) + thousands_sep : "");
            kw = i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + thousands_sep);
            kd = (decimals ? dec_point + Math.abs(number - i).toFixed(decimals).replace(/-/, 0).slice(2) : "");
            return km + kw + kd;
        }
        
        function updyn() {
			
			$('#error_title_form1').fadeOut();
			$('#error_title_form2').fadeOut();
			$('#error_title_form3').fadeOut();
			$('.inputStart_title').css({border: '1px solid #000'});
			$('.inputStart_description').css({border: '1px solid #000'});
			$('.inputStart_url').css({border: '1px solid #000'});
			
            $.ajax({
                type: 'POST',
                url: 'ajax.php?func=updyn',
                data: ({id: <?=$pr_row['id']?>, title: $('#title').val(), description: $('#description').val(), url: $('#url').val(), timer: $('#timer').val(), obper: $('#obper').val(), active_window: $('#active_window').val(), vip: $('#vip').val(), erotic: $('#erotic:checked').val(), freeid: $('#freeid:checked').val(), geo_ru: $('#geo_ru:checked').val(), geo_ua: $('#geo_ua:checked').val(), geo_by: $('#geo_by:checked').val(), geo_kz: $('#geo_kz:checked').val(), geo_ge: $('#geo_ge:checked').val(), geo_md: $('#geo_md:checked').val(), geo_am: $('#geo_am:checked').val(), geo_tj: $('#geo_tj:checked').val(), geo_az: $('#geo_az:checked').val(), geo_uz: $('#geo_uz:checked').val(), geo_pt: $('#geo_pt:checked').val(), geo_es: $('#geo_es:checked').val(), geo_ee: $('#geo_ee:checked').val(), geo_lv: $('#geo_lv:checked').val(), geo_lt: $('#geo_lt:checked').val(), geo_us: $('#geo_us:checked').val(), geo_gb: $('#geo_gb:checked').val(), geo_fr: $('#geo_fr:checked').val(), geo_de: $('#geo_de:checked').val(), geo_cn: $('#geo_cn:checked').val(), geo_all: $('#geo_all:checked').val(), geo_it: $('#geo_it:checked').val()}),
                dataType: 'html',
                beforeSend: function() {
                    $('.pajax').css({display:'block'});
                }, 
                success: function(data) {
                    if(data == 1) {
                        $('.pajax').css({display:'none'});
                       document.location.href = 'mdyn';
                    } else
					if(data == 2) {
						$('#error_title_form1').fadeIn();
						$('.div_form_eror_title').fadeIn().html('Вы не указали заголовок ссылки!');
						$('.inputStart_title').css({border: '1px solid #E85854'});
						$('.pajax').css({display:'none'});
						upScroll();
					} else  
					if(data == 3) {
						$('#error_title_form2').fadeIn();
						$('.div_form_eror_title').fadeIn().html('Вы не указали описание ссылки!');
						$('.inputStart_description').css({border: '1px solid #E85854'});
						$('.pajax').css({display:'none'});
						upScroll();
					} else 
					if(data == 4) {
						$('#error_title_form3').fadeIn();
						$('.div_form_eror_title').fadeIn().html('Вы не указали url ссылки!');
						$('.inputStart_url').css({border: '1px solid #E85854'});
						$('.pajax').css({display:'none'});
						upScroll();
					} else {
                        $('.erroralert').fadeIn(500).html(data);
                        setTimeout(function() {
                            $('.erroralert').fadeOut(500).html('&nbsp;');
                        }, 4000);
                        $('.pajax').css({display:'none'});
                    }
                }
            });
            return false;
        }
		
		function show_geo() {
			if ($('.show_geo').css('display') == 'none') {
				$('.show_geo').fadeIn(500);
			} else {
				$('.show_geo').fadeOut(300);
			}
		}
	
		function show_close() {
			if ($('#tmode').val() == '1') {
				$('.show_close').fadeIn(500);
			} else {
				$('.show_close').fadeOut(300);
			}
		}
		
		///Функция возврата каретки в верх окна.
		var timeScrollUP; 
		var top = Math.max(document.body.scrollTop,document.documentElement.scrollTop);
		function upScroll() {
		  var top = Math.max(document.body.scrollTop,document.documentElement.scrollTop);
		  if(top > 0) {
			window.scrollBy(0,-100);
			timeScrollUP = setTimeout('upScroll()',10);
		  } else clearTimeout(timeScrollUP);
		  return false;
		}
        </script>
		
		<link media="all" type="text/css" rel="stylesheet" href="/theme/css/input_form_fix.css" />
		
		<nav class="breadcrumb breadcrumb_stabilizator" style="background: #F7F7F7; border-radius: 1px;">
			<a class="breadcrumb-item" href="/mdyn">Управление рекламой</a>
			<span class="breadcrumb-item active">Редактирование</span>
		</nav>
		
		<div class="content_bar">
			<article class="postBox">
				
				<h5><a>Редактирование площадки № <?=$pr_row['id']?></a></h5><br>
				
				<div class="div_form">
					<table class=" table_form">
		
						<tr>
							<td class="td_form" >Заголовок ссылки:</td>
							<td class="" >
								<input class="inputStart_title" type="text" placeholder="укажите краткий заголовок рекламной кампании" id="title" maxlength="55" value="<?=$pr_row['title']?>" />
								<div style="display:none;" id="error_title_form1">
									<div class="eror_form"></div>
									<div class="div_form_eror_title"></div>
								</div>
							</td>
						</tr>
				
						<tr>
							<td class="td_form">Описание ссылки:</td>
							<td class="" >
								<input class="inputStart_description" type="text" placeholder="укажите краткое описание рекламируемого ресурса" id="description"  value="<?=$pr_row['description']?>" maxlength="55" />
								<div style="display:none;" id="error_title_form2">
									<div class="eror_form"></div>
									<div class="div_form_eror_title">Внимание, ссылка указанна не верно!</div>
								</div>
							</td>
						</tr>
                
						<tr>
							<td class="td_form">URL сайта:</td>
							<td class="" >
								<input class="inputStart_url" type="text" placeholder="обязательно укажите ссылку начиная с http:/https:" value="<?=$pr_row['url']?>" id="url" />
								<div style="display:none;" id="error_title_form3">
									<div class="eror_form"></div>
									<div class="div_form_eror_title">Внимание, ссылка указанна не верно!</div>
								</div>
							</td>
						</tr>
						<? if($pr_row['testdrive'] == 1) { ?>
						<tr>
							<td class="td_form">Время просмотра ссылки:</td>
							<td >
							<?
								switch ( $pr_row['timer'] ) {
									case '0': $timedrive = '10 секунд'; break;
									case '1': $timedrive = '20 секунд'; break;
									case '2': $timedrive = '30 секунд'; break;
									case '3': $timedrive = '40 секунд'; break;
									case '4': $timedrive = '50 секунд'; break; 
									case '5': $timedrive = '60 секунд'; break;
									case '6': $timedrive = '70 секунд'; break;
									case '7': $timedrive = '80 секунд'; break;
									case '8': $timedrive = '90 секунд'; break;
									case '9': $timedrive = '100 секунд'; break;
									case '10': $timedrive = '125 секунд'; break;
									case '11': $timedrive = '150 секунд'; break;
									case '12': $timedrive = '200 секунд'; break;
									case '13': $timedrive = '250 секунд'; break;
									case '14': $timedrive = '300 секунд'; break;
								}
								echo $timedrive;
							?>
							</td>
						</tr>
						<tr>
							<td class="td_form">Последующий переход:</td>
							<td >
							<?
								if($pr_row['obper'] == 0) { echo 'нет';} else { echo 'да'; }
							?>
							</td>
						</tr>
						<tr>
							<td class="td_form">Активное окно:</td>
							<td >
							<?
								if($pr_row['active_window'] == 0) { echo 'нет';} else { echo 'да'; }
							?>
							</td>
						</tr>
						<tr>
							<td class="td_form">V.I.P:</td>
							<td >
							<?
								if($pr_row['vip'] == 0) { echo 'нет';} else { echo 'да'; }
							?>
							</td>
						</tr>
						<? } else { ?>
							<tr>
								<td class="td_form">Время просмотра ссылки:</td>
								<td >
								  <select id="timer" style="width: 100px; height: 22px; display: none;" onchange="PlanChange(); return false;">
									<option>-- Выберите --</option>
									<option value="0" <? if( $pr_row['timer'] == 0 ) echo 'selected';?>>10 секунд&nbsp;&nbsp;(<?=$config['dyn10']?> <?=$config['valutaname'] ?>) - Mini</option>
									<option value="1" <? if( $pr_row['timer'] == 1 ) echo 'selected';?>>20 секунд&nbsp;&nbsp;(<?=$config['dyn20']?> <?=$config['valutaname'] ?>) - Mini</option>
									<option value="2" <? if( $pr_row['timer'] == 2 ) echo 'selected';?>>30 секунд&nbsp;&nbsp;(<?=$config['dyn30']?> <?=$config['valutaname'] ?>) - Standart</option>
									<option value="3" <? if( $pr_row['timer'] == 3 ) echo 'selected';?>>40 секунд&nbsp;&nbsp;(<?=$config['dyn40']?> <?=$config['valutaname'] ?>) - Standart</option>
									<option value="4" <? if( $pr_row['timer'] == 4 ) echo 'selected';?>>50 секунд&nbsp;&nbsp;(<?=$config['dyn50']?> <?=$config['valutaname'] ?>) - Standart</option>
									<option value="5" <? if( $pr_row['timer'] == 5 ) echo 'selected';?>>60 секунд&nbsp;&nbsp;(<?=$config['dyn60']?> <?=$config['valutaname'] ?>) - Standart</option>
									<option value="6" <? if( $pr_row['timer'] == 6 ) echo 'selected';?>>70 секунд&nbsp;&nbsp;(<?=$config['dyn70']?> <?=$config['valutaname'] ?>) - Standart</option>
									<option value="7" <? if( $pr_row['timer'] == 7 ) echo 'selected';?>>80 секунд&nbsp;&nbsp;(<?=$config['dyn80']?> <?=$config['valutaname'] ?>) - Standart</option>
									<option value="8" <? if( $pr_row['timer'] == 8 ) echo 'selected';?>>90 секунд&nbsp;&nbsp;(<?=$config['dyn90']?> <?=$config['valutaname'] ?>) - Standart</option>
									<option value="9" <? if( $pr_row['timer'] == 9 ) echo 'selected';?>>100 секунд&nbsp;&nbsp;(<?=$config['dyn100']?> <?=$config['valutaname'] ?>) - Mega</option>
									<option value="10" <? if( $pr_row['timer'] == 10 ) echo 'selected';?>>125 секунд&nbsp;&nbsp;(<?=$config['dyn125']?> <?=$config['valutaname'] ?>) - Mega</option>
									<option value="11" <? if( $pr_row['timer'] == 11 ) echo 'selected';?>>150 секунд&nbsp;&nbsp;(<?=$config['dyn150']?> <?=$config['valutaname'] ?>) - Mega</option>
									<option value="12" <? if( $pr_row['timer'] == 12 ) echo 'selected';?>>200 секунд&nbsp;&nbsp;(<?=$config['dyn200']?> <?=$config['valutaname'] ?>) - Mega</option>
									<option value="13" <? if( $pr_row['timer'] == 13 ) echo 'selected';?>>250 секунд&nbsp;&nbsp;(<?=$config['dyn250']?> <?=$config['valutaname'] ?>) - Mega</option>
									<option value="14" <? if( $pr_row['timer'] == 14 ) echo 'selected';?>>300 секунд&nbsp;&nbsp;(<?=$config['dyn300']?> <?=$config['valutaname'] ?>) - Mega</option>
								  </select>
								</td>
							</tr>
							<tr>
								<td class="td_form">Последующий переход:</td>
								<td >
									<select id="obper" style="width: 100px; height: 22px; display: none;" onchange="PlanChange(); return false;">
										<option>-- Выберите --</option>
										<option value="0" <? if( $pr_row['obper'] == 0 ) echo 'selected';?>>Нет</option>
										<option value="1" <? if( $pr_row['obper'] == 1 ) echo 'selected';?>>Да&nbsp;&nbsp;(+ <?=$config['obper'] ?> <?=$config['valutaname']?>)</option>
									</select>
								</td>
							</tr>
							<tr>
								<td class="td_form">Активное окно:</td>
								<td >
									<select id="active_window" style="width: 100px; height: 22px; display: none;" onchange="PlanChange(); return false;">
										<option>-- Выберите --</option>
										<option value="0" <? if( $pr_row['active_window'] == 0 ) echo 'selected';?>>Нет</option>
										<option value="1" <? if( $pr_row['active_window'] == 1 ) echo 'selected';?>>Да&nbsp;&nbsp;(+ <?=$config['active_window'] ?> <?=$config['valutaname']?>)</option>
									</select>
								</td>
							</tr>
							<tr>
								<td class="td_form">V.I.P:</td>
								<td >
									<select id="vip" style="width: 100px; height: 22px; display: none;" onchange="PlanChange(); return false;">
										<option>-- Выберите --</option>
										<option value="0" <? if( $pr_row['vip'] == 0 ) echo 'selected';?>>Нет</option>
										<option value="1" <? if( $pr_row['vip'] == 1 ) echo 'selected';?>>Да&nbsp;&nbsp;(+ <?=$config['vipdyn'] ?> <?=$config['valutaname']?>)</option>
									</select>
								</td>
							</tr>
						<? } ?>
				
						<tr>
							<td class="td_form" style="vertical-align: top;">Геотаргетинг:</td>
							<td >
								<div class="margin_add_geo"><a class="add_geo" onclick="show_geo();return false" href="#">скрыть / показать</a></div>
								<div class="show_geo" style="">
									<table class="table_geo_addtext">
										<tr>
											<td style="width: 50%;"><input type="checkbox" id="geo_ru" value="ru" <? if( $pr_row['geo_ru'] == 'ru' ) echo 'checked="selected"';?> /> <label>&nbsp;<img src="/theme/images/flags/ru.png" class="flagcountry" alt="" />&nbsp;&nbsp;Россия</label></td>
											<td style="width: 50%;"><input type="checkbox" id="geo_ua" value="ua" <? if( $pr_row['geo_ua'] == 'ua' ) echo 'checked="selected"';?> /> <label>&nbsp;<img src="/theme/images/flags/ua.png" class="flagcountry" alt="" />&nbsp;&nbsp;Украина</label></td>
										</tr>
										<tr>
											<td style="width: 50%;"><input type="checkbox" id="geo_by" value="by" <? if( $pr_row['geo_by'] == 'by' ) echo 'checked="selected"';?> /> <label>&nbsp;<img src="/theme/images/flags/by.png" class="flagcountry" alt="" />&nbsp;&nbsp;Белоруссия</label></td>
											<td style="width: 50%;"><input type="checkbox" id="geo_ge" value="ge" <? if( $pr_row['geo_ge'] == 'ge' ) echo 'checked="selected"';?> /> <label>&nbsp;<img src="/theme/images/flags/ge.png" class="flagcountry" alt="" />&nbsp;&nbsp;Грузия</label></td>
										</tr>
										<tr>
											<td style="width: 50%;"><input type="checkbox" id="geo_md" value="md" <? if( $pr_row['geo_md'] == 'md' ) echo 'checked="selected"';?> /> <label>&nbsp;<img src="/theme/images/flags/md.png" class="flagcountry" alt="" />&nbsp;&nbsp;Молдова</label></td>
											<td style="width: 50%;"><input type="checkbox" id="geo_kz" value="kz" <? if( $pr_row['geo_kz'] == 'kz' ) echo 'checked="selected"';?> /> <label>&nbsp;<img src="/theme/images/flags/kz.png" class="flagcountry" alt="" />&nbsp;&nbsp;Казакстан</label></td>
										</tr>
										<tr>
											<td style="width: 50%;"><input type="checkbox" id="geo_am" value="am" <? if( $pr_row['geo_am'] == 'am' ) echo 'checked="selected"';?> /> <label>&nbsp;<img src="/theme/images/flags/am.png" class="flagcountry" alt="" />&nbsp;&nbsp;Армения</label></td>
											<td style="width: 50%;"><input type="checkbox" id="geo_tj" value="tj" <? if( $pr_row['geo_tj'] == 'tj' ) echo 'checked="selected"';?> /> <label>&nbsp;<img src="/theme/images/flags/tj.png" class="flagcountry" alt="" />&nbsp;&nbsp;Таджикистан</label></td>
										</tr>
										<tr>
											<td style="width: 50%;"><input type="checkbox" id="geo_az" value="az" <? if( $pr_row['geo_az'] == 'az' ) echo 'checked="selected"';?> /> <label>&nbsp;<img src="/theme/images/flags/az.png" class="flagcountry" alt="" />&nbsp;&nbsp;Азербайджан</label></td>
											<td style="width: 50%;"><input type="checkbox" id="geo_uz" value="uz" <? if( $pr_row['geo_uz'] == 'uz' ) echo 'checked="selected"';?> /> <label>&nbsp;<img src="/theme/images/flags/uz.png" class="flagcountry" alt="" />&nbsp;&nbsp;Узбекистан</label></td>
										</tr>
										<tr>
											<td style="width: 50%;"><input type="checkbox" id="geo_pt" value="pt" <? if( $pr_row['geo_pt'] == 'pt' ) echo 'checked="selected"';?> /> <label>&nbsp;<img src="/theme/images/flags/pt.png" class="flagcountry" alt="" />&nbsp;&nbsp;Португалия</label></td>
											<td style="width: 50%;"><input type="checkbox" id="geo_es" value="es" <? if( $pr_row['geo_es'] == 'es' ) echo 'checked="selected"';?> /> <label>&nbsp;<img src="/theme/images/flags/es.png" class="flagcountry" alt="" />&nbsp;&nbsp;Испания</label></td>
										</tr>
										<tr>
											<td style="width: 50%;"><input type="checkbox" id="geo_ee" value="ee" <? if( $pr_row['geo_ee'] == 'ee' ) echo 'checked="selected"';?> /> <label>&nbsp;<img src="/theme/images/flags/ee.png" class="flagcountry" alt="" />&nbsp;&nbsp;Эстония</label></td>
											<td style="width: 50%;"><input type="checkbox" id="geo_lv" value="lv" <? if( $pr_row['geo_lv'] == 'lv' ) echo 'checked="selected"';?> /> <label>&nbsp;<img src="/theme/images/flags/lv.png" class="flagcountry" alt="" />&nbsp;&nbsp;Латвия</label></td>
										</tr>
										<tr>
											<td style="width: 50%;"><input type="checkbox" id="geo_lt" value="lt" <? if( $pr_row['geo_lt'] == 'lt' ) echo 'checked="selected"';?> /> <label>&nbsp;<img src="/theme/images/flags/lt.png" class="flagcountry" alt="" />&nbsp;&nbsp;Литва</label></td>
											<td style="width: 50%;"><input type="checkbox" id="geo_us" value="us" <? if( $pr_row['geo_us'] == 'us' ) echo 'checked="selected"';?> /> <label>&nbsp;<img src="/theme/images/flags/us.png" class="flagcountry" alt="" />&nbsp;&nbsp;Америка</label></td>
										</tr>
										<tr>
											<td style="width: 50%;"><input type="checkbox" id="geo_gb" value="gb" <? if( $pr_row['geo_gb'] == 'gb' ) echo 'checked="selected"';?> /> <label>&nbsp;<img src="/theme/images/flags/gb.png" class="flagcountry" alt="" />&nbsp;&nbsp;Англия</label></td>
											<td style="width: 50%;"><input type="checkbox" id="geo_fr" value="fr" <? if( $pr_row['geo_fr'] == 'fr' ) echo 'checked="selected"';?> /> <label>&nbsp;<img src="/theme/images/flags/fr.png" class="flagcountry" alt="" />&nbsp;&nbsp;Франция</label></td>
										</tr>
										<tr>
											<td style="width: 50%;"><input type="checkbox" id="geo_de" value="de" <? if( $pr_row['geo_de'] == 'de' ) echo 'checked="selected"';?> /> <label>&nbsp;<img src="/theme/images/flags/de.png" class="flagcountry" alt="" />&nbsp;&nbsp;Германия</label></td>
											<td style="width: 50%;"><input type="checkbox" id="geo_cn" value="cn" <? if( $pr_row['geo_cn'] == 'cn' ) echo 'checked="selected"';?> /> <label>&nbsp;<img src="/theme/images/flags/cn.png" class="flagcountry" alt="" />&nbsp;&nbsp;Китай</label></td>
										</tr>
										<tr>
											<td style="width: 50%;"><input type="checkbox" id="geo_it" value="it" <? if( $pr_row['geo_it'] == 'it' ) echo 'checked="selected"';?> /> <label>&nbsp;<img src="/theme/images/flags/it.png" class="flagcountry" alt="" />&nbsp;&nbsp;Италия</label></td>
											<td style="width: 50%;"><input type="checkbox" id="geo_all" value="all" <? if( $pr_row['geo_all'] == 'all' ) echo 'checked="selected"';?> /> <label>Другие страны</label></td>
										</tr>
									</table>
								</div>
							</td>
						</tr>
						<tr>
							<td class="td_form"></td>
							<td ><div class="pos_check"><input type="checkbox" <?if ( $pr_row['erotic'] == 1 ) echo 'checked'; ?> id="erotic" />&nbsp;&nbsp;<div class="td_pravka"><label>Содержит материалы для взрослых</label></div></div></td>
						</tr>
						<tr>
							<td class="td_form"></td>
							<td ><div class="pos_check"><input type="checkbox" <?if ( $pr_row['freeid'] == 1 ) echo 'checked'; ?> id="freeid" />&nbsp;&nbsp;<div class="td_pravka" >Только для свободных рефералов</div></div></td>
						</tr>
						<? if($pr_row['testdrive'] == 1) { ?>
						<tr>
							<td class="td_form">Количество визитов:</td>
							<td ><?=$config['testdriveSum']?></td>
						</tr>
						<? } else { ?>
						<tr>
							<td class="td_form">Стоимость просмотра:</td>
							<td class=""><div class="formPrice"><span id="summa"><?=$pr_row['active_window'] * $config['active_window'] + $pr_row['obper'] * $config['obper'] + $pr_row['vip'] * $config['vipdyn'] + $config[$timer]?></span> <?=$config['valutaname']?></div></td>
						</tr>
						<? } ?>
						<tr>
							<td class="td_form"><img src="/theme/images/preload.gif" class="pajax" style="display: none;"/></td>
							<td class="">
								<br><div class="more-link"><a href="#" onclick="updyn(); return false;">Сохранить</a></div><br><br>
							</td>
						</tr>
						<tr>
							<td class="td_form"></td>
							<td class="td_form" colspan="2"><div class="erroralert" ></div></td>
						</tr>
					</table>
				</div>
				<br>
			</article>
		</div>
        <?
    }
}
?>