var mouseX, mouseY; 
var objX, objY; 
var Obj;
var tuID;
var isDowm = false; //是否按下鼠标 
function mouseDown(obj, e,id) { 
obj.style.cursor = "move"; 
objX = obj.style.left; 
objY = obj.style.top; 
mouseX = e.clientX; 
mouseY = e.clientY; 
isDowm = true; 
Obj=obj;
tuID=id;
} 
function mouseMove(obj, e) { 
var div = obj; 
var x = e.clientX; 
var y = e.clientY; 
if (isDowm) { 
div.style.left = parseInt(objX) + parseInt(x) - parseInt(mouseX) + "px"; 
div.style.top = parseInt(objY) + parseInt(y) - parseInt(mouseY) + "px"; 
 OBJ=obj;
} 
} 
function mouseUp(obj, e,id) { 
if (isDowm) { 
var x = e.clientX; 
var y = e.clientY; 
var div = obj; 
div.style.left = (parseInt(x) - parseInt(mouseX) + parseInt(objX)) + "px"; 
div.style.top = (parseInt(y) - parseInt(mouseY) + parseInt(objY)) + "px"; 
var num_x= (parseInt(x) - parseInt(mouseX) + parseInt(objX));
var num_y=(parseInt(y) - parseInt(mouseY) + parseInt(objY));
mouseX = x; 
mouseY = y; 
obj.style.cursor = "default"; 
isDowm = false; 

var m="float_des"+id;
var b="box_float"+id;
 
 //计算红包是否放到了正确的位置Calc.num.value
 var istrue;
  for (var i=1;i<=8;i++){
  var box_p="box_place"+i;
   if(Math.abs(num_x) >=35 && Math.abs(num_y) >=26 && ((Math.abs(num_x) - 35) <=20) && ((Math.abs(num_y) - 26) <=20))
     {
	 	document.getElementById("box_place1").innerHTML=obj.innerText;
	    document.getElementById(m).style.display="none";
		document.getElementById(b).style.display="none";
		
		obj.style.display="none";
	  	istrue=1;
		break;
		}
	if(Math.abs(num_x) >= 70 && Math.abs(num_y) >= 15 && ((Math.abs(num_x) - 70) <=20) && ((Math.abs(num_y) - 15) <=20))
		  { document.getElementById("box_place2").innerHTML=obj.innerText;
	     document.getElementById(m).style.display="none";
		 document.getElementById(b).style.display="none";
	  	 istrue=1;
		 break;}
	if (Math.abs(num_x) >= 30 && Math.abs(num_y) >= 55 && ((Math.abs(num_x) - 30) <=20) && ((Math.abs(num_y) - 55) <=20))
		{document.getElementById("box_place3").innerHTML=obj.innerText;
	  	document.getElementById(m).style.display="none";
			document.getElementById(b).style.display="none";
	  	istrue=1;
	  break;}
	if(Math.abs(num_x) >= 290 && Math.abs(num_y) >= 100 && ((Math.abs(num_x) - 290) <=20) && ((Math.abs(num_y) - 100) <=20))
		{
		document.getElementById("box_place4").innerHTML=obj.innerText;
	  	document.getElementById(m).style.display="none";
		document.getElementById(b).style.display="none";
	  	istrue=1;
		break; }	
	if (Math.abs(num_x) >= 270 && Math.abs(num_y) >= 130 && ((Math.abs(num_x) - 270) <=20) && ((Math.abs(num_y) - 130) <=20))
		{document.getElementById("box_place5").innerHTML=obj.innerText;
			document.getElementById(b).style.display="none";
	  	    document.getElementById(m).style.display="none";
	  	istrue=1;
		 break;
			}
	if (Math.abs(num_x) >= 255 && Math.abs(num_y) >= 185 && ((Math.abs(num_x) - 255) <=20) && ((Math.abs(num_y) - 185) <=20))
			{
		 	document.getElementById("box_place6").innerHTML=obj.innerText;
	  		document.getElementById(m).style.display="none";
			document.getElementById(b).style.display="none";
	  		istrue=1;
			break; 
			 }
	if (Math.abs(num_x) >= 135 && Math.abs(num_y) >= 215 && ((Math.abs(num_x) - 135) <=20) && ((Math.abs(num_y) - 210) <=20))
			{
		 	document.getElementById("box_place7").innerHTML=obj.innerText;
	  		document.getElementById(m).style.display="none";
			document.getElementById(b).style.display="none";
	  		istrue=1;
		 break;
			 }
	if (Math.abs(num_x) >= 225 && Math.abs(num_y) >= 260 && ((Math.abs(num_x) - 225) <=20) && ((Math.abs(num_y) - 260) <=20))
			{
		 	document.getElementById("box_place8").innerHTML=obj.innerText;
	  		document.getElementById(b).style.display="none";
			document.getElementById(m).style.display="none";
	  		istrue=1;
			 break;
			 }
			
			 
  }
  if(istrue==1)
{ obj.style.display="none";
if (tuID<=7){
var num=tuID+1;
addmove(num);
}
}
 else{
alert("放的位置不正确，请拖入到提示框内!");
}
  
  } 
				

    
}



function x_tuo_text(id)
 {    var div_tuo=id;
 	  var des1="float_des"+id;
      var img1="float_img"+id;
	  var box1="box_float"+id;
 	  document.getElementById(des1).style.top=document.getElementById(img1).offsetTop;
	  document.getElementById(des1).style.left=document.getElementById(img1).offsetLeft;
 	  document.getElementById(des1).style.display="block";
	  document.getElementById(img1).style.display="none";
	  
	 }
 