/**
 * Перехват нажатия на ссылки в разделе «Программа тура» на легких версиях сайта
 * Все ссылки открываются в poup-up окнах
 *
 * Имя контейнера для перехвата: ''
 */
onload = function()
{
	var content_block = document.getElementById('content_box');
	if (content_block) {
		for (var i = 0, link = content_block.getElementsByTagName('a'), count = link.length; i < count; i++ ) {
			link[i].onclick = function(){ 
				window.open(this.href, "infoWindow", 'width=634,height=560,scrollbars=yes');
				return false;
			}
		}		
	}	
}



var checkAll = false;

var ie=ns=op=false;

if (navigator.userAgent.indexOf ("Opera") != -1) {op=true}
else if (navigator.userAgent.indexOf ("MSIE") != -1) {ie=true}
else if (navigator.userAgent.indexOf ("Netscape") != -1 ||
         navigator.userAgent.indexOf ("Gecko") != -1 ||
         navigator.userAgent.indexOf ("Mozilla") != -1 ||
         navigator.userAgent.indexOf ("Firefox") != -1) {ns=true}

function PreloadImages() {
 if (document.images) {
  var imgFiles = PreloadImages.arguments;
  var preloadArray = new Array();
  for (var i=0; i<imgFiles.length; i++) {
   preloadArray[i] = new Image();
   preloadArray[i].src = imgFiles[i];}}
}


function SetCookie(name, value, hours, path, domain, secure)
{
 var today = new Date();
 expires = new Date(today.getTime() + hours*60*60*1000);
 document.cookie = name + "=" + escape(value) +
                  ((hours) ? "; expires=" + expires.toGMTString() : "") +
                  ((path) ? "; path=" + path : "") +
                  ((domain) ? "; domain=" + domain : "") +
                  ((secure) ? "; secure" : "");
}


var ActiveTour = -1;
var ActiveButton = -1;
var ActivePoint = 0;
var CanUnpoint = false;

function Point(id,n)
{
 if (ActivePoint != 0)
  {
   document.getElementById('Point'+ActivePoint).className = "hid";
  }
 ActivePoint = id;
 CanUnpoint = false;
 document.getElementById('Point'+ActivePoint).style.top = pointTop+(pointStep*(n-1));
 document.getElementById('Point'+ActivePoint).className = "vis";
 if (document.all['Bold'+id+'_'+n])
  {
   document.getElementById('Bold'+id+'_'+n).className = "lite1i_ovr";
  }
}

function Point2(id,n)
{
 if (ActivePoint != 0)
  {
   document.getElementById('Point'+ActivePoint).className = "hid";
  }
 ActivePoint = id;
 CanUnpoint = false;
 if (id > 1)
 {
 document.getElementById('Point'+ActivePoint).style.top = pointTop2+(pointStep2*(n-1));
 }
 else
 {
 document.getElementById('Point'+ActivePoint).style.top = pointTop+(pointStep*(n-1));
 }
 document.getElementById('Point'+ActivePoint).className = "vis";
 if (document.all['Bold'+id+'_'+n])
  {
   document.getElementById('Bold'+id+'_'+n).className = "lite1i_ovr";
  }
}

function Point3(id,n)
{
 if (ActivePoint != 0)
  {
   document.getElementById('Point'+ActivePoint).className = "hid";
  }
 ActivePoint = id;
 CanUnpoint = false;
 document.getElementById('Point'+ActivePoint).style.top = pointTop3+(pointStep3*(n-1));
 document.getElementById('Point'+ActivePoint).className = "vis";
 if (document.all['Bold'+id+'_'+n])
  {
   document.getElementById('Bold'+id+'_'+n).className = "lite1i_ovr";
  }
}

function BtnUnPoint(id,n)
{
 CanUnpoint = true;
 document.getElementById('Bold'+id+'_'+n).className = "lite1i";
}

function UnPoint()
{
 if (CanUnpoint)
  {
   document.getElementById("Point"+ActivePoint).className = "hid";
  }
}


function GridOvr(n,img, kv)
{
 if (document.getElementById('Cell'+n).className == "grid")
  {
   if (img)
    {
     document.getElementById('Img'+img).src = "/data/gridimages/"+img+"-ovr.jpg";
    }
   document.getElementById('Cell'+n).className = "grid_hi";
   if (kv)
    {
     document.getElementById('Kvd'+n).className = "nomer_hi";
    }
  }
 else
  {
   if (img)
    {
     document.getElementById('Img'+img).src = "/data/gridimages/"+img+".jpg";
    }
   document.getElementById('Cell'+n).className = "grid"
   if (kv)
    {
     document.getElementById('Kvd'+n).className = "nomer";
    }
  }
}

function GridOvr2(n)
{
 if (document.getElementById('Cell'+n).className == "grid2")
  {
   document.getElementById('Cell'+n).className = "grid_hi2";
  }
 else
  {
   document.getElementById('Cell'+n).className = "grid2";
  }
}


function StepOvr(n)
{
 document.getElementById('Step'+n).src = "/_gfx/step-"+n+"-ovr.gif";
}


