//opens the separate window for the member area if german lid=1 else english lid=2
function newMemberWindow(xid){
	var xw, yh;
	
	if(screen){	
		xw = ((screen.width)-830)/2;
		yh = ((screen.availHeight)-80-600)/2;
	} else {
		xw = 10;
		yh = 10;
	}

	//alert("width=830,height=600,dependent=no,locationbar=no,scrollbars=yes,menubar=no,toolbar=yes,titlebar=no,resizable=yes,screenX="+xw+",left="+xw+",screenY="+yh+",top="+yh+",status=yes");

	
	popup = window.open("https://www.complementa.ch/member/login.asp?lid=" + xid,"customer_member_area","width=830,height=600,dependent=no,locationbar=no,scrollbars=yes,menubar=no,toolbar=yes,titlebar=no,resizable=yes,screenX="+xw+",left="+xw+",screenY="+yh+",top="+yh+",status=yes");
	popup.focus();
}

//opens the separate window for the complementa employee to login to metaframe
function newEmployeeWindow(){
	popup = window.open("https://www.complementa.ch/member/aspcenter/Citrix/NFuse17/redirect.asp?type=emp","employee_login","width=800,height=500,dependent=no,locationbar=no,menubar=no,toolbar=yes,titlebar=no,resizable=yes,status=yes,screenX=0,screenY=0,top=0,left=0");
	popup.focus();
}

//maximizes the size of window
function maximizeWin() {
  if (window.screen) {
    var aw = screen.availWidth;
    var ah = screen.availHeight;
    window.moveTo(0, 0);
    window.resizeTo(aw, ah);
  }
}

//replaces the current document in the window with logout.asp which kills the session and closes the window!!!!!!!
function killSession()
{
	alert("killSession");

	location.href="logout.asp";
}

//rounds figure x using a scale of n
function cicRound(x, n) {
	if (n < 1 || n > 14) return false;
	var e = Math.pow(10, n);
	var k = (Math.round(x * e) / e).toString();
	if (k.indexOf('.') == -1) k += '.';
	k += e.toString().substring(1);
	return k.substring(0, k.indexOf('.') + n+1);
}

//checks the length (number of entered characters) of a given field for correspondance with maxLength
function checkLength(field, maxLength){
	var length = eval('document.risiko.' + field + '.value.length')
	if (length > maxLength){
		alert('Ihre Eingabe übersteigt die maximale Länge von ' + maxLength + ' Zeichen.\nSie haben ' + length + ' Zeichen eingegeben!');
	}
}