    /**
     / THIRD FUNCTION
     * getPageSize() by quirksmode.com
     *
     * @return Array Return an array with page width, height and window width, height
     */
    function getPageSize() {
      var xScroll, yScroll;
      if (window.innerHeight && window.scrollMaxY) {  
        xScroll = window.innerWidth + window.scrollMaxX;
        yScroll = window.innerHeight + window.scrollMaxY;
      } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
        xScroll = document.body.scrollWidth;
        yScroll = document.body.scrollHeight;
      } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
        xScroll = document.body.offsetWidth;
        yScroll = document.body.offsetHeight;
      }
      var windowWidth, windowHeight;
      if (self.innerHeight) {  // all except Explorer
        if(document.documentElement.clientWidth){
          windowWidth = document.documentElement.clientWidth; 
        } else {
          windowWidth = self.innerWidth;
        }
        windowHeight = self.innerHeight;
      } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
        windowWidth = document.documentElement.clientWidth;
        windowHeight = document.documentElement.clientHeight;
      } else if (document.body) { // other Explorers
        windowWidth = document.body.clientWidth;
        windowHeight = document.body.clientHeight;
      }  
      // for small pages with total height less then height of the viewport
      if(yScroll < windowHeight){
        pageHeight = windowHeight;
      } else { 
        pageHeight = yScroll;
      }
      // for small pages with total width less then width of the viewport
      if(xScroll < windowWidth){  
        pageWidth = xScroll;    
      } else {
        pageWidth = windowWidth;
      }
      arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight);
      return arrayPageSize;
    };
    /**
     / THIRD FUNCTION
     * getPageScroll() by quirksmode.com
     *
     * @return Array Return an array with x,y page scroll values.
     */
    function getPageScroll() {
      var xScroll, yScroll;
      if (self.pageYOffset) {
        yScroll = self.pageYOffset;
        xScroll = self.pageXOffset;
      } else if (document.documentElement && document.documentElement.scrollTop) {   // Explorer 6 Strict
        yScroll = document.documentElement.scrollTop;
        xScroll = document.documentElement.scrollLeft;
      } else if (document.body) {// all other Explorers
        yScroll = document.body.scrollTop;
        xScroll = document.body.scrollLeft;  
      }
      arrayPageScroll = new Array(xScroll,yScroll);
      return arrayPageScroll;
    };

    jQuery.preloadImages = function() {
      for(var i = 0; i<arguments.length; i++) {
        jQuery("<img>").attr("src", arguments[i]);
      }
    }



