
// Drag n Drop - are we over the trash image?
DDObj.prototype.overTrash = function(d_ret, d_x, d_y)
{
	// Check to make sure we dont try and delete the name/number images
        if((this.name.substr(0,3) != "sav")) {
         	return false;
        }
        // Get trash bin centre
        var tbc_x = dd.elements['trash_bin'].x+(dd.elements['trash_bin'].w/2);
        var tbc_y = dd.elements['trash_bin'].y+(dd.elements['trash_bin'].h/2);

        if(dd.elements['trash_bin'].z < this.z && this.x < tbc_x && (this.x+this.w) > tbc_x && this.y < tbc_y && (this.y+this.h) > tbc_y)
        {
                return true;
        }
        return false;
};

function my_DropFunc()
{
	hideGrips();
	// document.getElementById('debug1').innerHTML = "catch drop";
	// Check to see if the image has been dropped on the trash image
	if(dd.obj != null) { // Dont check if we're called on init / on form submit
	 	if(dd.obj.overTrash()) {
			dd.obj.swapImage( dd.obj.defsrc );
			dd.obj.moveTo( dd.obj.defx, dd.obj.defy );
			dd.obj.resizeTo( dd.obj.defw, dd.obj.defh );
			if( dd.obj.name.substr(0,3) == 'sav' ){
				i = dd.obj.name.substr(3,2);
				vieNN[i] = 0;
				//alert( i );
			}
	  	}
	}
	zsave_catNN();
}
