function openEprasaWithMenu(url)
{
//	self.close();
	window.open(url,'view_new4','toolbar=1, menubar=1, location=1, scrollbars=1, status=1, resizable=1,width=1020,height=700');
}

function openEprasaWithoutMenu(url)
{
//	self.close();
	window.open(url,'view_new4','toolbar=0, menubar=0, location=0, scrollbars=1, status=0, resizable=1,width=1020,height=700');
}

function openProblemPopup()
{
	alert('Brak linka!');
	//window.open('','problem','toolbar=0, menubar=0, location=0, scrollbars=0, status=0, resizable=0,width=600,height=540');
}

function openWindow( art_id )
{
	window.location = 'index.php?act=mprasa&sub=article&id='+art_id;
	///window.open('index.php?act=popups&sub=view&id='+art_id,'view_new4','resizable=1,location=0,status=0,scrollbars=1,width=720,height=560');
}

function OpenSearch()
{
	var searchstr = document.getElementById("search").value;
	window.open('index.php?act=popups&sub=search&query='+searchstr, 'search', 'toolbar=0,location=0, menubar=0,status=0, width=640,height=480,scrollbars=1');
}
function OpenHelpWindow()
{
	var searchstr = document.getElementById("search").value;
	window.open('index.php?act=popups&sub=help', 'Pomoc', 'toolbar=0,location=0, menubar=0,status=0, width=640,height=480,scrollbars=1');
}

function OpenSearchForm()
{
	var searchstr = document.getElementById("search").value;
	window.open('index.php?act=popups&sub=search&query='+searchstr, 'search', 'toolbar=0,location=0, menubar=0,status=0, width=640,height=480,scrollbars=1');
	return false;
}


function goToPageNr( issueId ,pageId )
{
    //getImageData(issueId, pageId, 100, 'center')
	document.location.href="index.php?act=read&sub=show_issue&id="+issueId+"&page="+pageId+"";
}

function changeDate()
{
	var year = document.getElementById('DateSelectArchive').options[document.getElementById('DateSelectArchive').selectedIndex].value;
	var id = document.getElementById('issue_id').value;
	document.location.href = 'index.php?act=read&id='+id+'&year='+year;
}

function openEprasa()
{
	window.open('index.php?act=archive&sub=week&first_open=1', 'ePrasa', 'toolbar=0,location=0, menubar=0,status=0, width=1020,height=700,scrollbars=1,resizable=1');
}

function openLocation(id, page)
{
	document.location.href = 'index.php?act=mprasa&sub=page&id='+id+'&page='+page;
	///document.location.href = 'index.php?act=read&sub=show_issue&id='+id+'&page='+page;
}

var ie=document.all
var itemId = 0;
var openArticle = false;
var oArticleLink;//funkcja zdarzenia wywolanego po kliknięciu myszką na podswietlenia

function ArticleLink( id, page )
{
    openArticle = false;
    if( parseInt(page) > 0 )
    {
    	oArticleLink = function( oEvent ){
    		openLocation(id,page);
    	}
    }
    else
    {
    	oArticleLink = function( oEvent ){
    		window.location.href = 'http://'+page;
    	}
    }
}

function CommercialLink( id, page )
{
    openArticle = false;
    if( parseInt(page) > 0 )
    {
    	oArticleLink = function( oEvent ){
    		openLocation(id,page);
    	}
    }
    else
    {
    	oArticleLink = function( oEvent ){
    		window.open('http://'+page,'_blank');
    	}
    }
}

function ArticlePopup( id )
{
    itemId = id;
    openArticle = true;
    oArticleLink = function( oEvent ){
        openArticleWindow();
	}
}


function openArchive()
{
	var test = document.getElementById('DateSelect');
	var year = test.options[test.selectedIndex].value
	window.open('index.php?act=popups&sub=archive&year='+year,'view_new4','resizable=yes,location=no,status=no,scrollbars=yes,width=640,height=450');
}
var oOkienko;
function openArticleWindow()
{
	if( openArticle==true )
	{
		window.location.href = 'index.php?act=mprasa&sub=article&id='+itemId;
		//oOkienko = window.open('index.php?act=popups&sub=view&id='+itemId,'view_new4'+itemId,'resizable=1,location=0,status=0,scrollbars=1,width=720,height=560');
		//oOkienko.focus();
	}
}

function openArticleWindowById( articleId )
{
	window.open('index.php?act=popups&sub=view&id='+articleId,'view_new4'+articleId,'resizable=1,location=0,status=0,scrollbars=0,width=720,height=560');
}

// -------------------------------------------------------

