var specials_n=1;
var windows_count=5;
function changeSpecialsDivs() {
	if(specials_n>secials_div_count) specials_n=1;
	
	for (specials_i=1; specials_i<=secials_div_count; specials_i++) document.getElementById('specials_right_'+specials_i+'_div').style.display = 'none';
	document.getElementById('specials_right_'+specials_n+'_div').style.display = 'block';
	specials_n++;    
	}
	
function map_pop_up_windows(map_num)
{
	map_window= window.open ("", "map_window", "status=0,width=450,height=510"); 
	map_window.document.write('<html><body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 bgcolor="#6f6f6f"><table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0"><tr><td align=center valign=middle><a style="cursor: pointer;" onClick="self.close();"><img src="/image/map_office_'+map_num+'.jpg" border=0></a></td></tr></table></html></body>');  
}

function windows_off ()
{
	for (i=1; i<=windows_count; i++)
	{
		document.getElementById('fall_out_'+i).style.display = 'none';	
	}
}

function windows_on (id)
{
	for (i=1; i<=windows_count; i++)
	{
		if (i==id) document.getElementById('fall_out_'+i).style.display = 'block';	
			else document.getElementById('fall_out_'+i).style.display = 'none';	
	}
	
	document.getElementById('fall_out_'+id).style.display = 'block';	
}

/* AJAX для форм : B */
function getXmlHttp(){
  var xmlhttp; 
  try {
    xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (e) {
    try {
      xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (E) {
      xmlhttp = false;
    }
  }
  if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
    xmlhttp = new XMLHttpRequest();
  }
  return xmlhttp;
}

function load_nodes(div_id,id_int,select_name) {
    // создать объект для запроса к серверу, функция getXmlHttp будет дана ниже
    var req = getXmlHttp();
    //var req=new XMLHttpRequest();  
    req.open('GET','/ajlfjfasktkgakafasdjfk_load_nodes.php?id_int='+id_int+'&select_name='+select_name, true);  // задать адрес подключения
	
    // span рядом с кнопкой
    // в нем будем отображать ход выполнения
    var content = document.getElementById(div_id);
    req.onreadystatechange = function() {  // onreadystatechange активируется при получении ответа сервера	
        if (req.readyState == 4) { // если запрос закончил выполняться           
            if(req.status == 200) { // если статус 200 (ОК) - выдать ответ пользователю
                str=req.responseText;
			if(str.length>0){	
	        	content.innerHTML=str;
				content.style.display = 'block';
			}else{
				/*if (content.style.display == 'block')
					content.style.display = 'none';
	 			else content.style.display = 'block';*/	
				content.style.display = 'none';
				content.innerHTML='';
			}
            
			} else {
                content.innerHTML = "Error: Status "+request.status;
             }
            // тут можно добавить else с обработкой ошибок запроса
        }
 	
    }

	// объект запроса подготовлен: указан адрес и создана функция onreadystatechange
    // для обработки ответа сервера	
	req.send(null);  // отослать запрос
	
	//statusElem.innerHTML = 'Waiting response...' 
}
/* AJAX для форм : E */