function StepOut(n)
{
 document.getElementById('Step'+n).src = "/_gfx/step-"+n+".gif";
}


function GridPresentOvr()
{
 if (document.getElementById('Present').className == "grid")
  {
   document.getElementById('ImgPresent').src = "/_gfx/v-mark2-1.gif";
   document.getElementById('Present').className = "grid_hi"
  }
 else
  {
   document.getElementById('ImgPresent').src = "/_gfx/v-mark2.gif";
   document.getElementById('Present').className = "grid"
  }
}


function LoadFrame(n, adr)
{
 parent[n].location = adr;
}


function ShowDiv(n, el, ovr, out)
{
 if (document.getElementById(n).className == "hid")
  {
   if (el)
    {
     document.getElementById(el).src = "/_gfx/"+ovr;
    }
   document.getElementById(n).className = "vis";
  }
 else
  {
   if (el)
    {
     document.getElementById(el).src = "/_gfx/"+out;
    }
   document.getElementById(n).className = "hid";
  }
}

function ShowDivF(n, el, ovr, out)
{
 if (parent.document.getElementById(n).className == "hid")
  {
   if (el)
    {
     parent.document.getElementById(el).src = "/_gfx/"+ovr;
    }
   parent.document.getElementById(n).className = "vis";
  }
 else
  {
   if (el)
    {
     parent.document.getElementById(el).src = "/_gfx/"+out;
    }
   parent.document.getElementById(n).className = "hid";
  }
}

function OpenDiv(n, el, ovr, out)
{
   document.getElementById(n).className = "vis";
}

function HideDiv(n, el, ovr, out)
{
   document.getElementById(n).className = "hid";
}

function ShowFilter(n, m)
{
 if (document.getElementById(n).className == "hid")
  {
   document.getElementById(m).className = "hid";
   document.getElementById(n).className = "vis";
   document.getElementById('TDBACK').className = "filtr";
   document.getElementById('eye_search').src = "/_gfx/eye-white.gif";
   document.getElementById('mark_search').src = "/_gfx/v-mark4.gif";
  }
 else
  {
   document.getElementById(n).className = "hid";
   document.getElementById(m).className = "vis";
   document.getElementById('TDBACK').className = "";
   document.getElementById('eye_search').src = "/_gfx/eye-orange2.gif";
   document.getElementById('mark_search').src = "/_gfx/v-mark3.gif";

  }
}

function ConvertDateMonth(n)
{
 var num = parseInt(n);
 if(num < 10)
 {
  return "0"+num;
 }
 else
 {
  return num;
 }
 return 0;
}

function ConvertPrice(n, count)
{
 var str;
 var euro = eval("Euro" + n);
 if (!euro)
  {
   var kurs = Kurs;
   d = new Date();
   document.all['PrBtn'+n].innerHTML = 'ЦЕНА В РУБЛЯХ НА '+d.getDate()+'.'+ConvertDateMonth(d.getMonth()+1)+'.'+d.getYear().toString().substring(2,4);
  }
 else
  {
   var kurs = 1/Kurs;
   document.all['PrBtn'+n].innerHTML = 'ЦЕНА В ЕВРО';
  }
 for (var i = 0; i < count; i++)
  {
   if (document.all['Pr'+n+'_'+i])
    {
     str = document.all['Pr'+n+'_'+i].innerHTML;
     if (str.indexOf(' / ') != -1)
      {
       val = '';
       arr = str.split(' / ');
       for (var j = 0; j < arr.length; j++)
        {
         if (parseInt(arr[j], 10))
      	  {
      	   val += Math.round(arr[j]*kurs*100)/100+' / ';
 	  }
 	 else
      	  {
      	   val += arr[j]+' / ';
 	  }
        }
       document.all['Pr'+n+'_'+i].innerHTML = val.substring(0, val.length-3);
      }
     else if (str.indexOf('/') != -1)
      {
       val = '';
       arr = str.split('/');
       for (var j = 0; j < arr.length; j++)
        {
         if (parseInt(arr[j], 10))
          {
           val += Math.round(arr[j]*kurs*100)/100+' / ';
          }
         else
          {
           val += arr[j]+' / ';
          }
        }
       document.all['Pr'+n+'_'+i].innerHTML = val.substring(0, val.length-3);
      }
     else
      {
       if (parseInt(str, 10))
      	{
         document.all['Pr'+n+'_'+i].innerHTML = Math.round(str*kurs*100)/100;
      	}
      }
    }
  }
}


function OpenCabinetWindow(tour_sub)
{
 var par="width=750,height=560,copyhistory=0,directories=0,location=0,menubar=0,resizable=0,scrollbars=0,status=0,toolbar=0";
 if (tour_sub)
  {
   var url = "cabinet.php?tour_sub="+tour_sub;
  }
 else
  {
   var url = "cabinet.php";
  }
 CabinetW=window.open(url,"CabinetWindow",[par]);
 CabinetW.focus();
}


/*function OpenPhotoWindow(parentID, photoID, type)
{
 var par="width=780,height=566,copyhistory=0,directories=0,location=0,menubar=0,resizable=0,scrollbars=0,status=0,toolbar=0";
 PhotoW=window.open("/photo.php?parentID="+parentID+"&photoID="+photoID+"&type="+type,"PhotoWindow",[par]);
 PhotoW.focus();
}*/

