var autobn=1;
var autobnC=0;
var delay = 5000;
var delayMove=1;
var tim;
var curDivID=null;
var divTop;
var pxLeft;
var clipTop;
var step=3;
var st;
var up=0;
var isShowing=0;
var startHide=0;
var loc1opened=0;
var loc2opened=0;
var loc4opened=0;
var loc5opened=0;
var loc6opened=0;
var loc7opened=0;
var menuopened=0;

function changeForm(id){
if (id==1){bgc="#FAE320";hsrc='hide1.gif';hcln='uform1';}
if (id==2){bgc="#F7C128";hsrc='hide2.gif';hcln='uform2';}
if (id==3){bgc="#F5A31C";hsrc='hide2.gif';hcln='uform3';}
if (id==4){bgc="#F49115";hsrc='hide2.gif';hcln='uform4';}
if (id==5){bgc="#FFB232";hsrc='hide2.gif';hcln='uform2';}
document.getElementById("showForm").style.background=bgc;
document.getElementById("colorHide").className=hcln;
document.getElementById("hideSrc").src="/img/"+hsrc;
document.getElementById("mainForm").className="showall";
if (id==1){document.getElementById("airlinesForm").className="shownone";document.getElementById("lightsoftForm").className="shownone";document.getElementById("sirenaForm").className="showall";document.getElementById("webclientForm").className="shownone";document.getElementById("zhdForm").className="shownone";}
if (id==2){document.getElementById("sirenaForm").className="shownone";document.getElementById("airlinesForm").className="showall";document.getElementById("lightsoftForm").className="shownone";document.getElementById("webclientForm").className="shownone";document.getElementById("zhdForm").className="shownone";}
if (id==3){document.getElementById("sirenaForm").className="shownone";document.getElementById("airlinesForm").className="shownone";document.getElementById("lightsoftForm").className="shownone";document.getElementById("webclientForm").className="shownall";document.getElementById("zhdForm").className="shownone";}
if (id==4){document.getElementById("sirenaForm").className="shownone";document.getElementById("airlinesForm").className="shownone";document.getElementById("lightsoftForm").className="showall";document.getElementById("webclientForm").className="shownone";document.getElementById("zhdForm").className="shownone";}
if (id==5){document.getElementById("sirenaForm").className="shownone";document.getElementById("airlinesForm").className="shownone";document.getElementById("lightsoftForm").className="shownone";document.getElementById("webclientForm").className="shownone";document.getElementById("zhdForm").className="showall";}
}

function changeOffice(id){
if (id==1){document.getElementById("office").src="/img/office_a.gif";}
if (id==0){document.getElementById("office").src="/img/office.gif";}
}

function colorMenu(id){
startHide = 0;
for (ii=1;ii<8;ii++){
document.getElementById("item"+ii).className="menunobg";
document.getElementById("ileft"+ii).className="menunobg";
document.getElementById("iright"+ii).className="menunobg";
document.getElementById("ipic"+ii).src="/download/mm"+ii+".gif";
document.getElementById("menu"+ii).style.display="none";
}

document.getElementById("item"+id).className="menuabg";
document.getElementById("ileft"+id).className="u4";
document.getElementById("iright"+id).className="u5";
document.getElementById("ipic"+id).src="/download/mma"+id+".gif";
}


function showMenuQuick(el,divID,thismark){
if (navigator.appName == "Microsoft Internet Explorer"){
if (divID=="menu7"){ppl=119;} else{ppl=25;}
}
else if (navigator.appName == "Opera"){
if (divID=="menu7"){ppl=-105;} else{ppl=-11;}
}
else{
if (divID=="menu7"){ppl=-104;} else{ppl=-10;}
}
divID = document.getElementById(divID);
curDivID = divID;
curDivID.style.display = "block";
if (navigator.appName == "Microsoft Internet Explorer"){pxLeft=el.offsetLeft-ppl;}
else{
if (thismark==1){pxLeft=el.offsetLeft+ppl-9;}
else{pxLeft=el.offsetLeft+ppl-3;}
}
curDivID.style.left = pxLeft.toString() + 'px';
//moveMenu();
menuopened=1;
setTimeout("locOpenState(3)",5);
}

