
/**
 * Window Resize.
 *
 */
function resize_window(max_x, max_y) {
	
	var x = screen.width;
	var y = screen.height;
	
	if (x > max_x) {
		x = max_x;
	}
	
	if (y > max_y) {
		y = max_y;
	}
	
	window.resizeTo(x, y);
	move_center(x,y);
}

/**
 * Window Move.
 *
 */
function move_center(m, n) {
	
	var x = screen.width / 2;
	var y = screen.height / 2;

	x = x - m / 2;
	y = y - n / 2;
	
//	window.alert("(" + x + "," + y + ")");
	
	window.moveTo(x, y);
}


// ==================================================
var isMSIE 		= (navigator.userAgent.indexOf('MSIE') >= 0);
var isMac 		= (navigator.userAgent.indexOf('Mac') >= 0) ;
var isMacIE 	= (isMac)&&(navigator.appName=="Microsoft Internet Explorer");
var isOpera 	= (navigator.userAgent.indexOf('Opera')>=0);
var isSafari 	= (navigator.appVersion.indexOf("KHTML") >= 0);

var ms = navigator.appVersion.indexOf("MSIE");
var isIE7 = (ms>0) && (parseInt(navigator.appVersion.substring(ms+5, ms+6)) >= 7);


function open_flipper(url, width, height){
	var h = 0;
	var param = '';
	
	param = "width=" + width + ",height=" + height;
	if (isIE7){
		try {
			h = screen.height;
		}
		catch (ex) {
			h = 768;
		}
		
		if (h <= 768) {
			param += ',scrollbars=yes';
		}
		else {
			param += ',scrollbars=no';
		}
	}
	else {
			param += ',scrollbars=no';
	}
	
	try {
		var win = window.open(url, "flipper", param);
		win.focus();
	}
	catch (e) {
//		alert('Flipper is blocked.');
	}
}
// ==================================================
