//Generic Drag Script- da - Dynamic Drive (www.dynamicdrive.com)

//For full source code and terms of usage,

//visit http://www.dynamicdrive.com



/*modificato per farlo funzionare anche con mozilla in doctype strict ed evitare segnalazione errore sullo stesso browser - jerry masslo di mondoquarto.org
*/



/*rimodificato per glop- forse portato a uno stadio originale- lasciata solo la parte standard ricavata dal codice per ns6 e tagliando i document.all- jerry masslo di mondoquarto.org, marzo 2010, le altre modifiche risalenti intorno al 2004, anche Xinod mi pare partecipò.
*/



var dragapproved=false;

var z,x,y;





function move(e){/*funzione modificata da Mich di html.it*/

  if (dragapproved){

    z.style.left=document.getElementById? temp1+e.clientX-x+'px': temp1+event.clientX-x

    z.style.top=document.getElementById? temp2+e.clientY-y+'px': temp2+event.clientY-y

    return false

  }

}







function drags(e){

var firedobj=document.getElementById? e.target : event.srcElement

var topelement=document.getElementById? "html" : "body"



/*trovato da http://www.dynamicdrive.com/dynamicindex11/abox_dev.htm e aggiunto in sostiuzione - sembra funzionare senza segnalazione di errore in console.*/



if (firedobj.className=="drag"){

dragapproved=true

z=firedobj

temp1=parseInt(z.style.left+0)

temp2=parseInt(z.style.top+0)

x=document.getElementById? e.clientX: event.clientX

y=document.getElementById? e.clientY: event.clientY

document.onmousemove=move

return false

}

}



document.onmousedown=drags

document.onmouseup=new Function("dragapproved=false")