function showMenu(el, divID){
if (navigator.appName == "Microsoft Internet Explorer"){
if (divID=="menu7"){ppl=119;} else{ppl=25;}
}
else{
if (divID=="menu7"){ppl=-73;} else{ppl=21;}
}
divID = document.getElementById(divID);
if (curDivID!=null && divID!=curDivID){
clearTimeout(tim);
isShowing = 0;
curDivID.style.display="none";
}
curDivID = divID;
cancelHide();
startHide=0;     
up=0;    
if (!isShowing){
isShowing = 1;
curDivID.style.display = "block";
clipTop = curDivID.offsetHeight;           
divTop  = el.offsetTop+el.offsetHeight - curDivID.offsetHeight;   
if (navigator.appName == "Microsoft Internet Explorer"){pxLeft=el.offsetLeft-ppl;}
else{pxLeft=el.offsetLeft+ppl;}
curDivID.style.left = pxLeft.toString() + 'px';
moveMenu();
}
}


function cancelHide(){
if (clipTop==0)
clearTimeout(tim);
else
{
startHide = 0;
up=0;
}
}


function moveMenu(){
if (!up) st = step;
else st = -step;
divTop += st;
clipTop -= st;
if (clipTop<0){ divTop+=clipTop; clipTop=0}
curDivID.style.top = divTop.toString() + 'px';
curDivID.style.clip = "rect(" + clipTop +"px auto auto auto)";
if (clipTop==0){
up = 1;
if (startHide) tim = setTimeout("moveMenu()", delay);
return;
} 
if (clipTop>=curDivID.offsetHeight){
for (ii=1;ii<8;ii++){
document.getElementById("item"+ii).className="menunobg";
document.getElementById("ileft"+ii).className="menunobg";
document.getElementById("iright"+ii).className="menunobg";
document.getElementById("ipic"+ii).src="/download/mm"+ii+".gif";
}
startHide = 0;
isShowing = 0;
return;
}   
tim = setTimeout("moveMenu()", delayMove);
}


function hideMenu(){
if (clipTop==0){
up=1;
tim = setTimeout("moveMenu()", delay);
}
else {
startHide=1;
}
}

function hideForm(){
document.getElementById("mainForm").className="shownone";
}


function showPoint5(id){
document.getElementById("point"+id).bgColor="#0465C2";
document.getElementById("lasttd"+id).bgColor="#0465C2";
document.getElementById("thismm"+id).bgColor="#0465C2";
document.getElementById("point"+id).innerHTML='<img src=/img/point.gif width=10 height=10>';
}

function hidePoint5(id){
document.getElementById("point"+id).bgColor="";
document.getElementById("lasttd"+id).bgColor="";
document.getElementById("thismm"+id).bgColor="";
document.getElementById("point"+id).innerHTML='';
}

function changeDates(id,all){
document.getElementById("yourstartdate"+id).options[0].selected="true";
document.getElementById("dateselect").value=document.getElementById("yourstartdate"+id).value;
for (i=1; i<=all; i++){ 
if (i==id){document.getElementById("course"+i).className="showall";}
else{document.getElementById("course"+i).className="shownone";}
}
if (id==2){document.getElementById("kpk").className="showall";document.getElementById("kpk2").className="showall";}
else{document.getElementById("kpk").className="shownone";document.getElementById("kpk2").className="shownone";}
}


function optionDates(id){
document.getElementById("dateselect").value=document.getElementById("yourstartdate"+id).value;
}

function showSelect(id){
if (id==1){
document.getElementById("countries").className="shownone";
document.getElementById("cities").className="shownone";
document.getElementById("companies").className="showall";
}
if (id==2){
document.getElementById("cities").className="shownone";
document.getElementById("companies").className="shownone";
document.getElementById("countries").className="showall";
}
if (id==3){
document.getElementById("countries").className="shownone";
document.getElementById("companies").className="shownone";
document.getElementById("cities").className="showall";
}
}

function showAmadeus(){
document.amadeuSend.submit();
document.getElementById("thisframe").height=1200;
document.getElementById("thisframe").document.body.background="#000000";
}

function scrollFotosD(){
currentTop=document.getElementById("fotoset").scrollTop+150;
var hiter = document.getElementById("inside").firstChild;
if (currentTop<=(document.getElementById("inside").offsetHeight-document.getElementById("fotoset").offsetHeight)){
while (document.getElementById("fotoset").scrollTop<currentTop){
document.getElementById("fotoset").scrollTop++;
}
document.getElementById("inside").removeChild(hiter);
document.getElementById("fotoset").scrollTop=0;
document.getElementById("inside").appendChild(hiter);
}
}


