var img4Preload = new Array();

function createGallery()
{
    var obj = $('div.fotogalerie a');
	var obj2 = $('a[rel="lightbox[group]"]');
	
	if (obj.length > 0)
    {
        obj.lightBox();
    }
	
	if (obj2.length > 0)
	{
		obj2.lightBox();	
	}
}

$(window).bind('load', function() {
	var img = document.createElement('img');
	if (img4Preload.length > 0) {
		$(img).bind('load', function() {
			if(img4Preload[0]) {
				this.src = img4Preload.shift();
			}
		}).trigger('load');		
	}
});      

$(document).ready(function(){
    createGallery();
});

$(document).ready(function(){
	/*
    $('#odolena-voda-nabidka-pozemku').flash(
        { src: '../../../common/media/flash/odolena-voda-nabidka-pozemku.swf?xmlFile=../../reality/pozemky-odolena-voda/odolena-voda-nabidka-pozemku.xml',
          width: 675,
          height: 375 },
        { version: 10 }
    );
	*/
	$('#odolena-voda-nabidka-pozemku').flash(
        { src: '../../../common/media/flash/odolena-voda-nabidka-pozemku.swf',
          width: 675,
          height: 375 },
        { version: 10 }
    );
    
	$('#lannova-video-prezentace').flash(
        { src: '../../../common/media/flash/lannova-video-prezentace.swf',
          width: 675,
          height: 425 },
        { version: 10 }
    );
	
	$('#top-image.flash-odolena-voda').flash(
        { src: '../../../common/media/flash/flash-upoutavka-zahlavi-stranek.swf',
          width: 885,
          height: 199 },
        { version: 9 }
    );
});

function animate_lannova_panorama(direction)
{
    if (direction == "r")
    {
        $('a.animate-panorama-lannova img').animate({"left": "-368"}, 7000, 'linear', function(){
            animate_lannova_panorama("l");
        });
    }
    else
    {
        $('a.animate-panorama-lannova img').animate({"left": "0"}, 7000, 'linear', function(){
            animate_lannova_panorama("r");
        });
    }
}

function animate_odolena_voda_panorama(direction)
{
    if (direction == "r")
    {
        $('a.animate-panorama-odolena-voda img').animate({"left": "-405"}, 7500, 'linear', function(){
            animate_odolena_voda_panorama("l");
        });
    }
    else
    {
        $('a.animate-panorama-odolena-voda img').animate({"left": "0"}, 7500, 'linear', function(){
            animate_odolena_voda_panorama("r");
        });
    }
}

$(document).ready(function(){
    if ($('a.animate-panorama-odolena-voda').length > 0)
    {
        $('a.animate-panorama-odolena-voda').css({ "background-image" : "none" });
        $('a.animate-panorama-odolena-voda').append('<img src="/common/images/project-icon-odolena-voda-panorama.jpg" />');
        $('a.imglink img').css({ "display" : "block", "border" : "0px none", "position" : "absolute", "left" : "0", "top" : "0" });
        $("a.animate-panorama-odolena-voda").hover(
          function () {
            $(this).children('img').css({"top" : "-158px"});
          },
          function () {
            $(this).children('img').css({"top" : "0px"});
          }
        );
        animate_odolena_voda_panorama("r");
    }
    if ($('a.animate-panorama-lannova').length > 0)
    {
        $('a.animate-panorama-lannova').css({ "background-image" : "none" });
        $('a.animate-panorama-lannova').append('<img src="/common/images/project-icon-lannova-panorama.jpg" />');
        $('a.imglink img').css({ "display" : "block", "border" : "0px none", "position" : "absolute", "left" : "0", "top" : "0" });
        $("a.animate-panorama-lannova").hover(
          function () {
            $(this).children('img').css({"top" : "-158px"});
          },
          function () {
            $(this).children('img').css({"top" : "0px"});
          }
        );
        animate_lannova_panorama("r");
    }
});
