// JavaScript Document
var selected_id = 0, start_timer = 3, hint = false, loading = false;
var timer = start_timer;
function row_click(object) {
	//if (document.getElementById('new_window').checked)
	//	window.open('okienko_oferta.php?offer_id=' + object.id + '&cat_id=1&params=cat_id%3D1', '_blank');
		//, 'width=700,height=500,menubar=no,toolbar=no,location=no,scrollbars=auto,resizable=auto,status=no');
	//else
		window.open('oferta.php?numer=' + object.id, '_blank'); //,'width=825,height=600,menubar=no,toolbar=no,location=no,scrollbars=yes,resizable=yes,status=no');
}
function row_over(object) {
	timer = start_timer;
	object.style.backgroundColor = '#ffffff';
	selected_id = object.id;
}
function row_out(object) {
	row_hint(false);
	object.style.backgroundColor = object.className == 'row_even' ? '#C3C2C2' : '#C3C2C2';
	selected_id = 0;
}
function row_timer() {
	if (selected_id != 0) {
		timer--;
		if (timer <= 0)
			row_hint(true);
	}
	setTimeout('row_timer()', 500);
}
setTimeout('row_timer()', 500);
function row_hint(show) {
	if (!loading) {
		object = document.getElementById('hint_id');
		if (object) {
			if (show) {
				if (!hint) {
					hint = true;
					object.innerHTML = '<img src="../images/logo_anim.gif" width="16" height="16" alt="" hspace="4" />';
					loading = true;
					window.frames["hint_load"].location.href = 'oferta_dymek.php?cat_id=1&offer_id=' + selected_id;
				}
			} else {
				object.style.visibility = 'hidden';
				hint = false;
			}
		}
	}
}
function row_hint_loaded() {
	object = document.getElementById('hint_id');
	if (object)
			if (hint) {
				object.innerHTML = window.frames["hint_load"].document.body.innerHTML;
				row = document.getElementById(selected_id);
				if (row) {
					object.style.top = getPosY(row) + 4;
					object.style.left = getPosX(row) - 196;
					object.style.width = 200;
					object.style.visibility = 'visible';
				}
			}
	loading = false;
}

function getPosX( obj ) {
  var curleft = 0;
  if( obj ) {
    if( document.getElementById || document.all ) {
      while( obj.offsetParent ) {
        curleft += obj.offsetLeft;
        obj = obj.offsetParent;
      }
    } else
      if( document.layers )
        curleft += obj.x;
  }
  return curleft;
}

function getPosY( obj ) {
  var curtop = 0;
  if( obj ) {
    if( document.getElementById || document.all ) {
      while( obj.offsetParent ) {
        curtop += obj.offsetTop;
        obj = obj.offsetParent;
      }
    } else
      if( document.layers )
        curtop += obj.y;
  }
  return curtop;
}


