﻿  /*
  	$(function() {
		var offset = $("#fixed").offset();
		var topPadding = 15;
		$(window).scroll(function() {
			if ($(window).scrollTop() > offset.top) {
				$("#fixed").stop().animate({marginTop: $(window).scrollTop() - offset.top + topPadding});
			}
			else {$("#fixed").stop().animate({marginTop: 0});};});
	});
  */  
// использование Math.round() даст неравномерное распределение!
function rand(min, max)
{
  return Math.floor(Math.random() * (max - min + 1)) + min;
}

function facechange (objName) {
  if ( $(objName).css('display') == 'none' ) {
    $(objName).animate({height: 'show'}, 400);
  } else {
    $(objName).animate({height: 'hide'}, 200);
  }
}

  var ss =[1, 2];
  var metro = new Array('Китай-город' );//, 'Таганская', 'Парк культуры', 'Чистые пруды'

  var phones = ["(495)989-1854"];//"(495)989-1854", "(495)797-3487", "(495)363-1557", "(495)775-7016"

var length = phones.length;

$(document).ready(
  function()
  {
	for (a = 0, i = rand(0, length-1) ; a < phones.length; a++)
  {
    // alert(i);
	 $("#phones"+a).html(phones[i]);
	 $("#metro"+a).html(metro[i]);
     if (i == (phones.length-1)) {i = 0;} else {i++;}
  }
  if($("#phones4"))
  	for (a = length, i = rand(0,length-1) ; a < phones.length+length; a++)
  {
    // alert(i);
	 $("#phones"+a).html(phones[i]);
	 $("#metro"+a).html(metro[i]);
     if (i == (phones.length-1)) {i = 0;} else {i++;}
  }
  }

);
  




