var newWindow
var liveScreenHeight = screen.availHeight
var liveScreenWidth = screen.availWidth
var windowWidth = 2 * (liveScreenWidth / 3)
var windowHeight = 2 * (liveScreenHeight /3)

function openWindow(contentURL) {;
	widthHeight = 'height=' + windowHeight + ',width=' + windowWidth + ',scrollbars';
	newWindow = window.open(contentURL,"",widthHeight);
	newWindow.focus()
	}

function openWindowFix(contentURL,windowWidth,windowHeight) {;
	widthHeight = 'height=' + windowHeight + ',width=' + windowWidth + ',scrollbars';
	newWindow = window.open(contentURL,"",widthHeight);
	newWindow.focus()
	}

function closeWindow() {;
	if (newWindow && !newWindow.closed) {
		newWindow.close();
		}
	}
function setMsg(msg) {;
	window.status = msg;
	return true;
}
// Loads new window with image
function makeNewWindow(imageUrl,imageDim) {;
	newWindow=window.open(imageUrl,"",imageDim);
}

function openWindowAuto(img){
  image1= new Image();
  image1.src=(img);
  Controlla(img);
}
function Controlla(img){
  if((image1.width!=0)&&(image1.height!=0)){
    viewImage(img);
  }
  else{
    funzione="Controlla('"+img+"')";
    intervallo=setTimeout(funzione,20);
  }
}
function viewImage(img){
  windowWidth=image1.width+20;
  windowHeight=image1.height+20;
  widthHeight="width="+windowWidth+",height="+windowHeight;
  newWindow=window.open(img,"",widthHeight);
  newWindow.focus()
}