function loadDesc()
{
	d = jQuery('theDesc');
	jQuery('theDesc').style.display = 'block';
	jQuery('theDesc').style.visibility = 'visible';
	//jQuery('descDesc').innerHTML = description;
}

function closeDesc()
{
	jQuery('theDesc').style.display = 'none';
	jQuery('theDesc').style.visibility = 'hidden';
}


function jQuery(id)
{
	return document.getElementById(id);
}


function printSelected( id, imgId )
{
	var printForm = document.getElementsByName('type');
	var radioLength = printForm.length;
	for(var i = 0; i < radioLength; i++)
	{
		if( printForm[i].checked == true)
		{
			if( printForm[i].value == 'one' )
			{
				window.open('index.php?act=popups&sub=print&id='+id+'&imgid='+imgId+'&type=one','view','resizable=1,location=0,status=0,scrollbars=1,width=640,height=450');
			}
			else if( printForm[i].value == 'fromto' )
			{
				var imgFrom = document.getElementById('printFrom').value;
				var imgTo = document.getElementById('printTo').value;
				window.open('index.php?act=popups&sub=print&id='+id+'&from='+imgFrom+'&to='+imgTo+'&type=from','view','resizable=1,location=0,status=0,scrollbars=1,width=640,height=450');
			}
			else if( printForm[i].value == 'all' )
			{
				window.open('index.php?act=popups&sub=print&id='+id+'&type=all','view','resizable=1,location=0,status=0,scrollbars=1,width=640,height=450');
			}
		}
	}
}



// -------------------------------------------------------
var xOffset = 30;
var yOffset = -5;

function showPopup (targetObjectId, eventObj) {
	if(eventObj) {
		// hide any currently-visible popups
		hideCurrentPopup();
		// stop event from bubbling up any farther
		eventObj.cancelBubble = true;
		// move popup div to current cursor position
		// (add scrollTop to account for scrolling for IE)
		var newXCoordinate = (eventObj.pageX)?eventObj.pageX + xOffset:eventObj.x + xOffset + ((document.body.scrollLeft)?document.body.scrollLeft:0);
		var newYCoordinate = (eventObj.pageY)?eventObj.pageY + yOffset:eventObj.y + yOffset + ((document.body.scrollTop)?document.body.scrollTop:0);
		moveObject(targetObjectId, newXCoordinate, newYCoordinate);
		// and make it visible
		if( changeObjectVisibility(targetObjectId, 'visible') ) {
			// if we successfully showed the popup
			// store its Id on a globally-accessible object
			window.currentlyVisiblePopup = targetObjectId;
			return true;
		} else {
			// we couldn't show the popup, boo hoo!
			return false;
		}
	} else {
		// there was no event object, so we won't be able to position anything, so give up
		return false;
	}
} // showPopup

function hideCurrentPopup() {
	// note: we've stored the currently-visible popup on the global object window.currentlyVisiblePopup
	if(window.currentlyVisiblePopup) {
		changeObjectVisibility(window.currentlyVisiblePopup, 'hidden');
		window.currentlyVisiblePopup = false;
	}
} // hideCurrentPopup



// ***********************
// hacks and workarounds *
// ***********************

// initialize hacks whenever the page loads
window.onload = initializeHacks;

// setup an event handler to hide popups for generic clicks on the document
document.onclick = hideCurrentPopup;

function initializeHacks() {
	// this ugly little hack resizes a blank div to make sure you can click
	// anywhere in the window for Mac MSIE 5
	if ((navigator.appVersion.indexOf('MSIE 5') != -1)
	&& (navigator.platform.indexOf('Mac') != -1)
	&& getStyleObject('blankDiv')) {
		window.onresize = explorerMacResizeFix;
	}
	resizeBlankDiv();
	// this next function creates a placeholder object for older browsers
	createFakeEventObj();
}

function createFakeEventObj() {
	// create a fake event object for older browsers to avoid errors in function call
	// when we need to pass the event object to functions
	if (!window.event) {
		window.event = false;
	}
} // createFakeEventObj

function resizeBlankDiv() {
	// resize blank placeholder div so IE 5 on mac will get all clicks in window
	if ((navigator.appVersion.indexOf('MSIE 5') != -1)
	&& (navigator.platform.indexOf('Mac') != -1)
	&& getStyleObject('blankDiv')) {
		getStyleObject('blankDiv').width = document.body.clientWidth - 20;
		getStyleObject('blankDiv').height = document.body.clientHeight - 20;
	}
}

function explorerMacResizeFix () {
	location.reload(false);
}

