window.addEvent("domready", function(){

          /* xbox */
          
var x_box = new XBox(); 

});

// Kubure:


if(Page.page_var.is_homepage){
  
  var Disney={

    pos:1,
    sig:1,
    cnt:0,
    container:null,
    Slider:null,
    cheat:null,
    interval:null,
    idle:null,
    
    
    init:function(){
      Disney.container=gE("strc").firstEl();
      Disney.cnt=Disney.container.getElementsByTagName("img").length;
      Disney.Slider=new Slider("Disney.Slider",0,325,15,browser.isIE?10:5,Disney.sliderRun,Disney.sliderFinish);

      var lBut=gE("topref").lastEl(),rBut=gE("topref").lastEl().prevEl();
      rBut.registerEvent("click",Disney.clickLeft);
      lBut.registerEvent("click",Disney.clickRight);
      lBut.setDB();rBut.setDB();
      
      Disney.interval=window.setInterval(Disney.continueInterval,3000);
    },
    
    
    continueInterval:function(){
      if(Disney.Slider.actual==325 || Disney.Slider.actual==0)Disney.goLeft();
    },


    clickLeft:function(e){
      e=getEvent(e);
      if(Disney.interval)window.clearInterval(Disney.interval);
      if(Disney.idle)window.clearTimeout(Disney.idle);
      Disney.idle=window.setTimeout("Disney.interval=window.setInterval(Disney.continueInterval,3000);",10000);
      if(Disney.Slider.actual==325 || Disney.Slider.actual==0)Disney.goLeft();
      e.preventDefault();
    },


    clickRight:function(e){
      e=getEvent(e);
      if(Disney.interval)window.clearInterval(Disney.interval);
      if(Disney.idle)window.clearTimeout(Disney.idle);
      Disney.idle=window.setTimeout("Disney.interval=window.setInterval(Disney.continueInterval,3000);",10000);
      if(Disney.Slider.actual==325 || Disney.Slider.actual==0)Disney.goRight();
      e.preventDefault();
    },


    
    sliderRun:function(x){
      Disney.container.style.left=(-325)*Disney.pos-Disney.sig*x+"px";
    },

    
    sliderFinish:function(x){
      Disney.sliderRun(x);
      Disney.pos+=Disney.sig;

      if(!isNull(Disney.cheat)){
        if(Disney.sig==1){
          Disney.pos=0;
          Disney.container.style.left=0;
        }else{
          Disney.pos=Disney.cnt-1;
          Disney.container.style.left=(-325)*Disney.pos+"px";
        }
        
        Disney.cheat.style.position="static";        
        Disney.cheat=null;
        Disney.container.className="";
      }  
    },
    
    
    goLeft:function(){
      Disney.sig=1;
      if(Disney.pos==Disney.cnt-1){
        Disney.cheat=Disney.container.firstEl(); 
        Disney.cheat.style.position="absolute";
        Disney.cheat.style.left=325*Disney.cnt+"px";
        Disney.container.className="padleft";
      }
      Disney.Slider.actual=0;
      Disney.Slider.run();  
    },
    
    
    goRight:function(){
      Disney.sig=-1;
      if(Disney.pos==0){
        Disney.cheat=Disney.container.lastEl();
        Disney.cheat.style.position="absolute";
        Disney.cheat.style.left="-325px";
      }
      Disney.Slider.actual=0;      
      Disney.Slider.run();      
    }
  
  };
  
  
  registerEvent(window,"load",Disney.init);
}