function ShowIndexPopupWindow()
{
 var par="width=926,height=356,copyhistory=0,directories=0,location=0,menubar=0,resizable=0,scrollbars=1,status=0,toolbar=0";
 IndexPopupW=window.open("/_pages/contactsp.php","IndexPopupWindow",[par]);
 IndexPopupW.focus();
}

function ShowPopupWindow(type, id)
{
 var par="width=536,height=420,copyhistory=0,directories=0,location=0,menubar=0,resizable=1,scrollbars=1,status=0,toolbar=0";
 var parHotel="width=780,height=600,copyhistory=0,directories=0,location=0,menubar=0,resizable=1,scrollbars=0,status=0,toolbar=0";
if(type == 1)
{
 PopupW=window.open("/xml/G3Hotel.php?id="+id,"",[parHotel]);
 PopupW.focus();
}
else
{
 PopupW=window.open("/popup.php?type="+type+"&id="+id,"PopupWindow",[par]);
 PopupW.focus();
}
}


function ShowReservWindow(type, id)
{
 var par="width=650,height=450,copyhistory=0,directories=0,location=0,menubar=0,resizable=0,scrollbars=1,status=0,toolbar=0";
 ReservW=window.open("/reserv.php?type="+type+"&id="+id,"ReservWindow",[par]);
 ReservW.focus();
}


function ShowTourPopupWindow(link)
{
 var par="width=650,height=617,copyhistory=0,directories=0,location=0,menubar=0,resizable=0,scrollbars=1,status=0,toolbar=0";
 TourPopupW=window.open("/frame.php?"+link,"TourPopupWindow",[par]);
 TourPopupW.focus();
}

function ShowHotelPhotoPopupWindow(id,photo)
{
 var par="width=644,height=484,copyhistory=0,directories=0,location=0,menubar=0,resizable=0,scrollbars=1,status=0,toolbar=0";
 TourPopupW=window.open("/hotelphoto.php?id="+id+"&photo="+photo,"HotelPhotoPopupWindow",[par]);
 TourPopupW.focus();
}

function ShowLiteTourPopupWindow(link)
{
 var par="width=910,height=824,copyhistory=0,directories=0,location=0,menubar=0,resizable=0,scrollbars=1,status=0,toolbar=0";
 TourPopupW=window.open(link,"LiteTourPopupWindow",[par]);
 TourPopupW.focus();
}

function ShowLinkWindow(link)
{
 var par="width=400,height=125,copyhistory=0,directories=0,location=0,menubar=0,resizable=0,scrollbars=1,status=0,toolbar=0";
 LinkW=window.open("/link.php?link="+link,"LinkWindow",[par]);
 LinkW.focus();
}


function ShowMailWindow(ts, tg)
{
 var par="width=400,height=125,copyhistory=0,directories=0,location=0,menubar=0,resizable=0,scrollbars=1,status=0,toolbar=0";
 MailW=window.open("/mail.php?tour_sub="+ts+"&target="+tg,"MailWindow",[par]);
 MailW.focus();
}

function ShowMail2Window(tr, hs, tg)
{
 var par="width=400,height=125,copyhistory=0,directories=0,location=0,menubar=0,resizable=0,scrollbars=1,status=0,toolbar=0";
 MailW=window.open("/mail2.php?tour="+tr+"&hotel_sub="+hs+"&target="+tg,"MailWindow",[par]);
 MailW.focus();
}

function ShowMapWindow(id)
{
 var par="width=740,height=540,copyhistory=0,directories=0,location=0,menubar=0,resizable=1,scrollbars=1,status=0,toolbar=0";
 MapW=window.open("/gmaps.php?id="+id,"",[par]);
 MapW.focus();
}

function ShowBookWindow(id, isnew)
{
 if (isnew == 1)
 {
 	var par="width=860,height=640,copyhistory=0,directories=0,location=0,menubar=0,resizable=1,scrollbars=1,status=0,toolbar=0";
	BookW=window.open("http://online.dsbw.ru/order/?pid=t"+id+"&a=dsbw","BookWindow",[par]);
 } 	
 else
 {
	var par="width=860,height=640,copyhistory=0,directories=0,location=0,menubar=0,resizable=0,scrollbars=1,status=0,toolbar=0";
 	BookW=window.open("http://online.dsbw.ru/order.php?id="+id+"&a=dsbw","BookWindow",[par]);
 } 	
 BookW.focus();
}

function ShowBookWindow2(id, tour)
{
 var par="width=860,height=640,copyhistory=0,directories=0,location=0,menubar=0,resizable=0,scrollbars=1,status=0,toolbar=0";
 BookW=window.open("http://online.dsbw.ru/order.php?hid="+id+"&tour="+tour+"&a=dsbw","BookWindow",[par]);
 BookW.focus();
}