function getStyleObject(objectId) {
	// cross-browser function to get an object's style object given its id
	if(document.getElementById && document.getElementById(objectId)) {
		// W3C DOM
		return document.getElementById(objectId).style;
	} else if (document.all && document.all(objectId)) {
		// MSIE 4 DOM
		return document.all(objectId).style;
	} else if (document.layers && document.layers[objectId]) {
		// NN 4 DOM.. note: this won't find nested layers
		return document.layers[objectId];
	} else {
		return false;
	}
} // getStyleObject

function changeObjectVisibility(objectId, newVisibility) {
	// get a reference to the cross-browser style object and make sure the object exists
	var styleObject = getStyleObject(objectId);
	if(styleObject) {
		styleObject.visibility = newVisibility;
		return true;
	} else {
		// we couldn't find the object, so we can't change its visibility
		return false;
	}
} // changeObjectVisibility

function moveObject(objectId, newXCoordinate, newYCoordinate) {
	// get a reference to the cross-browser style object and make sure the object exists
	var styleObject = getStyleObject(objectId);
	if(styleObject) {
//		styleObject.left = newXCoordinate-150;
//		styleObject.top = newYCoordinate+25;
		return true;
	} else {
		// we couldn't find the object, so we can't very well move it
		return false;
	}
} // moveObject



//PODSWIETLENIE OBRAZKA:

var g_ref;
var g_from;
var g_moveTo;

function centerOnElement(from, baseElem, posElem, x, y) {

	var offsetTrail = baseElem;
	var offsetLeft = x;
	var offsetTop = y;
	// account for IE 6 CSS compatibility mode
	while (offsetTrail) {
		offsetLeft += offsetTrail.offsetLeft;
		offsetTop += offsetTrail.offsetTop;
		offsetTrail = offsetTrail.offsetParent;
	}
	if (navigator.userAgent.indexOf("Mac") != -1 &&
	typeof document.body.leftMargin != "undefined") {
		offsetLeft += document.body.leftMargin;
		offsetTop += document.body.topMargin;
	}
	posElem.style.left = offsetLeft + parseInt(baseElem.offsetWidth) + "px";
	posElem.style.top = offsetTop + "px";
}


var current=null;
var timeout=0;

function removePuff( ) {
	x = document.getElementById( 'puff' );
	x.innerHTML = '';
	x.style.visibility = 'hidden';
	timeout=0;
	current=null;
	g_ref=null;

	g_moveTo = null;
	contshowed = false;
	refout = false;
	baseout = false;
	divout = false;
}

var refout=false;
var baseout=false;
var divout=false;

function clearIfNeeded() {
	if((baseout)&&(divout))
	removePuff();
}

function showIfThereIsPuff() {
	if(g_ref) {
		baseout=false;
		refout=false;
		showPuff(g_ref , g_from, g_moveTo);
	}
}
function posLeft() {
	return typeof window.pageXOffset != 'undefined' ? window.pageXOffset:document.documentElement && document.documentElement.scrollLeft? document.documentElement.scrollLeft:document.body.scrollLeft? document.body.scrollLeft:0;
}
function posTop() {
	return typeof window.pageYOffset != 'undefined' ? window.pageYOffset:document.documentElement && document.documentElement.scrollTop? document.documentElement.scrollTop: document.body.scrollTop?document.body.scrollTop:0;
}
function centerOnElement(from, baseElem, posElem, x, y) {
	var offsetTrail = baseElem;
	var offsetLeft = x;
	var offsetTop = y;
	// account for IE 6 CSS compatibility mode
	/*while (offsetTrail) {
	offsetLeft += offsetTrail.offsetLeft;
	offsetTop += offsetTrail.offsetTop;
	offsetTrail = offsetTrail.offsetParent;
	}*/
	if (navigator.userAgent.indexOf("Mac") != -1 &&
	typeof document.body.leftMargin != "undefined") {
		offsetLeft += document.body.leftMargin;
		offsetTop += document.body.topMargin;
	}
	posElem.style.left = 300+offsetLeft + posLeft()//+ parseInt(baseElem.offsetWidth)
	+ "px";
	posElem.style.top = offsetTop+ posTop() + "px";
}

var contshowed = false;

function showCont(ref)
{
	contshowed=true;
	removePuff();
	base = document.getElementById( 'cont' );
	base.style.visibility = 'visible';
	base.style.left=0;
	base.style.top =0;
	base.innerHTML = ref.mytitle +
	"<hr size='1'><br><center><input type='button' class='button' onClick='removeCont();' value='Zamknij'></center>";
	centerOnElement(contzv, ref, base, 0, 0)
}

function showUniv(txt)
{
	contshowed=true;
	removePuff();
	base = document.getElementById( 'univ' );
	base.style.visibility = 'visible';
	base.style.left=110;
	base.style.top =110;
	//centerOnElement(contzv, ref, base, 0, 0)
}

