//BEAM  (C) Copyright APAK Beam 2003, 2004, 2005
//Program  : Startup
//Function : Javascript Startup Functions
//***********************Maintenance History************************************
//16-06-2005 J. Tancev		Created js file
//19-06-2005 J. Tancev      Updated for netscape
//******************************************************************************
var ChildWindow = null;
var LogoffWindow = null;
var browserName = navigator.appName;
var resolution = "&resWidth=" + screen.width + "&resHeight=" + screen.height;
var adminParameters = "?css=abk&Inst={1107769F-F3BB-44EE-EE6B-527CAD4EEEA5}";
var inetParameters = "?inetclient=true&Inst={1107769F-F3BB-44EE-EE6B-527CAD4EEEA5}&css=abk";
var adminParametersOpen = "?terminatesession=true&css=abk&Inst={1107769F-F3BB-44EE-EE6B-527CAD4EEEA5}";
var inetParametersOpen = "?terminatesession=true&inetclient=true&Inst={1107769F-F3BB-44EE-EE6B-527CAD4EEEA5}&css=abk";
//****************************************************
//Update to reflect the appropriate url including the 
//domain if hosted remotely
//ie. https://www.something.com/beamnetwebclient/Startup.aspx
//****************************************************
var systemUrl = "https://www.eahli.com/beamnetwebserver/Startup.aspx";
//var systemUrl = "https://localhost/beamnetwebserver/Startup.aspx";

//****************************************************

function OpenOnlineBankingAdmin() {
	if (ChildWindow != null) {
		try{
			ChildWindow.focus();
		}catch(e){
			startApplication(systemUrl + adminParametersOpen, "_blank");
		}
	}else{
		startApplication(systemUrl + adminParameters, "_blank");
	}
}

function OpenOnlineBankingInet() {
	if (ChildWindow != null) {
		try{
			ChildWindow.focus();
		}catch(e){
			startApplication(systemUrl + inetParametersOpen + resolution, "_blank");
		}
	}else{
		startApplication(systemUrl + inetParameters + resolution, "_blank");
	}
}

function startApplication(url, name){
	var y = screen.availWidth  - 10;		// Allow for borders
	var x = screen.availHeight - 50;		// Allow for taskbar
	if (screen.availHeight > 768) x = 718;	// Don't worry about lost space...
	if (screen.availWidth > 1024) y = 1024;
	ChildWindow = window.open(url, name, "height=" + x + ",width=" + y + ",directories=no,scrollbars=yes,status=yes,resizable=yes,location=no,menubar=no,titlebar=no,toolbar=no,top=0,left=0");
	if (browserName!="Microsoft Internet Explorer"){
		ChildWindow.onunload = distroyChild;	
	}
	ChildWindow.focus();
	return true;
}

function distroyChild(){
	ChildWindow = null;
}

function FocusOnChild() {
	window.focus();
}

function Initialize() {
	window.resizeTo(850, 600);
}