$(document).ready(function(){

/* Меню */
  $("div.FirstLevel>div").hover(function() {
    $(this).toggleClass("Selected");
  }, function() {
    $(this).toggleClass("Selected");
  });

  $("div.SecondLevel>div").hover(function() {
    $(this).toggleClass("Selected");
  }, function() {
    $(this).toggleClass("Selected");
  });
/* //Меню */

/* Подсвечивающиеся картинки */

  $("#Finam").hover(function() {
    $(this).attr({ src: '/i/finam_color.gif' });
  }, function() {
    $(this).attr({ src: '/i/finam_grey.gif' });
  });

  $("#Narodnaya").hover(function() {
    $(this).attr({ src: '/i/narodnaya_color.gif' });
  }, function() {
    $(this).attr({ src: '/i/narodnaya_grey.gif' });
  });
  
  $("#Minfin").hover(function() {
    $(this).attr({ src: '/i/minfin_color.gif' });
  }, function() {
    $(this).attr({ src: '/i/minfin_grey.gif' });
  });

  $("#Mos").hover(function() {
    $(this).attr({ src: '/i/mos_color.gif' });
  }, function() {
    $(this).attr({ src: '/i/mos_grey.gif' });
  });

  $("#Uralsib").hover(function() {
    $(this).attr({ src: '/i/uralsib_color.gif' });
  }, function() {
    $(this).attr({ src: '/i/uralsib_grey.gif' });
  });

  $("#Naufor").hover(function() {
    $(this).attr({ src: '/i/naufor_color.gif' });
  }, function() {
    $(this).attr({ src: '/i/naufor_grey.gif' });
  });

  $("#ASV").hover(function() {
    $(this).attr({ src: '/i/asv_color.gif' });
  }, function() {
    $(this).attr({ src: '/i/asv_grey.gif' });
  });

  $(".develop img").hover(function() {
    $(this).attr({ src: '/i/digitalestate_color.gif' });
  }, function() {
    $(this).attr({ src: '/i/digitalestate.gif' });
  });
/* //Подсвечивающиеся картинки */

/* Значения по умолчанию в формах */

  $('div#Search input').example('Поиск');

/* //Значения по умолчанию в формах */

/* Открывающиеся толкования */

  $("#LeftWordsList li a").ajax_tooltip({
    direction: 'left',
    top_offset: -20,
    left_offset: 20
  });

  $("#RightWordsList li a").ajax_tooltip({
    direction: 'right',
    top_offset: -20,
    left_offset: -315
  });

/* Работа с анкетой */
  /* Показать/скрыть анкету */
  $("#AnketaButton a").click(function(e) {
    if ($("#AnketaBoxContainer").css('display') == 'none') {
      $("#AnketaBoxContainer").css({
        left: e.pageX,
        top: e.pageY-200
      });
    }
    $("#AnketaBoxContainer").animate({opacity: 'toggle'}, 500);
    return false;
  });
  
  $("#CloseAnketaForm").click(function(e) {
    $("#AnketaBoxContainer").animate({opacity: 'toggle'}, 500);
    return false;
  });

  /* Submit анкеты по клику на кнопку */
  $("#AnketaSubmit").click(function(e) {
    $("#AnketaForm").ajaxSubmit({ 
      target: "#AnketaFormContainer",
      beforeSubmit: function() {
        $("#AnketaFormContainer").html("<div style='text-align:center;'><img src='/i/ajax_loader.gif'/><br>Загрузка...</div>");
      },
      // $.ajax options
      complete: function(msg) {
        if (!msg.responseText) {
          // Показать сообщение пользователю
          $("#AnketaSubmit").hide();
          $("#AnketaFormContainer").css({padding: 0});
          $("#AnketaFormContainer").html("<h2>Ваша заявка отправлена!</h2>");
          $("#AnketaFormContainer h2").css({"padding": 0});
          // Скрыть сообщение пользователю
          setTimeout(function(){
            $("#AnketaBoxContainer").fadeOut(500);
          }, 3000);
        }
      }
    });    
    return false;
  });
  
  $("#AnketaForm").submit(function(e) {
    $("#AnketaForm").ajaxSubmit({ 
      target: "#AnketaFormContainer",
      beforeSubmit: function() {
        $("#AnketaFormContainer").html("<div style='text-align:center;'><img src='/i/ajax_loader.gif'/><br>Загрузка...</div>");
      },
      // $.ajax options
      complete: function(msg) {
        if (!msg.responseText) {
          // Показать сообщение пользователю
          $("#AnketaSubmit").hide();
          $("#AnketaFormContainer").css({padding: 0});
          $("#AnketaFormContainer").html("<h2>Ваша заявка отправлена!</h2>");
          $("#AnketaFormContainer h2").css({"padding": 0});
          // Скрыть сообщение пользователю
          setTimeout(function(){
            $("#AnketaBoxContainer").fadeOut(500);
          }, 3000);
        }
      }
    });    
    return false;
  });

  /* Submit анкеты по "Enter" */
/*
  $("#AnketaForm input").keypress(function(e) {
    if (e.which == 13) {
      $("#AnketaForm").ajaxSubmit({ 
        target: "#AnketaFormContainer",
        beforeSubmit: function() {
        $("#AnketaFormContainer").html("<div style='text-align:center;'><img src='/i/ajax_loader.gif'/><br>Загрузка...</div>");
        }
      });
    }
    return false;
  });
*/
/* //Работа с анкетой */

/* Видеоролики */
  $('div.VideoList a').click(function() {

    $('body').append('<div id="VideoOverlay"></div><div id="VideoBox"><img src="/i/ajax_loader.gif"/></div>');

    // Style overlay and show it
    var arrPageSizes = getPageSize();
    var arrPageScroll = getPageScroll();

    $('#VideoOverlay').css({
      backgroundColor:  '#000',
      opacity: 0.8,
      width: arrPageSizes[0],
      height: arrPageSizes[1]
    }).fadeIn();

    $('#VideoBox').css({
      top: arrPageScroll[1] + (arrPageSizes[3] / 10),
      left: arrPageScroll[0] + ((arrPageSizes[0] / 2) - 225)
    }).show();

    $.ajax({
      url: '/index/video/video_' + $(this).attr('id') + '.html?isNaked=1',
      success: function(msg){
        $('#VideoBox').html(msg);
      }
    });
    $(document).bind("click", function(e){
      $('#VideoOverlay').remove();
      $('#VideoBox').remove();
    });
    return false;
  });


  $('#Video a').click(function() {

    $('body').append('<div id="VideoOverlay"></div><div id="VideoBox"><img src="/i/ajax_loader.gif"/></div>');

    // Style overlay and show it
    var arrPageSizes = getPageSize();
    var arrPageScroll = getPageScroll();

    $('#VideoOverlay').css({
      backgroundColor:  '#000',
      opacity: 0.8,
      width: arrPageSizes[0],
      height: arrPageSizes[1]
    }).fadeIn();

    $('#VideoBox').css({
      top: arrPageScroll[1] + (arrPageSizes[3] / 10),
      left: arrPageScroll[0] + ((arrPageSizes[0] / 2) - 225)
    }).show();

    $.ajax({
      url: '/index/video/video_' + $(this).attr('id') + '.html?isNaked=1',
      success: function(msg){
        $('#VideoBox').html(msg);
      }
    });
    $(document).bind("click", function(e){
      $('#VideoOverlay').remove();
      $('#VideoBox').remove();
    });
    return false;
  });
  
  $("div#Video img").hover(function() {
    colorimg = $(this).attr("colorimg");
    grayimg = $(this).attr("src");
    $(this).attr("src", colorimg);
    $(this).attr("colorimg", grayimg);
  }, function() {
    colorimg = $(this).attr("src");
    grayimg = $(this).attr("colorimg");
    $(this).attr("src", grayimg);
    $(this).attr("colorimg", colorimg);
  });

  $("div.VideoItem img").hover(function() {
    colorimg = $(this).attr("colorimg");
    grayimg = $(this).attr("src");
    $(this).attr("src", colorimg);
    $(this).attr("colorimg", grayimg);
  }, function() {
    colorimg = $(this).attr("src");
    grayimg = $(this).attr("colorimg");
    $(this).attr("src", grayimg);
    $(this).attr("colorimg", colorimg);
  });
/* //Видеоролики */

/* Меню */
  $('ul.sf-menu').superfish({
    animation	: {opacity:'show'},
    speed		: 'normal',
    autoArrows	: false,
    dropShadows : false
  });
/* //Меню */

  $('#ChooseCitySelect').change(function() {
  	$('#ChooseCity').submit();
  });

/* Страницы персонажей */

  $("#Column3 li a").ajax_tooltip({
    direction: 'right',
    url: 'test.html',
    top_offset: -20,
    left_offset: -290
  });
  
/* Персональный консультант */

  $('#City').change(function() {
  	if (this.value == 2) {
  		$('#CityAddress').removeClass('Hidden');
  	} else {
  		$('#CityAddress').addClass('Hidden');
  	}
  });

  $('#Aims').change(function() {
  	if (this.value) {
  		$('#AimsSum').removeClass('Hidden');
  		if (this.value == 1) $('#AimsSum').html("<option value='0'>--</option><option value='6'>от 1 млн. до 1,5 млн. руб.</option><option value='7'>от 1,5 млн. до 2 млн. руб.</option><option value='10'>от 2 млн. до 2,5 млн. руб.</option><option value='11'>от 2,5 млн. до 3 млн. руб.</option><option value='12'>от 3 млн. до 4 млн. руб.</option><option value='13'>от 4 млн. до 5 млн. руб.</option><option value='14'>от 5 млн. до 6 млн. руб.</option><option value='15'>от 6 млн. до 7 млн. руб.</option><option value='16'>от 7 млн. до 8 млн. руб.</option><option value='17'>от 8 млн. до 9 млн. руб.</option><option value='18'>от 9 млн. до 10 млн. руб.</option>");
  		if (this.value == 2) $('#AimsSum').html("<option value='0'>--</option><option value='8'>от 100 до 200 тыс. руб</option><option value='9'>от 200 до 300 тыс.руб.</option><option value='19'>от 300 до 400 тыс.руб.</option><option value='20'>от 400 до 500 тыс.руб.</option><option value='21'>от 500 до 600 тыс.руб.</option><option value='22'>от 600 до 800 тыс.руб.</option><option value='23'>от 800 до 1 000 млн.</option><option value='24'>от 1 млн. до 1,2 млн.</option><option value='25'>от 1,2 млн. до 1,5 млн.</option><option value='26'>от 1,5 млн. до 2 млн.</option>");
  		if (this.value == 3) $('#AimsSum').html("<option value='0'>--</option><option value='27'>10 тыс. руб. ежемесячно</option><option value='28'>15 тыс. руб. ежемесячно</option><option value='29'>20 тыс. руб. ежемесячно</option><option value='30'>30 тыс. руб. ежемесячно</option><option value='31'>40 тыс. руб. ежемесячно</option><option value='32'>50 тыс. руб. ежемесячно</option><option value='33'>100 тыс. руб. ежемесячно</option>");
  		if (this.value == 4) $('#AimsSum').html("<option value='0'>--</option><option value='34'>10 тыс. руб. ежемесячно</option><option value='35'>15 тыс. руб. ежемесячно</option><option value='36'>20 тыс. руб. ежемесячно</option><option value='37'>25 тыс. руб. ежемесячно</option><option value='38'>30 тыс. руб. ежемесячно</option><option value='39'>40 тыс. руб. ежемесячно</option><option value='40'>50 тыс. руб. ежемесячно</option>");
  		if (this.value == 5) $('#AimsSum').html("<option value='0'>--</option><option value='41'>1 млн. руб.</option><option value='42'>1,5 млн. руб.</option><option value='43'>2 млн. руб.</option><option value='44'>2,5 млн. руб.</option><option value='45'>3 млн. руб.</option><option value='46'>3,5 млн. руб.</option><option value='47'>4 млн. руб.</option><option value='48'>4,5 млн. руб.</option><option value='49'>5 млн. руб.</option><option value='50'>7 млн. руб.</option><option value='51'>10 млн. руб.</option><option value='52'>15 млн. руб.</option>");
  	} else {
  		$('#AimsSum').addClass('Hidden');
  	}

  });

  $("#ConsultantSubmit").click(function(e) {
    $("#Consultant").submit();
  });


});