function removeUniv( ) {
	contshowed=false;
	x = document.getElementById( 'univ' );
	x.style.visibility = 'hidden';
}

function removeCont( ) {
	contshowed=false;
	x = document.getElementById( 'cont' );
	x.innerHTML = '';
	x.style.visibility = 'hidden';
}

function showPuff( ref , from, moveTo, test)
{
	if(!contshowed) {
		g_ref=ref;
		g_from = from;
		g_moveTo = moveTo;

		current=ref;
		base = document.getElementById( 'puff' );
		base.style.visibility = 'visible';
		var tab = ref.coords.split(","); // zaznaczenie

		base.onmouseover = function() {
			baseout=false;
		}
		base.onmousemove = function() {
			baseout=false;
		}
		base.onmouseout = function() {
			baseout=true;
			clearIfNeeded()
		}

		ref.onmousemove = function() {
			refout=false;
		}
		ref.onmouseout = function(x) {
			refout=true;
			clearIfNeeded()
		}
		base.style.left=tab[0]-100;
		base.style.top=tab[1];
		base.style.width=tab[2]-tab[0];
		base.style.height=tab[3]-tab[1];
	}
}




//---------ZOOM-------------

var zoom_variable=100;
var zoom_areas_count = 0;
var zoom_areas = new Array();
var init_change = false;

var image_id;

var rotate='center';

function startZoom( id, img_rotate )
{
	image_id = id;
	rotate = img_rotate;
}

function initZoom( zoom )
{
	if( init_change==false )
	{
		zoom_variable = zoom;
		init_change = true;
	}
	document.getElementById("imgSizeInfo").innerHTML="Powiększenie: "+zoom_variable+"%";
	//image.style.width = parseInt((start_width*zoom_variable)/100)+'px';
	zoom_apply();
}

function zoom_initialize(el)
{
	zoom_x = el.width;
	zoom_y = el.height;
}

function zoom_apply()
{
	var licz=1;
	for(licz=1; licz <= zoom_areas_count; licz++)
	{
		var cmtmp = document.getElementById("click_map_tmp_f["+zoom_areas[licz]+"]");
		var cm = document.getElementById("click_map_f["+zoom_areas[licz]+"]");
		var tmp = cmtmp.coords.split(",");
		//        var str = parseInt((tmp[0]*zoom_variable)/100)+","+parseInt((tmp[1]*zoom_variable)/100)+","+parseInt((tmp[2]*zoom_variable)/100)+","+parseInt((tmp[3]*zoom_variable)/100);
		var str = Math.round((tmp[0]*zoom_variable)/100)+","+Math.round((tmp[1]*zoom_variable)/100)+","+Math.round((tmp[2]*zoom_variable)/100)+","+Math.round((tmp[3]*zoom_variable)/100);
		cm.coords = str;
		//e1.width = zoom_variable;
	}
	//alert(zoom_variable);
}

function zoom_plus()
{
	if( zoom_variable >= 125 )
	return;
	else
	zoom_variable += 25;

	document.getElementById("imgSizeInfo").innerHTML="Obrazek jest ładowany...";
	zoom_apply();
	document.getElementById("pdfimg").src="index.php?act=img&id="+image_id+"&s="+zoom_variable+"&rotate="+rotate;
	//initZoom( zoom_variable );
}

function zoom_minus()
{
	if( zoom_variable <= 75 )
	return;
	else
	zoom_variable -= 25;

	document.getElementById("imgSizeInfo").innerHTML="Obrazek jest ładowany...";
	zoom_apply();
	document.getElementById("pdfimg").src="index.php?act=img&id="+image_id+"&s="+zoom_variable+"&rotate="+rotate;
	//initZoom( zoom_variable );
}

//---------------------ZAZNACZENIE------------

function getElementsById(sId)
{
	var outArray = new Array();
	if(typeof(sId)!='string' || !sId)
	{
		return outArray;
	};

	if(document.evaluate)
	{
		var xpathString = "//*[@id='" + sId.toString() + "']"
		var xpathResult = document.evaluate(xpathString, document, null, 0, null);
		while ((outArray[outArray.length] = xpathResult.iterateNext())) { }
		outArray.pop();
	}
	else if(document.all)
	{
		for(var i=0,j=document.all[sId].length; i<j ; i+=1){
			outArray[i] =  document.all[sId][i];}

			if( outArray.length==0 )
			{
				outArray[0] = document.getElementById(sId);
			}
	}
	else if( document.getElementsByTagName )
	{

		var aEl = document.getElementsByTagName( '*' );
		for(var i=0,j=aEl.length;i<j;i+=1){

			if(aEl[i].id == sId )
			{
				outArray.push(aEl[i]);
			};
		};

	};

	return outArray;
}

