
//Apre il browser con tutte le propriet&agrave;
function openBrowser(link, title, width, height) {
	newWin = window.open(link, '', 'titlebar=1,toolbar=1,location=1,status=1,menubar=1,scrollbars=1,resizable=1,width=,height=' + width +',height=' + height);
}


function openWin(link, title) {
	newWin = window.open(link, '', 'titlebar=1,toolbar=0,location=0,status=0,menubar=1,scrollbars=0,resizable=0,width=600,height=400');
}

function openFreeWin(link, title, width, height) {
	newWin = window.open(link, '', 'titlebar=1,toolbar=0,location=0,status=0,menubar=1,scrollbars=0,resizable=0,width=' + width +',height=' + height);
}


//Trasforma i link specificati in open windows
function transformLink() {

	if (document.getElementById && document.createTextNode) {
		var l=document.getElementsByTagName("a");
		for(i=0;i<l.length;i++){
			if(l[i].className!='') {

				//Classico target = _blank
				if(l[i].className == 'newWindow') {
					l[i].onclick=function(){window.open(this.href, '', 'titlebar=1,toolbar=1,location=1,status=1,menubar=1,scrollbars=1,resizable=1,width=,height=');return(false)};
				//equivalente alla chiamata printPreview
				} else if (l[i].className== 'printableVersion' ) {
					l[i].onclick=function(){window.open(this.href, '', 'titlebar=1,toolbar=0,location=0,status=0,menubar=1,scrollbars=1,resizable=1,width=800,height=600');return(false)};
				//per aprire il popup per il tiny
				} else if (l[i].className== 'tinyWindow' ) {
					l[i].onclick=function(){window.open(this.href, '', 'titlebar=1,toolbar=0,location=0,status=0,menubar=0,scrollbars=0,resizable=1,width=750,height=620');return(false)};
				//finestra 640x480
				} else if (l[i].className== 'newWindow640' ) {
					l[i].onclick=function(){window.open(this.href, '', 'titlebar=1,toolbar=1,location=1,status=1,menubar=1,scrollbars=1,resizable=1,width=640,height=480');return(false)};
				//finestra 800x600
				} else if (l[i].className== 'newWindow800' ) {
					l[i].onclick=function(){window.open(this.href, '', 'titlebar=1,toolbar=1,location=1,status=1,menubar=1,scrollbars=1,resizable=1,width=800,height=600');return(false)};
				//popup per il cambio password
				} else if (l[i].className== 'passwordWindow' ) {
					l[i].onclick=function(){window.open(this.href, '', 'titlebar=1,toolbar=0,location=0,status=0,menubar=0,scrollbars=0,resizable=0,width=400,height=200');return(false)};
				//popup per l'upload
				} else if (l[i].className== 'uploadWindow' ) {
					l[i].onclick=function(){window.open(this.href, '', 'titlebar=1,toolbar=0,location=0,status=0,menubar=0,scrollbars=0,resizable=1,width=545,height=280');return(false)};
				}


			}
		}
	}

}


window.onload = function(e) {
  transformLink();
}

window.onunload = function(e) {
  transformLink();
}
