function navigateindex1()
{
var index=document.chooseforum1.which.selectedIndex;
var address=document.chooseforum1.which.options[index].value;
window.location=address;
}
function navigateindex2()
{
var index=document.chooseforum2.which.selectedIndex;
var address=document.chooseforum2.which.options[index].value;
window.location=address;
}
function insstr(str)
{
document.postform.anstext.value=document.postform.anstext.value+str;
}
function showsmiles(h)
{
if (h) { showhelp(1); }
var div = document.all.smileslist.style;
if (div.overflow == 'hidden') { div.overflow = 'visible'; }
else { div.overflow = 'hidden'; }
}
function showhelp(h)
{
if (h) { showsmiles(1); }
var div = document.all.help.style;
if (div.overflow == 'hidden') { div.overflow = 'visible'; }
else { div.overflow = 'hidden'; }
}
function ChangeImage()
{
document.images.avatar.src='./img/avatars/'+document.postform.avatars.options[document.postform.avatars.selectedIndex].value;
}
function copyQ()
{ txt='';
if (document.getSelection) { txt=document.getSelection(); }
else if (document.selection) { txt=document.selection.createRange().text; }
}
function pasteQ(author,mid){
if(txt.length<1) window.alert('Выделите текст и попробуйте еще!');
else document.postform.anstext.value=document.postform.anstext.value+"[q=\""+author+"\" mid="+mid+"]"+txt+"[/q]\n";
}
function pasteN(name)
{ document.postform.anstext.value=document.postform.anstext.value+"[u][b]"+name+":[/b][/u] ";
}
function get_quote_selection()
{
var text;
w = window;
if (w.document.getSelection) {
text = quote_strip_tags(w.document.getSelection());
} else if (w.getSelection) {
text = quote_strip_tags(w.getSelection() /*.getRangeAt(0)*/);
} else if (w.document.selection) {
var selection = w.document.selection;
text = selection.createRange().text;
} else {
text = '';
}
text = "" + text;
if (text.replace) text = text.replace("/^\s+|\s+$/g", "");
return text;
}
function insert_string(text, textarea)
{
var t = null;
if (textarea.focus) {
t = textarea;
} else if (document.all) {
t = document.all[textarea];
} else if (document.getElementsByName) {
t = document.getElementsByName(textarea);
if (t) t = t[0];
} else {
alert("Not supported in this browser!");
return false;
}
if (t.focus) t.focus();
if (document.selection && document.selection.createRange) {
var r = document.selection.createRange();
r.collapse();
r.text = text;
} else {
t.value += text;
}
}
function onclick_poster(name, textarea)
{
var text = '';
var sel = get_quote_selection()
if (sel) {
text = "[q" + (name!=''? '="'+name+'"' : '') + "]" + sel + "[/q]\n";
} else {
text = "[u][b]" + name + ':[/b][/u]\n';
}
insert_string(text, textarea);
return false;
}
//---
// From http://www.massless.org/mozedit/
function mozWrap(txtarea, open, close)
{// Modified by P.K.
var selLength = txtarea.textLength;
var selStart = txtarea.selectionStart;
var selEnd = txtarea.selectionEnd;
if(selLength == undefined || selStart == undefined || selEnd == undefined)
{
txtarea.value += open + txt + close;
return false;
}
if(selEnd == 1 || selEnd == 2)
{
selEnd = selLength;
}
var s1 = (txtarea.value).substring(0,selStart);
var s2 = (txtarea.value).substring(selStart, selEnd)
var s3 = (txtarea.value).substring(selEnd, selLength);
s2 ? s2 = s2 : s2 = txt;
txtarea.value = s1 + open + s2 + close + s3;
return true;
}
//---
//---
function get_codes(bcode, ecode, select)
{//P.K. bb codes function
var ta = document.postform.anstext;
if(false)
{
ta.value = bcode + ta.value + ecode;
}
else
{
var text_range;
if(document.getSelection)
{
text_range = document.getSelection();
mozWrap(ta, bcode, ecode);
}
else
{
text_range = document.selection.createRange().text;
if(text_range)
{
ta_copy = ta.value;
range_copy = text_range;
document.selection.createRange().text = bcode + document.selection.createRange().text + ecode;
if(ta_copy != ta.value)
{
ta_copy = ta.value;
document.selection.createRange().text = range_copy;
ta.value = ta_copy;
}
else
{
ta_copy = ta.value;
document.selection.createRange().text = range_copy;
ta.value = ta_copy + bcode + txt + ecode;
}
document.selection.empty;
document.selection.clear;
text_range = '';
range_copy = '';
ta_copy = '';
txt = '';
}
else
{
ta.value += bcode + ecode;
}
}
}
if(select){ select.selectedIndex = 0;}
}
function alert_mess(div_id){
var e = document.getElementById(div_id);
if(e.style.display == 'block')
e.style.display = 'none';
else
e.style.display = 'block';
}
function updCounters(){
up_counters_count++;
$('#counters').html("+((typeof(screen)=="undefined")?"":
";s"+screen.width+"*"+screen.height+"*"+(screen.colorDepth?
screen.colorDepth:screen.pixelDepth))+";u"+escape(document.URL)+
";h"+escape(document.title.substring(0,80))+";"+Math.random()+
")
");
if( up_counters_count<5 ){
setTimeout('updCounters()', 30000);
}else if( up_counters_count<10 ){
setTimeout('updCounters()', 60000);
}else{
setTimeout('updCounters()', 600000);
}
}
function getGeoIP(ip,div_id,div_id_prov){
$('#'+div_id).html('Геолокация:
');
$('#'+div_id_prov).html('Провайдер:
');
jQuery.ajax({
url: 'http://forum.n-sk.info/proxy_geo.php',
type: 'GET',
data:{ ip: ip },
success: function(res){
var inetnum = 'неизвестно';
var country = 'неизвестно';
var city = 'неизвестно';
var region = 'неизвестно';
var district = 'неизвестно';
var lat = 'неизвестно';
var lng = 'неизвестно';
$(res).find('ip').each(function(){
inetnum = $(this).find('inetnum').text();
country = $(this).find('country').text();
city = $(this).find('city').text();
region = $(this).find('region').text();
district = $(this).find('district').text();
lat = $(this).find('lat').text();
lng = $(this).find('lng').text();
});
result = '
';
result += '| Диапазон: | ' + inetnum + ' |
';
result += '| Страна: | ' + country + ' |
';
result += '| Город: | ' + city + ' |
';
result += '| Регион: | ' + region + ' |
';
result += '| Округ: | ' + district + ' |
';
result += '| Широта: | ' + lat + ' |
';
result += '| Долгота: | ' + lng + ' |
';
result += '
Информация является примерной и может не соответствовать действительности
Новокуйбышевск очень часто определяется как Самара, координаты указаны для города, либо для центрального офиса провайдера.';
$('#'+div_id).html(result);
},
error: function(){
$('#'+div_id).html('Информация временно недоступна');
}
});
jQuery.ajax({
url: 'http://forum.n-sk.info/proxy_provider.php',
type: 'GET',
data:{ ip: ip },
success: function(res){
$('#'+div_id_prov).html(res);
},
error: function(){
$('#'+div_id_prov).html('Информация временно недоступна');
}
});
}
function getOffset(elem) {
if (elem.getBoundingClientRect) {
// "правильный" вариант
return getOffsetRect(elem)
} else {
// пусть работает хоть как-то
return getOffsetSum(elem)
}
}
function getOffsetSum(elem) {
var top=0, left=0
while(elem) {
top = top + parseInt(elem.offsetTop)
left = left + parseInt(elem.offsetLeft)
elem = elem.offsetParent
}
return {top: top, left: left}
}
function getOffsetRect(elem) {
// (1)
var box = elem.getBoundingClientRect()
// (2)
var body = document.body
var docElem = document.documentElement
// (3)
var scrollTop = window.pageYOffset || docElem.scrollTop || body.scrollTop
var scrollLeft = window.pageXOffset || docElem.scrollLeft || body.scrollLeft
// (4)
var clientTop = docElem.clientTop || body.clientTop || 0
var clientLeft = docElem.clientLeft || body.clientLeft || 0
// (5)
var top = box.top + scrollTop - clientTop
var left = box.left + scrollLeft - clientLeft
return { top: Math.round(top), left: Math.round(left) }
}
function getShowedDiv(div_id){
var height = screen.height;
if(div_id==1){
var div_el=document.getElementById("banner_a");
}else if(div_id==2){
var div_el=document.getElementById("banner_b");
}else if(div_id==3){
var div_el=document.getElementById("banner_c");}
el=getOffset(div_el);
if( (el.top<0) || (el.top>height) ){delta=0;}else{delta=1;};
return delta;
}
/*
* jQuery autoResize (textarea auto-resizer)
* @copyright James Padolsey http://james.padolsey.com
* @version 1.04
*/
(function(a){a.fn.autoResize=function(j){var b=a.extend({onResize:function(){},animate:true,animateDuration:150,animateCallback:function(){},extraSpace:20,limit:1000},j);this.filter('textarea').each(function(){var c=a(this).css({}),k=c.height(),f=(function(){var l=['height','width','lineHeight','textDecoration','letterSpacing'],h={};a.each(l,function(d,e){h[e]=c.css(e)});return c.clone().removeAttr('id').removeAttr('name').css({position:'absolute',top:0,left:-9999}).css(h).attr('tabIndex','-1').insertBefore(c)})(),i=null,g=function(){f.height(0).val(a(this).val()).scrollTop(10000);var d=Math.max(f.scrollTop(),k)+b.extraSpace,e=a(this).add(f);if(i===d){return}i=d;if(d>=b.limit){a(this).css('overflow-y','');return}b.onResize.call(this);b.animate&&c.css('display')==='block'?e.stop().animate({height:d},b.animateDuration,b.animateCallback):e.height(d)};c.unbind('.dynSiz').bind('keyup.dynSiz',g).bind('keydown.dynSiz',g).bind('change.dynSiz',g)});return this}})(jQuery);
$(function () {
var tabContainers = $('div.tabs > div');
tabContainers.hide().filter(':first').show();
$('div.tabs ul.tabNavigation a').click(function () {
tabContainers.hide();
var show = tabContainers.filter(this.hash);
var bodyText = show.text();
function Ajax(tab){
$.ajax({
type: "GET",
url: 'ajax.php',
data: ({tab : tab}),
success: function(text){
show.html(text);
show.fadeIn('slow');
$("#wrapper p.hide").fadeIn('slow');
}
});
$("#loading").ajaxStart(function(){
$(this).show();
});
$("#loading").ajaxComplete(function(){
$(this).hide();
});
}
if(bodyText == ''){Ajax(this.hash);}else{show.fadeIn('slow')}
$('div.tabs ul.tabNavigation a').removeClass('selected');
$('div.tabs ul.tabNavigation li').addClass('noselli');
$(this).parent().removeClass('noselli');
$(this).addClass('selected');
return false;
}).filter(':first').click();
});
var swfuPhotos;
function BindSWFUpload() {
var swfuPhotosSettings = {
file_dialog_complete_handler: photos_fileDialogComplete,
upload_progress_handler: photos_uploadProgress,
upload_success_handler: photos_uploadSuccess,
upload_complete_handler: photos_uploadComplete,
swfupload_loaded_handler: swfuploadLoaded,
file_queue_error_handler: photos_fileQueueError,
file_size_limit: "10 MB",
file_types: "*.jpg;*.png",
file_types_description: "JPG, PNG images",
file_upload_limit: "0",
button_placeholder_id: "fAddPhotos"
}
var defaultSettings = {
flash_url: "files/swf/swfupload.swf",
upload_url: "upload.php",
post_params: {
"ASPSESSID": ASPSESSID
},
button_width: 115,
button_height: 32,
button_image_url: "files/images/white50.png",
button_window_mode: SWFUpload.WINDOW_MODE.TRANSPARENT,
button_cursor: SWFUpload.CURSOR.HAND
}
swfuPhotos = new SWFUpload($.extend(swfuPhotosSettings, defaultSettings));
}
//Подписки
function fav(set,id){
jQuery.ajax({
type: 'GET',
url: 'http://forum.n-sk.info/ajax.php',
data:{
mode: 'fav',
tid: id,
set: set
},
success: function(data){
$('#'+id).animate({opacity:'0'},100,function(){
$('#'+id).html(data).animate({opacity:'1'},500);
});
},
error: function(){
$('#'+id).html('Ошибка');
}
});
}
//Самомодерирование
function aPoll(div_id,aid,poll){
$('#'+div_id).html('Отправляем данные...');
jQuery.ajax({
url: 'http://forum.n-sk.info/ajax.php',
type: 'GET',
data:{
mode: 'apoll',
aid: aid,
poll: poll
},
success: function(data){
$('#'+div_id).animate({opacity:'1'},500);
$('#'+div_id).html(data);
},
error: function(){
$('#'+div_id).html('Ошибка обмена. Пожалуйста, обновите страницу.');
}
});
}
//Перенос сообщения
function mMove(div_id,input_tid,mid){
var tid = $('#'+input_tid).val();
tid = Math.floor(tid);
$('#'+div_id).html('Отправляем данные...');
jQuery.ajax({
url: 'http://forum.n-sk.info/ajax.php',
type: 'GET',
data:{
mode: 'mmove',
mid: mid,
tid: tid
},
success: function(data){
$('#'+div_id).animate({opacity:'1'},500);
$('#'+div_id).html(data);
},
error: function(){
$('#'+div_id).html('Ошибка обмена. Пожалуйста, обновите страницу.');
}
});
}
//Делаем новости
function mNews(div_id,chk_news,input_title,mid){
var news = $("#"+chk_news).attr("checked");
var title = $("#"+input_title).val();
if(title == ''){
alert('Введите заголовок новости!');
}else{
mid = Math.floor(mid);
$('#'+div_id).html('Отправляем данные...');
jQuery.ajax({
url: 'http://forum.n-sk.info/ajax.php',
type: 'GET',
data:{
mode: 'mnews',
news: news,
title: title,
mid: mid
},
success: function(data){
$('#'+div_id).animate({opacity:'1'},500);
$('#'+div_id).html(data);
},
error: function(){
$('#'+div_id).html('Ошибка обмена. Пожалуйста, обновите страницу.');
}
});
}
}
//Спасибо за сообщение
function mThanks(div_id,mid,uid){
$('#'+div_id).slideDown('fast').html('Отправляем данные...');
jQuery.ajax({
url: 'http://forum.n-sk.info/ajax.php',
type: 'GET',
data:{
mode: 'thanks',
mid: mid,
uid: uid
},
success: function(data){
$('#'+div_id).animate({opacity:'1'},500);
$('#'+div_id).html(data);
},
error: function(){
$('#'+div_id).html('Ошибка обмена. Пожалуйста, обновите страницу.');
}
});
}
//Проверка мыла
function checkMail(div_id,mail){
$('#'+div_id).html('Отправляем данные...');
jQuery.ajax({
url: 'http://forum.n-sk.info/ajax.php',
type: 'GET',
data:{
mode: 'checkmail',
mail: mail
},
success: function(data){
$('#'+div_id).animate({opacity:'1'},500);
$('#'+div_id).html(data);
},
error: function(){
$('#'+div_id).html('Ошибка обмена. Пожалуйста, обновите страницу.');
}
});
}
//Изменение мыла
function setMail(div_id,mail){
$('#'+div_id).html('Отправляем данные...');
jQuery.ajax({
url: 'http://forum.n-sk.info/ajax.php',
type: 'GET',
data:{
mode: 'setmail',
mail: mail
},
success: function(data){
$('#'+div_id).animate({opacity:'1'},500);
$('#'+div_id).html(data);
},
error: function(){
$('#'+div_id).html('Ошибка обмена. Пожалуйста, обновите страницу.');
}
});
}
//Изменение мыла
function getForget(div_id,mail){
$('#'+div_id).html('Отправляем данные...');
jQuery.ajax({
url: 'http://forum.n-sk.info/ajax.php',
type: 'GET',
data:{
mode: 'forget',
mail: mail
},
success: function(data){
$('#'+div_id).animate({opacity:'1'},500);
$('#'+div_id).html(data);
},
error: function(){
$('#'+div_id).html('Ошибка обмена. Пожалуйста, обновите страницу.');
}
});
}
/**
* @author Falchenko Maxim aka be3
* @plugin_page http://tops.net.ua/jquery_addtocopy/
* @desc Adds a link to the copied text
* @version 1.2
* @example
* $("#content").addtocopy();
* @license free
**/
jQuery.fn.addtocopy = function(usercopytxt) {
var options = {htmlcopytxt: '
More: '+window.location.href+'
', minlen: 1, addcopyfirst: false}
$.extend(options, usercopytxt);
var copy_sp = document.createElement('span');
copy_sp.id = 'ctrlcopy';
copy_sp.innerHTML = options.htmlcopytxt;
return this.each(function(){
$(this).mousedown(function(){$('#ctrlcopy').remove();});
$(this).mouseup(function(){
if(window.getSelection){ //good times
var slcted=window.getSelection();
var seltxt=slcted.toString();
if(!seltxt||seltxt.length