var test;
var testt;
function getCoordinate(){
 px = event.offsetX;
 py = event.offsetY;
}
function opr_wh()
{
var oknoWidth=800; var oknoHeight=640;
if (self.innerWidth)
    oknoWidth = self.innerWidth;
else if (document.documentElement && document.documentElement.clientWidth)
    oknoWidth = document.documentElement.clientWidth;
else if (document.body)
    oknoWidth = document.body.clientWidth;

    if (self.innerHeight)
    oknoHeight = self.innerHeight;
else if (document.documentElement && document.documentElement.clientHeight)
    oknoHeight = document.documentElement.clientHeight;
else if (document.body)
    oknoHeight = document.body.clientHeight;

var begushaya = document.getElementById('begushaya');
if(begushaya!=undefined)
{
begushaya.style.width = eval(oknoWidth+'-317');
}
}

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 check(id){
if(eval('document.inggg.imn'+id+'.value') == "off")
{
eval('document.inggg.imn'+id+'.value = "on";');
eval('document.inggg.img'+id+'.src = "images/chk_on.png";');
eval('tr'+id+'.bgColor = "C9C5A2"');
if(id=='1')
{
eval('document.inggg.imn2.value = "off";');
eval('document.inggg.img2.src = "images/chk_off.png";');
eval('tr2.bgColor = ""');
}
if(id=='2')
{
eval('document.inggg.imn1.value = "off";');
eval('document.inggg.img1.src = "images/chk_off.png";');
eval('tr1.bgColor = ""');
}
}
else
{
eval('document.inggg.imn'+id+'.value = "off";');
eval('document.inggg.img'+id+'.src = "images/chk_off.png";');
eval('tr'+id+'.bgColor = ""');
}

var itogoq = 100;
var spisok = "Система управления сайтом";
for(n=1; n<=16; n++)
{
if(eval('document.inggg.imn'+n+'.value')!='off')
{
var cena = eval('document.inggg.cena'+n+'.value');
itogoq = eval(itogoq+'+'+cena);
spisok = spisok + ', ' + eval('title['+n+']\r\n');
}
}
document.getElementById('cennik').innerHTML = '<b>Стоимость разработки сайта составит:</b>&nbsp;<font class="cena">'+itogoq+'.00&nbsp;$</font>';
eval('document.inggg.control10.value = spisok;');
eval('document.inggg.control11.value = itogoq;');
}

function ajaxClear (div) {
   muuvv();
  // прелоадер: подставляет строку в DIV
//  div.style.display = 'none';
//  div.innerHTML = '';
//  $(div).style.pixelTop=-1000;
}

function ajaxUpdateee (div, uri, param) {
  $(div).style.display = '';
  // прелоадер: подставляет строку в DIV
  $(div).innerHTML = '<TABLE cellSpacing=1 cellPadding=5 border=0 bgcolor=\"#CDC8A5\" width="150" height="150"><tr><td align=\"center\"><img src="images/ajax.gif" border="0"><br>Загрузка...</td></tr></table>';

  // выполняет запрос к странице uri
  // с переменными param методом get
  // и подставляет результат в DIV
  var ajax = new Ajax.Updater(
    div, // значение атрибута id у DIV’а
    uri, // внешняя страница (скрипт)
    {
      method: 'get',
      parameters: param // переменные разделённые символом &
    }
  );
//  return false;


}