function findPosX(obj)
{
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x){
		curleft += obj.x;
	}
	return curleft;
}

function findPosY(obj)
{
	var curtop = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y){
		curtop += obj.y;
	}
	return curtop;
}

var showdiv=false;
var liczba = 0;
var zaznaczenie_id = 0;

//var ie=document.all;
//var ie = document.all && document.getElementById && !window.opera ? true : false;
var ie = navigator.userAgent.indexOf("compatible")>-1 && navigator.userAgent.indexOf("MSIE")>-1 && !window.opera ? true : false;

var ns6=document.getElementById && !document.all
var menu_disp = true;

var kjp_count_elem = 0;
var iGroup = 0;
var kjp_elements = new Array();
var bIsOp = window.opera ? true : false;
var bIsIE = navigator.userAgent.indexOf("compatible")>-1 && navigator.userAgent.indexOf("MSIE")>-1 && !bIsOp;

/*
 * Naklada przezroczystość na podane element w skali: 0-100
 */
function kjp_optical( node, value ){
	var type;
    	//alert("Używasz " + navigator.appName + " " + navigator.appVersion);
    	//alert(typeof document.all);
	if( typeof node.style.MozOpacity == "string" ){
		//type = "MozOpacity";
		//value = value/100;
    	node.style.MozOpacity = value/100;
	}else if (bIsIE){
		//type = "filter";
    	//value = "alpha(opacity="+value+")";
    	node.style["filter"] = "alpha(opacity="+value+")";
	}else if (bIsOp){
		//type = "opacity"
		//value = value/100;
    	node.style.opacity = value/100;
	}else{
		//type = "KhtmlOpacity";
		//value = value/100;
		node.style.KhtmlOpacity = value/100;
	}
}
function pokaz_zaznaczenie( id )
{
	//kontrolne usunięcie zaznaczenia
	kjp_kasuj();
	var aArticle;
	var art = new Array();
	for(var i=0; i<kjp_articles.length;i++){
		if(kjp_articles[i][0] == id){
			art.push(kjp_articles[i]);
		}
	}
	var fragment = document.createDocumentFragment();
	var iActGroup = iGroup++;
	//jeden artykuł wielokrotnie
	for (var t=0; t < art.length; t++){
		aArticle = art[t];
		dymek_value = aArticle[1];//zawartość dymka
		for(var i=0; i<aArticle[2].length;i++){
			var sActGroup = "kjpGroup"+iActGroup;
			//top, left, width, height
			var nowy = kjp_stworz_nowy( aArticle[2][i][0], aArticle[2][i][1], aArticle[2][i][2], aArticle[2][i][3], sActGroup );
			fragment.appendChild(nowy);
			kjp_elements.push(nowy.getAttribute("id"));
		}
	}

	var rodzic = document.getElementById("kjp_area");
	rodzic.appendChild(fragment);

    zaznaczenie_id = id;
}
//sprawdza czy element docelowy nie jest częścią zaznaczeniem,
//jeśli nie to kasuje zaznaczenie
function kjp_skasuj( sGroup, oEvent ){
	var sPrzechodziNa = false;
	if( bIsIE && oEvent.toElement ){
		sPrzechodziNa = oEvent.toElement.getAttribute("name");
	}else if( oEvent.relatedTarget ){
		sPrzechodziNa = oEvent.relatedTarget.getAttribute("name")
	}
	if( sGroup != sPrzechodziNa ){
		hideddrivetip();
		kjp_kasuj();
	}

}
//kasuje natychmiastowo zaznaczenia
function kjp_kasuj(){
	if( document.getElementById && kjp_elements.length>0 ){
		var sTmpId;
		while(sTmpId = kjp_elements.shift()){
			var tmp = document.getElementById( sTmpId );
			if ( tmp && ("object" == typeof tmp) && (tmp != null) ){
					tmp.parentNode.removeChild(tmp);
					kjp_count_elem--;
			}
		}
		iGroup--;
	}
}
function kjp_stworz_nowy ( top, left, width, height, sThisGroup, iThisGroup ){

	if( document.createElement && document.createAttribute){
		var nowy = document.createElement( "div" );
		nowy.setAttribute( "name", sThisGroup);
		kjp_count_elem++;

		var idName = "mojeCos"+kjp_count_elem;

		nowy.id = idName;
		nowy.setAttribute( "style", "");

		var myszover = function ( oEvent ){
				show_dymek();
			}
		var myszout = function ( oEvent ){
				kjp_skasuj( sThisGroup, oEvent );
			}
		var myszclick = function ( oEvent ){
				if( oEvent.stopPropagation ){
					oEvent.stopPropagation();
				}else{
					oEvent.cancelBubble = true;
				}
			}
		nowy.setAttribute( "class", "shows");
		if ( nowy.addEventListener ){
			nowy.addEventListener( "mouseover", myszover, false );
			nowy.addEventListener( "mouseout", myszout, false );
			if( oArticleLink ){
				nowy.addEventListener( "click", oArticleLink, false );
			}else{
				//?
			}
			nowy.addEventListener( "click", myszclick, false );
		}else if ( nowy.attachEvent ){
			nowy.attachEvent( "onmouseover", myszover );
			nowy.attachEvent( "onmouseout", myszout );
			if( oArticleLink ){
				nowy.attachEvent( "onclick", oArticleLink );
			}
			nowy.attachEvent( "onclick", myszclick );
		}
		nowy.style.position = "absolute";


		//nowy.style.border = "1px solid red";
		nowy.style.margin = "0";
		nowy.style.fontSize = "0";
		nowy.style.visibility = "visible";
		nowy.style.display = "block";
		nowy.style.background = "#CCCCCC";
		nowy.style.cursor = "pointer";

		//dodaje filtr przezroczystości
		kjp_optical(nowy,70);

		nowy.style.zIndex = 50;

		nowy.style.top 		= parseInt(top)+ "px";
		nowy.style.left		= parseInt(left)+ 30 + "px";
		nowy.style.width 	= parseInt(width)+"px";
		nowy.style.height 	= parseInt(height)+"px";

		return nowy;
	}
}

