$(document).ready(function(){		
	
    //UVOD - script pro popup okno s virtualni prohlidkou
	var _width = screen.width;
	var _height = screen.height;
	$("#vr").click( function() {
		_top = (_height - 600)/2;
		_left = (_width - 760)/2;
		window.open( $(this).attr('href'), '_blank','status=yes,top='+_top+',left='+_left+',width=744,height=540');
		return false;
	});

    //FOTOGALERIE - nahozeni scrollovani
    $("div.scrollable").scrollable({
        vertical: true,
        clickable: false,
        size: 3
    });
    
    //FOTOGALERIE - prepinani fotek
    var actualPic = "1";
    var clickAble = true;
    $("div.items img").click(function(){
        if(this.id != actualPic && clickAble == true){
            clickAble = false;
            var rightId = this.id;
            var rightSize = "";
            if($("#"+rightId).width()>$("#"+rightId).height())
            {
                rightSize = "wide";
            }else{
                rightSize = "tall";
                }
            $("#picture").fadeOut("slow", function(){                
                $("#pictureCont").empty();
                $("#pictureCont").html("<div id='picture' class='"+rightSize+"' style='background-image:url(images/fotogalerie/photos/"+rightId+".jpg);'></div>");
                $("#picture").hide();
                $("#picture").fadeIn("slow");
                actualPic = rightId;
                clickAble = true;
            });
        }
    });
    
    //KONTAKT - nahozeni GOOGLE mapy
    if (GBrowserIsCompatible()) {
		initialize();
	}
    
    function initialize(){
    	var mapa = new GMap2(document.getElementById('mapa'));
        mapa.setCenter(new GLatLng(49.192398, 16.602225), 18);
        mapa.setMapType(G_NORMAL_MAP);
        
        var xIcon = new GIcon(G_DEFAULT_ICON);
        xIcon.image = "images/kontakt/x.png";
        xIcon.iconSize = new GSize(30, 30);
        xIcon.shadowSize = new GSize(0, 0);

        markerOptions = { icon:xIcon };
        marker = new GMarker(new GLatLng(49.19220, 16.60198), markerOptions);        
        mapa.addOverlay(marker);
        //map.setUIToDefault();
    }    
});
