﻿function DoLoginPageStartupActions() {
	MakeSureThisPageIsInProperWindow();
	var a = document.frmLogin.txtName
	if (a != null) { a.focus(); }
	a = document.getElementById('ScreenResolution')
	if (a != null) { a.value = window.screen.width + ' x ' + window.screen.height; }
//	if (DoFlashTest()) {
//		document.getElementById('ScreenResolution').value = window.screen.width + ' x ' + window.screen.height;
//		document.getElementById('txtName').focus();
//	}
}

function DoFlashTest() {
	if ((navigator.appName).indexOf("Microsoft") != -1 ) {
		var instructionObj = document.getElementById("idFlash");
		if (instructionObj) {
			if (IsFlashInstalled()) {
				instructionObj.style.display = "none";
				document.getElementById('flashMessage').style.display = "none";
				document.getElementById('outer').style.display = "block";
			}
			else {
				document.getElementById('outer').style.display = "none";
				document.getElementById('flashMessage').style.display = "none";
				instructionObj.style.display = "block";
				return false;
			}
		}
	}
	else {
		document.getElementById('flashMessage').style.display = "none";
		document.getElementById('outer').style.display = "block";
	}
	return true;
}

function IsFlashInstalled() {

	var flashInstalled = false;
	var aryFlash = new Array();
	var objVar;

	aryFlash[0] = "ShockwaveFlash.ShockwaveFlash.10";
	aryFlash[1] = "ShockwaveFlash.ShockwaveFlash.9";
	aryFlash[2] = "ShockwaveFlash.ShockwaveFlash.8";


	for (i=0; i < aryFlash.length; i++) {
		try {
			objVar = new ActiveXObject(aryFlash[i]);
			flashInstalled = true;
			break;
		}
		catch (e) { }
	}

	return flashInstalled;
}


function getHighestLevelWindow() {
	var p = window;
	if (window != window.parent) p = p.parent;
	return p
}

function MakeSureThisPageIsInHighestLevelWindow() {
	if (window != window.parent) {
		var p = getHighestLevelWindow();
		p.location.href = window.location.href;
	}
}

function MakeSureThisPageIsNotContentPage() {

}


function MakeSureThisPageIsInProperWindow() {
	MakeSureThisPageIsNotContentPage();
	MakeSureThisPageIsInHighestLevelWindow();
}


function DefaultSubmitImageButton(strClientIdArg, e) {
	if (navigator.appName.indexOf("Microsoft") >= 0) {
		//return false;
		var key;
		if(window.event) {
			//for IE
			key = window.event.keyCode;
		}
		else {
			//for firefox
			key = e.which;
		}

		if (key == 13) {
			strTempId = strClientIdArg;
			if(strTempId != "") {
				document.getElementById(strClientIdArg).click();
				return false;
			}
		}
		else {
			return true;
		}
	}
}


function DisableAndSubmitForm() {
	var LoginForm = document.getElementById('frmLogin');
	if (LoginForm != null) {
		LoginForm.disabled = true;
		window.setTimeout("EnableForm();", 10000);
	}
}

function EnableForm() {
	var LoginForm = document.getElementById('frmLogin');
	if (LoginForm != null) {
		LoginForm.disabled = false;
	}
}
