function getElementsByClassName(classname, node) {
  if(!node) node = document.getElementsByTagName("body")[0];
    var a = [];
    var re = new RegExp('\\b' + classname + '\\b');
    var els = node.getElementsByTagName("*");
    for(var i=0,j=els.length; i<j; i++)
      if(re.test(els[i].className))a.push(els[i]);
    return a;
}

function changePosition() {
  var body = document.getElementsByTagName('body');
  var re1 = new RegExp('\\bprvniclanek\\b');
  var re2 = new RegExp('\\bhome\\b');
  change = re1.test(body[0].className);
  change2 = re2.test(body[0].className);
  if (change || change2) {
    var a = getElementsByClassName('article pos1');								// gets div
    var b = a[0].getElementsByTagName('p')[0];									// gets text paragraph
    a[0].childNodes[1].childNodes[1].style.bottom = b.clientHeight + "px";		// sets article title position to the bottom of div
    a[0].childNodes[0].style.bottom = b.clientHeight + 5 + "px";					// sets date position to the bottom of div + offset
  }
}
