function getBounds(element) {
  var left = element.offsetLeft;
  var top = element.offsetTop;
  for (var parent = element.offsetParent; parent; parent = parent.offsetParent) {
    left += parent.offsetLeft;
    top += parent.offsetTop;
  }
  return {left: left, top: top, width: element.offsetWidth, height: element.offsetHeight};
}
array_Obj=[];
function fly (obj) {
  with (this) {
    center_target_left = center_target_top = 0;
    finish_fly = null;

    fly_div = document.getElementById('flyDiv');
    fly_div.style.visibility = "hidden";
    fly_div.innerHTML = obj.innerHTML;
    bounds_FLY = getBounds(obj);
    fly_div.style.width = bounds_FLY.width + 'px';
    fly_div.style.height = bounds_FLY.height + 'px';
  }
}
fly.prototype.target = function (obj_targ) { 
  var bounds_target = getBounds(obj_targ);
  this.center_target_left = bounds_target.left + bounds_target.width/2;
  this.center_target_top  = bounds_target.top + bounds_target.height/2;
}
fly.prototype.calc_way = function ( num_step, time_fly ) {  
  this.num_step = num_step;
  this.period = Math.ceil( time_fly / num_step );
}
fly.prototype.fly_now = function () {
  if (!this.step) {
    this.step = 1;
    this.id = array_Obj.length;
    array_Obj[this.id]=this;
  }

  with (this) {
    if ( step > num_step ) {
      with (fly_div.style) {
        visibility = "hidden";
        top = left = 0;
      }
      if (finish_fly) finish_fly();
      step = 0;
      delete array_Obj[id];
      return;
    }
    fly_div.style.top = bounds_FLY.top - Math.ceil ( ( bounds_FLY.top - (center_target_top - bounds_FLY.height/2))/num_step * step ) + 'px';
    fly_div.style.left = bounds_FLY.left + Math.ceil ( ((center_target_left - bounds_FLY.width/2) - bounds_FLY.left)/num_step * step ) + 'px';

    if( step == 1 ) {
      fly_div.style.visibility = "visible";
    }
    step++;
  }
  timerID = setTimeout( "array_Obj[" + this.id + "].fly_now()", this.period);
}



var dragDropObj = new DHTMLgoodies_dragDrop();




function setUpDropItems()
{
       var quickImgs = document.getElementsByClassName( 'quickView' );
       var totaldragdivs = quickImgs.length;

       if( totaldragdivs )
       {
         	for( i=0; i<=totaldragdivs; i++ )
	        {	var divid = 'box'+i;
		        if( $(divid) )
		        dragDropObj.addSource(divid,true,true,true,false,'onDragFunction');			  
	        }
		
		dragDropObj.addTarget('dropBox','dropItems');   // Set <div id="dropBox"> as a drop target. Call function dropItems  on drop
                dragDropObj.init();
       }
       

		  
}