/*
The following two functions (slowMove & displayInfo) have been adapted from
http://isohunt.com Interface Javascript
by Gary Fung - email: gary{REPLACE_WITH_THE_AT_SIGN}isohunt.com

Feel free to use / mod this to your heart's content,
but you must keep these lines to acknowledge where this code originated.
Comments, mods or additions you'd like add to this script? Post it here:
http://isohunt.com/forum/viewforum.php?f=1

Tip popup functions adapted from AWStats: http://awstats.sourceforge.net/
*/
var delay;
// Delays the display of the iframe showing the kudoz sub page and the ProZ.com message
function slowMoveH(id, curH, targetH, stepH, mode) {
  diff = targetH - curH;
  if (diff != 0) {
    newH = (diff > 0) ? curH + stepH : curH - stepH;
    document.getElementById(id).style.width = newH + "px";
    if (delay) window.clearTimeout(delay);
    delay = window.setTimeout( "slowMoveH('" + id + "'," + newH + "," + targetH + "," + stepH + ",'" + mode + "')", 20 );
  }
  else if (mode != "o") document.getElementById(mode).style.display="none";
}
function slowMoveV(id, curH, targetH, stepH, mode) {
  diff = targetH - curH;
  if (diff != 0) {
    newH = (diff > 0) ? curH + stepH : curH - stepH;
    document.getElementById(id).style.height = newH + "px";
    if (delay) window.clearTimeout(delay);
    delay = window.setTimeout( "slowMoveV('" + id + "'," + newH + "," + targetH + "," + stepH + ",'" + mode + "')", 20 );
  }
  else if (mode != "o") document.getElementById(mode).style.display="none";
}
function displayInfo(element, url, bg_color, psize, pdir) {
  var steps = 10;
  var row_to_show = (document.getElementById) ? document.getElementById('row_' + element) : eval("document.all['row_" + element + "']");
  var frame_to_show = (document.getElementById) ? document.getElementById('frame_' + element) : eval("document.all['frame_" + element + "']");
//  var div_to_show = (document.getElementById) ? document.getElementById('div' + element) : eval("document.all['div" + element + "']");
  if (row_to_show != null) {
    if (row_to_show.style.display=="none") {
      if (!frame_to_show.src || frame_to_show.src != 'http://'+document.domain+url || frame_to_show.src != '') {
        row_to_show.style.display="";
        frame_src = 'http://'+document.domain+url
        if(frame_to_show.src != frame_src) {
          frame_to_show.src = frame_src;
        }
        if (pdir == "v") {
          slowMoveV('frame_' + element, 0, psize, psize / steps , 'o');
        } else {
          slowMoveH('frame_' + element, 0, psize, psize / steps , 'o');
        }
      }
    } else {
      // Close the iframe
      if (pdir == "v") {
        slowMoveV('frame_' + element, psize, 0, psize / steps, 'row_' + element);
      } else {
        slowMoveH('frame_' + element, psize, 0, psize / steps, 'row_' + element);
      }
    }
  }
}