function schowaj_zaznaczenie()
{
	if(showdiv || !bIsIE){
		kjp_kasuj();
	}
}

function hideIEzaz()
{
	if(bIsIE)
	{
		showdiv=false;
	}
}

var dymek_value = '';

function show_dymek()
{
    ddrivetip(dymek_value);
    //ddrivetip(dymek_value,'', 300)
	//tooltip( dymek_value );
}

function set_dymek( text )
{
	dymek_value = text;
}



var invisible=false;
function hideright()
{
	var table = document.getElementById('sb_top');
	var active = document.getElementById('leftTypeMenu');
	var inactive = document.getElementById('rightTypeMenu');
	var lactive = document.getElementById('centerTypeMenu');

	var listaStron = document.getElementById('listaStron');
	var mm_bottom_r = document.getElementById('mm_bottom_r');
	var mm_bottom_l = document.getElementById('mm_bottom_l');
	var obrazek = document.getElementById('hide_min');

	if( invisible==false )
	{
		var visibilityMode = 'hidden';
		var displayMode = 'none';
		obrazek.src="gfx/show_min.png";
		invisible=true;
		mm_bottom_r.width="26";
		table.width="26";
		if(ie && !window.opera)
		{
			mm_bottom_l.width = screen.width - 26;
		}

		DeleteCookie('hideright');
		SetCookie('hideright', '0');
	}
	else
	{
		var visibilityMode = 'visible';
		var displayMode = '';
		obrazek.src="gfx/hide_min.png";
		invisible=false;
		table.width="170";
		mm_bottom_r.width="173";
		if(ie && !window.opera)
		{
			mm_bottom_l.width = screen.width - 170;
		}
		DeleteCookie('hideright');
		SetCookie('hideright', '1');
	}

	active.style.visibility=visibilityMode;
	inactive.style.visibility=visibilityMode;
	listaStron.style.visibility=visibilityMode;
	lactive.style.visibility=visibilityMode;

	active.style.display=displayMode;
	inactive.style.display=displayMode;
	listaStron.style.display=displayMode;
	lactive.style.display=displayMode;
}

function showright()
{
	hideright();
	pause(1000);
	hideright();
	pause(1000);
}

function pause(numberMillis)
{
	var now = new Date();
	var exitTime = now.getTime() + numberMillis;
	while (true)
	{
		now = new Date();
		if (now.getTime() > exitTime)
		return;
	}
}

function noFunct()
{

}

function SetContentHeight(minus)
{
  	var myWidth = 0, myHeight = 0;
  	if( typeof( window.innerWidth ) == 'number' ) {
    	//Non-IE
    	myWidth = window.innerWidth;
    	myHeight = window.innerHeight;
  	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    	//IE 6+ in 'standards compliant mode'
    	myWidth = document.documentElement.clientWidth;
    	myHeight = document.documentElement.clientHeight;
  	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    	//IE 4 compatible
    	myWidth = document.body.clientWidth;
    	myHeight = document.body.clientHeight;
  	}

  	var mini = document.getElementById('mini');
	var dodatki = document.getElementById('dodatki');
//	var main = document.getElementById('main');
	var odejmij=0;

	if(myWidth<1015)
	{
		if(ie && !window.opera)
		{
			odejmij=12;
		}
		else
		{
			myHeight = myHeight-2;
		}
	}
	else
	{
		if(ie && !window.opera)
		{
		}
		else
		{
			odejmij=12;
		}
	}

	var height = myHeight - 125-20-minus+odejmij;
	if(mini)
	{
		mini.style.height = height+'px';
	}
	if(dodatki)
	{
		dodatki.style.height = height+'px';
	}
	/*
	if(main)
	{
		main.style.height = height+'px';
	}
	*/
}

