﻿// File JScript
//---------------------------------------------------------------
//Popup di IMMAGINE con riquadro tratteggiato nel punto di click 
//---------------------------------------------------------------
<!--
var ie=document.all
var ns=document.layers
var ns6=document.getElementById&&!document.all

function enlarge(which,e,zoom){
var ImgPU = null; 
if (ImgPU) ImgPU.onLoad = null;
ImgPU = new Image();
ImgPU.src = which;  

var wndWidth = ImgPU.width ; 
var wndHeight = ImgPU.height ; 

//if(wndWidth >= window.screen.availWidth){
//wndWidth = window.screen.availWidth;
//}
//if(wndHeight >= window.screen.availHeight){
//wndHeight = window.screen.availHeight;
//}
//if(wndHeight >= window.Height){
//wndHeight = window.screen.Height;
//}
//if(wndWidth >= window.screen.Width){
//wndWidth = window.screen.Width;
//}

if (zoom==null)
zoom=100;

wndWidth = wndWidth * zoom/100;
wndHeight = wndHeight * zoom/100;

var wndZoomX= wndWidth / (window.screen.Width/1.25)
var wndZoomY= wndHeight / (window.screen.Height/1.25)

if (wndZoomX>1 || wndZoomY>1){
    if (wndZoomX > wndZoomY) {
        wndWidth = wndWidth / wndZoomX;
        wndHeight = wndHeight / wndZoomX;
    }
    else {
        wndWidth = wndWidth / wndZoomY;
        wndHeight = wndHeight / wndZoomY;
    }
}
if (ie||ns6){
crossobj=document.getElementById? document.getElementById("showimage") : document.all.showimage
if (crossobj.style.visibility=="hidden"){
crossobj.style.left=ns6? pageXOffset+e.clientX : document.body.scrollLeft+event.clientX;
crossobj.style.top=ns6? pageYOffset+e.clientY : document.body.scrollTop+event.clientY;

if ((crossobj.style.left+wndWidth) > window.screen.Width) {
    crossobj.style.left= window.screen.Width - wndWidth;
}
if ((crossobj.style.top+wndHeight) > window.screen.Height) {
    crossobj.style.top= window.screen.Height - wndHeight;
} 

crossobj.innerHTML='<div align=left id=drag><SPAN STYLE="cursor: hand"><font face="verdana" color="#ff0000" size="2"><b onClick=closepreview()>Chiudi</b></font></span></div><img src="'+which+'" width='+ wndWidth +' height='+wndHeight+' >'
crossobj.style.visibility="visible"
}
else
crossobj.style.visibility="hidden"
return false
}

else if (document.layers){
if (document.showimage.visibility=="hide"){
document.showimage.document.write('<a href="#" onMouseover="drag_dropns(showimage)"><img src="'+which+'" border=0></a>')
document.showimage.document.close()
document.showimage.left=e.x
document.showimage.top=e.y
document.showimage.visibility="show"
}
else
document.showimage.visibility="hide"
return false
}

else
return true
}

function closepreview(){
crossobj.style.visibility="hidden"
}

var nsx,nsy,nstemp

function drag_dropns(name){
temp=eval(name)
temp.captureEvents(Event.MOUSEDOWN | Event.MOUSEUP)
temp.onmousedown=gons
temp.onmousemove=dragns
temp.onmouseup=stopns
}

function gons(e){
temp.captureEvents(Event.MOUSEMOVE)
nsx=e.x
nsy=e.y
}
function dragns(e){
temp.moveBy(e.x-nsx,e.y-nsy)
return false
}

function stopns(){
temp.releaseEvents(Event.MOUSEMOVE)
}

function drag_drop(e){
if (ie&&dragapproved){
crossobj.style.left=tempx+event.clientX-offsetx
crossobj.style.top=tempy+event.clientY-offsety
}
else if (ns6&&dragapproved){
crossobj.style.left=tempx+e.clientX-offsetx
crossobj.style.top=tempy+e.clientY-offsety
}
return false
}

function initializedrag(e){
if (ie&&event.srcElement.id=="drag"||ns6&&e.target.id=="drag"){
offsetx=ie? event.clientX : e.clientX
offsety=ie? event.clientY : e.clientY

tempx=parseInt(crossobj.style.left)
tempy=parseInt(crossobj.style.top)

dragapproved=true
document.onmousemove=drag_drop
}
}

document.onmousedown=initializedrag
document.onmouseup=new Function("dragapproved=false")
//-->



//---------------------------------------------------------------
//Popup FINESTRA di IMMAGINE autodimensionante con Margini e Pos Iniziale
//---------------------------------------------------------------
<!--
var WND_W_MARGIN = 0; 
var WND_H_MARGIN = 0; 

var ImgPU = null; 
var WndPU = null; 

function OpenPopupHandler() { 
    var wndWidth = ImgPU.width + WND_W_MARGIN; 
    var wndHeight = ImgPU.height + WND_H_MARGIN; 

    WndPU = window.open( 
        ImgPU.src, 
        "TestPU",
        "left=0, top=0, border=0," + " width=" + wndWidth + ", height=" + wndHeight + "," + 'scrollbars=no, resizable=no,status=no,location=no,toolbar=no'); 
    WndPU.focus(); 
} 

function OpenPopup(imgUrl) { 
    if(ImgPU) ImgPU.onload = null; 

    ImgPU = new Image(); 
    ImgPU.onload = OpenPopupHandler; 
    ImgPU.src = imgUrl; 
} 
//-->


