// All the javascript routines for LeifCodices

function doItFaster(){
	getCoords();
//	App.openwin('exit','exit.html',0,405,0,473,0,473,117,117);
//	App.openwin('landscape','arrowTwo.html',508,351,618,419,618,419,270,171);
	App.openwin('library','arrowOne.html',0,0,0,0,0,0,333,171);
//	if (navigator.platform.indexOf('Mac')==-1) {
		App.disappearMain();
//	}
}

window.focus();

var App = {}
App.windows = new Array();
App.openwin = function (name, url, ax, ay, bx, by, cx, cy, width, height) {
	if (navigator.platform.indexOf('Mac')==-1) window.onfocus=App.reappearMain;
	if (screenwidth<900) {
	// 800x600
		this.windows[name] = window.open(url,name,'width='+width+',height='+height+',left='+(leftpos+ax)+',top='+(toppos+ay)+',screenX='+(leftpos+ax)+',screenY='+(toppos+ay)+',menubar=no,scrollbars=no,location=no,toolbar=no,directories=no,status=no');
	} else if (screenwidth<1100) {
	//1024x768
		this.windows[name] = window.open(url,name,'width='+width+',height='+height+',left='+(leftpos+bx)+',top='+(toppos+by)+',screenX='+(leftpos+bx)+',screenY='+(toppos+by)+',menubar=no,scrollbars=no,location=no,toolbar=no,directories=no,status=no');
	} else {
	//1280x1024
		this.windows[name] = window.open(url,name,'width='+width+',height='+height+',left='+(leftpos+cx)+',top='+(toppos+cy)+',screenX='+(leftpos+cx)+',screenY='+(toppos+cy)+',menubar=no,scrollbars=no,location=no,toolbar=no,directories=no,status=no');
	}
}
App.close = function (handle) {
	if (handle) {
		if (this.windows[handle] && (!this.windows[handle].closed)) this.windows[handle].close();
	} else {
		for (var win in this.windows) this.windows[win].close();
	}
}
App.disappearMain = function () {
	window.resizeTo(10,10);
	window.moveTo(leftpos,toppos);
}
App.reappearMain = function () {
	window.moveTo(10,10);
	window.resizeTo(700,500);
}


screenwidth=(window.x||window.screen.width||window.clientX);

function getCoords() {
	
	if (screenwidth<900) {
	// 800x600
		leftpos=5;
		toppos=5;
	} else if (screenwidth<1100) {
	//1024x768
		leftpos=45;
		toppos=81;
	} else {
	//1280x1024
		leftpos=123;
		toppos=99;
	}
}

