var l18n = {

	loginMethodLegend: 'Wybierz sposóbb logowania',
	loginMethod: 'Sposób',
	loginMoreOptions: 'Więcej opcji',
	loginLessOptions: 'Mniej opcji',

	contactAllow: 'Chcę otrzymać odpowiedź',

	taxCategories: 'Kategorie',
	taxTags: 'Tagi',
	quickToggle: 'Zmaksymalizuj panel',
	quickToggleOff: 'Zminimalizuj panel',
	areaResize: 'Kliknij i pociągnij w dół, aby zwiększyć wysokość pola tekstowego',
	selectAll: 'Zaznacz wszystkie',
	deselectAll: 'Odznacz wszystkie',
	showMiniblog: 'Rozwiń »',
	htmlSwitch: 'Wyłącz HTML',
	htmlSwitchOff: 'Włącz HTML',
	hideMiniblog: 'Zwiń «',
	invertSelection: 'Odwróć zaznaczenie',
	emoticonPreview: 'Podgląd emotikony',
	uploadOptions: 'Zmień liczbę pól',
	chooseFile: 'Wybierz plik:',
	uploadDelete: 'Usuń',
	fileType: 'Typ pliku',
	passwordShowHide: 'Pokaż hasło w trakcie wpisywania',
	bricksMini: 'Pokaż opis szablonów',
	bricksMiniOff: 'Ukryj opis szablonów',
	entryPreviewSwitch: 'Ukryj podgląd',
	entryPreviewSwitchOff: 'Pokaż podgląd',
	addReader: 'Dodaj czytelnika',
	addReaderType: 'Typ:',
	addReaderAcc: 'Jogger.pl',
	addReaderPass: 'Spoza Jogger.pl',

	addNewLink: 'Dodaj link',
	addNewLinkNot: 'Anuluj',
	addNewLinkDesc: 'Dodaj opis tekstowy +',
	addNewLinkDescNot: 'Usuń opis tekstowy',
	addNewLinkXFN: 'Dodaj relację (XFN) +',
	addNewLinkXFNNot: 'Usuń relację (XFN)',

	qtSortTags: 'Zmień kolejność tagów',
	qtSortTagsOff: 'Ok, skończone',
	qtShowMore: 'Więcej tagów',
	qtShowLess: 'Mniej tagów',
	qtCloseTags: 'Zamknij wszystkie tagi',
	qtCompactForm: 'Włącz widok kompaktowy',
	qtCompactFormOff: 'Wyłącz widok kompaktowy',
	qtReorderTags: 'Zmień kolejność tagów',

	qtH3title: 'Quicktags',
	qtAddNew: 'Dodaj nowy tag',
	qtDelTag: 'Usuń tag',

	qtInfoTitle: 'Opis, tytuł, accesskey:',
	qtInfoExtra: 'Dodatkowy',

	qtTagsInfo: 'Tagi:',
	qtTagsOpen: 'Otwierający',
	qtTagsClose: 'Zamykający',
	qtTagsSingle: 'To jest pojedynczy tag',

	qtAttrsRow: 'Atrybuty:',
	qtAttrsName: 'Nazwa atrybutu',
	qtAttrsDefault: 'Domyślny tekst',
	qtAttrsReq: 'Wymagany',
	qtAttrsNew: 'Dodaj nowy atrybut',
	qtAttrsDel: 'Usuń',

	entryPreview: 'Podgląd wpisu',
	entryPreviewClose: 'Zamknij'

};

var Jogger = {

	userLogged: false,

	start: function() {
		this.isLogged();
		this.enhanceAccounts();
/*		if (document.body.id == 'single-contact') {
			this.enhanceContact();
		}
*/
		/*@cc_on
		/*@if (@_win32)
		this.fixIEFocus();
		/*@end@*/
	},

	isLogged: function() {
		if (document.body.className == 'logged') this.userLogged = true;
	},

	enhanceAccounts: function() {
		var acc = $('#actions li.accounts');
		var accul = acc.find('ul');
		if (accul.size() > 0) {
			acc.attr('id', 'accounts-js').children('a')
				.addClass('js')
				.bind('click', function(e) {
					var self = this;
					if ($(this).is('.selected')) {
						$(this).removeClass('selected');
						accul.hide();
					} else {
						$(this).addClass('selected');
						accul.show();

						$(document).bind('click', function(e) {
							if (e.target !== self) {
								$(self).removeClass('selected');
								accul.hide();
							}
						});

					}
					e.preventDefault();
				});

			accul
				.css('minWidth', acc.width() + 'px')
				.find('a').css('minWidth', acc.width() + 'px')
				/*@cc_on
				/*@if (@_win32)
				.css('width', acc.width() + 'px')
				/*@end@*/
		}
	},
/*
	enhanceContact: function() {

		var $handle = $('div.grid:eq(1)');
		var $next = $handle.next();
		var $allow = $next.add($next.next());

		var $div1 = $(document.createElement('div'));
		var $div2 = $(document.createElement('div'));
		var $label = $(document.createElement('label'));
		var $input = $(document.createElement('input'));

		$div1.addClass('indent').append($div2);
		$div2.addClass('fields').append($label);
		$input.attr({ 'id': 'contact-reply', 'type': 'checkbox' }).bind('click', function() {
			if (this.checked) {
				$allow.show();
			} else {
				$allow.hide().find('input').val('');
			}
		});
		$label.attr('for', 'contact-reply').append($input).append(l18n.contactAllow);

		$allow.hide();
		$handle.after($div1);
	},
*/
	fixIEFocus: function() {
		$('#access-content a').add('#access-sidebar a').bind('focus', function() {
			this.className = 'focus';
		}).bind('blur', function() {
			this.className = '';
		});
	}

}

function initialize() {
	Jogger.start();
	if (typeof JoggerHome != 'undefined') JoggerHome.start();
	if (typeof JoggerFrontend != 'undefined') JoggerFrontend.start();
}

$().ready(initialize);


