function showPopup(popup_type)
{
  //when IE - fade immediately
  if($.browser.msie)
  {
   $('#opaco').height($(document).height()).toggleClass('hidden');
  }
  else
  //in all the rest browsers - fade slowly
  {
   $('#opaco').height($(document).height()).toggleClass('hidden').fadeTo('slow', 0.7);
  }

  $('#popup')
   .html($('#cities_block').html())
   .alignCenter()
   .toggleClass('hidden');

  return false;
}

//additional properties for jQuery object
$(document).ready(function(){
  //align element in the middle of the screen
  $.fn.alignCenter = function() {
   //get margin left
   var marginLeft = -10 + 'px';
   //get margin top
   var marginTop = 5 + 'px';
   //return updated element
   return $(this).css({'margin-left':marginLeft, 'margin-top':marginTop});
  };
});

function closePopup()
{
  $('#opaco').toggleClass('hidden').removeAttr('style');
  $('#popup').toggleClass('hidden');
  return false;
}



function createXMLHttp() {
   if(typeof XMLHttpRequest != "undefined") {
    return new XMLHttpRequest();
   } else if(window.ActiveXObject) {
    var aVersions = ["MSXML2.XMLHttp.5.0", "MSXML2.XMLHttp.4.0",
         "MSXML2.XMLHttp.3.0", "MSXML2.XMLHttp",
         "Microsoft.XMLHttp"
         ];
    for (var i = 0; i < aVersions.length; i++) {
     try {
      var oXmlHttp = new ActiveXObject(aVersions[i]);
      alert(aVersions[i]);
      return oXmlHttp;
     } catch (oError) {
       
     }
    }
    throw new Error("Невозможно создать объект XMLHttp.");
   }
  }
  
   function displayCustomerCity(sText) {
   sElem = document.getElementById("trigger");
   sElem.innerHTML = sText;

  }
  
  function reloadPage() {
        this.location.reload();
}

  
function getRequest(town, phone1) 
 {   
   
    $("#result1").load("http://leasing-trade.ru/getCity.php", {city: town, phone: phone1});
 }
 
 function getRequestEn(town, phone1) 
 {   
   
    $("#result1").load("http://leasing-trade.ru/getCity.php", {city_en: town, phone_en: phone1});
 }
   
function getCity() {
   
  city1 = document.getElementById('inputselect_city').value; 
    $.cookie('the_cookie', '1', { expires: 3, path: "/" });
    
  $("#result").load("/index_sendler.php", {city: city1});
  document.getElementById('TB_window').style.display = 'none';
document.getElementById('TB_overlay').style.display = 'none'; 
   
} 

var cbwStatus = 0;
var request = null;
function callbackw() { 

 if (cbwStatus == 1) {
  document.getElementById('callback').style.display='none';
  cbwStatus = 0;

 } else {
  document.getElementById('callback').style.display='';
  cbwStatus = 1;
 }
}



function getCityClose() {
   
  
  document.getElementById('TB_window').style.display = 'none';
document.getElementById('TB_overlay').style.display = 'none';



}    