function scrollBnD(){
currentTop=document.getElementById("bnset").scrollTop+246;
var hiter = document.getElementById("inbn").firstChild;
if (currentTop<=(document.getElementById("inbn").offsetHeight-document.getElementById("bnset").offsetHeight)){
while (document.getElementById("bnset").scrollTop<currentTop){
document.getElementById("bnset").scrollTop=document.getElementById("bnset").scrollTop+3;
}
document.getElementById("inbn").removeChild(hiter);
document.getElementById("bnset").scrollTop=0;
document.getElementById("inbn").appendChild(hiter);
}
}


function scrollBnRand(ii){

for (kk=0;kk<document.getElementById("inbn").children.length;kk++){
if (ii==kk){
document.getElementById("blocksp["+kk+"]").bgColor="#BAFCAE";
document.getElementById("blocksp2["+kk+"]").bgColor="#BAFCAE";
document.getElementById("blocksp3["+kk+"]").bgColor="#BAFCAE";
document.getElementById("blocksp5["+kk+"]").bgColor="#BAFCAE";
document.getElementById("blocksp4["+kk+"]").className="llly";
document.getElementById("blocksp6["+kk+"]").className="rrry";
}
else{
document.getElementById("blocksp["+kk+"]").bgColor="#FFFFFF";
document.getElementById("blocksp2["+kk+"]").bgColor="#FFFFFF";
document.getElementById("blocksp3["+kk+"]").bgColor="#FFFFFF";
document.getElementById("blocksp5["+kk+"]").bgColor="#FFFFFF";
document.getElementById("blocksp4["+kk+"]").className="lll";
document.getElementById("blocksp6["+kk+"]").className="rrr";
}
}

var mname="bigb["+ii+"]";
if (document.getElementById("inbn").children[0].name!=mname){
currentTop=document.getElementById("bnset").scrollTop+246;
var hiter = document.getElementById("inbn").firstChild;
var remChild=new Array();
var jj=0;
for (kk=1;kk<document.getElementById("inbn").children.length;kk++){
if (document.getElementById("inbn").children[kk].name!=mname){
remChild[jj]=document.getElementById("inbn").children[kk];
//document.getElementById("inbn").removeChild(remChild);
//document.getElementById("inbn").appendChild(remChild[kk]);
jj++;
}
}

var ii=0;
while (ii<remChild.length){
document.getElementById("inbn").removeChild(remChild[ii]);
ii++;
}

var ii=0;
while (ii<remChild.length){
document.getElementById("inbn").appendChild(remChild[ii]);
ii++;
}


//alert(document.getElementById("inbn").children.length);
if (currentTop<=(document.getElementById("inbn").offsetHeight-document.getElementById("bnset").offsetHeight)){
while (document.getElementById("bnset").scrollTop<currentTop){
document.getElementById("bnset").scrollTop=document.getElementById("bnset").scrollTop+3;
}
document.getElementById("inbn").removeChild(hiter);
document.getElementById("bnset").scrollTop=0;
document.getElementById("inbn").appendChild(hiter);
}
}
}

function showTheBn(){
document.getElementById("bnmenu").className="shownone";
for (kk=0;kk<document.getElementById("inbn").children.length;kk++){
document.getElementById("hideb["+kk+"]").className="showall";
}
setTimeout("showBnAll()",1);
}

function showBnAll(){
//document.getElementById("bnctr").innerHTML='<table cellspacing=0 cellpadding=0 border=0><a onclick=hideBnAll();>скрыть предложения</a></table>';
var h=parseInt(document.getElementById("bnset").style.height);
if (h<document.getElementById("inbn").offsetHeight){
h=h+20;
document.getElementById("bnset").style.height=h;
setTimeout("showBnAll()",1);
}
}


function hideBnAll(){
var h=parseInt(document.getElementById("bnset").style.height);
if (h>246){
h=h-20;
document.getElementById("bnset").style.height=h;
setTimeout("hideBnAll()",1);
}
else{
for (kk=0;kk<document.getElementById("inbn").children.length;kk++){
document.getElementById("hideb["+kk+"]").className="shownone";
}
document.getElementById("bnmenu").className="showall";
}
}


function scrollFotosU(){
var hiter = document.getElementById("inside").lastChild;
var hiter2 = document.getElementById("inside").firstChild;
document.getElementById("inside").removeChild(hiter);
document.getElementById("inside").insertBefore(hiter,hiter2);
document.getElementById("fotoset").scrollTop=150;
currentTop=document.getElementById("fotoset").scrollTop-150;
if (currentTop>=0){
while (document.getElementById("fotoset").scrollTop>currentTop){
document.getElementById("fotoset").scrollTop--;
}
}
}