//---------------------------------------------------------------
//Popup di IMMAGINE autodimensionante con Margini e Pos Iniziale
//---------------------------------------------------------------

<!--
var ImgPU = null; 
var oPopup = window.createPopup();
function PopUpImage(url)
{
    var oPopBody = oPopup.document.body;
    
    if(ImgPU) ImgPU.onload = null; 
    ImgPU = new Image();
    ImgPU.src = url;  
    
    var wndWidth = ImgPU.width ; 
    var wndHeight = ImgPU.height ; 
    
    oPopBody.style.backgroundColor = "lightyellow";
    oPopBody.style.border = "solid black 1px";
    
    oPopBody.innerHTML = "    <img src='" + url + "' width=" + wndWidth + ", height=" + wndHeight + " />";
    
    oPopup.show(0, 0, wndWidth, wndHeight, document.body);
}
//-->



//---------------------------------------------------------------
//Popup di IMMAGINE da Dimensionare con Margini e Pos Iniziale
//---------------------------------------------------------------
<!--
var oPopup = window.createPopup();
function ButtonClick(url)
{
    var oPopBody = oPopup.document.body;
    oPopBody.style.backgroundColor = "lightyellow";
    oPopBody.style.border = "solid black 1px";
    
    oPopBody.innerHTML = "    <img src='" + url + "' width=100 height=100 />";
    
    
    oPopup.show(100, 100, 100, 100, document.body);
}
//-->

//---------------------------------------------------------------
//Popup di URL  con Margini e Pos Iniziale
//---------------------------------------------------------------
    <!--
    function popup(url, name, left, top, width, height)
    {
    settings=
    " toolbar=no, location=no, directories=no,"+
    "left="+ left +",top="+ top + ", "+
    "width="+ width +",height="+ height + ", "+
    " status=no, menubar=no, scrollbars=no, titlebar=no";

    //MyNewWindow=window.open("http://"+url,name,settings);
    MyNewWindow=window.open(url,name,settings);
    }
    //-->
    
//---------------------------------------------------------------
//Popup MODAL di URL  con Margini e Pos Iniziale
//---------------------------------------------------------------
    <!--
    function PopUpModal(url, name, left, top, width, height)
    {
    settings=
    " toolbar=no, location=no, directories=no,"+
    " status=no, menubar=no, scrollbars=no, titlebar=no";

    features=
    "dialogHeight: " + height + "px;" + "dialogWidth: " + width + "px;"+
    "dialogLeft: " + left + "px;"+ "dialogHeight: " + height + "px;" +
    "resizable:0; scroll=0; status=0; center:0;";
    

    //MyNewWindow=window.open("http://"+url,name,settings);
    MyNewWindow=window.showModelessDialog(url,settings,features);
    MyNewWindow.resizeTo(width+2,height+30) 
    }
    //-->


//---------------------------------------------------------------
//Popup che si espande di URL  con Margini e Pos Iniziale
//---------------------------------------------------------------
<!--
function expandingWindow(website, left, top, width, height) {
var windowprops=' width=1, height=1, scrollbars=no, resizable=no, status=no, location=no, toolbar=no, border=0'
var heightspeed = 1; 
var widthspeed = 1; 
var leftdist = left;   
var topdist = top; 
var lunghezza = width;
var altezza = height;

if(lunghezza == 0){
lunghezza = window.screen.availWidth;
		}
if(altezza == 0){
altezza = window.screen.availHeight;
}

if (window.resizeTo&&navigator.userAgent.indexOf("Opera")==-1) {
var winwidth = lunghezza;
var winheight = altezza;
var sizer = window.open("","","left=" + leftdist + ",top=" + topdist +","+ windowprops);
for (sizeheight = 1; sizeheight < winheight; sizeheight += heightspeed)
sizer.resizeTo("1", sizeheight);
for (sizewidth = 1; sizewidth < winwidth; sizewidth += widthspeed)
sizer.resizeTo(sizewidth, sizeheight);
sizer.location = website;
}
else
window.open(website,website);
}
//-->



//---------------------------------------------------------------
//Popup DIV con Immagine NON FUNZIONA
//---------------------------------------------------------------
function PopUpLocation(imgURL,e,txt){
var ImgPU = null; 
if (ImgPU) ImgPU.onLoad = null;
ImgPU = new Image();
ImgPU.src = imgURL;  

var wndWidth = ImgPU.width ; 
var wndHeight = ImgPU.height ; 


if (ie||ns6){
crossobj=document.getElementById? document.getElementById("showimage") : document.all.showimage
if (crossobj.style.visibility=="hidden"){
crossobj.style.left=ns6? pageXOffset+e.clientX : document.body.scrollLeft+event.clientX;
crossobj.style.top=ns6? pageYOffset+e.clientY : document.body.scrollTop+event.clientY;


crossobj.innerHTML='<div align=left id=drag><SPAN STYLE="cursor: hand"><font face="verdana" color="#ff0000" size="2"><b onClick=closepreview()>Chiudi</b></font></span></div><img src="'+imgURL+'" >'
crossobj.style.visibility="visible"
}
else
crossobj.style.visibility="hidden"
return false
}

else if (document.layers){
if (document.showimage.visibility=="hide"){
document.showimage.document.write('<a href="#" onMouseover="drag_dropns(showimage)"><img src="'+imgURL+'" border=0></a>')
document.showimage.document.close()
document.showimage.left=e.x
document.showimage.top=e.y
document.showimage.visibility="show"
}
else
document.showimage.visibility="hide"
return false
}

else
return true
}