function changeDisplay( show )
{
	var left = document.getElementById('leftTypeMenu');
	var center = document.getElementById('centerTypeMenu');
	var right = document.getElementById('rightTypeMenu');

	var mini = document.getElementById('mini');
	var dodatki = document.getElementById('dodatki');

	if( show == 'left' )
	{
		left.className = 'active';
		center.className = 'lactive';
		right.className = 'inactive';
		mini.style.display = '';
		mini.style.visibility = 'visible';
		dodatki.style.display = 'none';
		dodatki.style.visibility = 'hidden';

		DeleteCookie('displaySide');
		SetCookie('displaySide', '1');
	}
	else if( show == 'right' )
	{
		left.className = 'inactive';
		center.className = 'ractive';
		right.className = 'active';

		mini.style.display = 'none';
		mini.style.visibility = 'hidden';
		dodatki.style.display = '';
		dodatki.style.visibility = 'visible';

		DeleteCookie('displaySide');
		SetCookie('displaySide', '0');
	}
}

function maximizeWindow()
{
	/***********************************************
	* Auto Maximize Window Script- © Dynamic Drive (www.dynamicdrive.com)
	* This notice must stay intact for use
	* Visit http://www.dynamicdrive.com/ for this script and 100's more.
	***********************************************/

	top.window.moveTo(0,0);
	if (document.all) {
		top.window.resizeTo(screen.availWidth,screen.availHeight);
	}
	else if (document.layers||document.getElementById) {
		if (top.window.outerHeight<screen.availHeight||top.window.outerWidth<screen.availWidth){
			top.window.outerHeight = screen.availHeight;
			top.window.outerWidth = screen.availWidth;
		}
	}
}

function maximizeMain( mode )
{
	var intTopHeight = 120;
	var intFootHeight = 32;
	if( mode == 1 )
		var intBonus = 120;
	else
		var intBonus = 100;
	var intMinus = screen.height-intTopHeight-intFootHeight-intBonus;
}
var canResize = true;
function maximizeThisWindow( strContainerId, intHeader, intFooter )
{
	intMinus = intHeader + intFooter;
	objContainer = document.getElementById( strContainerId );
	_maximizeThisWindow( objContainer, intMinus );
	window.onresize = function() {
		_maximizeThisWindow( objContainer, intMinus );
	}
	setTimeout('resizeIt()', 200);
}

function _maximizeThisWindow( objContainer, intMinus )
{
	if( objContainer == null )
	{
		return;
	}
	if( ie )
	{
		intHeight = document.body.clientHeight - intMinus;
		//intWidth = document.body.clientWidth;
		//strWidth = document.body.clientWidth + 'px';
		objContainer.style.width = document.body.clientWidth - 15 + 'px';
		//alert( intWidth );
	}
	else
	{
		intHeight = window.innerHeight - intMinus;
		intWidth = window.innerWidth;
		objContainer.style.width = intWidth - 15 + 'px';
	}
	if( intHeight > 0 )
	{
		strHeight = parseInt( intHeight ) + 'px'
		objContainer.style.height = strHeight;
	}
	return;
}
function resizeIt()
{
    if( navigator.appName == "Microsoft Internet Explorer" )
    {
    	/*
    	if( !mouseRight )
	        intHeight = document.body.clientHeight;
	        if( intHeight < 0 )
	        	intHeight = 1;
	        intWidth  = document.body.clientWidth;
	        if( intWidth < 720 )
		  		top.resizeTo( 720, intHeight);
		  */
    	try
    	{
	        intHeight = document.body.offsetHeight;
	        intHeight = document.body.clientHeight;
	        //alert( document.body.offsetHeight + ' ' + document.body.clientHeight );
	        if( intHeight < 0 )
	        	intHeight = 1;
	        intWidth  = document.body.offsetWidth;
	        if( intWidth < 720 )
	        {
		  		//top.resizeTo( 720, intHeight+58);
		  		top.resizeTo( 720, 560);
		  		canResize = false;
	        }
    	}
    	catch( error )
    	{
    		/*
			txt="There was an error on this page.\n\n"
			txt+="Error description: " + error.description + "\n\n"
			txt+="Click OK to continue.\n\n"
			alert(txt)
			*/
    	}
    }
    else
    {
		/*
        intHeight = window.outerHeight;
        if( intHeight < 0 )
        	intHeight = 1;
		*/
        intWidth  = window.outerWidth;
        if( intWidth < 720 && intWidth != 160 )
        {
        	//alert( intWidth );
          	window.resizeTo( 720, 560);
          //window.resizeTo( 720, 400);
        }
    }
	setTimeout('resizeIt()', 200);
    return;
}


