/***********************************************
* 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 fadeIn_img(imageId) 
{
    $("#"+imageId).animate({
  	opacity: .99
  	}, 340, function() {
});
}
function fadeOut_img(imageId) 
{
    $("#"+imageId).animate({
  	opacity: .5
  	}, 340, function() {
});
}

$(function() {
        $('a.lightbox').lightBox();
    });



var move=0;
var pokaz=0;

function scrollimages (fromid, toid, rate, maxid, direction)
{
   var i=(fromid+move*rate);
   var max=(toid+move*rate);
   
   if(pokaz>0)
   {
       if(direction=='przod')
       {
         i+=rate;
         max+=rate;
         if(max>=maxid)
         {
            i=maxid-rate+1;
            max=maxid+1;
            move-=1;
         }
         
         for(;i<max;i++)
         {
            $("div#port-lista"+i).fadeIn("100");
         }
         move+=1;
       }
       
       if(direction=='tyl')
       {
         i-=rate;
         max-=rate;
         
         if(i<0)
         {
           i=0;
           max=rate;
           move+=1;
         }
         
         for(;i<max;i++)
         {
            $("div#port-lista"+i).fadeIn("100");
         }
         move-=1;
       }
       pokaz=0;
  }
  else
  {
    for(hide=0;hide<=maxid;hide++)
    {
        $("div#port-lista"+hide).fadeOut("100");
    }
    pokaz=1;
    setTimeout("scrollimages ("+fromid+", "+toid+", "+rate+", "+maxid+", '"+direction+"');",400);
  }     
   
   
}

function okno(adres) 
{
   var nazwa = "eXonet.pl";
   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 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;
}

if (window != top) top.location.href = location.href;