function scrollBnU(){
var hiter = document.getElementById("inbn").lastChild;
var hiter2 = document.getElementById("inbn").firstChild;
document.getElementById("inbn").removeChild(hiter);
document.getElementById("inbn").insertBefore(hiter,hiter2);
document.getElementById("bnset").scrollTop=246;
currentTop=document.getElementById("bnset").scrollTop-246;
if (currentTop>=0){
while (document.getElementById("bnset").scrollTop>currentTop){
document.getElementById("bnset").scrollTop=document.getElementById("bnset").scrollTop-3;
}
}
}



function getAuto(str,id){
if (str.length>2){
var req = getXmlHttp();

req.onreadystatechange = function() {  
// onreadystatechange активируется при получении ответа сервера
if (req.readyState == 4) { 
// если запрос закончил выполняться
//statusElem.innerHTML = req.statusText // показать статус (Not Found, ОК..)
if(req.status == 200) { 
// если статус 200 (ОК) - выдать ответ пользователю
document.getElementById("loc"+id).innerHTML=req.responseText;
if (req.responseText.length>0){
document.getElementById("loc"+id).className="loc";
if (id==1){loc1opened=1;}
if (id==2){loc2opened=1;}
setTimeout("locOpenState("+id+")",5);
}
else{
document.getElementById("loc"+id).className="shownone";
}
}
// тут можно добавить else с обработкой ошибок запроса
}
}
// (3) задать адрес подключения
req.open('GET', '/getAuto.php?str='+encodeURI(str)+"&id="+id, true);  

// объект запроса подготовлен: указан адрес и создана функция onreadystatechange
// для обработки ответа сервера
// (4)
req.send(null);  // отослать запрос
}
else{
document.getElementById("loc"+id).className="shownone";
}
}


function getAuto_sirena(str,id){
if (str.length>2){
var req = getXmlHttp();

req.onreadystatechange = function() {  
// onreadystatechange активируется при получении ответа сервера
if (req.readyState == 4) { 
// если запрос закончил выполняться
//statusElem.innerHTML = req.statusText // показать статус (Not Found, ОК..)
if(req.status == 200) { 
// если статус 200 (ОК) - выдать ответ пользователю
document.getElementById("loc"+id).innerHTML=req.responseText;
if (req.responseText.length>0){
document.getElementById("loc"+id).className="loc";
if (id==4){loc4opened=1;}
if (id==5){loc5opened=1;}
setTimeout("locOpenState("+id+")",5);
}
else{
document.getElementById("loc"+id).className="shownone";
}
}
// тут можно добавить else с обработкой ошибок запроса
}
}
// (3) задать адрес подключения
req.open('GET', '/getAuto_sirena.php?str='+encodeURI(str)+"&id="+id, true);  

// объект запроса подготовлен: указан адрес и создана функция onreadystatechange
// для обработки ответа сервера
// (4)
req.send(null);  // отослать запрос
}
else{
document.getElementById("loc"+id).className="shownone";
}
}


function getAuto_zhd(str,id){
if (str.length>0){
var req = getXmlHttp();

req.onreadystatechange = function() {  
// onreadystatechange активируется при получении ответа сервера
if (req.readyState == 4) { 
// если запрос закончил выполняться
//statusElem.innerHTML = req.statusText // показать статус (Not Found, ОК..)
if(req.status == 200) { 
// если статус 200 (ОК) - выдать ответ пользователю
document.getElementById("loc"+id).innerHTML=req.responseText;
if (req.responseText.length>0){
document.getElementById("loc"+id).className="loc";
if (id==6){loc6opened=1;}
if (id==7){loc7opened=1;}
setTimeout("locOpenState("+id+")",5);
}
else{
document.getElementById("loc"+id).className="shownone";
}
}
// тут можно добавить else с обработкой ошибок запроса
}
}
// (3) задать адрес подключения
req.open('GET', '/getAuto_zhd.php?str='+encodeURI(str)+"&id="+id, true);  

// объект запроса подготовлен: указан адрес и создана функция onreadystatechange
// для обработки ответа сервера
// (4)
req.send(null);  // отослать запрос
}
else{
document.getElementById("loc"+id).className="shownone";
}
}


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 doSub(city,id){
if(id==1){document.getElementById("B_LOCATION_1").value=city;}
if(id==2){document.getElementById("E_LOCATION_1").value=city;}
if(id==4){document.getElementById("origin-city-name").value=city;}
if(id==5){document.getElementById("destination-city-name").value=city;}
if(id==6){document.getElementById("from").value=city;}
if(id==7){document.getElementById("to").value=city;}
document.getElementById("loc"+id).className="shownone";
}