//reference
if(Page.page_id==18 || Page.page_id==20){
	

function HeavyBox(gallery,cls){

  var doyle=document.getElementsByTagName("body");
  var bodie=doyle[0];
    
  
  var viewport_height=getViewportHeight();
  var viewport_width=getViewportWidth();
  
  
  var darkness=document.createElement("div");
  darkness.id="darkness";
  darkness.style.height=viewport_height+"px";
   
  
   
  bodie.appendChild(darkness);
   
   
  var table_container=document.createElement("div");
  table_container.id="heavybox_table_container";
  table_container.innerHTML='<table id="heavybox_table" cellspacing="0" cellpadding="0"><tbody><tr><td><div id="heavybox"><img src="" alt="" /><div id="flash"></div><div id="heavybox_pages"></div><div id="heavybox_description"><div id="heavybox_count"></div><div id="heavybox_close">'+(document.lang=="cs"?"zavřít":"close")+'</div><p><b>&nbsp;</b></p><p>&nbsp;</p></div><a id="heavybox_prev"></a><a id="heavybox_next"></a></div></td></tr></tbody></table>';
  
  table_container.firstChild.style.width=viewport_width+"px";
 // table_container.firstChild.style.height=viewport_height+"px";
  table_container.style.top=bodie.scrollTop+"px";
  bodie.appendChild(table_container);

  var box=gE("heavybox");
   
  registerEvent(gE("heavybox_prev"),"mouseover",function(e){if(!browser.isIE && e || browser.isIE){e=getEvent(e);e.target.style.backgroundPosition="0 -3000px";}});
  if(browser.isIE) registerEvent(gE("heavybox_prev"),"mousemove",function(e){e=getEvent(e);e.target.style.backgroundPosition="0 -3000px";});
  registerEvent(gE("heavybox_prev"),"mouseout",function(e){if(!browser.isIE && e || browser.isIE){e=getEvent(e);e.target.style.backgroundPosition="0 0";}});
  registerEvent(gE("heavybox_next"),"mouseover",function(e){if(!browser.isIE && e || browser.isIE){e=getEvent(e);e.target.style.backgroundPosition="100% -3000px";}});
  if(browser.isIE) registerEvent(gE("heavybox_next"),"mousemove",function(e){e=getEvent(e);e.target.style.backgroundPosition="100% -3000px";});
  registerEvent(gE("heavybox_next"),"mouseout",function(e){if(!browser.isIE && e || browser.isIE){e=getEvent(e);e.target.style.backgroundPosition="100% 0";}});
   
  
  var switchPage=function(){
    var pagesContainer=getEl("heavybox_pages");  
    var spans=pagesContainer.getElementsByTagName("span");
    pagesContainer._actual.className="";
    pagesContainer._actual=spans[current_index];
    pagesContainer._actual.className="act";
  };
  
  
 var nextImage=function(){
    if(current_index<images.length)current_index++;
    switchPage();
    setVH("heavybox_prev","heavybox_next");
    hideButtons();
    loadImage();
   };
   
   
   
  var prevImage=function(){
    if(current_index>0)current_index--;  
    switchPage();
    setVH("heavybox_prev","heavybox_next");
    hideButtons();
    loadImage();
  };
   
  registerEvent(gE("heavybox_next"),"click",nextImage);
  registerEvent(gE("heavybox_prev"),"click",prevImage);
  
  
  var day=function(){
    setDN(darkness,table_container);
    unregisterEvent(document,"keydown",onKey);
    unregisterEvent(window,"resize",resz);
  };
  
  registerEvent(gE("heavybox_close"),"click",day);
  
  
   
   
  var onKey=function(e){
    e=getEvent(e);
    if(e.which==27)day();
    if(e.which==37 && current_index>1)prevImage();
    if(e.which==39 && current_index<images.length-1)nextImage();
    e.preventDefault();
  };
   
   
  var resz=function(){
    darkness.style.height=getElementHeight(bodie)+40+"px";
//    table_container.style.height=getViewportHeight()+"px";
 //table_container.style.height=getElementHeight(bodie)+40+"px";
// alert(getElementHeight(bodie)+40+"px");
  //  table_container.firstChild.style.width=getViewportWidth()+"px";
//    table_container.firstChild.style.height=getViewportHeight()+"px";
  };


  var scrl=function(){
   // table_container.style.top=document.documentElement.scrollTop+"px";
    getEl("heavybox").style.top=document.documentElement.scrollTop+"px";
  };
  
  
  
  var night=function(){
scrl();
    resz();
    setDB(darkness,table_container);
    registerEvent(document,"keydown",onKey);
    registerEvent(window,"resize",resz);
    registerEvent(window,"scroll",scrl);
  };
   
  
  
   
   
  var hideButtons=function(){
    gE("heavybox_next").style.backgroundPosition=gE("heavybox_prev").style.backgroundPosition="0 0";
  };
   
   
   var images=[];
   
  var thumbs_container=gE(gallery);
  var thumbs=isUndefined(cls)?thumbs_container.getElementsByTagNames("a"):thumbs_container.getElementsByClassName(cls);
var current_index=0;

  for(var i=0;i<thumbs.length;i++){

    var fc=function(e){
      e=getEvent(e);
      night();
      images=projectImages[this.id.substring(3)];
      
      
      var pagescont=getEl("heavybox_pages");
      if(images.length==1)setDN(pagescont);
      var showImageByNumber=function(){
        pagescont._actual.className="";
        pagescont._actual=this;
        pagescont._actual.className="act";
        current_index=this.firstChild.data-1;
        loadImage();  
      };
      
      pagescont.innerHTML="";
      
      for(var i=0;i<images.length;i++){
        var page=document.createElement("span");
        page.appendChild(document.createTextNode(i+1));
        registerEvent(page,"click",showImageByNumber);
        if(i==0){page.className="act";pagescont._actual=page;}
        pagescont.appendChild(page);  
        
        
      }
      
      
      current_index=0;
      loadImage();
      e.preventDefault();
      return false;
    };

    registerEvent(thumbs[i],"click",fc);
  }
 
   
 
  
   
   
  var noMoreWait=function(){
    box.className="nowait";
  };
   
   
  var resizeBox=function(w,h,fc){
    setDN(box.firstChild);
    box.className="";
    gE("heavybox").style.width=w+"px";
    
    gE("heavybox").style.height=h+"px";
    
    var he=viewport_height;
    
    if(h>viewport_height)he=h+90+"px";
    if(h>getElementHeight(bodie))he=h+90+"px";else he=getElementHeight(bodie)+"px";
    
    darkness.style.height=table_container.style.height=table_container.firstChild.style.height=he;
    
   // noMoreWait();
    if(isFunction(fc))fc();
  };
  
   
  var textDescription=function(txt){
    var cont=gE("heavybox_description");
    if(isString(txt))cont.lastChild.previousSibling.firstChild.firstChild.data=txt+"\u00A0";
    if(images.length>1) cont.lastChild.firstChild.data=(document.lang=="cs"?"Obrázek ":"Image ")+(current_index+1)+(document.lang=="cs"?" z":" of")+(((images.length<6 || images.length==8) && document.lang=="cs")?"e":"")+" "+(images.length);
  };
   
   
   
  var loadImage=function(){
  
    resizeBox(parseInt(images[current_index].width)+20,parseInt(images[current_index].height)+20,function(){textDescription(images[current_index].description);showImage();});
  };
   
   
  var showImage=function(){
if(images[current_index].src.indexOf(".swf")>0){

/*    box.firstChild.nextSibling.data=images[current_index].src;
    box.firstChild.nextSibling.firstChild.value=images[current_index].src;

    box.firstChild.nextSibling.width=images[current_index].width;
    box.firstChild.nextSibling.height=images[current_index].height;
*/
 setDN(box.firstChild);
box.firstChild.nextSibling.innerHTML='<object data="'+images[current_index].src+'" width="'+images[current_index].width+'" height="'+images[current_index].height+'" type="application/x-shockwave-flash"><param name="movie" value="'+images[current_index].src+'" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /><param name="wmode" value="opaque" /></object>';
setDB(box.firstChild.nextSibling);
}else{
setDN(box.firstChild.nextSibling);
    box.firstChild.src=images[current_index].src;
    box.firstChild.width=images[current_index].width;
    box.firstChild.height=images[current_index].height;

     window.setTimeout(function(){noMoreWait();setDB(box.firstChild)},15);
    }
    
    
   
    
    if(current_index>0){
      setVV("heavybox_prev");
      if(browser.isOldIE)gE("heavybox_prev").style.height=Math.round(0.9*images[current_index].height)+"px";
    }else setVH("heavybox_prev"); 
   
    if(current_index==images.length-1)setVH("heavybox_next");else{
      setVV("heavybox_next");
      if(browser.isOldIE)gE("heavybox_next").style.height=Math.round(0.9*images[current_index].height)+"px";
     }
   };
   

}


  registerEvent(window,"domready",function(){if(getEl("projects"))new HeavyBox("projects","gal");});


}


