// USER VARIABLES
WinW = 500;
WinH = 400;
Zoom = 1.2;
Pause = 20;
LoginURL = 'index.cfm?FuseAction=Admin.Login';

// COMMON VARIABLES
scrW = screen.availWidth;
scrH = screen.availHeight;

// KEYPRESS EVENT
function getKey() {
	if (window.event.keyCode == 123) {
		OpenAdminWindow(LoginURL);
		return false;
	} else {
		return true;
	}
}
document.onkeydown = getKey;

// OPEN ADMIN POPUP WINDOW
function OpenAdminWindow(url) {
	endW = WinW;
	endH = WinH;
	endX = (scrW-endW)/2;
	endY = (scrH-endH)/2;
	curW = 100;
	curH = 100;
	curX = (scrW-curW)/2;
	curY = (scrH-curH)/2;
	W = window.open('','Admin','width='+curW+',height='+curH+',top='+curY+',screeny='+curY+',left='+curX+',screenx='+curX);
	ShowURL = url;
	ZoomOut();
}

function ZoomOut() {
	if(W&&(curW!=endW||curH!=endH)&&!W.closed) {
		W.moveTo((scrW-curW)/2,(scrH-curH)/2);
		W.resizeTo(curW,curH);
		if(curW<endW) curW*=Zoom;
		if(curH<endH) curH*=Zoom;
		if(curW>endW) curW=endW;
		if(curH>endH) curH=endH;
		timer = setTimeout('ZoomOut()',Pause);
	} else {
		clearTimeout(timer);
		W.moveTo(endX,endY);
		W.resizeTo(endW,endH);
		if(document.layers)	{W.outerWidth = endW; W.outerHeight = endH;}
		W.document.location = ShowURL;
		W.focus();
	}
}

// CLOSE ADMIN POPUP WINDOW
function CloseAdminWindow(CW) {
	endW = 100;
	endH = 100;
	endX = (scrW-endW)/2;
	endY = (scrH-endH)/2;
	curW = WinW;
	curH = WinH;
	curX = (scrW-curW)/2;
	curY = (scrH-curH)/2;
	W = CW;
	W.document.location = 'about:blank';
	ZoomIn();
}

function ZoomIn() {
	if(W&&(curW!=endW||curH!=endH)&&!W.closed){
		W.resizeTo(curW,curH);
		W.moveTo((scrW-curW)/2,(scrH-curH)/2);
		if(curW>endW) curW*=(1/Zoom);
		if(curH>endH) curH*=(1/Zoom);
		if(curW<endW) curW=endW;
		if(curH<endH) curH=endH;
		timer = setTimeout('ZoomIn()',Pause);
	} else {
		clearTimeout(timer);
		W.close();
	}
}

function ReloadMain() {
	location.reload();
}