


function okno(nazwa,szer,wys)
{	 
	if(eval(szer)==0)
		szer = 100;
	if(eval(wys)==0)
		szer = 200;
	window.open(nazwa,'','toolbar=no,scrollbars=yes,resizable=yes,status=no,location=no,directories=no,width='+eval(szer)+',height='+eval(wys)+',menubar=no,top=200,left=200')
}

function fullscreen(plik,nazwa)
{	 
	window.open(plik,nazwa,'fullscreen=yes')
}

function ant_kalendarz_zmien_zakres(panel,link)
{
    $('#'+panel).load(link);
}

		var data_od;
		var data_do;
		var ONEDAY = 3600 * 24;

		function resetDates() {
			data_od = data_do = null;
		}

		function filterDates1(cal) {
			data_od = cal.date.getTime();
			/* If they haven't chosen an 
			end date before we'll set it to the same date as the start date This
			way if the user scrolls in the start date 5 months forward, they don't
			need to do it again for the end date.
			*/

			if (data_do == null) { 
				Zapatec.Calendar.setup({
					inputField     :    "data_od",
					button         :    "trigger_od",  // What will trigger the popup of the calendar
					ifFormat       :    "%b %d, %Y",
					date           :     cal.date,
					showsTime      :     false,          //no time
					dateStatusFunc		:    disallowDateBefore, //the function to call
					onUpdate       :    filterDates2
				});
			}
		}

		function filterDates2(cal) {
			var date = cal.date;
			data_do = date.getTime()
		}

		/*
		* This functions return true to disallow a date
		* and false to allow it.
		*/


		/* 
		* Can't choose days before today or before the
		* end date
		*/
		function disallowDateBefore(date) {
			date = date.getTime();
			if ((data_od != null) && (date < (data_od + ONEDAY))) {
				//start date can't be prior to end date
				return true; 
			} 
			var now = new Date().getTime();
			if (date < (now - ONEDAY)) {
				//start date can't be prior to today
				return true;
			}

			return false;
		}

		/* 
		* Can't choose days before today or before the
		* start date
		*/
		function disallowDateAfter(date) {
			date = date.getTime();
			if ((data_do != null) && (date > (data_do - ONEDAY))) {
				//end date can't be before start date
				return true;
			} 

			var now = new Date().getTime();
			if (date < (now - ONEDAY)) {
				//end date can't be prior to today
				return true;
			}
			return false;
		}