// ********************* General Cookie handling *********************
// Cookie Functions - Second Helping (21-Jan-96)
// Written by: Bill Dortch, hIdaho Design <bdortch@netw.com>
// The following functions are released to the public domain.

function getCookieVal (offset) {
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}

function GetCookie (name) {
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen) {
var j = i + alen;
if (document.cookie.substring(i, j) == arg)
return getCookieVal (j);
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) break;
}
return null;
}

function SetCookie (name, value) {
var argv = SetCookie.arguments;
var argc = SetCookie.arguments.length;
var expires = (argc > 2) ? argv[2] : null;
var path = (argc > 3) ? argv[3] : null;
var domain = (argc > 4) ? argv[4] : null;
var secure = (argc > 5) ? argv[5] : false;
document.cookie = name + "=" + escape (value) +
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
((path == null) ? "" : ("; path=" + path)) +
((domain == null) ? "" : ("; domain=" + domain)) +
((secure == true) ? "; secure" : "");
}

function DeleteCookie (name) {
var exp = new Date();
exp.setTime (exp.getTime() - 1);
// This cookie is history
var cval = GetCookie (name);
document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();

}

function setScrollBarPosition( page )
{
	if ( page == 'strony' )
	{
		var scroll = document.getElementById('mini');
		//objDiv.scrollTop = objDiv.scrollHeight;
		DeleteCookie('scroll_strony');
		SetCookie('scroll_strony', scroll.scrollTop);
	}
	else if( page == 'dodatki' )
	{
		var scroll = document.getElementById('dodatki');
		DeleteCookie('scroll_dodatki');
		SetCookie("scroll_dodatki", scroll.scrollTop);
	}
}

function moveScrollbarPosition( page, top )
{
	document.getElementById( page ).scrollTop = top;
}

function showMainHideProgress()
{
	document.getElementById( 'main_progress' ).style.display = 'none';
//	document.getElementById( 'main' ).style.display = 'block';
}
function getAllNodes( objRoot )
{
	arrNodes = new Array();
	arrNodes[0] = objRoot;
	nodes = objRoot.getElementsByTagName( 'p' );
	for( i=0; i<nodes.length; i++ )
	{
		arrNodes[arrNodes.length] = nodes[i];
	}
	nodes = objRoot.getElementsByTagName( 'span' );
	for( i=0; i<nodes.length; i++ )
	{
		arrNodes[arrNodes.length] = nodes[i];
	}
	nodes = objRoot.getElementsByTagName( 'div' );
	for( i=0; i<nodes.length; i++ )
	{
		arrNodes[arrNodes.length] = nodes[i];
	}
	nodes = objRoot.getElementsByTagName( 'li' );
	for( i=0; i<nodes.length; i++ )
	{
		arrNodes[arrNodes.length] = nodes[i];
	}
	return arrNodes;
}
/*
function _getAllNodes( objRoot )
{
	arrNodes = new Array();
	nodes = objRoot.getElementsByTagName( 'p' );
	for( i=0; i<nodes.length; i++ )
	{
		arrNodes[arrNodes.length] = nodes[i];
	}
	nodes = objRoot.getElementsByTagName( 'span' );
	for( i=0; i<nodes.length; i++ )
	{
		arrNodes[arrNodes.length] = nodes[i];
	}
	nodes = objRoot.getElementsByTagName( 'div' );
	for( i=0; i<nodes.length; i++ )
	{
		arrNodes[arrNodes.length] = nodes[i];
	}
	return;

	return arrNodes;
}
*/
//writeConsole('Hello from JavaScript!');
function writeConsole(content) {
 top.consoleRef=window.open('','myconsole',
  'width=350,height=250'
   +',menubar=0'
   +',toolbar=1'
   +',status=0'
   +',scrollbars=1'
   +',resizable=1')
 top.consoleRef.document.writeln(
  '<html><head><title>Console</title></head>'
   +'<body bgcolor=white onLoad="self.focus()">'
   +content
   +'</body></html>'
 )
 top.consoleRef.document.close()
}