    // convert all characters to lowercase to simplify testing

    var agt=navigator.userAgent.toLowerCase();

    // *** BROWSER VERSION ***
    // Note: On IE5, these return 4, so use is_ie5up to detect IE5.
    var is_major = parseInt(navigator.appVersion);
    var is_minor = parseFloat(navigator.appVersion);

    var is_ie     = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
    var is_ie3    = (is_ie && (is_major < 4));
    var is_ie4    = (is_ie && (is_major == 4) && (agt.indexOf("msie 4")!=-1) );
    var is_ie4up  = (is_ie && (is_major >= 4));
    var is_ie5    = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")!=-1) );
    var is_ie5_5  = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.5") !=-1));
    var is_ie5up  = (is_ie && !is_ie3 && !is_ie4);
    var is_ie5_5up =(is_ie && !is_ie3 && !is_ie4 && !is_ie5);
    var is_ie6    = (is_ie && (is_major == 4) && (agt.indexOf("msie 6.")!=-1) );
    var is_ie6up  = (is_ie && !is_ie3 && !is_ie4 && !is_ie5 && !is_ie5_5);
    var is_opera = (window.opera)?true:false;
    var is_opera7 = (window.opera)?true:false;
    var is_gecko = (agt.indexOf('gecko') != -1);


if(document.all && !document.getElementById)
    document.getElementById = function(id) { return document.all[id]; }

if(document.all && !document.getElementsByTagName)
    document.getElementsByTagName = function(tag) { return document.all.tags(tag); }


var lo = 1;
function sof (a) {
	if (document.getElementById('foto' + lo)) document.getElementById('foto' + lo).style.display = 'none';
	document.getElementById('oferta' + lo).style.display = 'none';
	document.getElementById('lin' + lo).className = '';
	lo = a;
	if (document.getElementById('foto' + lo)) document.getElementById('foto' + lo).style.display = '';
	document.getElementById('oferta' + lo).style.display = '';
	document.getElementById('lin' + lo).className = 'selected';

}

function footReset() {
	f = document.getElementById('footer').style.position="relative";
	f = document.getElementById('footer').style.position="absolute";
	//alert('test');
	if (txtalert != '') {
		alert(txtalert);
		txtalert = '';
	}
}


