<!--
function SubmitAndRun(parRedirectOk,parRedirectNo,parType) {
	frmLogin.txtRedirectOk.value = parRedirectOk;
	frmLogin.txtRedirectNo.value = parRedirectNo;
	frmLogin.txtType.value = parType;
    frmLogin.submit();
}

function checkSubmitAndRun(parRedirectOk,parRedirectNo,parType) {
	if (window.event.keyCode == 13) {
		// Enter key is pressed
		frmLogin.txtRedirectOk.value = parRedirectOk
		frmLogin.txtRedirectNo.value = parRedirectNo
		frmLogin.txtType.value = parType
                frmLogin.submit()
	} else {
		// Other than  enter key pressed
		window.event.cancelBubble = true;
	}
}

function doOK() 
	{    
		if (userName.value.length > 0)
		{
			if (userPwd.value.length > 0)   
			{      
				window.returnValue = userName.value + "!" + userPwd.value;
				window.close();
			} else {
				alert("Utilizador ou Password Inválida");
				userPwd.focus();
			}
		} else {
			alert("Utilizador ou Password Inválida");
			userName.focus();
		}
			
		return true;   
}



// *** loginWindow ***
function loginWindow(parSkin,parRedirectNo,parRedirectOk,parType){
	var SHeight, SWidth;
	sHeight = screen.height;
	sWidth = screen.width
	var boxWidth, boxHeight, boxLeft, boxTop;
	boxWidth = 350;
	boxHeight = 160;
	boxLeft = (screen.width - boxWidth) / 2;
	boxTop = (screen.height - boxHeight) / 2;

    optionString = "dialogWidth:" + boxWidth + "px;dialogHeight:" + boxHeight + "px;dialogLeft:" + boxLeft + "px;dialogTop:" + boxTop + "px;status: No;"
	var vReturnValue = window.showModalDialog(parSkin,"",optionString);
	if (typeof(vReturnValue) != "undefined")
	{ 
		if (vReturnValue != "out") {
			frmLogin.txtuIDuPWD.value =  vReturnValue;
			frmLogin.txtRedirectOk.value =  parRedirectOk;
			frmLogin.txtRedirectNo.value =  parRedirectNo;
			frmLogin.txtType.value =  parType;						
			frmLogin.submit();
			return true;
		} else {
		    window.close
		}		
	} else {
		window.close
	}
}

// *** POP-UP ***

    var optionString,mainWin;
    function dialogpopper(thisUrl,thisWidth,thisHeight,thisTop,thisLeft)
    {
    optionString = ('dialogWidth:' + thisWidth + ';dialogHeight:' + thisHeight + ';status:no');
    mainWin = showModalDialog(thisUrl,"",optionString);
    }
 
    function NewWindow(mypage, myname, w, h, scroll) {
    var winl = (screen.width - w) / 2;
    var wint = (screen.height - h) / 2;
    winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable=no,location=no'
    win = window.open(mypage, myname, winprops)
    if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
    }

//-->

function CaricaFoto(img,tit){	
  foto1= new Image();
  foto1.src=(img);
  Controlla(img,tit);
}
function Controlla(img,tit){
  if((foto1.width!=0)&&(foto1.height!=0)){
    viewFoto(img,tit);
  }
  else{
    funzione="Controlla('"+img+"','"+tit+"')";
    intervallo=setTimeout(funzione,20);
  }
}
function viewFoto(img,tit){
  largh=foto1.width+20;
  altez=foto1.height+20;
  var winl = (screen.width - largh) / 2;
  var wint = (screen.height - altez) / 2;
  stringa="width="+largh+",height="+altez+",top="+wint+",left="+winl;
  finestra=window.open("","",stringa);
  finestra.document.write("<head><title>"+tit+"</title><link rel='stylesheet' type='text/css' href='includes/main.css'><body class='popup'><div align='center' valign='middle'><img src='");
  finestra.document.write(img);
  finestra.document.write("' border='1' class='image'></div></body></html>");

}