
var offsetfrommouse=[15,25]; //image x,y offsets from cursor position in pixels. Enter 0,0 for no offset

function get_trail() {
	return $('preview_div');
}

var IE = document.all;

var mousex = 0;
var mousey = 0;

function getMouseXY(e) {
  if (IE) { // grab the x-y pos.s if browser is IE
    tempX = event.clientX + document.body.scrollLeft
    tempY = event.clientY + document.body.scrollTop
  } else {  // grab the x-y pos.s if browser is NS
    tempX = e.pageX
    tempY = e.pageY
  }
  // catch possible negative values in NS4
  if (tempX < 0){tempX = 0}
  if (tempY < 0){tempY = 0}
  // show the position values in the form named Show
  // in the text fields named MouseX and MouseY
  mousex = tempX
  mousey = tempY
  return true
}

if (!IE) document.captureEvents(Event.MOUSEMOVE)

document.onmousemove = getMouseXY;


function truebody(){
return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function pause(millisecondi)
{
    var now = new Date();
    var exitTime = now.getTime() + millisecondi;

    while(true)
    {
        now = new Date();
        if(now.getTime() > exitTime) return;
    }
}


function show_preview(imagename,width,height,number_id) {

var docwidth =mousex;
var docheight=mousey;

//$("prev_" + number_id).style.visibility = 'hidden';

newHTML = '<div class="border_preview" style="width: ' + width + 'px;height: ' + height + 'px;background-color:#597F94;border:black 2px solid;padding:10px;">';
newHTML = newHTML + '<div id="my_img"><img src="' + imagename+ '" /></div></div>';


var l = docwidth - width - 50;

l = l.toString();

var t = docheight - (height + 55);

t  = t.toString();

$("prev_" + number_id).style.left = l + 'px';
$("prev_" + number_id).style.top  = t + 'px';

//$("prev_" + number_id).style.display = 'block';

$("prev_" + number_id).innerHTML = newHTML;

var e = new Effect.Grow("prev_" + number_id);
/*
e.startOn = function() {
$("prev_" + number_id).style.visibility = 'hidden';
}*/

//$("prev_" + number_id).style.visibility = 'visible';



}

function hide_preview(number_id) {

$("prev_" + number_id).innerHTML = '&nbsp;';
$("prev_" + number_id).style.display = 'none';
}
