function click(aid){
  var imgel = new Image();
  imgel.src = "/_click.php?id=" + aid + "&tm=" + new Date().getTime();
  if (typeof(_uacct)!='undefined') {
    var elid = 'a'+aid;
    var eli = document.getElementById(elid);
    if  (eli) {
      var elia = eli.getElementsByTagName("H3")[0].getElementsByTagName("A")[0];
      var title = encodeURIComponent(elia.innerHTML);
      var track = '/clanek/' + aid + '-' + title;
      urchinTracker(track);
    }
  }
}

function columnize() {
  $('.anote').each(function(index) {
    columnize_auto($(this).attr('id'));
    if (index==2) columnize_column('reklama','2');
  });
  $('#anotes3').hide();
}
  

function columnize_auto(id) {
	var element = $('#'+id).detach();
  var col1 = $('#column1');
  var col2 = $('#column2');
  var col3 = $('#column3');
  var height1 = col1.height();
  var height2 = col2.height();
  var height3 = col3.height();
  if (height3>90) height3 = height3+90;
	column = 1;
	if (height2<height1) {
		column = 2;
		if (height3<height2) column = 3;
	}
	else if (height3<height1) column = 3;
	element.appendTo('#column'+column);
}

function columnize_column(id,column) {
	var element = $('#'+id).detach();
	element.appendTo('#column'+column);
}


function calibrate(id1,id2,id3) {
	calibrate_height($('#a'+id1+' h3'), $('#a'+id2+' h3'), $('#a'+id3+' h3'));
	calibrate_valign($('#a'+id1+' h3 a'), $('#a'+id2+' h3 a'), $('#a'+id3+' h3 a'));
	// calibrate_height($('#a'+id1+' p.perex'), $('#a'+id2+' p.perex'), $('#a'+id3+' p.perex'));
}

function calibrate_height(el1,el2,el3) {
	var size = el1.height();
	var size2 = el2.height();
	var size3 = el3.height();
	if (size2>size) size = size2;
	if (size3>size) size = size3;
	el1.css('min-height',size+'px');
	el2.css('min-height',size+'px');
	el3.css('min-height',size+'px');
	el1.css('_height',size+'px');
	el2.css('_height',size+'px');
	el3.css('_height',size+'px');

}

function calibrate_valign(el1,el2,el3) {
	var size1 = el1.height();
	var size2 = el2.height();
	var size3 = el3.height();
	size = size1;
	if (size2>size) size = size2;
	if (size3>size) size = size3;
	el1.css('padding-top',(size-size1)+'px');
	el2.css('padding-top',(size-size2)+'px');
	el3.css('padding-top',(size-size3)+'px');
}