function closeFunction(){
if (loc1opened==2){document.getElementById("loc1").className = "shownone"; loc1opened=0;}
if (loc2opened==2){document.getElementById("loc2").className = "shownone"; loc2opened=0;}
if (loc4opened==2){document.getElementById("loc4").className = "shownone"; loc4opened=0;}
if (loc5opened==2){document.getElementById("loc5").className = "shownone"; loc5opened=0;}
if (loc6opened==2){document.getElementById("loc6").className = "shownone"; loc5opened=0;}
if (loc7opened==2){document.getElementById("loc7").className = "shownone"; loc5opened=0;}
if (menuopened==2){
for (ii=1;ii<8;ii++){
document.getElementById("item"+ii).className="menunobg";
document.getElementById("ileft"+ii).className="menunobg";
document.getElementById("iright"+ii).className="menunobg";
document.getElementById("ipic"+ii).src="/download/mm"+ii+".gif";
document.getElementById("menu"+ii).style.display="none";
}
menuopened=0;
}
}

function locOpenState(id){
if(id==1){loc1opened=2;}
if(id==2){loc2opened=2;}
if(id==3){menuopened=2;}
if(id==4){loc4opened=2;}
if(id==5){loc5opened=2;}
if(id==6){loc6opened=2;}
if(id==7){loc7opened=2;}
}

function autostartBN(numall){
if (autobn==1){
autobnC++;
if (autobnC==numall){autobnC=0;}
this.scrollBnRand(autobnC);
setTimeout("autostartBN("+numall+")",5000);
}
}

function oprosAnswer(opros){
for (zz=0;zz<document.getElementsByName("yourvote"+opros).length;zz++){
if (document.getElementsByName("yourvote"+opros)[zz].checked==true){var answer=document.getElementsByName("yourvote"+opros)[zz].value;}
}

//alert(document.getElementsByName("yourvote"+opros).length);

var req = getXmlHttp();
req.onreadystatechange = function() {  
// onreadystatechange активируется при получении ответа сервера
if (req.readyState == 4) { 
// если запрос закончил выполняться
//statusElem.innerHTML = req.statusText // показать статус (Not Found, ОК..)
if(req.status == 200) { 
// если статус 200 (ОК) - выдать ответ пользователю
if (req.responseText.length>0){
//alert(req.responseText);
if (document.getElementById("mycolor"+opros)){
document.getElementById("opbutton"+opros).innerHTML="<table cellspacing=0 cellpadding=0 border=0><td valign=center><img src=/img/ajax.gif></td><td valign=center class=mtx style='padding-left:10px;'><b>Благодарим Вас за участие в нашем опросе.</b></td></table>";
}
else{
document.getElementById("opbutton"+opros).innerHTML="<table cellspacing=0 cellpadding=0 border=0><td valign=center><img src=/img/ajax2.gif></td><td valign=center class=mtx style='padding-left:10px;'><b>Благодарим Вас за участие в нашем опросе.</b></td></table>";
}
setTimeout("oprosHide("+opros+")",1000);

//document.getElementById("myopros"+opros).className="shownone";
//document.getElementById("cartbutton").innerHTML='<table cellspacing=0 cellpadding=0 border=0 width=145><td valign=center height=55 align=center><table cellspacing=0 cellpadding=0 border=0><td valign=top><img src=/img/ready.gif width=21 height=20></td><td valign=top class=readytx style="padding-left:5;padding-top:2;">Страница добавлена<br>в &laquo;Мои Закладки&raquo;</td></table></td></table>';
}
}
// тут можно добавить else с обработкой ошибок запроса
}
}
// (3) задать адрес подключения
req.open('GET', '/oprosAnswer.php?opros='+opros+'&answer='+answer, true);  

// объект запроса подготовлен: указан адрес и создана функция onreadystatechange
// для обработки ответа сервера
// (4)
req.send(null);  // отослать запрос
}

