/* Cached on Sat, 27 Apr 2024 09:36:14 */ document.setCookie = function(name, value, hour, path, domain, secure) {// setCookie("myCookie", "my name", 24); var curCookie = name+"="+escape(value)+ ((hour)?"; expires="+new Date((new Date()).getTime() + hour * 3600000).toGMTString():"")+ ((path)?"; path="+path:"")+ ((domain)?"; domain="+domain:"")+ ((secure)?"; secure":""); if (curCookie.length < 4096 || confirm("Cookie more 4KB!")) document.cookie = curCookie; } document.getCookie = function(name) {// alert(getCookie("myCookie")); var prefix = name+"="; var cookieStartIndex = document.cookie.indexOf(prefix); if (cookieStartIndex == -1) return null; var cookieEndIndex = document.cookie.indexOf(";", cookieStartIndex + prefix.length); if (cookieEndIndex == -1) cookieEndIndex = document.cookie.length; return unescape(document.cookie.substring(cookieStartIndex + prefix.length, cookieEndIndex)); } String.prototype.toQueryParams = function() { var arr = this.split('&'); var p = new Array(); for(var i in arr) { var arrln = arr[i].split('='); p[arrln[0]] = decodeURIComponent(arrln[1]); } return p; } String.prototype.hrefReplace = function(q) { var arr = q.split('&'); var p = new Array(); for(var i in arr) { var arrln = arr[i].split('='); p[p.length] = arrln[0]; } var re = new RegExp('\\&?\\b('+p.join('|')+')\\b\\=[^&]*', 'g'); var t = this.split('#'); t[0] = t[0].replace(re, '')+'&'+q; return t.join('#'); } function zebra() { var tables = document.getElementsByTagName('TABLE'); var l = 0; for(var k = 0, countt = tables.length; k < countt; k++) { if (tables[k].className != 'tablmain') continue; var table = tables[k]; for(var i = 0, countrow = table.rows.length; i < countrow; i++) { if (table.rows[i].style.display != 'none') l++; table.rows[i].className = (l % 2 == 1) ? 'alternate' : ''; } } } function onlymandatory(b) { var tables = document.getElementsByTagName('TABLE'); for(var k = 0, countt = tables.length, first = true; k < countt; k++) { if (tables[k].className != 'tablmain') continue; var table = tables[k]; table.style.display = (first || b)?'':'none'; first = false; for(var i = 1, countrow = table.rows.length; i < countrow; i++) { if (table.rows[i].cells[0].className != 'abridged') { table.rows[i].style.display = b?'none':''; } } } zebra(); document.getElementById('idbutnextpage').style.visibility = document.getElementById('idbutprevpage').style.visibility = b?'hidden':'visible'; document.getElementById('idbutsubmitpage').style.visibility = document.getElementById('recaptcha').style.visibility = b?'visible':'hidden'; document.getElementById('idbutprevpage').style.visibility = 'hidden'; } function nextpage() { var tables = document.getElementsByTagName('TABLE'); var countt = tables.length; for(var k = 0; k < countt; k++) { if (tables[k].className == 'tablmain') { var table = tables[k]; if (table.style.display == '') { table.style.display = 'none'; tables[k + 1].style.display = ''; if (typeof tables[k + 2] == 'undefined' || tables[k + 2].className != 'tablmain') { document.getElementById('idbutnextpage').style.visibility = 'hidden'; document.getElementById('idbutsubmitpage').style.visibility = document.getElementById('recaptcha').style.visibility = 'visible'; } document.getElementById('idbutprevpage').style.visibility = 'visible'; break; } } } } function prevpage() { var tables = document.getElementsByTagName('TABLE'); var countt = tables.length; for(var k = 0; k < countt; k++) { if (tables[k].className == 'tablmain') { var table = tables[k]; if (table.style.display == '') { table.style.display = 'none'; tables[k - 1].style.display = ''; if (typeof tables[k - 2] == 'undefined' || tables[k - 2].className != 'tablmain') document.getElementById('idbutprevpage').style.visibility = 'hidden'; document.getElementById('idbutnextpage').style.visibility = 'visible'; document.getElementById('idbutsubmitpage').style.visibility = document.getElementById('recaptcha').style.visibility = 'hidden'; break; } } } } function addmultiblock(ob) { var newFields = ob.cloneNode(true); var newField = newFields.childNodes; var insertHere = ob.nextSibling; insertHere.parentNode.insertBefore(newFields,insertHere); } function textarealimit(ob) { var maxlength = ob.getAttribute('maxlength'); if (ob.value.length > maxlength + 1) { ob.value = ob.value.substr(0, maxlength); } return ob.value.length < maxlength; } function item_input_checked(a) { var b = document.getCookie('item_input_checked'); if (a.checked && !b) { document.setCookie('item_input_checked', a.value); } else { var re = new RegExp('\\,?\\b'+a.value+'\\b'); if (a.checked) { if (!re.test(b)) b += ','+a.value; } else { b = b.replace(re, ''); b = b.replace(/^\,/, ''); } document.setCookie('item_input_checked', b); } } function populateCity(ob, country) { for (var i in datasourceCities[country]) { var opt = document.createElement('OPTION'); opt.value = datasourceCities[country][i][1]; opt.text = datasourceCities[country][i][2]; if (datasourceCities[country][i][0] == 1) opt.style.backgroundColor = '#FFFFAA'; ob.options.add(opt); } } function populateCity_n(ob, country) { ob.options.length = 2; for (var i in datasourceCities[country]) { var opt = document.createElement('OPTION'); opt.value = datasourceCities[country][i][1]; opt.text = datasourceCities[country][i][2]; if (opt.value == 61) continue; ob.options.add(opt); } } function populateCity_nq(ob, country) { ob.options.length = 1; for (var i in datasourceCities_n[country]) { var opt = document.createElement('OPTION'); opt.value = datasourceCities_n[country][i][1]; opt.text = datasourceCities_n[country][i][2]; ob.options.add(opt); } } function bookmarksite(title,url){ if (window.sidebar) // firefox window.sidebar.addPanel(title, url, ""); else if(window.opera && window.print){ // opera var elem = document.createElement('a'); elem.setAttribute('href',url); elem.setAttribute('title',title); elem.setAttribute('rel','sidebar'); elem.click(); } else if(document.all)// ie window.external.AddFavorite(url, title); } function ad_remove(ob, id) { var $this = $(ob); var data = {command: 'remove'}; data['ad['+id+']'] = 'on'; $.post("?page=ad", data, function(data) { if (data == 'OK') $this.parent().remove(); }); } function ad_visible(ob, id) { var $this = $(ob); console.log($this.attr('title')); var state = $this.attr('title') == 'on'; var data = {command: state ? 'off' : 'on'}; data['ad['+id+']'] = 'on'; $.post("?page=ad", data, function(data) { if (data == 'OK') { $this.text(state ? 'Вкл.' : 'Выкл.'); $this.attr('title', state ? 'off' : 'on'); $this.css('color', state ? 'red' : 'blue'); } }); } $(function() { $('.ad-view').submit(function(event) { event.preventDefault(); var $this = $(this); var data = $this.serialize(); $.post($this.attr('action'), data, function(data) { console.log(data); }); }); $('.ad-view select[name=command]').change(function() { $('.ad-view select[name=command]').val($(this).val()); }); });