var fotogallery=
{
    time:null,moveTrack:6,moveDirection:0,tapeLength:0,gCont:null,imgBigArray:new Array,imgGallery:'photo',imgDescribe:'desc-title',bigZoom:'zoom',bigLink:'big-url',bigBox:'photo-big',bigCont:'big-cont',iB:null,_gE:function(o)
    {
        return document.getElementById(o)
    }
    ,init:function()
    {
        var gallery=fotogallery._gE('gallery');
        fotogallery.gCont=fotogallery._gE('gs');
        function countTapeLenght()
        {
            var gHeight=parseInt(fotogallery._getstyle(gallery,'','height',1));
            var oneImgHeight=parseInt(fotogallery._getstyle(fotogallery.gCont.getElementsByTagName('img')[0],'','height',1));
            var oneDivMargin=parseInt(fotogallery._getstyle(fotogallery.gCont,'div','marginTop',0));
            var imgCount=fotogallery.gCont.getElementsByTagName('img').length;
            fotogallery.tapeLength=-((imgCount*oneImgHeight)+((imgCount+1)*oneDivMargin)+(imgCount*2)-gHeight)
        }
        if(navigator.userAgent.indexOf('KHTML')!=-1)
        {
            fotogallery.gCont.getElementsByTagName('img')[0].onload=countTapeLenght
        }
        else
        {
            countTapeLenght()
        }
    }
    ,_getstyle:function(o,w,a,t)
    {
        if(t==1)
        {
            return o.currentStyle?o.currentStyle[a]:document.defaultView.getComputedStyle?document.defaultView.getComputedStyle(o,null).getPropertyValue(a):window.getComputedStyle(o,null)[a]
        }
        else
        {
            return o.getElementsByTagName(w)[0].currentStyle?o.getElementsByTagName(w)[0].currentStyle[a]:document.defaultView.getComputedStyle?document.defaultView.getComputedStyle(o.getElementsByTagName(w)[0],null).getPropertyValue("margin-top"):window.getComputedStyle(o.getElementsByTagName(w)[0],null)[a]
        }
    }
    ,fillBigArray:function(urlBig,widthBig,heightBig,desc)
    {
        for(i=0;i<this.imgBigArray.length;i++)
        {
            if(urlBig==this.imgBigArray[i].url)
            {
                return 0
            }
        }
        var im=new Object();
        im.url=urlBig;
        im.width=widthBig;
        im.height=heightBig;
        im.desc=desc;
        this.imgBigArray[this.imgBigArray.length++]=im
    }
    ,_moveScroll:function()
    {
        if(fotogallery.gCont.style.marginTop)
        {
            if(fotogallery.tapeLength<0)
            {
                if((parseInt(fotogallery.gCont.style.marginTop)>=fotogallery.tapeLength&&fotogallery.moveDirection==-1)||(parseInt(fotogallery.gCont.style.marginTop)<=0&&fotogallery.moveDirection==1))
                {
                    fotogallery.gCont.style.marginTop=(parseInt(fotogallery.gCont.style.marginTop)+(fotogallery.moveTrack*fotogallery.moveDirection))+'px'
                }
                else
                {
                    clearInterval(fotogallery.time)
                }
            }
        }
        else
        fotogallery.gCont.style.marginTop='0px'
    }
    ,scroll:function(move)
    {
        this.moveDirection=move;
        fotogallery.time=setInterval(fotogallery._moveScroll,50)
    }
    ,endScroll:function()
    {
        clearInterval(this.time)
    }
    ,changeMedium:function(urlGallery,wGallery,hGallery,urlLarge,wLarge,hLarge,describe,click)
    {
        var iG=this._gE(this.imgGallery);
        var iD=this._gE(this.imgDescribe);
        var bZ=this._gE(this.bigZoom);
        var bL=this._gE(this.bigLink);

        if(iG.src==urlGallery)
        {
           return false
        };
        hide();
        iD.innerHTML=describe;
        iG.width=wGallery;
//        iG.height=hGallery;
        iG.onload=show;
        iG.src=urlGallery;

        function hide()
        {
            iG.style.visibility='hidden';
        }
        function show()
        {
            iG.style.visibility='visible'
        }
        if(urlLarge!='')
        {
            iG.title='Kliknutím fotografii zvětšíte.';
            bZ.className='';
            bL.href=urlLarge;
//            alert(iG.onclick);
            onc = function onclick(event)
                  {
                      window.open(urlLarge,'','resizable=yes,location=no,menubar=no,scrollbars=yes,status=no,toolbar=no,fullscreen=no,dependent=no');
                      return false;
                  };
            iG.onclick = onc;
            bL.onclick = onc;
//            alert(iG.onclick);
            bL.title='Kliknutím fotografii zvětšíte.';
        }
        else
        {
            bZ.className='hide';
            iG.onclick=null;
            bL.onclick=null;
            iG.title='';
            bL.title='';
        }

//        alert(urlGallery+"\n"+wGallery+"\n"+hGallery+"\n"+urlLarge+"\n"+wLarge+"\n"+hLarge+"\n"+describe);

        return false
    }
    ,slide:function(move)
    {
//        var actUrl=fotogallery.iB.src;var desc=fotogallery._gE('b-desc-title');
//        var author=fotogallery._gE('b-desc-author');
        var bB=this._gE(this.bigBox);
        var bC=this._gE(this.bigCont);
        for(i=0;i<fotogallery.imgBigArray.length;i++)
        {
            if(fotogallery.imgBigArray[i].url==actUrl)
            {
                if((i+move)<0||(i+move)>(fotogallery.imgBigArray.length-1))
                {

                }
                else
                {
                    if(move==-1&&typeof(fotogallery.imgBigArray[i-2])=='undefined')
                    {
                        fotogallery._gE('arr-back').style.visibility='hidden'
                    }
                    else
                    {
                        fotogallery._gE('arr-back').style.visibility='visible'
                    }
                    if(move==1&&typeof(fotogallery.imgBigArray[i+2])=='undefined')
                    {
                        fotogallery._gE('arr-next').style.visibility='hidden'
                    }
                    else
                    {
                        fotogallery._gE('arr-next').style.visibility='visible'
                    }
                    fotogallery.iB.style.visibility='hidden';fotogallery.iB.src=fotogallery.imgBigArray[i+move].url;if(!(document.all&&!window.opera))
                    {
                        bC.style.width=(parseInt(fotogallery.imgBigArray[i+move].width))+'px';bB.style.width=(parseInt(fotogallery.imgBigArray[i+move].width)+10)+'px'
                    }
                    function showS()
                    {
                        fotogallery.iB.style.visibility='visible'
                    }
                    fotogallery.iB.onload=showS;
                    fotogallery.iB.width=fotogallery.imgBigArray[i+move].width;
                    fotogallery.iB.height=fotogallery.imgBigArray[i+move].height;
                    desc.innerHTML=fotogallery.imgBigArray[i+move].desc;
//                    author.innerHTML=fotogallery.imgBigArray[i+move].auth;
//                    if(fotogallery.imgBigArray[i+move].authUrl!='')
//                    {
//                        author.innerHTML='<a href="'+fotogallery.imgBigArray[i+move].authUrl+'" target="_blank">'+fotogallery.imgBigArray[i+move].auth+'</a>'
//                    }
//                    else
//                    {
//                        author.innerHTML=fotogallery.imgBigArray[i+move].auth
//                    }
                }
            }
        }
    }
}
;var dom=
{
    gO:function(o)
    {
        return document.getElementById(o)
    }
}
;var buble=
{
    cont:null,loader:null,showTimer:null,hideTimer:null,x:0,y:0,_gE:function(o)
    {
        return document.getElementById(o)
    }
    ,hide:function()
    {
        function closeBuble()
        {
            window.clearTimeout(buble.showTimer);buble.showTimer=null;if(buble.loader!=null)
            {
                buble.cont.removeChild(buble.loader);buble.loader=null
            }
        }
        buble.hideTimer=window.setTimeout(closeBuble,200)
    }
    ,show:function(o,url,e)
    {
        if(!e)
        {
            e=window.event
        }
        ;this.x=e.clientX;this.y=e.clientY;sX=!document.documentElement.scrollTop?document.body.scrollLeft:document.documentElement.scrollLeft;sY=!document.documentElement.scrollTop?document.body.scrollTop:document.documentElement.scrollTop;this.x=this.x+sX;this.y=this.y+sY+5;buble.cont=document.getElementsByTagName('body')[0];function getData()
        {
            dynamicRequest.send(url)
        }
        ;buble.showTimer=window.setTimeout(getData,500)
    }
    ,cancelHide:function()
    {
        window.clearTimeout(buble.hideTimer);buble.hideTimer=null
    }
    ,makeOutput:function(text,title,imgURL,imgW,imgH,imgAlt)
    {
        var c=this.cont;var l=this.loader=document.createElement('div');var html='<div id="buble-cnt" onmouseover="return buble.cancelHide();" onmouseout="return buble.hide();" style="top:'+this.y+'px; left:'+this.x+'px;"><div id="buble">';html+='<img src="http://1.im.cz/n/05/img/bublelogo.gif" width="65" height="15" alt="Novinky.cz" /> <div class="close" onclick="return buble.hide();">zav��t okno</div>';html+='<h4>'+title+'</h4>';html+='<p>';if(imgURL!='')html+='<img src="'+imgURL+'" width="'+imgW+'" height="'+imgH+'" alt="'+imgAlt+'" />';html+=text+'</p>';html+='<div class="clear"></div></div></div>';l.innerHTML=html;c.appendChild(l)
    }
}
;var dynamicRequest=
{
    allowXMLHTTPREQUEST:false,init:function(allowXMLHTTPREQUEST)
    {
        this.allowXMLHTTPREQUEST=allowXMLHTTPREQUEST
    }
    ,send:function(url)
    {
        if(url!='')
        {
            this.allowXMLHTTPREQUEST==true?this.httpRequestRoutine(url):this.scriptRoutine(url)
        }
    }
    ,httpRequestRoutine:function(url)
    {
        if(typeof(XMLHttpRequest)!='undefined')
        {
            var XHR=new XMLHttpRequest()
        }
        else
        {
            try
            {
                var XHR=new ActiveXObject("Msxml2.XMLHTTP")
            }
            catch(e)
            {
                return this.scriptRoutine(url)
            }
        }
        try
        {
            XHR.open("GET",url,true)
        }
        catch(e)
        {
            return this.scriptRoutine(url)
        }
        function stateAction()
        {
            if(XHR.readyState==4)
            {
                if(XHR.status==200)
                {
                    eval(XHR.responseText);return 1
                }
            }
            else if(XHR.readyState==0)
            {
                this.scriptRoutine(url)
            }
        }
        XHR.onreadystatechange=stateAction;XHR.send(null);return 0
    }
    ,scriptRoutine:function(url)
    {
        var cHead=document.getElementsByTagName('head')[0];typeof(this.loader)!='undefined'?cHead.removeChild(this.loader):'';this.loader=document.createElement('script');this.loader.type="text/javascript";this.loader.src=url+'?'+Math.random(999);try
        {
            cHead.appendChild(this.loader)
        }
        catch(e)
        {
            return 1
        }
        return 0
    }
}
