
//////////////////////////////////////////////////////

var galLength1;
var pages1;
var przewijanie1;
var currentPage = 0;

var pages_length=1;

function catScrollInit(){
 pages1 = $$('.small_gal_page');
 pages_length = pages1.length;
 catScroll();
}

function catScroll(){
 przewijanie1 = new Fx.Scroll("scroll_div",{duration:500});
 galLength1 = pages_length*780;
 $('scroll_content').style.width = galLength1+'px';
}

function catScrollTo(element){
 przewijanie1.toElement($(element));
}

function catScrollRight(){
 if(currentPage<(pages_length-1)){
 catScrollTo(pages1[currentPage+1]);
 currentPage++;
 return;
 }
}

function catScrollLeft(){
 if(currentPage>0){
 catScrollTo(pages1[currentPage-1]);
 currentPage--;
 return;
 }
}


/////////////

var fade;
var currentImgSrc = '';
var currentImgDescription = '';
var imgload=0;
var imgloadfadecmplt = 0; 

function loadImg(newSrc,bigSrc, w, h){
    var img = $('big_img');
     var newImg = new Image();
    //newImg.removeEvents();
     newImg.src = newSrc;
     imgloadfadecmplt = 0;
     fade = new Fx.Style(img,'opacity',{ duration:50,
        onComplete: function(){
			if(imgload!=1){
				imgloadfadecmplt = 1;
			}
            if(imgload == 1){
                imgload=0;
                img.src = newImg.src;
                fade.stop();;
                fade.start(0.1,1);
            }
        }
     });
     fade.start(1,0.1);
     newImg.onload = function(){
            imgload = 1;
			if(imgloadfadecmplt == 1){
				img.src = newImg.src;
				fade.start(0.1,1);
				imgload = 0;
			}
     }   
     if (newImg.complete)
    	{
    		imgload = 1;
			
    	} 
    	/*
  	$('big_img').onclick = function(){
                popImage2(bigSrc,'obrazek',w,h);
            }
    */
}   


var MAX_DUMP_DEPTH = 10;

      

       function dumpObj(obj, name, indent, depth) {

              if (depth > MAX_DUMP_DEPTH) {

                     return indent + name + ": <Maximum Depth Reached>";

              }

              if (typeof obj == "object") {

                     var child = null;

                     var output = indent + name + "<br/>";

                     indent += "\t";

                     for (var item in obj)

                     {

                           try {

                                  child = obj[item];

                           } catch (e) {

                                  child = "<Unable to Evaluate>";

                           }

                           if (typeof child == "object") {

                                  output += dumpObj(child, item, indent, depth + 1);

                           } else {

                                  output += indent + item + ": " + child + "<br/>";

                           }

                     }

                     return output;

              } else {

                     return obj;

              }

       }