function ShowPoiskturaBookWindow(id, agency, isnew)
{
  agurl = agency?("?a="+agency):"";
  if (isnew == 1)
  {
 	var par="width=860,height=640,copyhistory=0,directories=0,location=0,menubar=0,resizable=1,scrollbars=1,status=0,toolbar=0";
	BookW=window.open("http://online.dsbw.ru/tour/"+id+"/"+agurl,"BookWindow",[par]);
  } 	
  else
  {
	var par="width=860,height=640,copyhistory=0,directories=0,location=0,menubar=0,resizable=0,scrollbars=1,status=0,toolbar=0";
 	BookW=window.open("http://online.dsbw.ru/tour/"+id+"/"+agurl,"BookWindow",[par]);
  } 	
  BookW.focus();
}

function ShowStatusWindow()
{
 var par="width=600,height=550,copyhistory=0,directories=0,location=0,menubar=0,resizable=0,scrollbars=1,status=0,toolbar=0";
 BookW=window.open("http://online.dsbw.ru/status.php?a=dsbw","StatusWindow",[par]);
 BookW.focus();
}

function ShowPoiskturaTourPopupWindow(link)
{
 var par="width=910,height=824,copyhistory=0,directories=0,location=0,menubar=0,resizable=0,scrollbars=1,status=0,toolbar=0";
 TourPopupW=window.open(link,"",[par]);
 TourPopupW.focus();
}

function ShowPoiskturaStatusWindow(agency)
{
 agurl = agency?("?a="+agency):"";
 var par="width=600,height=550,copyhistory=0,directories=0,location=0,menubar=0,resizable=0,scrollbars=1,status=0,toolbar=0";
 BookW=window.open("http://online.poisktura.com/status.php"+agurl,"StatusWindow",[par]);
 BookW.focus();
}

function ShowPoiskturaRegisterWindow(agency)
{
 agurl = agency?("&a="+agency):"";
 var par="width=860,height=640,copyhistory=0,directories=0,location=0,menubar=0,resizable=0,scrollbars=1,status=0,toolbar=0";
 BookW=window.open("http://online.poisktura.com/register.php?step=1"+agurl,"BookWindow",[par]);
 BookW.focus();
}

function ShowPoiskturaLoginWindow(agency)
{
 agurl = agency?("&a="+agency):"";
 var par="width=860,height=640,copyhistory=0,directories=0,location=0,menubar=0,resizable=0,scrollbars=1,status=0,toolbar=0";
 BookW=window.open("http://online.poisktura.com/register.php?step=5"+agurl,"BookWindow",[par]);
 BookW.focus();
}


function ShowPoiskturaRegisterSiteWindow(agency)
{
 agurl = agency?("&a="+agency):"";
 var par="width=860,height=640,copyhistory=0,directories=0,location=0,menubar=0,resizable=0,scrollbars=1,status=0,toolbar=0";
 BookW=window.open("http://online.poisktura.com/register.php?step=3"+agurl,"BookWindow",[par]);
 BookW.focus();
}

function ShowHelpWindow()
{
 var par="width=780,height=640,copyhistory=0,directories=0,location=0,menubar=0,resizable=0,scrollbars=1,status=0,toolbar=0";
 HelpW=window.open("/help.php","HelpWindow",[par]);
 HelpW.focus();
}

function ShowResortWindow(id)
{
 var par="width=600,height=550,copyhistory=0,directories=0,location=0,menubar=0,resizable=0,scrollbars=1,status=1,toolbar=0";
 ResortW=window.open("/resort.php?id="+id,"ResortWindow",[par]);
 ResortW.focus();
}

function ShowLiteWindow(id)
{
 var par="width=600,height=550,copyhistory=0,directories=0,location=0,menubar=0,resizable=0,scrollbars=1,status=1,toolbar=0";
 HelpW=window.open("/web/type/liteinfo/liteid/"+id+"/index.php","LiteWindow",[par]);
 HelpW.focus();
}

function ShowAgencyWindow(id, region)
{
 var par="width=600,height=550,copyhistory=0,directories=0,location=0,menubar=0,resizable=0,scrollbars=1,status=1,toolbar=0";
 if (region == "M") { region = "msk"; }
 else if (region == "S") { region = "samara"; }
 else if (region == "E") { region = "ekb"; }
 else if (region == "R") { region = "don"; }
 else if (region == "P") { region = "spb"; }
 else { region = "msk"; }
 HelpW=window.open("/web/region/"+region+"/type/agencyinfo/agencyid/"+id+"/index.php","AgencyWindow",[par]);
 HelpW.focus();
}

function ShowSubsWindow(id)
{
 var par="width=780,height=640,copyhistory=0,directories=0,location=0,menubar=0,resizable=0,scrollbars=1,status=0,toolbar=0";
 BookW=window.open("/subs.php?id="+id,"SubsWindow",[par]);
 BookW.focus();
}

function WinCenter()
{
 if (ie) {
  self.moveTo((screen.availwidth-self.document.body.clientWidth)/2,(screen.availheight-self.document.body.clientHeight)/2);}
 if (ns) {
  self.moveTo((screen.width-self.window.innerWidth)/2,(screen.height-self.window.innerHeight)/2);}
 if (op) {
  self.moveTo((screen.width-self.window.innerWidth)/2,(screen.height-self.window.innerHeight-130)/2);}
}