function oprosHide(opros){
//document.getElementById("myopros"+opros).className="shownone";


var req = getXmlHttp();
req.onreadystatechange = function() {  
// onreadystatechange активируется при получении ответа сервера
if (req.readyState == 4) { 
// если запрос закончил выполняться
//statusElem.innerHTML = req.statusText // показать статус (Not Found, ОК..)
if(req.status == 200) { 
// если статус 200 (ОК) - выдать ответ пользователю
if (req.responseText.length>0){
//alert(req.responseText);
document.getElementById("oprosContent").innerHTML=req.responseText;
//setTimeout("oprosHide("+opros+")",1000);

//document.getElementById("myopros"+opros).className="shownone";
//document.getElementById("cartbutton").innerHTML='<table cellspacing=0 cellpadding=0 border=0 width=145><td valign=center height=55 align=center><table cellspacing=0 cellpadding=0 border=0><td valign=top><img src=/img/ready.gif width=21 height=20></td><td valign=top class=readytx style="padding-left:5;padding-top:2;">Страница добавлена<br>в &laquo;Мои Закладки&raquo;</td></table></td></table>';
}
}
// тут можно добавить else с обработкой ошибок запроса
}
}
// (3) задать адрес подключения
req.open('GET', '/oprosRedraw.php', true);  

// объект запроса подготовлен: указан адрес и создана функция onreadystatechange
// для обработки ответа сервера
// (4)
req.send(null);  // отослать запрос


}


function switchWait(){
document.getElementById("visaContent").innerHTML="<img src=/img/wait.gif>";
setTimeout("switchVisa()",500);
}

function switchVisa(){
var req = getXmlHttp();
req.onreadystatechange = function() {  
if (req.readyState == 4) { 
if(req.status == 200) { 
//var oHouseList = document.forms["rushotels"].elements["h_city"];
//var oHouseListOptionsCnt = oHouseList.options.length;
//oHouseList.length = 0;
//var response=req.responseText;
//var massiv = response.split("#");
//var cityNames = massiv[0].split(",");
//var cityValues = massiv[1].split(",");
//for (i = 0; i < cityValues.length; i++){
//if (document.createElement){
//var newHouseListOption = document.createElement("OPTION");
//newHouseListOption.text = cityNames[i];
//newHouseListOption.value = cityValues[i];
//(oHouseList.options.add) ? oHouseList.options.add(newHouseListOption) : oHouseList.add(newHouseListOption, null);
//}
//}
document.getElementById("visaContent").innerHTML=req.responseText;
}
}
}
req.open('GET', '/switchVisa.php?str='+encodeURI(document.getElementById("visaPrice").value)+'&str2='+encodeURI(document.getElementById("visaService").value)+'&str3='+encodeURI(document.getElementById("visaCountry").value), true);  
req.send(null);  // отослать запрос
}



function switchVisaService(){
var req = getXmlHttp();
req.onreadystatechange = function() {  
if (req.readyState == 4) { 
if(req.status == 200) {

var frmVisa = document.forms["onlinevisa"].elements["visaService2"];
var optVisa = frmVisa.options.length;

for (i = 0; i < optVisa; i++){
if (frmVisa.options[i].value==document.getElementById("visaService").value){frmVisa.options[i].selected=true;}
}

 
var oHouseList = document.forms["visass"].elements["visaPrice"];
var oHouseListOptionsCnt = oHouseList.options.length;
oHouseList.length = 0;
var response=req.responseText;
var massiv = response.split("#");
var cityNames = massiv[0].split(",");
var cityValues = massiv[1].split(",");
for (i = 0; i < cityValues.length; i++){
if (document.createElement){
var newHouseListOption = document.createElement("OPTION");
newHouseListOption.text = cityNames[i];
newHouseListOption.value = cityValues[i];
(oHouseList.options.add) ? oHouseList.options.add(newHouseListOption) : oHouseList.add(newHouseListOption, null);
}
}
setTimeout("switchWait()",1);
}
}
}
req.open('GET', '/switchVisaService.php?str2='+encodeURI(document.getElementById("visaService").value)+'&str3='+encodeURI(document.getElementById("visaCountry").value), true);  
req.send(null);  // отослать запрос
}


