// JavaScript Document

//Изменяет 4 последнии буквы на b.---
function izmstr(ind) {
tochka=ind.substring(ind.length-4, ind.length);
ind=ind.substring(0, ind.length-4);
ind=ind.concat("b");
ind=ind.concat(tochka);
return ind;
};
//=============================================================================//


//Формирует содержимое нового окна
function writetowindow(wri) {
wri=izmstr(wri);
var textes = "<html><head><title>Офисные перегородки - ЮНИТЕКС<\/title><\/head><body leftmargin='0' topmargin='0' marginheight='0' marginwidth='0'><table cellpadding='0' cellspacing='0'><tr><td><a href='javascript:window.close()'><img src='"+wri+"' border='0' alt='Офисные перегородки Юнитекс' /></a></td><\/tr><\/table><\/body><\/html>";
newwidow.document.write(textes);
newwidow.document.close();
};
//==================================================================//


//Формирует новое окно
function newwind(im,shir,vis) {
wri=im;
shir=shir;
vis=vis;
znahenie="fullscreen=0,resizable=0,scrollbars=0,left=0,top=0,width="+shir+",height="+vis+"";
newwidow=window.open("","nw", znahenie);
setTimeout("writetowindow(wri)",50);
newwidow.focus();
};
//=============================================================================//


//Вывод вызова консультанта
var req=new Array();
var reqTimeout;
var numbpolya;
var numbpolyanew=new Array();
var numzn=0;
var numzap=0;


function validator()
{
return false;
}


function loadXMLDoc(url, xmpar) {
	prostonum=numzn;
	//alert('ПОШЛО '+prostonum);
    req[prostonum] = null;
    if (window.XMLHttpRequest) {
        try {
            req[prostonum] = new XMLHttpRequest();
        } catch (e){}
    } else if (window.ActiveXObject) {
        try {
            req[prostonum] = new ActiveXObject('Msxml2.XMLHTTP');
        } catch (e){
            try {
                req[prostonum] = new ActiveXObject('Microsoft.XMLHTTP');
            } catch (e){}
        }
    }
 
    if (req[prostonum]) {
		
		document.getElementById(numbpolyanew[prostonum]).innerHTML='<div align="center">ЗАГРУЗКА...</div>';
        req[prostonum].onreadystatechange = function() {
			//alert('Изменено '+xmpar);
			processReqChange(xmpar);
			
		}
		//processReqChange;
        req[prostonum].open("GET", url, true);
        req[prostonum].send(null);
        //reqTimeout = setTimeout("req[prostonum].abort();", 50000);
    } else {
        alert("Браузер не поддерживает AJAX");
    }
}
 
 
 
 
function processReqChange(pram) {
    //alert('Запуск');
    if (req[pram].readyState == 4) {
        //clearTimeout(reqTimeout);
 

        // only if "OK"
        if (req[pram].status != 200) {
            alert("Не удалось получить данные:\n" + req[pram].statusText);
        }
    	else
			{	
				//alert('Вывод');
				
				//numzn=numzn+1;
				numzap=numzap+1;
				//alert('Выводов '+numzap+'Для '+numzn);
				//alert(numzn);
				//numbpolyanew[numzn]=params3;
				//alert(numbpolyanew[numzn]);
				
				document.getElementById(numbpolyanew[pram]).innerHTML=req[pram].responseText;
			}
	}  //else {
	//		document.getElementById(numbpolya).innerHTML='<div align="center">ЗАГРУЗКА...</div>';
//	}
	
}
 
 
function requestdata(params, params2, params3)
{
//alert(params);
//alert(params2);
//alert(params3);
//alert(params4);
numzn=numzn+1;
//alert(numzn);
numbpolyanew[numzn]=params3;
//alert(numbpolyanew[numzn]);

numbpolya=params3;
loadXMLDoc('/otpravkasoobsheniya.php?fio='+params2+'&polevivod='+params, numzn);

//alert(numbpolya);
}






function albl(Elem) {	
//Используется для отображения невидимого div
//alert(document.getElementById('dno').style);
		if (document.getElementById(Elem).style.display=='none') {
		document.getElementById(Elem).style.display='block';
		
		} else {
		document.getElementById(Elem).style.display='none';
		}
}

function alblprin(Elem, dopzn) {	
//Используется для отображения невидимого div
//alert(document.getElementById('dno').style);
		if (dopzn==1) {
		document.getElementById(Elem).style.display='block';
		
		} else {
		document.getElementById(Elem).style.display='none';
		}
}