
function completeDocument(lang) {
  // prepare animation
  $('body').append('<div id="cache"></div><div id="flash"></div>');
  commonComplete(lang);
  $('#header h2, #header p, #header #lang, #footer h3, #footer h2, #footer p, #music, #basketheader').css('display', 'none');
  $('#header, #footer').css({left: '50%', width: '0%'});
}

function resizeDocument(h) {
  if (h - 88 - 86 < 1030)
    $('#cbg, #cache').height(h - 88 - 86);
  else
    $('#cbg, #cache').height(1030);
  $('#cbg img').height($('#cbg').height());

  var w = $(window).width();
  if ($.browser.safari && (w < $(document).width()))
    w = $(document).width();
  if ($('#cbg img').width() > w) {
    $('#cbg img').css('marginLeft', '-'+Math.ceil(($('#cbg img').width() - w) / 2)+'px');
  }

  if ($('#cbg img').height() > 0) {
    $('#cache').remove();
  }
  else
    $('#cbg img').load(function(){
      $('#cache').remove();
    });

  return false;
}

function animate() {
  if (navigator.appVersion.match("MSIE")) {
    arVersion = navigator.appVersion.split("MSIE");
    if (parseFloat(arVersion[1]) < 6) {
      window.location.href = 'http://www.rendez-vous.ru/upgrade.html';
      return false;
    }
  }
  else if (navigator.appVersion.match("Firefox")) {
    arVersion = navigator.appVersion.split("Firefox");
    if (parseFloat(arVersion[1]) < 2) {
      window.location.href = 'http://www.rendez-vous.ru/upgrade.html';
      return false;
    }
  }
  else if (navigator.appVersion.match("Safari")) {
    arVersion = navigator.appVersion.split("Safari");
    arVersion[1] = arVersion[1].replace(/[^0-9\.]+/, '');
    if (parseFloat(arVersion[1]) < 500) {
      window.location.href = 'http://www.rendez-vous.ru/upgrade.html';
      return false;
    }
  }
  else if (navigator.appVersion.match("Opera")) {
    arVersion = navigator.appVersion.split("Opera");
    if (parseFloat(arVersion[1]) < 9) {
      window.location.href = 'http://www.rendez-vous.ru/upgrade.html';
      return false;
    }
  }
  else if (navigator.appVersion.match("Chrome")) {
    arVersion = navigator.appVersion.split("Chrome");
    if (parseFloat(arVersion[1]) < 1) {
      window.location.href = 'http://www.rendez-vous.ru/upgrade.html';
      return false;
    }
  }
  commonResize();
  $('#header').animate({left: '0%', width: '100%'}, 2000, 'easeOutQuint');
  $('#footer').animate({left: '0%', width: '100%'}, 2000, 'easeOutQuint', function(){
    $('#header h2, #header p, #header #lang, #footer h3, #footer h2, #footer p, #music, #basketheader').css('display', 'block');
    menusClean(); footerClean();
    startFlash();
  });
  // preload
  preloadImages('/images/play-sel.png', '/images/pause-sel.png');
}

function startFlash() {
  // flash animations
  var params2 = {
	quality: "hight",
	bgcolor: "#000000"
  };
  if ($('#music').length)
    swfobject.embedSWF("/swf/sound_on_off.swf", "music", "30", "13", "9.0.0","", false, params2, false);

return false;

  var h = $(window).height();
  if ($.browser.safari)
    h = $(document).height();

  var fh = 516;
  if (h - 88 - 86 < 1030) {
    fh = 516 * (h - 88 - 86) / 1030;
    $('#flash').height(fh);
    var mt = 602 * (h - 88 - 86) / 1030;
    $('#flash').css('top', Math.floor(mt)+'px');
  }
  else {
    $('#flash').height(516);
    $('#flash').css('top', '602px');
  }

  var fw = Math.ceil(fh * 3.337209302);
  $('#flash').html('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#3,0,0,0" width="'+fw+'" height="'+fh+'"><param name="src" value="/swf/soldes.swf" /><param name="quality" value="hight" /><param name="wmode" value="transparent" /><embed src="/swf/soldes.swf" pluginspage="http://www.macromedia.com/shockwave/download/" type="application/x-shockwave-flash" quality="hight" wmode="transparent" width="'+fw+'" height="'+fh+'"></embed></object>');

}