function ajaxUpdatepix (div, uri, param) {

  var divv = document.getElementById(''+div+'');

var oknoWidth=800; var oknoHeight=640;
if (self.innerWidth)
    oknoWidth = self.innerWidth;
else if (document.documentElement && document.documentElement.clientWidth)
    oknoWidth = document.documentElement.clientWidth;
else if (document.body)
    oknoWidth = document.body.clientWidth;

    if (self.innerHeight)
    oknoHeight = self.innerHeight;
else if (document.documentElement && document.documentElement.clientHeight)
    oknoHeight = document.documentElement.clientHeight;
else if (document.body)
    oknoHeight = document.body.clientHeight;
   var scrollt = document.body.scrollTop;
   var scrolll = document.body.scrollLeft;


//   divv.style.display = '';
//   divv.style.top = eval(scrollt+'+(('+oknoHeight+'/2)-150)');
//   divv.style.left = eval(scrolll+'+(('+oknoWidth+'/2)-70)');


     divv.style.display = '';
//     divv.style.top = eval(scrollt+'+(('+oknoHeight+'/2)-250)');
     divv.style.left = eval(scrolll+'+(('+oknoWidth+'/2)-270)');
//     divv.innerHTML = '<table border="0" cellspacing="0" cellpadding="0"><tr><td><img border="0" src="images/pix_1.gif" width="8" height="6"></td><td background="images/pix_1_pix.gif"><img border="0" src="images/pix_1_pix.gif" width="500" height="6"></td><td><img border="0" src="images/pix_1_2.gif" width="9" height="6"></td></tr><tr><td background="images/pix_2_1.gif"><img border="0" src="images/pix_2_1.gif" width="8" height="400"></td><td bgcolor=\"#CDC8A5\" align=\"center\"><TABLE cellSpacing=1 cellPadding=5 border=0 bgcolor=\"#CDC8A5\" width="150" height="150"><tr><td align=\"center\"><img src="images/ajax.gif" border="0"><br>Загрузка...</td></tr></table></td><td background="images/pix_2_2.gif"><img border="0" src="images/pix_2_2.gif" width="9" height="1"></td></tr><tr><td><img border="0" src="images/pix_3_1.gif" width="8" height="10"></td><td background="images/pix_3_2.gif"><img border="0" src="images/pix_3_2.gif" width="1" height="10"></td><td><img border="0" src="images/pix_3_3.gif" width="9" height="10"></td></tr></table>';
   muuv();
   var xmlhttp = getXmlHttp();
   var current_date = new Date();
   xmlhttp.open('GET', 'http://'+location.host+'/'+uri+'?'+param, true);
   xmlhttp.onreadystatechange = function() {
   if (xmlhttp.readyState == 4)
   {
    if(xmlhttp.status == 200)
    {//    for(i=100; i<=700; i++)
//    {
//       settimeout('function {divv.style.top = i;}'), 100);
//    }

     divv.innerHTML = xmlhttp.responseText;
    }
   }
 }
xmlhttp.send(null);
}



function muuv(){
var oknoWidth=800; var oknoHeight=640;
if (self.innerWidth)
    oknoWidth = self.innerWidth;
else if (document.documentElement && document.documentElement.clientWidth)
    oknoWidth = document.documentElement.clientWidth;
else if (document.body)
    oknoWidth = document.body.clientWidth;

    if (self.innerHeight)
    oknoHeight = self.innerHeight;
else if (document.documentElement && document.documentElement.clientHeight)
    oknoHeight = document.documentElement.clientHeight;
else if (document.body)
    oknoHeight = document.body.clientHeight;
   var scrollt = document.body.scrollTop;
   var scrolll = document.body.scrollLeft;

clearTimeout(testt);
document.getElementById('testDiv').style.left = eval(scrolll+'+(('+oknoWidth+'/2)-270)');

var i = parseInt(document.getElementById('testDiv').style.top);
toppp = parseInt(eval(scrollt+'+(('+oknoHeight+'/2)-250)'));
if(i<=toppp)
{
ii=30;
if(i>=toppp-60){ii=11;}
if(i>=toppp-40){ii=9;}
if(i>=toppp-20){ii=7;}
if(i>=toppp-10){ii=5;}
if(i>=toppp-5){ii=3;}
if(i>=toppp-3){ii=1;}
i=i+ii;
//document.getElementById('testDivv').innerHTML = ii;
document.getElementById('testDiv').style.top = i;
test = setTimeout('muuv()', 1);
}
}

function muuvv(){
clearTimeout(test);
var i = parseInt(document.getElementById('testDiv').style.top);
if(i >= -700)
{
ii=30;
if(i>=toppp-60){ii=11;}
if(i>=toppp-40){ii=9;}
if(i>=toppp-20){ii=7;}
if(i>=toppp-10){ii=5;}
if(i>=toppp-5){ii=3;}
if(i>=toppp-3){ii=1;}

i=i-ii;
document.getElementById('testDiv').style.top = i;
testt = setTimeout('muuvv('+i+')', 1);
}
}


function ajaxUpdate (div, uri, param) {

  var divv = document.getElementById(''+div+'');
   divv.innerHTML = '<center><img src="images/ajax.gif" border="0"><br>Загрузка...</center>';
   var xmlhttp = getXmlHttp();
   var current_date = new Date();
   xmlhttp.open('GET', 'http://'+location.host+'/'+uri+'?'+param, true);
   xmlhttp.onreadystatechange = function() {
   if (xmlhttp.readyState == 4)
   {
    if(xmlhttp.status == 200)
    {
     divv.innerHTML = xmlhttp.responseText;
    }
   }
 }
xmlhttp.send(null);
}



function refresh() {
   var current_date = new Date();
   var kcaptcha = document.getElementById('kcaptcha');
    kcaptcha.innerHTML = '<img src=\"kcaptcha/index.php?d='+current_date+'312\">';
}




