function swapImages() {
  var $active = $('#partnerzy-gal .active');
  var $next = ($('#partnerzy-gal .active').next().length > 0) ? $('#partnerzy-gal .active').next() : $('#partnerzy-gal img:first');
  $active.fadeOut(function(){
  $active.removeClass('active');
  $next.fadeIn().addClass('active');
  });
}

$(function() {
  // Run our swapImages() function every 5secs
  setInterval('swapImages()', 2000);
});

$(function() {
        $('div.cykle_praca_foto a.powieksz').lightBox();
    });
$(function() {
        $('a.lightbox').lightBox();
    });

$(document).ready(function() {
   $("div#glowna").mousemove(function() {
       $("div#info").addClass("pokaz").slideDown("slow");
       $("div#info").removeClass("schowaj");
              
     return false;
   });
 });

function zmien_termin (stopien)
{
  for(i=1;i<=4;i++)
  {
    display_div('termin'+i,0);
    disable_field('termin'+i,1);
  }
  display_div('termin'+stopien,1);
  disable_field('termin'+stopien,0);
}

function closePopup()
{
  pokaz_div('popup_swf',0,this);
}
function close_popup(div)
{
  pokaz_div(div,0,this);
}

function change_menu (strona)
{
  var menu;
  menu=document.getElementById('menu_boczne');
  if(strona!='')
  {
    menu.src="gfx/menu/" + strona +".gif";
  }
  else
  {
    menu.src="gfx/menu/menu.gif";
  }  
}

/***********************************************
* DHTML slideshow script-  Ś Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice must stay intact for legal use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

var photos=new Array()
var photoslink=new Array()
var which=0
var foto=0

//Specify whether images should be linked or not (1=linked)
var linkornot=1

//do NOT edit pass this line

var preloadedimages=new Array()
for (i=0;i<photos.length;i++){
preloadedimages[i]=new Image()
preloadedimages[i].src=photos[i]
}


function applyeffect(){
if (document.all && photoslider.filters){
photoslider.filters.revealTrans.Transition=Math.floor(Math.random()*23)
photoslider.filters.revealTrans.stop()
photoslider.filters.revealTrans.apply()
}
}



function playeffect(){
if (document.all && photoslider.filters)
photoslider.filters.revealTrans.play()
}

function keeptrack(){
window.status="Image "+(which+1)+" of "+photos.length
}

function change_photo(foto){
which=foto
applyeffect()
document.images.photoslider.src=photos[foto]
document.anchors.photoslider.href=photoslink[foto]
playeffect()
keeptrack()
}

function backward(){
if (which>0){
which--
applyeffect()
document.images.photoslider.src=photos[which]
playeffect()
keeptrack()
}
}

function forward(){
if (which<photos.length-1){
which++
applyeffect()
document.images.photoslider.src=photos[which]
playeffect()
keeptrack()
}
}

function transport(){
window.location=photoslink[which]
}


function mycarousel_itemVisibleInCallback(carousel, item, i, state, evt)
{
    // The index() method calculates the index from a
    // given index who is out of the actual item range.
    var idx = carousel.index(i, mycarousel_itemList.length);
    carousel.add(i, mycarousel_getItemHTML(mycarousel_itemList[idx - 1]));
};
function mycarousel_itemVisibleOutCallback(carousel, item, i, state, evt)
{
    carousel.remove(i);
};

/**
 * Item html creation helper.
 */
function mycarousel_getItemHTML(item)
{
    return '<div class="cykle_praca_foto"><a href="?a=galeria_absolwentow&amp;opcja=show&amp;idgal=' + item.id + '"><img src="' + item.url + '" alt="' + item.title + '" /></a></div><div class="cykle_praca_tytul"><a href="?a=galeria_absolwentow&amp;opcja=show&amp;idgal=' + item.id + '">' + item.title + '</a></div></div>';
};


function okno(adres) 
{
   var nazwa = "WSF";
   var dane= "menubar=no, toolbar=no, location=no, scrollbars=yes, resizable=no, status=no, width=617, height=520";
   noweOkno = window.open(adres, nazwa, dane);
}

function pokaz_div(div,x,t)
{
	div_=document.getElementById(div);
 	if(x>0) { div_.style.visibility="visible";  }
 	else { div_.style.visibility="hidden" ;  }
}
function display_div(div,x,t)
{
	div_=document.getElementById(div);
 	if(x>0) { div_.style.display="block";  }
 	else { div_.style.display="none" ;  }
}
function disable_field(div,x)
{
	div_=document.getElementById(div);
 	div_.disabled=x;
}
function display_tr(div,x)
{
	div_=document.getElementById(div);
 	if(x>0) { div_.style.display="table-row";  }
 	else { div_.style.display="none" ;  }
}
function przekaz_wartosc(div1,div2)
{
	div1_=document.getElementById(div1);
	div2_=document.getElementById(div2);
 	div2_.value=div1_.value;
}

function findObj(n, d) {
		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 && document.getElementById) x=document.getElementById(n); return x;
}
function show(n) {
	nObject = findObj (n);
	if (nObject) nObject.style.display='';
}
function hide(n) {
	nObject = findObj (n);
	if (nObject) nObject.style.display='none';
}
function limit_short(text,max)
{
  if(text.value.length>max)
  {
   	text.value=text.value.substring(0,max);
  }
  else text.form.licznik_short.value=(max-text.value.length);
}
function limit(text,max)
{
  if(text.value.length>max)
  {
   	text.value=text.value.substring(0,max);
  }
  else text.form.licznik_opis.value=(max-text.value.length);
}
function limit_slowa(text,max)
{
  if(text.value.length>max)
  {
   	text.value=text.value.substring(0,max);
  }
  else text.form.licznik_slowa.value=(max-text.value.length);
}
function check(text)
{
  if(text.form.temat.value!='' && text.form.podpis_short.value!='' && text.form.podpis.value!='' && text.form.slowa_kluczowe.value!='')
  {
   	text.form.akcja.disabled=0;
  }
  else text.form.akcja.disabled=1;
}