function switchVisaCountry(){
var req = getXmlHttp();
req.onreadystatechange = function() {  
if (req.readyState == 4) { 
if(req.status == 200) { 

var frmVisa = document.forms["onlinevisa"].elements["visaCountry2"];
var optVisa = frmVisa.options.length;

for (i = 0; i < optVisa; i++){
if (frmVisa.options[i].value==document.getElementById("visaCountry").value){frmVisa.options[i].selected=true;}
}


var oHouseList = document.forms["visass"].elements["visaService"];
var oHouseListOptionsCnt = oHouseList.options.length;
oHouseList.length = 0;
var response=req.responseText;
var massiv = response.split("#");
var cityNames = massiv[0].split(",");
var cityValues = massiv[1].split(",");
for (i = 0; i < cityValues.length; i++){
if (document.createElement){
var newHouseListOption = document.createElement("OPTION");
newHouseListOption.text = cityNames[i];
newHouseListOption.value = cityValues[i];
(oHouseList.options.add) ? oHouseList.options.add(newHouseListOption) : oHouseList.add(newHouseListOption, null);
}
}

oHouseList = document.forms["onlinevisa"].elements["visaService2"];
oHouseListOptionsCnt = oHouseList.options.length;
oHouseList.length = 0;
for (i = 0; i < cityValues.length; i++){
if (document.createElement){
var newHouseListOption = document.createElement("OPTION");
newHouseListOption.text = cityNames[i];
newHouseListOption.value = cityValues[i];
(oHouseList.options.add) ? oHouseList.options.add(newHouseListOption) : oHouseList.add(newHouseListOption, null);
}
}


setTimeout("switchVisaService()",1);
}
}
}
req.open('GET', '/switchVisaCountry.php?str3='+encodeURI(document.getElementById("visaCountry").value), true);  
req.send(null);  // отослать запрос
}


function switchVisaCountry2(){
var req = getXmlHttp();
req.onreadystatechange = function() {  
if (req.readyState == 4) { 
if(req.status == 200) { 

var oHouseList = document.forms["onlinevisa"].elements["visaService2"];
var oHouseListOptionsCnt = oHouseList.options.length;
oHouseList.length = 0;
var response=req.responseText;
var massiv = response.split("#");
var cityNames = massiv[0].split(",");
var cityValues = massiv[1].split(",");
for (i = 0; i < cityValues.length; i++){
if (document.createElement){
var newHouseListOption = document.createElement("OPTION");
newHouseListOption.text = cityNames[i];
newHouseListOption.value = cityValues[i];
(oHouseList.options.add) ? oHouseList.options.add(newHouseListOption) : oHouseList.add(newHouseListOption, null);
}
}

}
}
}
req.open('GET', '/switchVisaCountry.php?str3='+encodeURI(document.getElementById("visaCountry2").value), true);  
req.send(null);  // отослать запрос
}


function vitrina(){
document.getElementById("pleasewait").className="shownone";
document.getElementById("vitrina").className="showall";
}

function TryToFind(request){
alert(1);
}

function changeTourCountry(id){
this.changeForm(4);
window.frames["tourframe"].DestinationCountryComboBox.setValue(id);
window.frames["tourframe"].OnSelectDestinationCountry(id);

}

function iLove(id){
document.getElementById("bigTx"+id).className="showall";
document.getElementById("komme"+id).className="showall";
document.getElementById("konkurs"+id).bgColor="#F7C128";
document.getElementById("klt"+id).className="lt2_";
document.getElementById("krt"+id).className="rt2__";
document.getElementById("klb"+id).className="lb2_";
document.getElementById("krb"+id).className="rb2__";
}
function iDontLove(id){
document.getElementById("bigTx"+id).className="shownone";
document.getElementById("komme"+id).className="shownone";
document.getElementById("konkurs"+id).bgColor="#BBE9FE";
document.getElementById("klt"+id).className="lt2";
document.getElementById("krt"+id).className="rt2";
document.getElementById("klb"+id).className="lb2";
document.getElementById("krb"+id).className="rb2";
}

function agreeLove(){
var kch=document.getElementsByName("kch");
var kvalue=document.getElementsByName("kvalue");
var resultvalue='';
for (ii=0;ii<kch.length;ii++){
if (kch[ii].checked==true){resultvalue+='#'+kvalue[ii].value;}
}
if (resultvalue.length>0){
resultvalue+='#';

var komments=document.getElementById("ktext").value;
var req = getXmlHttp();
req.onreadystatechange = function() {  
if (req.readyState == 4) { 
if(req.status == 200) { 

document.getElementById("kontent").innerHTML='<div style="padding-top:20px;"><table width=95% cellspacing=0 cellpadding=0 border=0><td valign=top bgcolor=#BBE9FE><table width=100% cellspacing=0 cellpadding=0 border=0><td valign=top class=lb2><table width=100% cellspacing=0 cellpadding=0 border=0><td valign=top class=rb2><table width=100% cellspacing=0 cellpadding=0 border=0><td valign=top class=rt2><table width=100% cellspacing=0 cellpadding=0 border=0><td class=lt2 style="padding-top:45;padding-bottom:50;" align=center><span class=mtx>Благодарим Вас за помощь в выборе и оценке разработанных логотипов.<br><br>Ваше мнение очень важно для нас.</span></td></table></td></table></td></table></td></table></td></table></div>';

}
}
}

if (komments.length>0){req.open('GET', '/addKonkurs.php?values='+encodeURI(resultvalue)+'&komments='+encodeURI(komments), true);}
else{req.open('GET', '/addKonkurs.php?values='+encodeURI(resultvalue), true);}
req.send(null);  // отослать запрос

}
else{
document.getElementById("konerror").className="showall";
}
}


