var CNavigation = {
	doPrint: function() {},
	displayPrintPreview: function() {},
	goBack: function() {}
};

CNavigation.doPrint = function() {
	window.print();
};

CNavigation.displayPrintPreview = function() {
	window.open(this, 'drukuj', 'toolbar=no, menubar=no, location=no, personalbar=no, status=no, resizable=no, scrollbars=yes, copyhistory=no, width=980, height=600, top=30, left=30');
	
	return false;
};

/**
 * Prosta metoda powodująca cofnięcie się na poprzednią stronę (wykorzystuje obiekt history)
 */
CNavigation.goBack = function() {
	history.back();
	
	return false;
};

if( typeof(jQuery) == 'function' ) {
	/**
	 * Prosta metoda debugująca
	 * 
	 * @param Handler hObj uchwyt do obiektu, tablicy, której elementy mają być wyświetlone
	 * @param Integer iDepth ilość zapętleń
	 */
	CNavigation.doDebug = function(hObj, iDepth) {
		var msg = '';
		
		jQuery.each( hObj, function(i, j) {
			msg += i+": "+j+"\r\n";
			
			if( iDepth >= 1 ) {
				jQuery.each( j, function(k, l) {
					msg += k+": "+l+"\r\n";
					
					if( iDepth >= 2 ) {
						jQuery.each( l, function(m, n) {
							msg += m+": "+n+"\r\n";
						});
					}
				});
			}
		});
		
		alert(msg);
	};

	/**
	 * Coś w stylu kontrolera
	 */
	$(document).ready(function() {
		$(".bottomPanel .back").click( CNavigation.goBack );
		$(".lokalizatorPanel .back-2").click( CNavigation.goBack );
		
		$(".bottomPanel .print_bottom").click( CNavigation.displayPrintPreview );
		$(".lokalizatorPanel .print_bottom").click( CNavigation.displayPrintPreview );
		
		$(".do_print").click( CNavigation.doPrint );
	});
} else {
	alert('BŁĄD KRYTYCZNY!\r\nBrak biblioteki jQuery. Część elementów może nie działać. (kalendarz.js)');
}
