function offer_list_expand(id) {
    with (document) {
        getElementById('row_' + id + '_1').style.display = 'none';
        getElementById('row_' + id + '_2').style.display = '';
        getElementById('row_' + id + '_3').style.display = '';
    }
    return false;
}

function offer_list_collapse(id) {
    with (document) {
        getElementById('row_' + id + '_1').style.display = '';
        getElementById('row_' + id + '_2').style.display = 'none';
        getElementById('row_' + id + '_3').style.display = 'none';
    }
    return false;
}

function offer_list_over(id) {
    with (document) {
        if (getElementById('row_' + id + '_1').className == 'offer_list_even') {
            getElementById('row_' + id + '_1').className = 'offer_list_even_over';
            getElementById('row_' + id + '_2').className = 'offer_list_expanded_even_over';
            getElementById('row_' + id + '_3').className = 'offer_list_more_even_over';
        } else if (getElementById('row_' + id + '_1').className == 'offer_list_odd') {
            getElementById('row_' + id + '_1').className = 'offer_list_odd_over';
            getElementById('row_' + id + '_2').className = 'offer_list_expanded_odd_over';
            getElementById('row_' + id + '_3').className = 'offer_list_more_odd_over';
        }
    }
    //row_over(id);
}

function offer_list_out(id) {
    with (document) {
        if (getElementById('row_' + id + '_1').className == 'offer_list_even_over') {
            getElementById('row_' + id + '_1').className = 'offer_list_even';
            getElementById('row_' + id + '_2').className = 'offer_list_expanded_even';
            getElementById('row_' + id + '_3').className = 'offer_list_more_even';
        } else if (getElementById('row_' + id + '_1').className == 'offer_list_odd_over') {
            getElementById('row_' + id + '_1').className = 'offer_list_odd';
            getElementById('row_' + id + '_2').className = 'offer_list_expanded_odd';
            getElementById('row_' + id + '_3').className = 'offer_list_more_odd';
        }
    }
    row_out(id);
}

var timer = 0;
var running = false;
var object = 0, object_width = 0, object_height = 0;
var previous = 0;

function row_timer() {
	if (running) {
		timer--;
		if (timer < 1) {
			if (object != 0) {
				window.frames["hint_load"].location.href = "oferta_dymek.php?window=hint&offer=" + object;
			} 
		}
	}
}

setInterval("row_timer()", 700);

function row_over(id, width, height) {
	if (id != previous) {
		document.getElementById("hint_id").style.display = "none";
		timer = 3;
		object = id;
		object_width = width;
		object_height = height;
		running = true;
	}
}

function row_out(id) {
	running = false;
	if (object != 0) {
		previous = object;
	}
	//document.getElementById("hint_id").style.display = "none";
	object = 0;
}

function row_hide()
{
	document.getElementById("hint_id").style.display = "none";
	running = false;
	object = 0;
	previous = 0;
}

function row_hint_loaded() {
	if (running) {
		document.getElementById("hint_id").innerHTML = window.frames["hint_load"].document.body.innerHTML;
		document.getElementById("hint_id").style.display = "";
		x = obj_x(document.getElementById("row_" + object + "_1"));
		y = obj_y(document.getElementById("row_" + object + "_1"));
		document.getElementById("hint_id").style.left = x - 100;
		document.getElementById("hint_id").style.top = y + 20;
		document.getElementById("hint_id").style.width = object_width;
		document.getElementById("hint_id").style.height = object_height;
		running = false;
	}
}

function obj_x(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 obj_y(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;
}

function obj_width(obj) {
	return obj.offsetWidth; 
}

function obj_height(obj) {
	return obj.offsetHeight; 
}

function offer_list_compare(category) {
    document['category_' + category].submit();
    return false;
}

function note_add(offer) {
	window.open("dodaj_do_notesu_chmurka.php?window=hint&notepad=add&offer=" + offer,
                "_blank", "width=300,height=200,menubar=no,toolbar=no,location=no,scrollbars=none,resizable=no,status=no");
                
	return false;
}

function watch_add(offer) {
	window.open("dodaj_do_obserwowanych_chmurka.php?window=hint&offer=" + offer,
                "_blank", "width=300,height=200,menubar=no,toolbar=no,location=no,scrollbars=none,resizable=no,status=no");
                
	return false;
}
