function Init() {
	LightboxInit();
	EventsInit();
	SetSize();
	$('#Top').each(function(){InsertFlash('/fla/top.swf', 950, 265, 'Top');});
}

function Zaokraglij(co, ile) {
	li = Math.pow(10, ile);
	w = Math.round(co * li) / li;
	return w;
}

function LightboxInit() {
	$("#Left A").each(function(){
		if (UseLightbox($(this).attr('href'))) $(this).attr('name', 'UseLBox');
	});
	$("#Left A[name='UseLBox']").lightBox();
	$("#Left A[name='UseLBox']").attr("title", "Kliknij z boku zdjęcia aby zobaczyć następne.");
}

function UseLightbox(string) {
	if (string.indexOf('.jpg') > 0) return true;
	if (string.indexOf('.jpeg') > 0) return true;
	if (string.indexOf('.gif') > 0) return true;
	if (string.indexOf('.png') > 0) return true;
	if (string.indexOf('.bmp') > 0) return true;
	if (string.indexOf('.tif') > 0) return true;
	return false;
}

function InsertFlash(fla, w, h, div) {
	var so = new SWFObject(fla, "mymovie", w, h, "8", "transparent");
   so.addParam("wmode", "transparent");
   so.write(div);
}

function SetSize() {
	l = $('#Left').height();
	r = $('#Right').height();
	if (l > r) $('#Right').height(l);
}

function SprawdzMail() {
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (!filter.test(document.getElementById('email').value)) w = 1;
																		  else w = 0;
	if (w == 1) {
						window.alert('Nieprawidłowy adres e-mail!');
						return false;
	} else return true;
}
		
function EventsInit() {

}

if (window.addEventListener) {
	window.addEventListener("load", Init, false);
}else if (window.attachEvent) {
	window.attachEvent("onload", Init);
}