function LogOut()
{
 SetCookie('DSBWuser', '');
 window.close();
}


function ScrollLeft()
{
 if ((scroll-1) >= 0)
  {
   scroll--;
  }
 if (photoID.length < 4)
  {
   for (var i=0; i < photoID.length; i++)
    {
     AssignImage(i+1, i);
    }
  }
 else
  {
   var n = 0;
   for (var i=scroll; i < scroll+4; i++)
    {
     n++;
     AssignImage(n, i);
    }
  }
}


function ScrollRight()
{
 if ((scroll+1) <= (photoID.length-4))
  {
   scroll++;
  }
 if (photoID.length < 4)
  {
   for (var i=0; i < photoID.length; i++)
    {
     AssignImage(i+1, i);
    }
  }
 else
  {
   var n = 0;
   for (var i=scroll; i < scroll+4; i++)
    {
     n++;
     AssignImage(n, i);
    }
   }
}


function AssignImage(n,i)
{
 document.getElementById('IMG'+n).src = '/data/photo/'+photoID[i]+'.jpg';
 document.getElementById('IMG'+n).className = 'ref';
 if (photoName[i])
  {
   document.getElementById('IMG'+n).title = photoName[i];
  }
}

function FirstAssignImage()
{
 for (var i=0; i < 4; i++)
  {
   document.getElementById('IMG'+(i+1)).src = '/_gfx/empty.gif';
   document.getElementById('IMG'+(i+1)).title = '';
   document.getElementById('IMG'+(i+1)).className = '';
  }
 if (photoID.length < 4)
  {
   for (var i=0; i < photoID.length; i++)
    {
     AssignImage(i+1, i);
    }
  }
 else
  {
   var n = 0;
   for (var i=scroll; i < 4; i++)
    {
     AssignImage(i+1, i);
    }
  }
}


function ShowPhoto(type, n)
{
 if (photoID.length == 0 || n >= photoID.length)
  {
   return false;
  }
 OpenPhotoWindow(parentID, photoID[n+scroll], type);
}


function OpenHotel(id)
{
 window.open('http://hotels.dsbw.ru/site/hotel/hotel.php?WareID='+id, '', 'toolbar=0,menubar=0,location=0,status=0,scrollbars=yes,resizable=0,height=500,width=700,left=50,top=50');
}


function CheckCountryList(count, fName, vName)
{
 var list = '';
 var checkAll = true;
 for (var i=1; i<count; i++)
  {
   if (document.forms[fName]['chk'+i].checked == true)
    {
     list = list+document.forms[fName]['chk'+i].value+'|';
    }
   else
    {
     checkAll = false;
    }
  }
 document.forms[fName][vName].value = list.substring(0, list.length-1);
 if (checkAll)
  {
   document.forms[fName]['chkALL'].checked = true;
  }
 else
  {
   document.forms[fName]['chkALL'].checked = false;
  }
}


function SelectAllInlist(count, fName, vName)
{
 var list = '';
 for (var i=1; i<count; i++)
  {
   document.forms[fName]['chk'+i].checked = checkAll;
    if (checkAll)
     {
      list = list+document.forms[fName]['chk'+i].checked+'|';
     }
  }
 document.forms[fName][vName].value = list.substring(0, list.length-1);
 if (checkAll)
  {
   document.forms[fName]['chkALL'].checked = true;
  }
 else
  {
   document.forms[fName]['chkALL'].checked = false;
  }
 checkAll = !checkAll;
}


function PrintTourName(n)
{
 //re = /<br>/gi;
 var str = document.all['Name'+n].innerHTML;
 if (document.all['Days'+n])
  {
   var days = document.all['Days'+n].innerHTML;
  }
 if (document.all['Price'+n])
  {
   var price = document.all['Price'+n].innerHTML;
  }
 if (days && price)
  {
   var str_right = "<table cellpadding=0 cellspacing=0 width=225><tr><td rowspan=3 width=1><img src='/_gfx/v-line.gif'></td><td align='right'><b style='margin-right: 8'>"+days+"</b></td></tr><tr height=1><td bgcolor=#000000></td></tr><tr><td align='right'><b style='margin-right: 8'>"+price+"</b></td></tr></table>";
  }
 else if (days)
  {
   var str_right = "<table cellpadding=0 cellspacing=0 width=225><tr><td width=1><img src='/_gfx/v-line.gif'></td><td align='right'><b style='margin-right: 8'>"+days+"</b></td></tr></table>";
  }
 else if (price)
  {
   var str_right = "<table cellpadding=0 cellspacing=0 width=225><tr><td width=1><img src='/_gfx/v-line.gif'></td><td align='right'><b style='margin-right: 8'>"+price+"</b></td></tr></table>";
  }
 else
  {
   var str_right = "";
  }
// var result = "<table cellpadding=0 cellspacing=0 width=100%><tr height=36><td><p class='in_grid5'>"+str.replace(re, ' ')+"</p></td><td width=180 nowrap align='right'>"+str_right+"</td></tr></table>";
 var result = "<table cellpadding=0 cellspacing=0 width=100%><tr height=36><td><p class='in_grid7'>"+str+"</p></td><td width=225 nowrap align='right'>"+str_right+"</td></tr></table>";
// parent.document.all['SelectedTour'].innerHTML = "<img src='/_gfx/selected-tour.gif'>";
// parent.document.all['SelectedTour'].innerHTML = "";
 parent.document.all['TourList'].innerHTML = "<a href='JavaScript:document.location.reload()' class='navi'><nobr>ТУРЫ РАЗДЕЛА</nobr></a><br><img src='/_gfx/hl1.gif' width=102 height=4>";
 parent.document.all['Tab'].innerHTML = result;
}


