
    lar=70;
    i=0;
    n1=1;
    ni=0;
    cont=50;
    icont=0;
    var immag;
    var nome;
    var nome1;
    var img = new Array();
    colore='red';
    curElement=null;
 
    for(i=0;i<100;i++) {
    img[i]=new Array();}
    
    /*  0  nome immagine
        1  larghezza
        2  altezza
        3  src
    */

    img[0][0]= "pic0000";
    img[0][1]= 150;
    img[0][2]= 300;
    img[0][3]= "pic0000.jpg";
    
    img[1][0]= "pic0100";
    img[1][1]= 100;
    img[1][2]= 100;
    img[1][3]= "pic0100.jpg";
    
    img[2][0]= "pic0200";
    img[2][1]= 100;
    img[2][2]= 100;
    img[2][3]= "pic0200.jpg";
   
    img[3][0]= "pic0300";
    img[3][1]= 100;
    img[3][2]= 100;
    img[3][3]= "pic0300.jpg";
   
    img[4][0]= "pic0400";
    img[4][1]= 100;
    img[4][2]= 100;
    img[4][3]= "pic0400.jpg";
   
    img[5][0]= "pic0500";
    img[5][1]= 100;
    img[5][2]= 100;
    img[5][3]= "pic0500.jpg";
   
    img[6][0]= "pic0600";
    img[6][1]= 100;
    img[6][2]= 100;
    img[6][3]= "pic0600.jpg";
   
    img[7][0]= "pic0700";
    img[7][1]= 100;
    img[7][2]= 100;
    img[7][3]= "pic0700.jpg";
   
    img[8][0]= "pic0800";
    img[8][1]= 100;
    img[8][2]= 100;
    img[8][3]= "pic0800.jpg";
   
    img[9][0]= "pic0900";
    img[9][1]= 100;
    img[9][2]= 100;
    img[9][3]= "pic0900.jpg";
 
      document.ondragstart = doDragStart;
      document.onmousedown = doMouseDown;
      document.onmousemove = doMouseMove;
      document.onmouseup = new Function("curElement=null")

   // finestra di popup standard
  function openStandardWindow(urlwin, titolo)
  {
    return window.open(urlwin, titolo,
      "menubar=no,personalbar=no,status=no,titlebar=no,"+
      "screenX=300,screenY=120,top=120,left=300,width=700,height=450,"+
      "resizable=yes,alwaysRaised=yes,scrollbars=yes");
  }

 
   function openw()
   {
     openStandardWindow("D:\\siti\\w3w\\workstar\\viewstar\\listaimg.htm", "lista")
   }

   function cambiawin(pagina)
   {
     window.parent.centrale.location.href = "http://www.w3w.it/w3w/workstar/viewstar/"+ pagina;
   }
   
   function cambiasfo()
   {
      window.parent.inferiore.document.bgColor = colore;
      if (colore == "white") { colore = "red"; return }
      if (colore == "silver") { colore = "white"; return}
      if (colore == "green") { colore = "silver"; return}
      if (colore == "aqua") { colore = "green"; return}
      if (colore == "navy") { colore = "aqua"; return}
      if (colore == "yellow") { colore = "navy"; return}
      if (colore == "red") { colore = "yellow"; return}

   }

   function insimg(immag,nvar,nx,ny)
   {
    document.images[0].src=immag+(nvar+0)+".jpg";
    img[0][1]= nx;
    img[0][2]= ny;
    document.images[0].width=img[0][1]/2;
    document.images[0].height=img[0][2]/2;   
    img[0][3]= immag+(nvar+0)+".jpg";
   }


   
   function visimg()
   {
  //  for (i=0;i<9;i++)
  //   {
    document.images[0].src="pic1"+".jpg";
    document.images[1].src="pic2"+".jpg";
    document.images[2].src="pic3"+".jpg";
    document.images[3].src="pic4"+".jpg";
    document.images[4].src="pic5"+".jpg";
    img[0][3]= "pic1"+".jpg";
    img[1][3]= "pic2"+".jpg";
    img[2][3]= "pic3"+".jpg";
    img[3][3]= "pic4"+".jpg";
    img[4][3]= "pic5"+".jpg";
    //document.images[i].width=img[i-6][1]/2;
    //document.images[i].height=img[i-6][2]/2;
   // document.images[i].width =document.images[i].width/2;
    //document.images[i].height=document.images[i].height/2;
   //  }
}


       
   function canimg()
   {
    document.images[nome].width =1;  
    document.images[nome].height =1; 
    document.images[nome].style.pixelLeft=1;
    document.images[nome].style.pixelTop=1;
   }


   function doMouseMove() 
   {
    var newleft=0, newTop = 0
    if ((event.button==1) && (curElement!=null))
     {
       newleft=event.clientX;
       if (newleft<0) newleft=0;
       newtop=event.clientY;
       if (newtop<0) newtop=0;

       if (sel==1)
        { 
         curElement.style.pixelLeft= newleft;
         curElement.style.pixelTop= newtop;
        }
      	if (sel==0)
      	 {
      	  document.images[n1].style.pixelLeft= newleft;
          document.images[n1].style.pixelTop= newtop;
        }
       event.returnValue = false
       event.cancelBubble = true
        }
      }
  
      function doMouseDown() 
      {
        if (event.clientY >  30) sel=1
        if (event.clientY <= 30) sel=0
        if ((event.button==1) && (event.srcElement.tagName=="IMG"))
          {
          	
          
          curElement = event.srcElement
          nome=curElement.id;
  //        window.T1.value=nome
          for (ni=0;ni<9;ni++)
             {
             nome1=img[ni][0];
             if (nome==nome1)
                {
                document.images[cont].src =img[ni][3];
             	document.images[cont].width=img[ni][1]*1.5;
             	document.images[cont].height=img[ni][2]*1.5;
             	n1=cont;
             	cont++;
             	sel=0;
             	return ;
                }
             }
           }
        }

    
    
    

      function doDragStart() {
        // Don't do default drag operation.
        //if ("IMG"==event.srcElement.tagName)
        //  event.returnValue=false;
        //  curElement = event.srcElement
        //  nome=curElement.id;
        //  window.T1.value=nome
        //  if (nome=="Pic1")
        //     { window.T1.value="nicola"}

      }
