function move_box(an, box) {
	var cleft = -150;
	var ctop = 0;
	var obj = an;
	while (obj.offsetParent) {
		cleft += obj.offsetLeft;
		ctop += obj.offsetTop;
		obj = obj.offsetParent;
	}
	box.style.left = cleft + 'px';
	ctop += an.offsetHeight + 8;
	if (document.body.currentStyle &&
			document.body.currentStyle['marginTop']) {
		ctop += parseInt(
				document.body.currentStyle['marginTop']);
	}
	box.style.top = ctop + 'px';
}
function move_single_box(an, box) {
  var cleft = 50;
  var ctop = 0;
  var obj = an;
  while (obj.offsetParent) {
    cleft += obj.offsetLeft;
    ctop += obj.offsetTop;
    obj = obj.offsetParent;
  }
  box.style.left = cleft + 'px';
  ctop += an.offsetHeight + 8;
  if (document.body.currentStyle &&
    document.body.currentStyle['marginTop']) {
    ctop += parseInt(
      document.body.currentStyle['marginTop']);
  }
  box.style.top = ctop + 'px';
}

var single_boxdiv=null;
var parent_node_grid=$('bids_grid');

function show_hide_single_box(an, width, height, borderStyle) {
	
	var href = an.href;
	
	if (single_boxdiv != null && document.getElementById(href)!=single_boxdiv) {
		parent_node_grid.removeChild(single_boxdiv);
		/*
		if (single_boxdiv.style.display=='none') {
			move_box(an, single_boxdiv);
			single_boxdiv.style.display='block';
		} else
			single_boxdiv.style.display='none';
		document.removeChild(single_boxdiv);*/
		single_boxdiv=null;
	}
	
	single_boxdiv = document.getElementById(href);
	
	if (single_boxdiv != null) {
		if (single_boxdiv.style.display=='none') {
			move_box(an, single_boxdiv);
			single_boxdiv.style.display='block';
		} else
			single_boxdiv.style.display='none';
		return false;
	}
	
	single_boxdiv = document.createElement('div');
	single_boxdiv.setAttribute('id', href);
	single_boxdiv.style.display = 'block';
	single_boxdiv.style.position = 'absolute';
	single_boxdiv.style.width = width + 'px';
	single_boxdiv.style.height = height + 'px';
	single_boxdiv.style.border = borderStyle;
	single_boxdiv.style.backgroundColor = '#fff';
	
	var contents = document.createElement('iframe');
	contents.scrolling = 'auto';
	contents.frameBorder = '0';
	contents.style.width = width + 'px';
	contents.style.height = height + 'px';
	contents.src = href;
	
	single_boxdiv.appendChild(contents);
	parent_node_grid.appendChild(single_boxdiv);
	move_single_box(an, single_boxdiv);
	
	return false;
}

function show_hide_box(an, width, height, borderStyle) {
  var href = an.href;
  var boxdiv = document.getElementById(href);

  if (boxdiv != null) {
    if (boxdiv.style.display=='none') {
      move_box(an, boxdiv);
      boxdiv.style.display='block';
    } else
      boxdiv.style.display='none';
    return false;
  }

  boxdiv = document.createElement('div');
  boxdiv.setAttribute('id', href);
  boxdiv.style.display = 'block';
  boxdiv.style.position = 'absolute';
  boxdiv.style.width = width + 'px';
  boxdiv.style.height = height + 'px';
  boxdiv.style.border = borderStyle;
  boxdiv.style.backgroundColor = '#fff';

  var contents = document.createElement('iframe');
  contents.scrolling = 'no';
  contents.frameBorder = '0';
  contents.style.width = width + 'px';
  contents.style.height = height + 'px';
  contents.src = href;

  boxdiv.appendChild(contents);
  document.body.appendChild(boxdiv);
  move_box(an, boxdiv);

  return false;
}