// Make a pop-up window function.
function open_window (width, height, url, name) {

	// Add some pixels to the width and height.
	width = width + 25;
	height = height + 50;

	// If the window is already open, resize it to the new dimensions.
	if (window.popup_window && !window.popup_window.closed) {
		window.popup_window.resizeTo (width, height);
	} 

	// Set the window properties.
	var window_specs = "location=no, scrollbars=yes, menubars=no, toolbars=no, resizable=yes, width=" + width + ", height=" + height;

	// Set the URL.
	//var url = "reg_window.php";

	// Create the pop-up window.
	popup_window = window.open(url, name, window_specs);
	popup_window.focus();

	return false;
} // End of function.

// Make a pop-up window positioned at certain location.
function open_window_pos (width, height, x, y, url, name) {
	// Add some pixels to the width and height.
	width = width + 25;
	height = height + 50;

	// If the window is already open, resize it to the new dimensions.
	if (window.popup_window && !window.popup_window.closed) {
		window.popup_window.resizeTo (width, height);
	} 

	// Set the window properties.
	var window_specs = "location=no, scrollbars=yes, menubars=no, toolbars=no, resizable=no, left=" + x + ", top=" + y + ", width=" + width + ", height=" + height;

	// Set the URL.
	//var url = "reg_window.php";

	// Create the pop-up window.
	popup_window = window.open(url, name, window_specs);
	popup_window.focus();

	return false;
} // End of function.

// zobrazeni okna pro kasuistiky
function open_prednaska(url) {

	// Size of window
	width = 765;
	height = 555;

	// If the window is already open, resize it to the new dimensions.
	if (window.popup_window && !window.popup_window.closed) {
		window.popup_window.resizeTo (width, height);
	} 

	// Set the window properties.
	var window_specs = "location=no, scrollbars=no, menubars=no, toolbars=no, resizable=yes, left=100, top=100, width=" + width + ", height=" + height;

	// Create the pop-up window.
	popup_window = window.open(url, 'prednaska', window_specs);
	popup_window.focus();

	return false;
} // End of function.


// otevreni okna s review
function open_review(url) {
	return open_window(screen.width - 50, screen.height - 100, url, '_blank');
}

// otevreni okna pro farmakologie
function open_farmakologie(url) {
	return open_window(screen.width - 50, screen.height - 100, url, '_blank');
}

// otevreni okna s vysvetlivkou ke slovu ze slovniku pojmu
function open_dict(url) {
	return open_window_pos(450, 350,
			Math.round((screen.width / 2) - 225),
			Math.round((screen.height / 2) - 175),
			url, '_blank');
}

// otevreni okna se zkouskou
function open_zkouska(url) {
	return open_window(600, 500, url, 'zkouska');
}

// otevreni okna se zkouskou
function open_znalosti(url) {
	return open_window(520, 450, url, 'znalosti');
}

// otevreni profilu prednasejiciho
function open_profil(url) {
	return open_window(400, 400, url, '_blank');
}

// otevreni profilu prednasejiciho
function open_pravidla(url) {
	return open_window(400, 400, url, '_blank');
}

