// (c) BaS 2003
var MMConf;
var MMConfChanged;
var drawedMMenu;
var prev;

// Flash generator
function printFlash(_conf, w, h, movie) {
	if (!movie) {
		movie = '_img/header.swf';
		MMConfChanged = (_conf == MMConf) ? 'false' : 'true';
		setCookie('MMConf', _conf, 10);
	}
	if (!w) w = 765;
	if (!h) h = 140;
	
	var flashvras = '_conf=' + _conf + '&_bg=' + prev + "&_MMConfChanged=" + MMConfChanged + "&_drawedMMenu=" + drawedMMenu;
	
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="' + w + '" height="' + h + '">');
	document.write('<param name="quality" value="high">');
	document.write('<param name="movie" value="' + movie + '">');
	document.write('<param name="flashvars" value="' + flashvras + '">');
	document.write('<embed width="' + w + '" height="' + h + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" src="' + movie + '" flashvars="' + flashvras + '"></embed>');
	document.write('</object>');
	setCookie('drawedMMenu', 'true', 10);
}

// Footnote
function printFootnote() {
	document.write('<a href="index.htm">home page</a> | <a href="katedra.htm">Department</a> - <a href="zespoly.htm">researches</a> - <a href="studenci_specjalnosci.htm">education</a> - <a href="kandydaci_main.htm">recruitment</a> - <a href="ciekawe.htm">links</a> - <a href="kontakt.htm">contact</a> | <a href="../index.htm">polish version</a>');
}

// helpers
function openPage(url, prevImg, target) {
	setCookie('prev', prevImg);
	
	window[target].location.href = url;
}

// Coockie
function getCookie(name) {
	var end, start;
	name += '=';

	if (!document.cookie.length)
		return false;
	if ((start = document.cookie.indexOf(name)) >= 0) { 
		end = document.cookie.indexOf(';', start += name.length);
		if (end < 0)
			end = document.cookie.length;
	}
	if (end <= start)
		return false;
	else
		return unescape(document.cookie.substring(start, end));
}

function setCookie(name, value, expire) 
{
	var eDate = new Date ();
	eDate.setTime(eDate.getTime() + Math.round( ((expire) ? expire : 30) * 24 * 6000));

	document.cookie = name + '=' + escape(value) + ((expire) ? '; expires=' + eDate.toGMTString() : '');	
}

// Windows
function openWin(url, w, h) {
	if (!w) w = 570;
	if (!h) h = 400;
		
	var newWin = window.open(url, 'popup', 'toolbar=0,resizable=0,scrollbars=1,width=' + w + ',height=' + h);
	newWin.resizeTo(w, h);
	newWin.focus();
	
	return false;
}

function openWinImg(url, w, h) {
	if (!w) w = 570;
	if (!h) h = 600;
		
	var newWin = window.open(url, 'popup', 'toolbar=0,resizable=0,scrollbars=1,width=' + w + ',height=' + h);
	newWin.resizeTo(w, h);
	newWin.focus();
	
	return false;
}



// get cookie parametrs
MMConf = getCookie('MMConf');
drawedMMenu = getCookie('drawedMMenu');
prev = getCookie('prev');