var odswiezanie = false;

function cbinit()
{
	try{$("a[rel='admin'], a[ref='admin'], a.edytuj").colorbox({width:"900px", height:"100%", iframe:true, current:'', overlayClose:false});} catch(e) { }
	try{$("a[rel='zdjecia']").colorbox({transition:"elastic", maxHeight:"100%", scalePhotos:true, current:'Zdjęcie: {current} z {total}'});} catch(e) { }
	$(document).bind('cbox_open', function(){
		$('object,embed').hide();
		if ($.fn.colorbox.element().attr('rel') == 'admin' || $.fn.colorbox.element().attr('ref') == 'admin' || $.fn.colorbox.element().hasClass('edytuj'))
		{
			$('html').scrollTop(0);
			$('html').addClass('bez_przewijakow');
		}
	});
	$(document).bind('cbox_closed', function(){
		$('object,embed').show();
		if ($.fn.colorbox.element().attr('rel') == 'admin' || $.fn.colorbox.element().attr('ref') == 'admin' || $.fn.colorbox.element().hasClass('edytuj'))
		{
			$('html').removeClass();
			if (odswiezanie)
			{
				window.location.href = window.location.href;
			}
		}
	});
}

$(document).ready(function(){
	cbinit();
});
