<!--

// ***********************
// * Design by seVi      *
// * Dariusz Krzeminski  *
// * sevi@vectigal.pl    *
// * 2003.12.01          *
// ***********************

alpha_speed = 20;

	if (navigator.appName.indexOf("Netscape") != -1 && parseInt(navigator.appVersion) >= 5) {
		browser = 2;
		version = 0;
	} else if (navigator.appName.indexOf("Microsoft") != -1 && parseInt(navigator.appVersion) >= 4) {
		browser = 1;
		version = parseFloat(navigator.appVersion.substr(navigator.appVersion.indexOf("MSIE") + 4));
	} else {
		browser = 0;
		version = 0;
	}

function _get_object(id) {
	return document.getElementById(id);
}


function _set_timeout(id, exec, time) {
	id_object = _get_object(id);
	id_object.timeout = 
		setTimeout(exec, time);
	return id_object.timeout;
}


function _clear_timeout(id) {
	id_object = _get_object(id);
	clearTimeout(id_object.timeout);
}


function _get_visible(id) {
	id_object = document.getElementById(id);

	switch (browser) {
		case 1:
		case 2:
			return id_object.style.visibility == 'visible'; //	return id_object.style.visibility == 'show';
	}
}

function _set_visible(id, visible) {
	id_object = document.getElementById(id);

	switch (browser) {
		case 1:
		case 2:
			id_object.style.visibility = visible ? 'visible' : 'hidden'; return; //	id_object.style.visibility = visible ? 'show' : 'hide'; return;
	}
}


function _get_alpha(id) {
	id_object = document.getElementById(id);
	switch (browser) {
		case 1:	return id_object.filters.alpha.opacity;
		case 2:	return id_object.style.MozOpacity * 100;
	}
}


function _set_alpha(id, alpha) {
	id_object = _get_object(id)
	if (alpha < 0) alpha = 0; else if (alpha > 100) alpha = 100;
	switch (browser) {
		case 1:	id_object.filters.alpha.opacity = alpha; 
			return;
		case 2:	id_object.style.MozOpacity = alpha / 100; 
			return;
	}
}


function alpha_in(id) {
	alpha = _get_alpha(id);
	alpha += alpha_speed;
	if (alpha > 100) alpha = 100;
	_set_alpha(id, alpha);
	if (alpha < 100) setTimeout("alpha_in('" + id + "');", 50);
}


function alpha_out(id) {
	alpha = _get_alpha(id);
	alpha -= alpha_speed;
	if (alpha < 0) alpha = 0;
	_set_alpha(id, alpha);
	if (alpha > 0) setTimeout("alpha_out('" + id + "');", 50);
}


function alpha_go(id, go) { 

	switch (browser) {
		case 1:	if (version < 6) return;
		case 2:	break;
	}

	_clear_timeout(id);
	alpha = _get_alpha(id);
	if (go > alpha + alpha_speed) alpha += alpha_speed; else if (go < alpha - alpha_speed) alpha -= alpha_speed; else alpha = go;
	_set_alpha(id, alpha);
	if (alpha != go) _set_timeout(id, "alpha_go('" + id + "', " + go + ");", 50);
}


function menu_show(id, show, time) {
	_clear_timeout(id);
	if (time == null || time == 0)  _set_visible(id, show);
	else _set_timeout(id, "_set_visible('" + id + "', " + show + ");", time * 1000);
}


function menu_alpha_go(id, go) {

	switch (browser) {
		case 1:	if (version < 6) if (go == 0) menu_show(id, false, 0.2); else menu_show(id, true); 
			return;
		case 2:	break;
	}

	_clear_timeout(id);
	
	visible = _get_visible(id);
	alpha = _get_alpha(id);

	if (go > alpha + alpha_speed) alpha +=alpha_speed; else if (go < alpha - alpha_speed) alpha -= alpha_speed; else alpha = go;
	_set_alpha(id, alpha);

	if (visible && !alpha) _set_visible(id, false);
	else if (!visible && alpha) _set_visible(id, true);
	if (alpha != go) _set_timeout(id, "menu_alpha_go('" + id + "', " + go + ");", 50);
}


var _popup_alert = '';

function _popup_click(e) {
	switch (browser) {
		case 1: /*alert(_popup_alert);*/ return false;
		case 2: break;
	}
}

function popup_lock(text) {
	_popup_alert = text;
	switch (browser) {
		case 1:	document.oncontextmenu = _popup_click; break;
		case 2: break;	
	}
}

function menu_image_id(id_object, image) {
	id_object.src = image;
}

function menu_image(id, image) {
	menu_image_id(_get_object(id), image);
}

function menu_array(menu_array, k) {
	for (i = 0; i < menu_array.length; i++) {
		menu_show(menu_array[i], false);
	};
	menu_show(menu_array[k], true);
}

function open_win(url, windowW, windowH, scrol, target) {
	if (!target) target = 'vti_win';
	windowW += 30; windowH += 50; windowX = ((screen.width - windowW) / 2); windowY = ((screen.height - windowH) / 2);
	win = window.open(url, target,'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=' + (scrol ? 'yes' : 'no') + ',resizable=no,left='+windowX+',top='+windowY+',width='+windowW+',height='+windowH); win.document.close();
	/*win.resizeTo(windowW, windowH); win.moveTo(windowX, windowY);*/ win.focus();
}

function open_foto(file, windowW, windowH, scrol, target, title, bgcolor, bordercolor) {
	if (!target) target = 'vti_foto';
	if (!title) title = 'Galeria';
	if (!bgcolor) bgcolor = '#748BB7';
	if (!bordercolor) bordercolor = '#444444'; //bgcolor;
	windowW += 35; windowH += 55; windowX = ((screen.width - windowW) / 2); windowY = ((screen.height - windowH) / 2);
	win = window.open('', target,'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=' + (scrol ? 'yes' : 'no') + ',resizable=no,left='+windowX+',top='+windowY+',width='+windowW+',height='+windowH); win.document.write('<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-2"><title>' + title +'</title></head><body bgcolor=' + bgcolor + ' leftmargin=0 topmargin=0><table cellpadding=0 cellspacing=0 border=0 width=100% height=100%><td align=center valign=center><a href="javascript:window.close()"><img src="./' + file + '" style="border: solid 3px ' + bordercolor + '" border=0 alt="Zamknij okna"></a></td></table></body></html>'); win.document.close();
	/*win.resizeTo(windowW, windowH); win.moveTo(windowX, windowY);*/ win.focus();
}

function preload_foto() {
	if (document.images) {
		if (!document._image) document._image = new Array();
		var i, j = document._image.length, a = preload_foto.arguments;
		for (i = 0; i < a.length; i++) 
			if (a[i].indexOf("#") != 0) { 
				document._image[j] = new Image; 
				document._image[j++].src = a[i];
			}
	}
}

//-->