// Получение свойства css
function getElementComputedStyle(elem, prop)
{
  if (typeof elem!="object") elem = document.getElementById(elem);
  
  // external stylesheet for Mozilla, Opera 7+ and Safari 1.3+
  if (document.defaultView && document.defaultView.getComputedStyle)
  {
    if (prop.match(/[A-Z]/)) prop = prop.replace(/([A-Z])/g, "-$1").toLowerCase();
    return document.defaultView.getComputedStyle(elem, "").getPropertyValue(prop);
  }
  
  // external stylesheet for Explorer and Opera 9
  if (elem.currentStyle)
  {
    var i;
    while ((i=prop.indexOf("-"))!=-1) prop = prop.substr(0, i) + prop.substr(i+1,1).toUpperCase() + prop.substr(i+2);
    return elem.currentStyle[prop];
  }
  
  return "";
}

//Подгрузка изображений, находящихся в директории
//названия - 1.jpg, 2.jpg и т.д.
//imgDir - строка
//imgExt - расширение файла (jpg, gif, png, ...)
//imgCount - количество
function loadImage (imgDir, imgExt, imgCount)
{
  ImgAr = new Array();
  for (i = 0; i < imgCount; i++)
  {
    ImgAr[i] = new Image ();
	ImgAr[i].src = imgDir + i + '.' + imgExt;
  }
}



//отключаем все div внутри контейнерского element
function DivNoDisplay (element)
{
  for (var i = 0; i < element.childNodes.length; i++) {
    if (element.childNodes[i].nodeType == 1) {	
	  if (getElementComputedStyle(element.childNodes[i], "display") == 'block')
	  {	    
	    element.childNodes[i].style.display = 'none';	  }
	}
  }
}

//Определение координат мыши относительно документа
//e - вставляем event в документе
//возвращает объект.x и объект.y - координаты
function mouseC(e) {
	var posx = 0;
	var posy = 0;
	if (!e) var e = window.event;
	if (e.pageX || e.pageY) 	{
		posx = e.pageX;
		posy = e.pageY;
	}
	else if (e.clientX || e.clientY) 	{
		posx = e.clientX + document.body.scrollLeft
			+ document.documentElement.scrollLeft;
		posy = e.clientY + document.body.scrollTop
			+ document.documentElement.scrollTop;
	}
	return {"x":posx, "y":posy};
}



//======================================================
//                 Для велосипедов
//======================================================