function PrintTourHeader()
{
 var result = "<table cellpadding=0 cellspacing=0 width=100%><tr height=36><td width=8 nowrap></td><td width=130 nowrap><b>название тура</b></td><td width=130 nowrap><b>ближайшие даты</b></td><td width=50 nowrap><b>места</b></td><td width=80 nowrap><b>цена</b></td><td width=130 nowrap><b>менеджер тура</b></td><td><b>бронирование</b></td></tr></table>";
// document.all['SelectedTour'].innerHTML = "";
 document.all['TourList'].innerHTML = "";
 document.all['Tab'].innerHTML = result;
}


function CheckFormData(fName, arrData)
{
 for(var i=0; i<arrData.length; i++)
  {
   if (!document.forms[fName][arrData[i]].value)
    {
     return false;
    }
  }
}


function PrintCharterName(n)
{
 var str = document.all['Name'+n].innerHTML;
 parent.document.all['CharterList'].innerHTML = "<a href='JavaScript:charter_list.history.back(); ClearCharterName()' class='navi'><nobr>К СПИСКУ</nobr></a><br><img src='/_gfx/hl1.gif' width=65 height=4>";
 parent.document.all['CharterName'].innerHTML = "<p class='in_grid5'>"+str+"</p>";
}

function ClearCharterName()
{
 parent.document.all['CharterList'].innerHTML = "";
 parent.document.all['CharterName'].innerHTML = "";
}


function servm(elem, targ)
{
	len = elem.options.length;
	ser = '';
	for (var i = 0; i < len; i++)
	{
		ev = new String(elem.options[i].value);
		if(elem.options[i].selected)
		{
			ser = ser+'#'+ev;
		}
	}
	targ.value = ser.substring(1);
}


function SubmitFilterForm()
{
	servm(HotelFilter.ServicePre, HotelFilter.Service);
	servm(HotelFilter.LocationPre, HotelFilter.Location);
	servm(HotelFilter.PricePre, HotelFilter.Price);
	HotelFilter.submit();
}


function HotelFilterSubmit(id, sub, page)
{
	HotelFilter.action = "/web/type/reshotel/id/"+id+"/sub/"+sub+"/page/"+page+"/index.php";
	HotelFilter.submit();
}


function Frame_SetPoint(pointID, newZoom)
{
	parent.document['map_drag'].SetVariable('pointID', pointID);
	parent.document['map_drag'].SetVariable('newZoom', newZoom);
}

/*function SetPoint(pointID, newZoom)
{
	document['map_drag'].SetVariable('pointID', pointID);
	document['map_drag'].SetVariable('newZoom', newZoom);
}*/


function ShowTourists(n, t)
{
 for (var i=10; i>t; i--)
  {
   document.all['FIO'+n+'_'+i].value='';
   document.all['SEX'+n+'_'+i].value='';
   document.all['DAY'+n+'_'+i].value='';
   document.all['MONTH'+n+'_'+i].value='';
   document.all['YEAR'+n+'_'+i].value='';
   document.getElementById('tourist'+n+'_'+i).className = 'hid';
  }
 for (i=1; i<=t; i++)
  {
   document.getElementById('tourist'+n+'_'+i).className = 'vis';
  }

}