//kontakt
if(Page.page_var.api_key)registerEvent(window,"domready",function(){
  
  var map=new GMap2(getEl("map"));
  var point=new GLatLng(50.1118,14.50347);
  map.setCenter(point,16);
  map.addControl(new GMapTypeControl(),new GControlPosition(G_ANCHOR_BOTTOM_RIGHT,new GSize(10,10)));
  map.addControl(new GSmallMapControl());
  map.addOverlay(new GMarker(point));
          
   // map.openInfoWindowHtml(map.getCenter(),'<img src="/common/images/layout/logo/logo.gif" alt="pragueBest" /><br />Pod pekárnami 7<br>Praha 9&nbsp;&nbsp;190 00<br />3. patro');

  if(browser.isIE)registerEvent(window,"unload",GUnload);
    
});


registerEvent(window,"domready",function(){
  gE(document.documentElement).getElementsByClassName("targetblank","a").registerEvent("click",function(e){e=getEvent(e);if(typeof window.open(this.href)=="object")e.preventDefault();});
});



if(browser.isIE)registerEvent(window,"domready",function(){
 var objs=document.getElementsByTagName("object");
      var objl=objs.length;
      for(var i=0;i<objl;i++){
        var obj=objs[i];
        var parent=obj.parentNode;
        var html=obj.outerHTML;
        html=html.substring(0,html.indexOf("</"));
        var params=parent.getElementsByTagName("param");
        var parl=params.length;
        for(var j=0;j<parl;j++)html+=params[j].outerHTML;
        html+="</object>";
        obj.outerHTML=html;
        var nobjs=parent.getElementsByTagName("object");
        setVV(nobjs[0]);
      }   
});






