function prepareRequest() {
var http_request = false;
if (window.XMLHttpRequest) {
http_request = new XMLHttpRequest();}
else if (window.ActiveXObject) { // IE
try { http_request = new ActiveXObject("Msxml2.XMLHTTP");} catch (e) {try {http_request = new ActiveXObject("Microsoft.XMLHTTP");} catch (e) {}}}
if (!http_request) {alert('Ошибка при создании XMLHTTP'); return false;}
return http_request;
}
function alertContents(http_request, list_value) {
var PickText, prevDiv;
if (http_request.readyState == 4) {
if (http_request.status == 200) PickText = http_request.responseText; else PickText = 'There was a problem with the request.';
prevDiv = document.getElementById(list_value); prevDiv.innerHTML = PickText;}}

function requester2(url2, n, place, type, gida) {
if (type=='smsgoz')
{
	url=url2;
	msg_to_list='&mail='+window.document.sendsms.mail.value+'&text='+window.document.sendsms.text.value;
}

http_request = prepareRequest();
hide('msg'); hide('dld');
if (n > 1) pbar = "progr2"+place; else pbar = "progr";
ge(pbar).style.visibility = 'visible';
ge(pbar).style.display = 'inline';
setTimeout('ge(pbar).src = "/musor/loading.gif"', 200);
http_request.onreadystatechange = function() { alertFContents(http_request, n, place); }
http_request.open('POST', url);
http_request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=windows-1251');
http_request.send(msg_to_list);
}

function alertFContents(http_request, n, place) {
var PickText, prevDiv;
if (http_request.readyState == 4) {
if (http_request.status == 200) PickText = parseResponse(http_request.responseText);
else PickText = 'There was a problem with the request.';
if (n>1) {var prevDiv = ge(place); pbar = "progr2"+place;} else {var prevDiv = ge('fBox'); pbar = "progr";}
if (n==3) {hide('r'); show('msg');}
if (n==4) {show('dld');}
prevDiv.innerHTML = PickText;
ge(pbar).style.visibility = 'hidden'; ge(pbar).style.display = 'none';}
}
function parseResponse(response) {
response= response.replace(/^[\s\n]+/g, '');
if(response.substr(0,10)=="<noscript>")
{
try{ var arr = response.substr(10).split("</noscript>"); eval(arr[0]); return arr[1]; } catch(e){return response;}
}else{return response;}
}
function ge() {
var ea;
for( var i = 0; i < arguments.length; i++ ) {
var e = arguments[i];
if (typeof e == 'string') e = document.getElementById(e);
if (arguments.length == 1) return e;
if( !ea ) ea = new Array();
ea[ea.length] = e;
}
return ea;
}
function hide()
{
for( var i = 0; i < arguments.length; i++ ) {
var element = ge(arguments[i]);
if (element && element.style) element.style.display = 'none';
}
}

function show()
{
for( var i = 0; i < arguments.length; i++ ) {
var element = ge(arguments[i]);
if (element && element.style) element.style.display = 'block';
}
}
function Ajax(doneHandler, failHandler)
{
newAjax = this;
this.onDone = doneHandler;
this.onFail = failHandler;
this.transport = this.getTransport();
this.transport.onreadystatechange = ajaxTrampoline(this);
}
Ajax.prototype.get = function (uri, query, force_sync)
{
force_sync = force_sync || false;
if (typeof query != 'string') query = ajaxArrayToQueryString(query);
fullURI = uri+(query ? ('?'+query) : '');
this.transport.open('GET', fullURI, !force_sync );
this.transport.send('');
}
Ajax.prototype.post = function (uri, data, force_sync)
{
force_sync = force_sync || false;
if (typeof data != 'string' ) data = ajaxArrayToQueryString(data);
var post_form_id=ge('post_form_id');
if (post_form_id) data+='&post_form_id='+post_form_id.value;
this.transport.open('POST', uri, !force_sync);
this.transport.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
this.transport.send(data);
}
Ajax.prototype.stateDispatch = function ()
{
if (this.transport.readyState == 1 && this.showLoad)
ajaxShowLoadIndicator();
if (this.transport.readyState == 4) {
if (this.showLoad) ajaxHideLoadIndicator();
if (this.transport.status >= 200 && this.transport.status < 300 && this.transport.responseText.length > 0) {
 if( this.onDone ) this.onDone(this, this.transport.responseText);} else {
if( this.onFail ) this.onFail(this);}
}
}
Ajax.prototype.getTransport = function () {
var ajax = null;
try { ajax = new XMLHttpRequest(); }
catch(e) { ajax = null; }
try { if(!ajax) ajax = new ActiveXObject("Msxml2.XMLHTTP"); }
catch(e) { ajax = null; }
try { if(!ajax) ajax = new ActiveXObject("Microsoft.XMLHTTP"); }
catch(e) { ajax = null; }
return ajax;
}
function ajaxTrampoline(ajaxObject) {
return function () { ajaxObject.stateDispatch(); };
}
function ajaxArrayToQueryString(queryArray)
{
var sep = '';
var query = "";
for( var key in queryArray ) {
query = query + sep + encodeURIComponent(key) + '=' + encodeURIComponent(queryArray[key]);
sep = '&';}
return query;
}
var ajaxLoadIndicatorRefCount = 0;
function ajaxShowLoadIndicator() {
indicatorDiv = ge('ajaxLoadIndicator');
if( !indicatorDiv ) {
indicatorDiv = document.createElement("div");
indicatorDiv.id = 'ajaxLoadIndicator';
indicatorDiv.innerHTML = 'Loading';
indicatorDiv.className = 'ajaxLoadIndicator';
document.body.appendChild(indicatorDiv);
}
indicatorDiv.style.top = (5 + pageScrollY()) + 'px';
indicatorDiv.style.left = (5 + pageScrollX()) + 'px';
indicatorDiv.style.display = 'block';
ajaxLoadIndicatorRefCount++;
}
function ajaxHideLoadIndicator() {
ajaxLoadIndicatorRefCount--;
if (ajaxLoadIndicatorRefCount == 0) ge('ajaxLoadIndicator').style.display = '';
} 