function iLike(id){
var komments=document.getElementById("ktext"+id).value;
var prist='_for';
var req = getXmlHttp();
req.onreadystatechange = function() {  
if (req.readyState == 4) { 
if(req.status == 200) { 
document.getElementById("kontent"+id).innerHTML='<span class=greentx><strong><br>Благодарим Вас за помощь в выборе и оценке<br>разработанных логотипов.<br>Ваше мнение очень важно для нас.<br></strong></span>';
}
}
}
if (komments.length>0){req.open('GET', '/addKonkurs.php?values='+encodeURI(id)+'&prist='+encodeURI(prist)+'&komments='+encodeURI(komments), true);}
else{req.open('GET', '/addKonkurs.php?values='+encodeURI(id)+'&prist='+encodeURI(prist), true);}
req.send(null);  // отослать запрос
}


function iDoNotLike(id){
var komments=document.getElementById("ktext"+id).value;
var prist='_against';
var req = getXmlHttp();
req.onreadystatechange = function() {  
if (req.readyState == 4) { 
if(req.status == 200) { 
document.getElementById("kontent"+id).innerHTML='<span class=greentx><strong><br>Благодарим Вас за помощь в выборе и оценке<br>разработанных логотипов.<br>Ваше мнение очень важно для нас.<br></strong></span>';
}
}
}
if (komments.length>0){req.open('GET', '/addKonkurs.php?values='+encodeURI(id)+'&prist='+encodeURI(prist)+'&komments='+encodeURI(komments), true);}
else{req.open('GET', '/addKonkurs.php?values='+encodeURI(id)+'&prist='+encodeURI(prist), true);}
req.send(null);  // отослать запрос
}




function setKonkursMenu(){
document.getElementById("menuKonkurs").style.paddingTop=document.body.scrollTop;
setTimeout("setKonkursMenu()",10);
}


function startAgain(){
setTimeout("reallyStartAgain()",200);
}

function reallyStartAgain(){
document.getElementById("mykonkurs").GotoFrame(0);
document.getElementById("mykonkurs").Stop();
}


function doSummer(){
var yourname=document.getElementById("yourname").value;
var yourphone=document.getElementById("yourphone").value;
var yourmail=document.getElementById("yourmail").value;
var yournumber=document.getElementById("yournumber").value;
if (yourname.length>0 && yourphone.length>0 && yourmail.length>0 && yournumber.length>0){
document.getElementById("regError").innerHTML="";
document.getElementById("regButton").innerHTML='<table cellspacing=0 cellpadding=0 border=0><td valign=center><img src=/img/35.gif></td><td valign=center class=mtx style="padding-left:10px;"><b>Идет отправка данных.</b></td></table>';
setTimeout("realSummer()",500);
}
else{
document.getElementById("regError").innerHTML="<span class=red><strong>Все поля обязательны для заполнения</strong></span>";
}
}

function realSummer(){
var yourname=document.getElementById("yourname").value;
var yourphone=document.getElementById("yourphone").value;
var yourmail=document.getElementById("yourmail").value;
var yournumber=document.getElementById("yournumber").value;
var req = getXmlHttp();
req.onreadystatechange = function() {  
if (req.readyState == 4) { 
if(req.status == 200) { 
document.getElementById("regButton").innerHTML='<span class=greentx><strong>Благодарим Вас за интерес к нашей акции.<br>Номер Вашего билета успешно зарегистрирован.<br></strong></span>';
}
}
}
req.open('GET', '/addBilet.php?yourname='+encodeURI(yourname)+'&yourphone='+encodeURI(yourphone)+'&yourmail='+encodeURI(yourmail)+'&yournumber='+encodeURI(yournumber), true);
req.send(null);  // отослать запрос
}

