
function foto(url,width,height,closeOnClick,windowName,windowTitle,t){
	if(!url)return
	function readSize(){if(t.complete)showPopup(t.width,t.height);else setTimeout(readSize,1e2)}
	function showPopup(w,h){with(window.open('',windowName||'','width='+(width||w)+',height='+(height||h)).document){open();write('<html><head><title>'+(windowTitle||'')+'</title></head><body style="margin:0;padding:0"><img src="'+url+'" style="display:block'+(closeOnClick?';cursor: pointer" onclick="self.close()" title="Zamknij okno"':'"')+'></body></html>');close()}}
	if(!width||!height)t=new Image(),t.src=url,readSize()
	else showPopup(width,height)
}

function sprawdz(adres) 
{
	if (adres != "") 
	{
		var re = new RegExp("[^@]{1,}[@]{1}[^@.]{1,}[.]{1}[^@]{1,}","gi");
		var wynik = re.test(adres);
		if (wynik == true) 
		{
			return true;
		}
		if (wynik == false) 
		{
			window.alert("Nieprawidłowy adres e-mail.");
			return false;
		}
	}
	window.alert("Nieprawidłowy adres e-mail.");
	return false;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
 
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function fot(nr) {
	if(nr==1) foto('gfx/katowice-foto-duze.jpg',800,323,false,'foto','DuetCentrum.pl');
	if(nr==2) foto('gfx/warszawa-foto-duze.jpg',640,480,false,'foto','DuetCentrum.pl');
}

function slideShow() {
  
	$('div.med:first').fadeIn(2500);
	//$('div.med').css({opacity: 0.0});
	//$('div.med:first').css({opacity: 1.0});
	gallery();
	setInterval('gallery()',5000);
	
}

function gallery() 
{	
	var current = ($('div.med.show')?  $('div.med.show') : $('div.med:first'));
	var next = ((current.next().length) ? ((current.next().hasClass('caption'))? $('div.med:first') :current.next()) : $('div.med:first'));	
	//Set the fade in effect for the next image, show class has higher z-index
	
  //Hide the current image
  current.removeClass('show')
  .fadeOut(2500);
  
  //Set the fade in effect for the next image, show class has higher z-index
  next.addClass('show')
	.fadeIn(2500);
}
function nazyczenie()
{
  $('#nazyczenie').fadeOut(2000).fadeIn(2000);
}

function baner_hid()
{
  var div=document.getElementById('baner_s');
  //div.style.display='none';
  //div.style.visibility='hidden';
  Effect.Fade(div, {delay: .1, duration: 3 });
  var div=document.getElementById('baner_s_close');
  div.style.display='none';
  div.style.visibility='hidden';
  return false;
}
function baner_hid_now()
{
  var div=document.getElementById('pods_zamknij');
  div.style.display='none';
  var div=document.getElementById('bpodsumowanie');
  div.style.display='none';
  //div.style.visibility='hidden';
  //div.style.visibility='hidden';
  return false;
}
$(document).ready(function()
{
      $('ul.sf-menu').superfish();
      
      //$.preloadCssImages();
      
      slideShow();
      
      $('a.lightbox').lightBox();
      
      $(".tt").easyTooltip();
      
      /*$('#jsddm > li > a').each(function(){
          var x= $(this);
          var tlo = x.css('background-image');
          var s=tlo.split('.');
          x.hover(function(){
            x.css('background-image', s[0] + '.' + s[1] + '.' + s[2] + 'a.jpg');
          },
          function(){
            x.css('background-image', s[0] + '.' + s[1] + '.' + s[2] + '.jpg');
          })
      });*/
      /*$('#nazyczenie').fadeIn(2000);
      setInterval('nazyczenie()',3000);*/
      
});







