function go_page(np) {
  var adr="http://www.2511155.ru/";
//  var adr="http://www.test2.ru/";
  if (np==1) {
  var urls=adr+"index.php?m=";
  window.location.href=urls+np;
  }

  if (np==2) {
  var urls=adr+"country.php";
  window.location.href=urls;
  }

  if (np==3) {
  var urls=adr+"avia.php";
  window.location.href=urls;
  }

  if (np==4) {
  var urls=adr+"contact.php";
  window.location.href=urls;
  }

  if (np==100) {
  var urls=adr+"cruise/cruise.php";
  window.location.href=urls;
  }
}


function go_feed(id,r,h,hot) {
  var date = document.getElementById('date').value;
  if (date!="0") {
  var adr="http://www.2511155.ru/";
  var urls=adr+"feedback.php?id=";
  var mywin=urls+id+"&r="+r+"&razm="+h+'&date='+date+"&hot="+hot;
//    alert (mywin);
  windop = window.open(mywin,"mywin","height=690, width=990,left=10,top=10, scrollbars=no, resizable=no"); 
  } else {
    alert ("Укажите дату тура!");
  }
  }

function hotel_feedback(hot){
  var adr="http://www.2511155.ru/";
  var urls=adr+"hotel_feedback.php?id=";
  var mywin=urls+hot;
  windop = window.open(mywin,"mywin","height=690, width=990,left=10,top=10, scrollbars=no, resizable=no"); 
}

function open_photo(p){
 mywin="open_photo.php?pic="+p;
 windop = window.open(mywin,"mywin","height=630,width=450,left=10,top=10, scrollbars=no, resizable=no"); 
}

function ch_height() {
/*
        var n=450;
        konk_height=eval("document.getElementById('konkurs')");
        cont_height=eval("document.getElementById('cont')");
        block_height=eval("document.getElementById('wind')");

	if (navigator.userAgent.indexOf ("MSIE 5") != -1) {
        if (block_height.clientHeight<1550) {block_height.style.height="1500px"}        
          ch=cont_height.clientHeight+n;
        }
	if (navigator.userAgent.indexOf("MSIE 4") != -1) {
          ch=cont_height.clientHeight+n;
        if (block_height.clientHeight<1550) {block_height.style.height="1500px"}        
        }
	if (navigator.userAgent.indexOf ("MSIE 4.5") != -1) {
          ch=cont_height.clientHeight+n;
        if (block_height.clientHeight<1550) {block_height.style.height="1500px"}        
        }
	if (navigator.userAgent.indexOf ("MSIE 6.0") != -1) {
          ch=cont_height.clientHeight+n;
        if (block_height.clientHeight<1550) {block_height.style.height="1500px"}        
        }
	if (navigator.userAgent.indexOf ("Opera") != -1) {
          ch=document.body.scrollHeight+35;
        konk_height.style.height="253px";
        if (block_height.clientHeight<1550) {block_height.style.height="1500px"}                  
        }

	if (navigator.userAgent.indexOf ("Mozilla/5.0") != -1)	{
        ch=document.defaultView.scrollMaxY+n+115;
        konk_height.style.height="272px";
        if (block_height.clientHeight<1550) {block_height.style.height="1500px"}        
        }
	if (navigator.userAgent.indexOf ("Mozilla/4.7") != -1)	{
        ch=document.defaultView.scrollMaxY+n+115;
        konk_height.style.height="272px";
        if (block_height.clientHeight<1550) {block_height.style.height="1500px"}        
        }


//        alert ("Основное окно: "+block_height.clientHeight);
//        alert ("Основной контент: "+ch);


        if ((ch+n)>=block_height.clientHeight) {
        block_height.style.height=(ch)+"px";
        }
*/
}

// Получаем url для подключения
url = document.location.href;
xend = url.lastIndexOf("/") + 1;
var base_url = url.substring(0, xend);

function ajax_do (url) {
// Начинается с http?
if (url.substring(0, 4) != 'http') {
url = base_url + url;
}
// Создаем новый JS элемент
var jsel = document.createElement('SCRIPT');
jsel.type = 'text/javascript';
jsel.src = url;
// Дописываем элемент к документу
document.body.appendChild (jsel);

}

function ajax_get (url, el) {
// Has element been passed as object or id-string?
if (typeof(el) == 'string') {
el = document.getElementById(el);
}
// Valid el?
if (el == null) { return false; }
// Does URL begin with http?
if (url.substring(0, 4) != 'http') {
url = base_url + url;
}
// Create getfile URL
getfile_url = base_url + 'getfile.php?url=' + escape(url) + '&el=' + escape
(el.id);
// Do Ajax
ajax_do (getfile_url);
return true;
}

function ajax_get_ (url, el) {
// Has element been passed as object or id-string?
if (typeof(el) == 'string') {
el = document.getElementById(el);
}
// Valid el?
if (el == null) { return false; }
// Does URL begin with http?
if (url.substring(0, 4) != 'http') {
url = base_url + url;
}
// Create getfile URL
getfile_url = base_url + 'getfile.php?url=' + escape(url) + '&el=' + escape
(el.id);
// Do Ajax
ajax_do (getfile_url);
return true;
}

