
function getElement(id)
{
	if (document.all)
		return document.all[id];
	else if (document.getElementById)
		return document.getElementById(id);
	else
		return false;
}


function setButtonStyle(button,state,size)
{
	var isObject = typeof button == 'object';
	
  	style = isObject ? button.style : eval(button+".style");

	var imageName = size > 0 && size < 4 ? "button0" + size : "button01";
    style.backgroundImage = state=='on' ? "url(cms/images/buttons/"+imageName+"_b.gif)" : "url(cms/images/buttons/"+imageName+"_a.gif)";
}


//
// Otwiera nowe okno popup.
//
function openPopupWindow(strName, strLocation, width, height)
{
	if ( strLocation.indexOf("popup=1")<0 )
	{
		// dodaj popup=1 do URL'a
		if ( strLocation.indexOf('?') >=0 )
			strLocation += "&popup=1";
		else
			strLocation += "?popup=1";
	}
	var popupWindow = window.open(strLocation, strName, 'toolbar=no, location=no, height='+height+', width='+width+', '+
		'status=no, menubar=no, scrollbars=yes, resizable=yes, top=' +
		(window.screen.height/2 - height/2) + ', left=' + (window.screen.width/2 - width/2));
	//setTimeout("popupWindow.focus()", 1000);
	popupWindow.focus();
	return popupWindow;
}

//
// Otwiera nowe okno popup. Uzywane przez modul linkman.
//
function linkmanOpenPopup(windowName, location, options)
{
	if ( location.indexOf("popup=1")<0 )
	{
		// dodaj popup=1 do URL'a
		if ( location.indexOf('?') >=0 )
			location += "&popup=1";
		else
			location += "?popup=1";
	}
	var popupWindow = window.open(location, windowName, options);
	//setTimeout("popupWindow.focus()", 1000);
	popupWindow.focus();
	return popupWindow;
}

//--------------------------------------

//
// Funkcje związane z parsowaniem i formatowaniem daty.
//

//
// Dodaje dni do daty.
//
function addDaysToDate(date, numOfDays)
{
	return new Date(date.getFullYear(), date.getMonth(), date.getDate()+numOfDays);
}

//
// Zamienia string w formacie YYYY-MM-DD na obiekt typu Date.
//
function parseDate(dateString)
{
	var str = new String(dateString);
	var array = str.split('-');
	if (array.length!=3)
		return null;
	var year = array[0];
	var month = array[1].charAt(0)=='0' ? parseInt(array[1].substr(1, 1)) : parseInt(array[1]);
	var day = array[2].charAt(0)=='0' ? parseInt(array[2].substr(1, 1)) : parseInt(array[2]);
	var date = new Date(year, month-1, day);
	if (isNaN(date))
		return null;
	date.setHours(0);
	date.setMinutes(0);
	date.setSeconds(0);
	date.setMilliseconds(0);
	return date;
}

//
// Zamienia obiekt Date na string w formacie YYYY-MM-DD.
//
function formatDate(date)
{
	return date.getFullYear() + "-" + formatDatePart(date.getMonth()+1) +
		"-" + formatDatePart(date.getDate());
}

//
// Funkcja pomocnicza dla funckcji formatDate(). Dodaje znak '0' do czesci daty.
//
function formatDatePart(value)
{
	var v = String(value);
	return v.length==1 ? "0"+v : v;
}

//--------------------------------------

//
// Funkcje związane z DP2
//

// Otwarcie popupa z formularzem rezerwacji biletów autorstwa Artura Godziny i Anixe.
function openAirTickets()
{
	window.open('http://www.odkryjpolske.pl/~godzina/bilety/bilety.php','','width=640,height=480,scrollbars=yes,resizable=yes');
}

/*

function lib_bwcheck(){ //Browsercheck (needed)

	this.ver=navigator.appVersion

	this.agent=navigator.userAgent

	this.dom=document.getElementById?1:0

	this.opera5=this.agent.indexOf("Opera 5")>-1

	this.opera6=this.agent.indexOf("Opera 6")>-1  

	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5 && !this.opera6)?1:0; 

	this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5 && !this.opera6)?1:0;

	this.ie4=(document.all && !this.dom && !this.opera5)?1:0;

	this.ie=this.ie4||this.ie5||this.ie6

	this.mac=this.agent.indexOf("Mac")>-1

	this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0; 

	this.ns4=(document.layers && !this.dom)?1:0;

	this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5 || this.opera6);

	return this

}

var bw=new lib_bwcheck();

*/



