/* Создание нового объекта XMLHttpRequest для общения с Web-сервером */
var xmlHttp = false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
try {
  xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
  try {
    xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (e2) {
    xmlHttp = false;
  }
}
@end @*/

if (!xmlHttp && typeof XMLHttpRequest != 'undefined') {
  xmlHttp = new XMLHttpRequest();
}

function Gsub(){
document.getElementById('subgolos').clear;
document.getElementById('subgolos').innerHTML ="  <input type=submit name=sendgolos id=sendgolos value=\" Голосовать \">";
}
function Gsub2(){
alert("Не выбран ни один из вариантов ответа");
}

function Gsuben(){
document.getElementById('subgolosen').clear;
document.getElementById('subgolosen').innerHTML ="  <input type=submit name=sendgolosen id=sendgolosen value=\" Голосовать \">";
}
function Gsub2en(){
alert("Please, choose one of variants of the answer");
}

function na_open_window(name, url, left, top, width, height, toolbar, menubar, statusbar, scrollbar, resizable)
{
  toolbar_str = toolbar ? 'yes' : 'no';
  menubar_str = menubar ? 'yes' : 'no';
  statusbar_str = statusbar ? 'yes' : 'no';
  scrollbar_str = scrollbar ? 'yes' : 'no';
  resizable_str = resizable ? 'yes' : 'no';
  window.open(url, name, 'left='+left+',top='+top+',width='+width+',height='+height+',toolbar='+toolbar_str+',menubar='+menubar_str+',status='+statusbar_str+',scrollbars='+scrollbar_str+',resizable='+resizable_str);
}

function openIt() {
 currEl = event.srcElement;
 if (currEl.className == "subhead") {
 newId = currEl.id + "vis" 
 imgId = currEl.id
 showIt = document.all(newId) ;
 if (showIt.style.display == "none") {
 showIt.style.display = "" ;
 document.images(imgId).src = 'img/minus.gif' 
 } else {
 showIt.style.display = "none" ;
 document.images(imgId).src = 'img/plus.gif' 
 }
 }
}


function callServer1() {
  var city1 = document.getElementById("city1").value;
  var url1 = "lib/raion/get.php?city1=" + escape(city1);
  xmlHttp.open("GET", url1, true);
  xmlHttp.onreadystatechange = updatePage1;
  xmlHttp.send(null);
}

function updatePage1() {
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") {
    var response1 = xmlHttp.responseText;
document.getElementById('raion_data').innerHTML = response1;
  }
}

function callServer1en() {
  var city1en = document.getElementById("city1en").value;
  var url1 = "lib/raion/get_en.php?city1en=" + escape(city1en);
  xmlHttp.open("GET", url1, true);
  xmlHttp.onreadystatechange = updatePage1en;
  xmlHttp.send(null);
}

function updatePage1en() {
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") {
    var response1 = xmlHttp.responseText;
document.getElementById('raion_data').innerHTML = response1;
  }
}

function callServer2() {
  var city2 = document.getElementById("city2").value;
  var url1 = "lib/raion/get2.php?city2=" + escape(city2);
  xmlHttp.open("GET", url1, true);
  xmlHttp.onreadystatechange = updatePage1;
  xmlHttp.send(null);
}

function updatePage2() {
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") {
    var response2 = xmlHttp.responseText;
document.getElementById('raion_data').innerHTML = response2;
  }
}

function process1(element){
document.getElementById('counter1').innerHTML = 2500 - element.value.length;
if ( element.value.length <= 2500){
document.getElementById('counter1').className = 'counter';
} else {
document.getElementById('counter1').className = 'full_counter';
}
}


function callendarServ($dat) {
//  var city1 = document.getElementById("city1").value;
//  var url1 = "lib/calendar.php?city1=" + escape(city1);
  var url1 = "lib/calendar.php?month=" + $dat;
  xmlHttp.open("GET", url1, true);
  xmlHttp.onreadystatechange = updateCalendar;
  xmlHttp.send(null);
}

function updateCalendar() {
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") {
    var response1 = xmlHttp.responseText;
document.getElementById('calendar').innerHTML = response1;
  }
}


function OvrCellServ(src)
{ 
src.style.backgroundColor = '#CC0000';
	return true;
}


function OutCellServ(src)
{ 
src.style.backgroundColor = '#1D3A67';
	return true;
}


function OvrCellNav(src)
{ 
src.style.cursor = 'hand';
src.style.backgroundColor = '#787878';
if(event.srcElement.tagName=='TD') {window.status=src.children.tags('A')[0];
}
	return true;
}


function OutCellNav(src)
{ 
src.style.cursor = 'default';
src.style.backgroundColor = '';
window.status='';
	return true;
}
function OvrCellNav0(src)
{ 
src.style.cursor = 'hand';
src.style.backgroundColor = '#409C8D';
if(event.srcElement.tagName=='TD') {window.status=src.children.tags('A')[0];
}
	return true;
}


function OutCellNav0(src)
{ 
src.style.cursor = 'default';
src.style.backgroundColor = '';
window.status='';
	return true;
}

function OCN(src)
{ 
src.style.cursor = 'hand';
src.style.backgroundColor = '#012b67';
window.status='';
if(event.srcElement.tagName=='TD') {window.status=src.children.tags('A')[0];}
	return true;
}
function OCN1(src)
{ 
src.style.cursor = 'hand';
src.style.backgroundColor = '';
window.status='';
	return true;
if(event.srcElement.tagName=='TD') {window.status=src.children.tags('A')[0];}
}



function show(act,bn){ 
if(act==1){
document.getElementById('small'+bn).style.display = 'none'; 
document.getElementById('big'+bn).style.position = 'absolute';
document.getElementById('big'+bn).style.display = 'block'; 
}
if(act==0){
document.getElementById('small'+bn).style.display = 'block'; 
document.getElementById('big'+bn).style.display = 'none';}

}