var HitCollector={
  
  hit: [],
  containerPosX: 0,
  containerPosY: 0,
  
  setContainerPos: function() {
    HitCollector.containerPosX = findPosX("global");
    HitCollector.containerPosY = findPosY("global");
  },
  
  init: function() {
    HitCollector.setContainerPos();

  	registerEvent(window, "resize", HitCollector.setContainerPos);  
    
    registerEvent(document.getElementsByTagName("body")[0], "click", function(e) {
      e = getEvent(e);
      var x = e.pageX - HitCollector.containerPosX;
      var y = e.pageY - HitCollector.containerPosY;
      if(isUndefined(HitCollector.hit[x])) {
				HitCollector.hit[x] = [];
			}
      if(isUndefined(HitCollector.hit[x][y])) {
				HitCollector.hit[x][y] = 1;
			}
			else {
				HitCollector.hit[x][y]++;
			}
    });
    
    registerEvent(window, "unload", function() {
      var params = "action=hit_insert&";
      for(var x in HitCollector.hit) {
				for(var y in HitCollector.hit[x]) {
					if (typeof HitCollector.hit[x][y] === 'number') {
						params += ("hit[" + x + "][" + y + "]=" + HitCollector.hit[x][y] + "&");
					}
				}
			}
      params += ("time=" + (new Date()).getTime() + "&page_id=" + Page.page_id);
      var ajax = new AJAX();
      ajax.setFinalMethod(function(){});
      ajax.request("POST", "/kubure.php", params, false);
    });
    
  }
  
  
};


registerEvent(window,"domready",HitCollector.init);



if(/\bheatmap=on\b/.test(window.location.search))registerEvent(window,"domready",function(){
  var night=document.createElement("div");
  night.id="night";
  var body=document.getElementsByTagName("body")[0];
  body.appendChild(night);
  night.style.width=getElementWidth(body)+"px";
  night.style.height=getElementHeight(body)+"px";
  
  var limit=1;
  var qsMatches=window.location.search.match(/\blimit=(\d+)\b/);
  if(qsMatches)limit=qsMatches[1];
  
  var ajax=new AJAX();
  ajax.setFinalMethod(function(status){
    if(status==200){
      var doc=ajax.getResponseObject();
      var points=doc.getElementsByTagName("point");
      var pl=points.length;
      var gpX=findPosX("global");
      var gpY=findPosY("global");
      
      function putPuan(point){
        var puan=document.createElement("span");
        var x=parseInt(point.getAttribute("x"));
        var y=parseInt(point.getAttribute("y"));
        var h=parseInt(point.firstChild.data);
        var hf=Math.floor(h/2);
        puan.style.left=x+gpX-hf+"px";
        puan.style.top=y+gpY-hf+"px";
        puan.style.width=puan.style.height=h+"px";
        night.appendChild(puan);
      
      }
      
      for(var i=0;i<pl;i++)putPuan(points[i]);

    }
  });
  ajax.request("POST","/kubure.php","page_id="+Page.page_id+"&action=hit_select&limit="+limit+"&time="+(new Date()).getTime());
  
  
});









