
var ajax = new sack();
var articleListObj;
var activeArticle = false;
var clickedArticle = false;
var contentObj	// Reference to article content <div>

function showContent()	// Displaying content in the content <div>
{
	contentObj.innerHTML = ajax.response;	// ajax.response is a variable that contains the content of the external file	
}

function showWaitMessage()
{
	contentObj.innerHTML = 'поиск данных.....<br>пожалуйста, ждите';
}
function getAjaxFile(fileName)
{
	ajax.requestFile = fileName;	// Specifying which file to get
	ajax.onCompletion = showContent;	// Specify function that will be executed after file has been found
	ajax.onLoading = showWaitMessage;	// Action when AJAX is loading the file
	ajax.runAJAX();		// Execute AJAX function	
}

function getSpectList(n,t)
{
	contentObj = document.getElementById('spectContainer');
	contentObj.innerHTML = '';

		var SpectID;
		SpectID = n;
		getAjaxFile('/tpl/get_spect_list.php?SpectID='+SpectID+'&type='+t);

}

function getMetroList(n)
{
	contentObj = document.getElementById('metroContainer');
	contentObj.innerHTML = '';

		var CityIDs;
		CityIDs = n;
		getAjaxFile('/tpl/get_metro_list.php?CityIDs='+CityIDs);

}

function getOkrugList(n)
{
	contentObj = document.getElementById('okrugContainer');
	contentObj.innerHTML = '';
	if (document.getElementById('CityIDs_'+n).checked){
		var CityIDs = document.getElementById('CityIDs_'+n).value;
		getAjaxFile('/tpl/get_okrug_list.php?CityIDs='+CityIDs);
	}
}

function getCityList(sel)
{
	var regionCode = sel.options[sel.selectedIndex].value;
	contentObj = document.getElementById('cityContainer');
	contentObj.innerHTML = '';
	document.getElementById('okrugContainer').innerHTML = '';
	document.getElementById('metroContainer').innerHTML = '';
	getAjaxFile('/tpl/get_cities_list.php?regionCode='+regionCode);
	setTimeout("getMetroList("+regionCode+")",5000);
}
function show_title(id,title)
{
	document.getElementById(id).innerHTML = 'Вы выбрали <b>'+title+'</b>';
}
function uncheck(id)
{
	document.getElementById(id).checked=false;
}
function enable_list(obj){
    if(document.getElementById){
      var el = document.getElementById(obj);
      if(el.style.display != "block"){
        el.style.display = "block";
      }else{
        el.style.display = "none";
      }
    }
}