function CheckResHotel()
{
 var n = 0;
 var k = 0;
 if (!document.all['day1'].value || !document.all['month1'].value || !document.all['year1'].value || !document.all['day2'].value || !document.all['month2'].value || !document.all['year2'].value)
  {
   alert('Укажите дату заезда и отъезда');
   return false;
  }
 if (document.all['DBL'].value < 1 && document.all['SGL'].value < 1 && document.all['TRIPL'].value < 1 && document.all['CHILD'].value < 1)
  {
   alert('Укажите количество туристов');
   return false;
  }
 if (document.all['DBL'].value > 0)
  {
   k = parseInt(document.all['DBL'].value)+1;
   n = 1;
   for(var i=1; i<k; i++)
    {
     if (!document.all['FIO'+n+'_'+i].value || !document.all['SEX'+n+'_'+i].value || !document.all['DAY'+n+'_'+i].value || !document.all['MONTH'+n+'_'+i].value || !document.all['YEAR'+n+'_'+i].value)
      {
       alert('Введите данные туристов');
       return false;
      }
    }
  }
 if (document.all['SGL'].value > 0)
  {
   k = parseInt(document.all['SGL'].value)+1;
   n = 2;
   for(var i=1; i<k; i++)
    {
     if (!document.all['FIO'+n+'_'+i].value || !document.all['SEX'+n+'_'+i].value || !document.all['DAY'+n+'_'+i].value || !document.all['MONTH'+n+'_'+i].value || !document.all['YEAR'+n+'_'+i].value)
      {
       alert('Введите данные туристов');
       return false;
      }
    }
  }
 if (document.all['TRIPL'].value > 0)
  {
   k = parseInt(document.all['TRIPL'].value)+1;
   n = 3;
   for(var i=1; i<k; i++)
    {
     if (!document.all['FIO'+n+'_'+i].value || !document.all['SEX'+n+'_'+i].value || !document.all['DAY'+n+'_'+i].value || !document.all['MONTH'+n+'_'+i].value || !document.all['YEAR'+n+'_'+i].value)
      {
       alert('Введите данные туристов');
       return false;
      }
    }
  }
 if (document.all['CHILD'].value > 0)
  {
   k = parseInt(document.all['CHILD'].value)+1;
   n = 4;
   for(var i=1; i<k; i++)
    {
     if (!document.all['FIO'+n+'_'+i].value || !document.all['SEX'+n+'_'+i].value || !document.all['DAY'+n+'_'+i].value || !document.all['MONTH'+n+'_'+i].value || !document.all['YEAR'+n+'_'+i].value)
      {
       alert('Введите данные туристов');
       return false;
      }
    }
  }

 if (!document.all['USERTYPE'].value || (document.all['USERTYPE'].value == 1 && (!document.all['Z_FIO'].value || !document.all['Z_PHONE'].value || !document.all['Z_MAIL'].value)) || (document.all['USERTYPE'].value == 2 && (!document.all['A_NAME'].value || !document.all['A_FIO'].value || !document.all['A_PHONE'].value || !document.all['A_MAIL'].value)))
  {
   alert('Введите контактные данные');
   return false;
  }

}


function CheckResTicket()
{
 var n = 0;
 var k = 0;
 if (!document.all['day1'].value || !document.all['month1'].value || !document.all['year1'].value || !document.all['day2'].value || !document.all['month2'].value || !document.all['year2'].value)
  {
   alert('Укажите дату вылета и прилета');
   return false;
  }
 if (document.all['PASS'].value < 1)
  {
   alert('Укажите количество пассажиров');
   return false;
  }
 if (document.all['PASS'].value > 0)
  {
   k = parseInt(document.all['PASS'].value)+1;
   n = 1;
   for(var i=1; i<k; i++)
    {
     if (!document.all['FIO'+n+'_'+i].value || !document.all['SEX'+n+'_'+i].value || !document.all['DAY'+n+'_'+i].value || !document.all['MONTH'+n+'_'+i].value || !document.all['YEAR'+n+'_'+i].value)
      {
       alert('Введите данные пассажиров');
       return false;
      }
    }
  }

 if (document.all['city_v'].value == 'other' && !document.all['city_v_text'].value)
  {
   alert('Укажите город вылета');
   return false;
  }
 if (!document.all['city1'].value)
  {
   alert('Укажите город туда');
   return false;
  }
 if (!document.all['city2'].value)
  {
   alert('Укажите город обратно');
   return false;
  }

 if (!document.all['USERTYPE'].value || (document.all['USERTYPE'].value == 1 && (!document.all['Z_FIO'].value || !document.all['Z_PHONE'].value || !document.all['Z_MAIL'].value)) || (document.all['USERTYPE'].value == 2 && (!document.all['A_NAME'].value || !document.all['A_FIO'].value || !document.all['A_PHONE'].value || !document.all['A_MAIL'].value)))
  {
   alert('Введите контактные данные');
   return false;
  }

}

function DisableStopSaleItems(p)
{
 switch (p) {
  case 1:
   document.getElementById('TOURS').disabled = true;
   document.getElementById('KEYWORD').disabled = false;
   document.getElementById('CATALOGS').disabled = false;
   document.getElementById('region').disabled = false;
   document.getElementById('day1').disabled = false;
   document.getElementById('month1').disabled = false;
   document.getElementById('year1').disabled = false;
   document.getElementById('day2').disabled = false;
   document.getElementById('month2').disabled = false;
   document.getElementById('year2').disabled = false;
   document.getElementById('m_yes').disabled = false;
   document.getElementById('m_no').disabled = false;
   document.getElementById('m_lit').disabled = false;
   document.getElementById('price').disabled = false;
   document.getElementById('BUTTON').disabled = false;
  break;
  case 2:
   document.getElementById('TOURS').disabled = false;
   document.getElementById('KEYWORD').disabled = true;
   document.getElementById('CATALOGS').disabled = true;
   document.getElementById('region').disabled = true;
   document.getElementById('day1').disabled = true;
   document.getElementById('month1').disabled = true;
   document.getElementById('year1').disabled = true;
   document.getElementById('day2').disabled = true;
   document.getElementById('month2').disabled = true;
   document.getElementById('year2').disabled = true;
   document.getElementById('m_yes').disabled = true;
   document.getElementById('m_no').disabled = true;
   document.getElementById('m_lit').disabled = true;
   document.getElementById('price').disabled = true;
   document.getElementById('BUTTON').disabled = true;
  break;

  }
}

