// ------- mishka API ver 2.0 --------

//get object by id
function obj(id) {
  return document.getElementById(id);
}

//returns event handler
function evt(e) {
  if(e) return e;
  else return event;
}

function eventSX(e) {
	return evt(e).screenX;
}

function eventSY(e) {
	return evt(e).screenY;
}

//returns event object
function oEvent(e) {
  if(e) return e.target;
  else return event.srcElement;
}

function sCtrl(e) {
  return evt(e).ctrlKey;
}

function sShift(e) {
  return evt(e).shiftKey;
}

function blr() {
  if(this.blur) this.blur();
}

function show(o) {
  o.style.visibility = 'visible';
}

function hide(o) {
  o.style.visibility = 'hidden';
}

function oParent(o, n) {
  if(o.parentNode.tagName == n) return o.parentNode;
  else return oParent(o.parentNode, n);
}

function oResize(o, oW, oH) {
  setWidth(o, oW);
  setHeight(o, oH);
}

function setWidth(o, oW) {
  o.style.width = oW+"px";
}

function setHeight(o, oH) {
  o.style.height = oH+"px";
}

function getWidth(o) {
  if(typeof(o.offsetWidth) != "undefined") return o.offsetWidth;
  else if(typeof(o.style.pixelWidth) != "undefined") return o.style.pixelWidth;
  else return -1;
}

function getHeight(o) {
  if(typeof(o.offsetHeight) != "undefined") return o.offsetHeight;
  else if(typeof(o.style.pixelHeight) != "undefined") return o.style.pixelHeight;
  else return -1;
}

function oMove(o, oX, oY) {
  setX(o, oX);
  setY(o, oY);
}

function setX(o, oX) {
  o.style.left = oX+"px";
}

function setY(o, oY) {
	o.style.top = oY+"px";
}

function getX(o) {
  var x = 0;
  while(o) {
    if(o.offsetLeft) x += o.offsetLeft;
    o = o.offsetParent ? o.offsetParent : null;
  }
  return x;
}

function getY(o) {
  var y = 0;
  while(o) {
    if(o.offsetTop) y += o.offsetTop;
    o = o.offsetParent ? o.offsetParent : null;
  }
  return y;
}

function clientWidth() {
  if(window.innerWidth) return window.innerWidth;
  else return document.documentElement.clientWidth;
}

function clientHeight() {
  if(window.innerHeight) return window.innerHeight;
  else return document.documentElement.clientHeight;
}

function preloadImg() { 
	var imgs = new Array();
	var a = preloadImg.arguments;
	for(i=0; i<a.length; i++) {
		imgs[i]=new Image();
		imgs[i].src=a[i];
	}
}

function swapImg(img, iurl) {
	img.src = iurl;
}

function rf() {
	return false;
}

//-------------------------------------------------------