/* Предзагрузка изображений */
$.preloadImages("/netcat_files/85/63/h_573bcc33f46b47b07ffc617e44ff6bbf","/netcat_files/85/63/h_d3e5e4947f1b09a4a8cf7c825828e831","/netcat_files/85/63/h_b56764a16c19800ddefb170ed93229ff","/netcat_files/85/63/h_57ac268c2edfa2d3c36b61af4c78cd31","/netcat_files/85/63/h_c9752c085ba2401cc9121ff956e547b3","/netcat_files/85/63/h_d7533f956e769326e93691637d6641c4","/netcat_files/85/63/h_55145320ba4cb8d17768714ebf583d41","/netcat_files/85/63/h_82233f277a1c0beb76e1a1de12b3b852","/netcat_files/85/63/h_8eaa3493ea2fbfdc8767f2512f36a569","/netcat_files/85/63/h_597c02dac75bd0679f3c6996f74d4936","/netcat_files/85/63/h_576d0f742befeca8be72c5b006692ab1","/netcat_files/85/63/h_1301a073c3c8cf410b7a24c56022cce3","/netcat_files/85/63/h_b71da97ec6d966d3eb184332ad724547","/netcat_files/85/63/h_3f1b7b28216d9047e1b676b9d229445c","/netcat_files/85/63/h_945b102db616e6b50cb8a97c7ed08025","/netcat_files/85/63/h_31f8c024e8135831284d5066e6cd2bd2","/netcat_files/85/63/h_eaf0a8d09313cc37581975d6ba96eb14","/netcat_files/85/63/h_8006661ae94f748e187749538f20d2c7","/i/finam_color.gif","/i/narodnaya_color.gif","/i/minfin_color.gif","/i/mos_color.gif","/i/naufor_color.gif","/i/asv_color.gif","/i/digitalestate_color.gif");

/* Переменные календаря */

var SUB_FOLDER = '', NETCAT_PATH = '/netcat/';
  
/* //Переменные календаря */