function submit_form(scr_php,dest_div,p) {

// Get form values

var id_city = document.getElementById('id_city').value;
var idc = document.getElementById('idc').value;
var id_star = document.getElementById('id_star').value;
var date1 = document.getElementById('date1').value;
var date2 = document.getElementById('date2').value;
var night1 = document.getElementById('night1').value;
var night2 = document.getElementById('night2').value;
var price = document.getElementById('price').value;
var pricec = document.getElementById('pricec').value;
var tour = document.getElementById('tour').value;
var resort = document.getElementById('resort').value;
var hotel = document.getElementById('hotel').value;
var food = document.getElementById('food').value;
var sortColumn = document.getElementById('sortColumn').value;
var adult = document.getElementById('adult').value;
var child = document.getElementById('child').value;
var htBetter = document.getElementById('htBetter').checked;
var rand_cache = document.getElementById('rand_cache').value;

// Construct URL
url =  escape(scr_php)+'?id_city=' + escape(id_city)
       + '&idc=' + escape(idc)
       + '&id_star=' + escape(id_star)
       + '&htBetter=' + escape(htBetter)
       + '&date1=' + escape(date1)
       + '&date2=' + escape(date2)
       + '&night1=' + escape(night1)
       + '&night2=' + escape(night2)
       + '&price=' + escape(price)
       + '&pricec=' + escape(pricec)
       + '&tour=' + escape(tour)
       + '&resort=' + escape(resort)
       + '&hotel=' + escape(hotel)
       + '&food=' + escape(food)
       + '&sortColumn=' + escape(sortColumn)
       + '&adult=' + escape(adult)
       + '&child=' + escape(child)
       + '&page=' + escape(p)
       + '&rand_cache=' + escape(rand_cache);

document.getElementById('result').innerHTML='<p align="center"><object classid="clsid:D27CDB6E-AE6D-11CF-96B8-444553540000" id="obj1" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" border="0" width="160" height="60" align="top">\n';
document.getElementById('result').innerHTML+='<param name="movie" value="img/load.swf">\n';
document.getElementById('result').innerHTML+='<param name="quality" value="High">\n';
document.getElementById('result').innerHTML+='<embed src="img/load.swf" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" name="obj1" width="160" height="60"></object></p>\n';

ajax_get (url, dest_div);   
	
}


function sub_qw() {
var id_city = document.getElementById('id_city').value;
var idc = document.getElementById('idc').value;
var id_star = document.getElementById('id_star').value;
var date1 = document.getElementById('date1').value;
var date2 = document.getElementById('date2').value;
var night1 = document.getElementById('night1').value;
var night2 = document.getElementById('night2').value;
var price = document.getElementById('price').value;
var pricec = document.getElementById('pricec').value;
var tour = document.getElementById('tour').value;
var resort = document.getElementById('resort').value;
var hotel = document.getElementById('hotel').value;
var food = document.getElementById('food').value;
var razm = document.getElementById('razm').value;
var rand_cache = document.getElementById('rand_cache').value;

// Construct URL
url =  '?id_city=' + escape(id_city)
       + '&idc=' + escape(idc)
       + '&id_star=' + escape(id_star)
       + '&date1=' + escape(date1)
       + '&date2=' + escape(date2)
       + '&night1=' + escape(night1)
       + '&night2=' + escape(night2)
       + '&price=' + escape(price)
       + '&pricec=' + escape(pricec)
       + '&tour=' + escape(tour)
       + '&resort=' + escape(resort)
       + '&hotel=' + escape(hotel)
       + '&food=' + escape(food)
       + '&razm=' + escape(razm)
       + '&rand_cache=' + escape(rand_cache);
 var i=0;

 if (i==0) {
 mywin="search_tours.php"+url;
 windop = window.open(mywin,"mywin","height=690,width=990,left=10,top=10, scrollbars=yes, resizable=no"); 
 }
}

function sub_qw_menu(id,idc) {

 url='?id=' + escape(id)
 + '&idc=' + escape(idc);
 mywin="search_tours.php"+url;
 windop = window.open(mywin,"mywin","height=690,width=990,left=10,top=10, scrollbars=yes, resizable=no"); 
}

function foo(fields) {
 window.open("date.php?fields="+fields,"myWindow", "toolbar=0,width=260,height=190,left=50,top=50");
}

function ch_back(id,c) {
//   alert(id+" - "+c);
     tr=eval("document.getElementById(id)");
   if (c==1) {tr.style.backgroundColor="#99CCFF";}
   if (c==0) {tr.style.backgroundColor="#FFFFFF";}
}

function avia() {

 var id=1;
 var idc=1;

 var j_update_user_prefs = document.getElementById('j_update_user_prefs').value;
 var avia_city = document.getElementById('avia_city').value;
 var avia_airport = document.getElementById('avia_airport').value;
 var avia_date_to = document.getElementById('avia_date_to').value;
 var avia_date_return = document.getElementById('avia_date_return').value;
 var avia_interval = document.getElementById('avia_interval').value;
 var showNulls = document.getElementById('showNulls').value;


 url='?showNulls=' + escape(showNulls)
 + '&j_update_user_prefs=' + escape(j_update_user_prefs)
 + '&city=' + escape(avia_city)
 + '&avia_city=' + escape(avia_city)
 + '&avia_airport=' + escape(avia_airport)
 + '&avia_date_to=' + escape(avia_date_to)
 + '&avia_date_return=' + escape(avia_date_return)
 + '&avia_interval=' + escape(avia_interval);

  mywin="avia_load.php"+url;
//  alert (mywin);
  ajax_get (mywin, 'result');   
// windop = window.open(mywin,"mywin","height=500,width=490,left=10,top=10, scrollbars=yes, resizable=no"); 
}