function GroupDivs(n)
{
 document.getElementById('Info').className = "hid";
 document.getElementById('Search').className = "hid";
 document.getElementById('TourMap').className = "hid";
 for(var i=1; i<4; i++)
  {
   if (i != n)
    {
     document.getElementById('BTN'+i+'_x').className = "hid";
     document.getElementById('BTN'+i).className = "vis";
    }
   else
    {
     document.getElementById('BTN'+i).className = "hid";
     document.getElementById('BTN'+i+'_x').className = "vis";
    }
  }
}

function GroupDivsF(n)
{
 parent.document.getElementById('Info').className = "hid";
 parent.document.getElementById('Search').className = "hid";
 parent.document.getElementById('TourMap').className = "hid";
 for(var i=1; i<4; i++)
  {
   if (i != n)
    {
     parent.document.getElementById('BTN'+i+'_x').className = "hid";
     parent.document.getElementById('BTN'+i).className = "vis";
    }
   else
    {
     parent.document.getElementById('BTN'+i).className = "hid";
     parent.document.getElementById('BTN'+i+'_x').className = "vis";
    }
  }
}

function GroupDivs2(n)
{
 document.getElementById('Info').className = "hid";
 document.getElementById('Search').className = "hid";
 for(var i=1; i<3; i++)
  {
   if (i != n)
    {
     document.getElementById('BTN'+i+'_x').className = "hid";
     document.getElementById('BTN'+i).className = "vis";
    }
   else
    {
     document.getElementById('BTN'+i).className = "hid";
     document.getElementById('BTN'+i+'_x').className = "vis";
    }
  }
}

function ShowBigMap(n)
{
 var par="width=634,height=600,copyhistory=0,directories=0,location=0,menubar=0,resizable=0,scrollbars=0,status=0,toolbar=0";
 MapW=window.open("/map.php?id="+n,"MapWindow",[par]);
 MapW.focus();
}


function ShowBigImg(n, p, t, x)
{
	if (p == 0) { var w = 1000; var h=600;}
		else { var w = 800; var h=800;}

	var par="width="+w+",height="+h+",copyhistory=0,directories=0,location=0,menubar=0,resizable=0,scrollbars=0,status=0,toolbar=0";
	ImgW=window.open("/img.php?id="+n+'&title='+t+'&name='+x, "", [par]);
	ImgW.focus();
}

function flip(targetElement)
{
	if (targetElement.style.display == "")
	{
		hidevis(targetElement);
	}
	else
	{
		showvis(targetElement);
	}
}

function showvis(targetElement)
{
	targetElement.style.display = "";
	targetElement.style.visibility = "visible";
}

function hidevis(targetElement)
{
	targetElement.style.display = "none";
	targetElement.style.visibility = "hidden";
}

function fliphtml(targetElement, visibleElement, vistext, hidtext)
{
	if (visibleElement.style.display == "")
	{
		targetElement.innerHTML = hidtext;
	}
	else
	{
		targetElement.innerHTML = vistext;
	}
}

function flipimg(targetElement, visibleElement, vistext, hidtext)
{
	if (visibleElement.style.display == "")
	{
		targetElement.src = '/images/'+hidtext+'.gif';
	}
	else
	{
		targetElement.src = '/images/'+vistext+'.gif';
	}
}

function layerd(layerName)
{
	return document.getElementById(layerName)
}

<!-- ------------------------ -->

var d = document;
	var isNS = (d.layers)?true:false;
	var isIE = (d.all)?true:false;
	var isDom = (!isIE&&d.getElementById)?true:false;
	var isOpera=navigator.userAgent.indexOf("Opera")!=-1;
	var vis = false;

function checkBrowser(){
	this.ver=navigator.appVersion
	this.dom=document.getElementById?1:0
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
	this.ie4=(document.all && !this.dom)?1:0;
	this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0;
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5)
	return this
}

bw=new checkBrowser()


function showLayer(id) {
	if(isDom) {
		var doc = document.getElementById(id);
		eval("doc.style.visibility=\'visible\'");
	}
	if(isIE) {
		eval("d.all."+id+".style.visibility=\'visible\'");
	}
	if(isNS) {
		d[id].visibility = 'show';
	}
}


function hideLayer(id) {
	if(isDom) {
		var doc = document.getElementById(id);
		eval("doc.style.visibility=\'hidden\'");
	}
	if(isIE) {
		eval("d.all."+id+".style.visibility=\'hidden\'");
	}
	if(isNS) {
		if (vis == false) setTimeout('d[\''+id+'\'].visibility = \'hide\';',1500);
		else setTimeout('d[\''+id+'\'].visibility = \'show\';',1500);
	}
}


// для отдельных агетств

function changeDomainName(domainname) {
   var pattern = ['a.qok', 'a.price', '#bookonlinelink'];
   var re = new RegExp(domainname+'.online.poisktura.com', 'i');
   var rpattern = 'online.'+domainname+'.ru';
   $.each( pattern,
       function(k,v){
         if( $(v).attr('href') )$(v).attr('href', $(v).attr('href').replace(re, rpattern)  );
       }
   );
   
}