// All the javascript routines for LeeMarvinToolbox


window.focus();

var App = {};
App.windows = new Array();
App.openwin = function (name, url, ax, ay, bx, by, cx, cy, dx, dy, ex, ey, fx, fy, gx, gy, hx, hy, ix, iy, 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 if (screenwidth<1200) {
	//1152x768
		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");
	} else if (screenwidth<1300) {
	//1280x854 / 1280x1024 / 1280x1024 / 1280x768 / 1280x800
		this.windows[name] = window.open(url,name,"width="+width+",height="+height+",left="+(leftpos+dx)+",top="+(toppos+dy)+",screenX="+(leftpos+dx)+",screenY="+(toppos+dy)+",menubar=no,scrollbars=no,location=no,toolbar=no,directories=no,status=no");
	} else if (screenwidth<1400) {
	//1360x768
		this.windows[name] = window.open(url,name,"width="+width+",height="+height+",left="+(leftpos+ex)+",top="+(toppos+ey)+",screenX="+(leftpos+ex)+",screenY="+(toppos+ey)+",menubar=no,scrollbars=no,location=no,toolbar=no,directories=no,status=no");
	} else if (screenwidth<1500) {
	//1440x900
		this.windows[name] = window.open(url,name,"width="+width+",height="+height+",left="+(leftpos+fx)+",top="+(toppos+fy)+",screenX="+(leftpos+fx)+",screenY="+(toppos+fy)+",menubar=no,scrollbars=no,location=no,toolbar=no,directories=no,status=no");
	} else if (screenwidth<1700) {
	//1680x1050
		this.windows[name] = window.open(url,name,"width="+width+",height="+height+",left="+(leftpos+gx)+",top="+(toppos+gy)+",screenX="+(leftpos+gx)+",screenY="+(toppos+gy)+",menubar=no,scrollbars=no,location=no,toolbar=no,directories=no,status=no");
	} else if (screenwidth<2000) {
	//1920x1200
		this.windows[name] = window.open(url,name,"width="+width+",height="+height+",left="+(leftpos+hx)+",top="+(toppos+hy)+",screenX="+(leftpos+hx)+",screenY="+(toppos+hy)+",menubar=no,scrollbars=no,location=no,toolbar=no,directories=no,status=no");
	} else {
	//2560x1600
		this.windows[name] = window.open(url,name,"width="+width+",height="+height+",left="+(leftpos+ix)+",top="+(toppos+iy)+",screenX="+(leftpos+ix)+",screenY="+(toppos+iy)+",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(250,1600);
};


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

function getCoords() {
	
	if (screenwidth<900) {
	// 800x600
		leftpos=10;
		toppos=10;
	} else if (screenwidth<1100) {
	//1024x768
		leftpos=122;
		toppos=60;
	} else if (screenwidth<1200) {
	//1152x768
		leftpos=176;
		toppos=60;
	} else if (screenwidth<1300) {
	//1280x854 / 1280x1024 / 1280x1024 / 1280x768 / 1280x800
		leftpos=240;
		toppos=110;
	} else if (screenwidth<1400) {
	//1360x768
		leftpos=280;
		toppos=60;
	} else if (screenwidth<1500) {
	//1440x900
		leftpos=320;
		toppos=120;
	} else if (screenwidth<1700) {
	//1680x1050
		leftpos=440;
		toppos=180;
	} else if (screenwidth<2000) {
	//1920x1200
		leftpos=560;
		toppos=220;
	} else {
	//2560x1600
		leftpos=880;
		toppos=400;
	}
}

function doItFaster(){
	getCoords();
	App.openwin('sansfemmeian','intro.html',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,450,300);
//	if (navigator.platform.indexOf('Mac')==-1) {
	App.disappearMain();
//	}
}


function launchInfo(){
	window.open("info.html","info","width=250,height=1600,scrollbars=1,resize=1");
}
