/*
$Id: icons_box.js,v 1.9 2008/12/04 11:06:34 max Exp $
vim: set ts=2 sw=2 sts=2 et:
*/

var saved_image = false;
var outImgTO = false;
var outThumbTO = false;
var dpiconMSIE6Fixed = false;
var _url1;
var _id;

function dicon_over(url, w, h, isPng, id, url1) {

	var img = document.getElementById(id);
  if (!img)
    return false;

  if (outImgTO) {
    clearTimeout(outImgTO);
    outImgTO = false;
  }

	if (id == 'welcome_img' && !saved_image) {
    saved_image = new Image();
	saved_image.src = getImgSrc(img);
    saved_image.width = img.width;
    saved_image.height = img.height;
    saved_image.isPng = isPngFix(img);
  }
  if (id != 'welcome_img') {
  	_url1 = url1;
	_id = id;
  }

  if (!this.onmouseout) {
    this.onmouseout = func_out;
  }	

  return dicon_set_image(url, w, h, isPng, id);
}

function func_out() {
  dicon_out();
  thumb_out(_url1, _id);
}

/* Icon onmouseout handler */
function dicon_out() {
  outImgTO = setTimeout(
    function() {
	    dicon_set_image(saved_image.src, saved_image.width, saved_image.height, saved_image.isPng, 'welcome_img');
    },
    10
  );
  return true;
}
function thumb_out(url1, id) {
  outThumbTO = setTimeout(
    function() {
	    dicon_set_image(url1, thumb_width, thumb_height, 0, id);
    },
    10
  );
  return true;
}

/* Change product thumbnail (temporary) */
function dicon_set_image(src, w, h, isPNG, id) {
  var img = document.getElementById(id);
  if (!img)
    return false;

//  img.style.display = 'none';
  var img = document.getElementById(id);
  if (img)
    img.style.display = '';
  img.width = w;
  img.height = h;

  setTimeout(
    function() {
      img.src = src;
      if (isPNG)
        pngFix(img);
    },
    10
  );

  return true;
}

