var flashvars = {
    xmlPath: "flash/karuzela.xml"
};
var params = {
    wmode: "transparent"
};

swfobject.embedSWF("flash/karuzela.swf", "swf", "800", "192", "9.0.0", "", flashvars, params);


if ($('#swf_produkty').length > 0)
{
    var flashvars2 = {
        xmlPath: "flash/produkty.xml"
        //align: "left",
        //sort: true
    };
    var params2 = {
        wmode: "transparent"
    };

    swfobject.embedSWF("flash/produkty.swf", "swf_produkty", "1000", "380", "10.0.0", "", flashvars2, params2);
};

	
jQuery(document).ready(function()
{
    if ($('#mycarousel').length > 0)
    {
        $('#mycarousel').jcarousel({
            vertical: true,
            scroll: 2
        });
    };

    if ($('.tabNavigation').length > 0)
    {
        $(function () {
			var tabContainers = $('article.tabs > div');
			tabContainers.hide().filter(':first').show();
			
			$('article.tabs ul.tabNavigation a').click(function () {
				tabContainers.hide();
				tabContainers.filter(this.hash).fadeIn();
				$('article.tabs ul.tabNavigation li').removeClass('selected');
				$(this).parent().addClass('selected'); //parent bo chodzi o przypisanie klasy do li, w którym jest a
				return false;
			}).filter(':first').click();
		});
    };
});

//detekcja flasha, jeśli nie ma zainstalowanego, to serwujemy jCarousel zamiast flasha; wymagany plugin jquery.jqplugin
if ($('#swf').length > 0 && $('#no-swf').length > 0)
{
    if ($.browser.flash == true)
    {
        $("#no-swf").remove();
    }
    else
    {
        $("#swf").remove();
        $('#noswf-menu').jcarousel({
            scroll: 1
        });
    };
};

if ($('#noswf_produkty').length > 0)
{
    if ($.browser.flash == true)
    {
        $("#noswf_produkty").remove();
    }
    else
    {
        $("#swf_produkty").remove();
        $('#produkty-jq').jcarousel({
            scroll: 1
        });
    };
};


//wykrywanie kliknięcia w header => redirect do podstrony
$('.homepage header').click(function() {
    window.location = 'aplikacje';
});


function reloadYoutube(t)
{
    $('#youtube-iframe').attr('src', 'http://www.youtube.com/embed/' + t);
}


//if ($('#gwiazdka').length > 0)
//{
//    swfobject.embedSWF("flash/gwiazdka.swf", "gwiazdka", "300", "850", "9.0.0", "", "", {wmode: "transparent"});
//};