function flash(name,src,x,y,ver,opcja) {
	

	if (opcja == 'w3c') {
		document.write ('<object id="'+name+'" type="application/x-shockwave-flash" data="'+src+'" width="'+x+'" height="'+y+'" >');
		document.write ('<param name="movie" value="'+src+'" >');
		document.write ('<param name="swliveconnect" value="true">');
		document.write ('</object>');
	}
	else {

		document.write ('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
		document.write ('codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='+ver+',0,0,0"');
		document.write ('width='+x+' height='+y+' id="'+name+'">');
		document.write ('<param name=movie value="'+src+'">');
		document.write ('<param name=quality value=high>');

		if (opcja == 'transparent') document.write ('<param name="wmode" value="transparent">');

		document.write ('<param name="swliveconnect" value="true">');
		document.write ('<embed src="'+src+'" quality="high" width="'+x+'" height="'+y+'"');
		document.write (' type="application/x-shockwave-flash"');
		document.write (' pluginspage="http://www.macromedia.com/downloads/"');
		document.write (' name="'+name+'" swliveconnect="true">');
		document.write ('</embed>');
		document.write ('</object>');
	}
}



var lastWin;
function setImg (imgSrc,reSize) {
	if (lastWin.jestem) {
		
		if (reSize == 1) {
			lastWin.document.body.innerHTML = '<img src="'+imgSrc+'" id="obrazek" onload="window.resizeTo(this.width + 10,this.height + 30);window.moveTo(20,20);" >'; 
			lastWin.focus();
		}
		else {
			lastWin.document.body.innerHTML = '<img src="'+imgSrc+'" id="obrazek" >'; 
		}
			
	}	
	else {
		setTimeout("setImg('"+imgSrc+"', '"+reSize+"')",100);
	}
}


function setSizeImg () {
	if (lastWin.document.getElementById('obrazek')) {

	//	lastWin.resizeTo(lastWin.document.getElementById('obrazek').width + 10,lastWin.document.getElementById('obrazek').height + 30);
	//	lastWin.moveTo(20,20); 
		alert(lastWin.document.getElementById('obrazek').src);
		lastWin.close(); 
		zoomImg(lastWin.document.getElementById('obrazek').src,lastWin.document.getElementById('obrazek').width,lastWin.document.getElementById('obrazek').height);
	}	
	else {
		setTimeout("setSizeImg()",100);
	}
}

// onload="window.resizeTo(this.width + 10,this.height + 30);window.moveTo(20,20);

function zoomImg(imgSrc,xSize,ySize) {
	reSize = 1;
	if (xSize && ySize) reSize = 0;
	if (!xSize) xSize=300;
	if (!ySize) ySize=300;
	scrollBary='no';
	xPos=20;
	lastWin = window.open('','Zoom', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars='+scrollBary+',resizable=yes,fullscreen=no,channelmode=no,width='+xSize+',height='+ySize+',top=0,left='+xPos);
	
	setImg (imgSrc,reSize);
	void(0);
}
function zoom2(imgSrc) {
	lastWin = window.open('sdgsdgsd','zoomOkno','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,fullscreen=no,channelmode=no,width=300,height=300,top=0,left=150');

	void(0);
}

function oW (path,Xsiz,Ysiz,Xp,Yp,resi,scrollb) {
	if (path.indexOf('zoom.php') != -1) path = '/heuristic2/'+path;
	var przed = '';
	if (!(Xsiz > 0)) { Xsiz = 300; }
	if (!(Ysiz > 0)) { Ysiz = 300; }
	if (Xp == 'right') Xp = screen.width - 20 - Xsiz;
	if (!(Xp > 0)) { Xp = 30; }
	if (!(Yp > 0)) { Yp = 30; }
	if (resi == null) resi = 'yes';
	if (scrollb == null) scrollb = 'yes';
	var w = window.open(przed+path, 'fotozoom', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars='+scrollb+',resizable='+resi+',fullscreen=no,channelmode=no,width='+Xsiz+',height='+Ysiz+',top='+Yp+',left='+Xp);
	w.focus();
	void(0);
}

function el (id) {
        return document.getElementById(id);
}

function tf (txt,id) {
		if (el(id).value == '') {
	        alert(txt);
			el(id).focus();
			return false;
		}
		else return true;
}

function ts (txt,id) {
		if (el(id).selectedIndex == 0) {
	        alert(txt);
			el(id).focus();
			return false;
		}
		else return true;
}

function te (txt,id) {
		if (el(id).value != '' && el(id).match(/^.*\@.*\..*$/)==null) {
	        alert(txt);
			el(id).focus();
			return false;
		}
		else return true;
}

function tc (txt,id) {
		if (!(el(id).checked)) {
		
	        if (txt != '') { alert(txt); el(id).focus(); }
			return false;
		}
		else return true;
}



function pobierz(nazwa) {
    if (document.cookie.length > 0) {
        startc = document.cookie.indexOf(nazwa + "=");
        if (startc != -1) {
            startc += nazwa.length + 1;
            endc = document.cookie.indexOf(";", startc);
            if (endc == -1) {
                endc = document.cookie.length;
            }
            return unescape(document.cookie.substring(startc,endc));
        }
	return false;
    }
    return false;
}

function rejestruj(nazwa, wartosc,dni) {
    var dzisiaj=new Date();
    var wygasnie=new Date();
    !dni ?dni=7 :"";
    // dni - data po kt�rej ciastko traci wa?no?a (domy?lnie tydzien)
    // je?li dni==0 to wa?ne w ci1gu danej "sesji"
    wygasnie.setTime(dzisiaj.getTime()+1000*60*60*24*dni);
	document.cookie=nazwa+"="+escape(wartosc)+";expires="+wygasnie.toGMTString();
}

function sClear(obj,itxt) {
	if (obj.value == itxt) obj.value = '';
}
function sReturn(obj,itxt) {
	if (obj.value == '') obj.value = itxt;
}


// **************** MENU *******************

var activeSubMenu = false;
var timeOut = 1000;

$(document).ready(function(){
	$('#menu ul li a.menu').mouseover(function(){subMenu($(this).get(0), 1);});
	$('#menu ul li a.menu').mouseout(function(){subMenu($(this).get(0), 0);});
	$('#menu ul li ul.submenu').mouseover(function(){overMenu($(this).get(0));
							 if($(this).parent().attr('class') != 'selected')
							 {
							 	$(this).parent().addClass('selected2');
							 }});
	$('#menu ul li ul.submenu').mouseout(function(){outMenu($(this).get(0));
							if($(this).parent().attr('class') != 'selected')
							{
								$(this).parent().removeClass('selected2');
							}});
});

function subMenu(obj,show)
{
  if(obj.nextSibling)
  {
    if(obj.nextSibling.innerHTML)
    {
      activeSubMenu = t = obj.nextSibling;	

      if (show)
      {
	allul = document.getElementsByTagName('ul');
	for (a = 0; a < allul.length; ++a) if (allul[a].className == 'submenu') allul[a].style.visibility = 'hidden';
	t.style.visibility = 'visible';
      }
      else
      {
        activeSubMenu = false;
	setTimeout ("hideSubmenu(document.getElementById('"+t.id+"'))",timeOut);
      }
    }
  }
}

function hideSubmenu(t) {
	if (!activeSubMenu || activeSubMenu != t) t.style.visibility = 'hidden';
}

function overMenu(t) {
	activeSubMenu = t;
}

function outMenu(t) {
	activeSubMenu = false;
 	setTimeout ("hideSubmenu(document.getElementById('"+t.id+"'))",timeOut);
}

function addslashes(str) {
	str=str.replace(/\'/g,'\\\'');
	str=str.replace(/\"/g,'\\"');
	str=str.replace(/\\/g,'\\\\');
	str=str.replace(/\0/g,'\\0');
	return str;
}
function stripslashes(str) {
	str=str.replace(/\\'/g,'\'');
	str=str.replace(/\\"/g,'"');
	str=str.replace(/\\\\/g,'\\');
	str=str.replace(/\\0/g,'\0');
	return str;
}

function emailValid(t,im,em) {
	
	var imie = document.getElementById('newsImieF');
	var mail = document.getElementById('newsEmailF');
	var er = document.getElementById('newsEmailI');
	
	try{
	if (!imie.value) {
		er.innerHTML = im;
		mail.focus(); 
		mail.parentNode.parentNode.className = 'alertRow';
		return false;
	}
	else {
		if (mail.value.indexOf('@',0) == -1 || mail.value.indexOf('.',0) == -1){
			er.innerHTML = em;
			mail.focus(); 
			mail.parentNode.parentNode.className = 'alertRow';
			return false;
		}
	}
	}
	catch(e){}
}

function emailPassValid(t,g) {
	
	var email = document.getElementById('emailF');
	var eror = document.getElementById('emailI');
	
	try{
	if (email.value.indexOf('@',0) == -1 || email.value.indexOf('.',0) == -1){
		eror.innerHTML = g;
		email.focus(); 
		email.parentNode.parentNode.className = 'alertRow';
		return false;
	}
	}catch(e){}
}


function prints(a) {


	var links = document.location.href;
	if(links.indexOf('#') != -1) {
		links=document.location.href.substring(0,links.indexOf('#'));

	}

	if(links[links.length-1] != '/') {
		links = links+'&print=1';
	}
	else {
		links = links+'page.php?print=1';
	}

	oW(links,740,740);

}


// **************** JQUERY *******************

$(document).ready( function(){
	 

	//zegar
	//CoolClock.findAndCreateClocks();

	// CYCLE DLA GALERII
	// -------------------------------------------------------------------------
	$('.galleryRollItems').cycle({
		fx:     'fade',  
    		speed:  'slow', 
   		timeout: 20000, 
    		next:   '#next', 
    		prev:   '#prev' 
	});
	// mp3 player
        $('img.actItemMp3').each(function(){

               if (this.alt != '') {
                       $(this).after('<object type="application/x-shockwave-flash" style="width: ' + this.width + 'px; height:' + this.height + 'px;" data="/mp3player.swf?mp3file=' + this.alt + '&txt=' + this.title + '"><param name="movie" value="/mp3player.swf?mp3file=' + this.alt + '&txt=' + this.title + '"/><param name="wmode" value="transparent" /></object>');
               }
        });
        $('img.actItemMp3').remove();


	// youtube player
        $('img.actItemYoutube').each(function(){

		if (this.alt != '') {
			$(this).after('<object type="application/x-shockwave-flash" style="width: ' + this.width + 'px; height:' + this.height + 'px;" data="' + this.alt + '"><param name="movie" value="' + this.alt + '" /><param name="wmode" value="transparent" /></object>');
		}		
	});
	$('img.actItemYoutube').remove();


	// last gallery
	$('.last_gallery').cycle({fx: 'fade',
		                       speed: 300,
	        	               timeout: 5000});


	//Menu class
	$('#menu li a.menu').hover(
		function(){
			if($(this).parent('li').attr('class') != 'selected'){
				$(this).children('.leftMenuCorner').addClass('leftMenuCornerHover');
				$(this).children('.rightMenuCorner').addClass('rightMenuCornerHover');
				$(this).children('.centerMenu').addClass('centerMenuHover');
			}
		},
		function(){
			if($(this).parent('li').attr('class') != 'selected'){
				$(this).children('.leftMenuCorner').removeClass('leftMenuCornerHover');
				$(this).children('.rightMenuCorner').removeClass('rightMenuCornerHover');
				$(this).children('.centerMenu').removeClass('centerMenuHover');
			}
		}
	);
	
	$('#menu li:last').css('background','none');
	
	


	





});



// ********************* MARQUEE *************************
$(document).ready(function() {

  $("#ma_marquee").marquee({ scrollSpeed: 30 }); 

});





// ********************* PRZETARGI **************************

$(document).ready( function(){

	$('.prz_attach').click(function() {
		if($(this).next().height()==0)
		{
			var tmp=$(this).next().children().height();
			$(this).next().animate({ height : tmp+'px' }, 200);
		}
		else
		{
			$(this).next().animate({ height : '0px' }, 200);
		}
	});



	$('.prz_s').click(function() {
		$('#data_start').val( $('#prz_ys').val()+'-'+$('#prz_ms').val()+'-'+ $('#prz_ds').val() );
	});

	$('.prz_e').click(function() {
		$('#data_koniec').val( $('#prz_ye').val()+'-'+$('#prz_me').val()+'-'+ $('#prz_de').val() );
	});

	
	$('#prz_sb').change(function() {
		window.location=$('#prz_sb').val();
	});
	
});


// ***************** CERTYFIKATY I PLIK PRZETARGU ************************

$(document).ready(function() {

	$('.cert_hov').hover(function(e) {
		$('#ttc_img').attr('src', $(this).next().attr('src') );
		$('#ttc_img').css('margin-top', (92-($(this).next().height()/2+10))+'px');
		$('#ttc_title').html( $(this).next().next().html() );
		$('#ttc_box').css('display', 'block');
		$('#ttc_box').css('left', ($(this).offset().left+($(this).width()/2)-190)+'px');
		$('#ttc_box').css('top', ($(this).offset().top-194)+'px');
	}, function() {
		$('#ttc_box').css('display', 'none');
	});


	$('.prz_tooltip').hover(function(e) {
		$('#ttf_txt').html( $(this).next().html() );
		$('#ttf_box').css('display', 'block');
		$('#ttf_box').css('left', ($(this).offset().left+($(this).width()/2)-30)+'px');
		$('#ttf_box').css('top', ($(this).offset().top-74)+'px');


	}, function() {
		$('#ttf_box').css('display', 'none');
	});



	// CYCLE DLA CERTYFIKATÓW
	// -------------------------------------------------------------------------
	$('.cert_box').cycle({
		fx:     'fade', 
    		speed:  'slow', 
   		timeout: 5000
	});


	
});







// *************** NAGRODY ******************

$(document).ready(function() {


	// CYCLE DLA NAGRÓD
	// -------------------------------------------------------------------------
	$('.nagr_box').cycle({
		fx:     'fade', 
    		speed:  'slow', 
   		timeout: 4000
	});

    $(".centerMenu").mouseup(function(){
     // $(this).append('<span style="color:#F00;">Mouse up.</span>');
//	$(this).css('color', '#ffffff');
    }).mousedown(function(){
     // $(this).append('<span style="color:#00F;">Mouse down.</span>');
	//alert('dwn');
//	$(this).css('color', '#ff0000');
    });



    $(".menu").mouseup(function(){
     // $(this).append('<span style="color:#F00;">Mouse up.</span>');
//	$(this).css('color', '#ffffff');
    }).mousedown(function(){
     // $(this).append('<span style="color:#00F;">Mouse down.</span>');
	//alert('dwn');
//	$(this).css('color', '#ff0000');
    });	

	$(".menu").hover(function() {
		$(this).children().next().css('color', '#1178B1');	
	}, function() {
		if($(this).children().next().hasClass("centerMenuHover"))
		{
			$(this).children().next().css('color', '#1178B1');	
		}
		else
		{
			$(this).children().next().css('color', '#ffffff');	
		}
	});


});



$(document).ready(function() {

//	if($('#home_ban').length)
//	{
//		if($.browser.msie){
//			$('#home_ban').html('<!-- actItemSwf:0:alt="/xban_loader.swf?xmlf=onasie&mainPath=/&url=&"  title="" width="500" height="337":START --><object type="application/x-shockwave-flash" style="width: 500px; height:337px;" data="/xban_loader.swf?xmlf=onasie&mainPath=/&url=&"><param name="movie" value="/xban_loader.swf?xmlf=onasie&mainPath=/&url=&" /><param name="wmode" value="transparent" /></object><!-- actItemSwf:0:END -->');
//			//$('#home_ban').html('<img width="500px" height="337" src="/img/banery/home/homeie.jpg"/>');
//		}
//	}
});


// *************** BLING BLING ******************


$(document).ready(function() {

	$('#oh_launch').click(function() {
		if($('#oh_short').css('display')=='block')
		{
			$('#onas_swf').css('display', 'none');
			$('#oh_short').css('display', 'none');
			$('#oh_cont').css('display', 'block');
			$(this).html(wstecz_txt);
			$(this).css('background', 'url(/img/layout/back.gif) no-repeat 0 3px');
		}
		else
		{
			$('#onas_swf').css('display', 'block');
			$('#oh_short').css('display', 'block');
			$('#oh_cont').css('display', 'none');
			$(this).html(wiecej_txt);
			$(this).css('background', 'url(/img/layout/markers/more.gif) no-repeat 0 3px');
		}
	});


	$('.sciezkaBox a').click(function() {
		var x = 0;
		var y = 0;
		if (self.innerHeight) {
			x = self.innerWidth;
			y = self.innerHeight;
		}
		else if (document.documentElement && document.documentElement.clientHeight) {
			x = document.documentElement.clientWidth;
			y = document.documentElement.clientHeight;
		}
		else if (document.body) {
			x = document.body.clientWidth;
			y = document.body.clientHeight;
		}

		if (y < 800 || x < 1024) {
			window.location=$(this).attr("href");
		}
	});

});

