function addEvent(obj, type, fn) {
			if (obj.addEventListener) {
					obj.addEventListener(type, fn, false);
			} 
			else if (obj.attachEvent) {
				obj["e"+type+fn] = fn;
				obj[type+fn] = function() {obj["e"+type+fn](window.event); 
			}
				obj.attachEvent("on"+type, obj[type+fn]);
			}
}
		
function funkcja_inicjujaca() {
			
		}
		
addEvent(window, "load", funkcja_inicjujaca);


function inicjalizacja () {
	 podmenu ();
	 fckeditor ();
	 galeria_podglad ();
	 swf_reklama ();
}

function podmenu () {
			
			$("ul.podmenu_lista li ul").not("ul.pokaz_menu").hide();
			$("ul.podmenu_lista li ul").prev("a").click( 
					function () {
					
							$(this).next("ul").slideToggle();
							$("ul.podmenu_lista li a").not(this).next("ul:visible").slideUp();
							
							return false;
					});
}

function fckeditor () {
	if (document.getElementById('tresc')) {
	var oFCKeditor = new FCKeditor( 'tresc' ) ;
	oFCKeditor.BasePath = "/js/fckeditor/" ;
	oFCKeditor.ToolbarSet = 'Tygodnik' ;

	oFCKeditor.ReplaceTextarea() ;
	}
	if (document.getElementById('wstep')) {
	var oFCKeditor2 = new FCKeditor( 'wstep' ) ;
	oFCKeditor2.BasePath = "/js/fckeditor/" ;
	oFCKeditor2.ToolbarSet = 'Tygodnik' ;

	oFCKeditor2.ReplaceTextarea() ;
	}
}

function galeria_podglad () {
	
	$("a.powieksz").colorbox({initialWidth:156, initialHeight:80, maxWidth:"95%", maxHeight:"90%", scrolling:"false", rel:"true"});
}

function swf_reklama () {
  	
  	nazwa = $('div.reklama div.swf').text();
	var wartosc = nazwa.split('/');

  	$('div.reklama div.swf').flash(
	{
		swf: '/zarzadzanie/uploads/reklama/'+wartosc[0]+'',
		height: wartosc[1],
		width: 598 
	}
	);
}


