/*

This code is from isohunt.com. Thanks Gary :)

Venkman: Added Ajax stuff.

*/

var smooth_timer;

function smoothHeight(id, curH, targetH, stepH, mode) {
  diff = targetH - curH;
  if (diff != 0) {
    newH = (diff > 0) ? curH + stepH : curH - stepH;
    ((document.getElementById) ? document.getElementById(id) : eval("document.all['" + id + "']")).style.height = newH + "px";
    if (smooth_timer) window.clearTimeout(smooth_timer);
    smooth_timer = window.setTimeout( "smoothHeight('" + id + "'," + newH + "," + targetH + "," + stepH + ",'" + mode + "')", 16 );
  }
  else if (mode != "o") ((document.getElementById) ? document.getElementById(mode) : eval("document.all['" + mode + "']")).style.display="none";
}

function servOC(i) {
	var trObj = (document.getElementById) ? document.getElementById('qr-' + i) : eval("document.all['qr-" + i + "']");
	var ifObj = (document.getElementById) ? document.getElementById('qd-' + i) : eval("document.all['qd-" + i + "']");
	if (trObj != null) {
		if (trObj.style.display=="none")
		{
			ifObj.style.height = "0px";
			trObj.style.display="";

			Element.update('h-' + i, '<img src="/www/images/db/minus.gif" width="9" height="9" border="0" alt="Contract">');
			new Ajax.Updater('qd-' + i, 'getQuestDetails.php', {method: 'get', parameters: 'id=' + i});
			smoothHeight('qd-' + i, 0, 210, 42, 'o');
		}
		else
		{
			Element.update('h-' + i, '<img src="/images/db/plus.gif" width="9" height="9" border="0" alt="Expand">');
			smoothHeight('qd-' + i, 210, 0, 42, 'qr-' + i);

		}
	}
}
