youTubeIFrameHtml = '<iframe class="youtube-player" type="text/html" width="580" height="326" src="http://www.youtube.com/embed/OLePK6lM-bg?fs=1&amp;hl=en_US&amp;rel=0&amp;showinfo=0&amp;autohide=1&amp;autoplay=1" frameborder="0"></iframe>';


$(document).ready(function(){
        if($("#topnav-inner").length > 0)
        {
           $.ajax({
                url:  Configuration["webroot"] + Configuration["topnav_inner_ajax"],
                success: function(data) {
                    $('#topnav-inner').html(data);
                }
            });
        }
        // only for the startpage
        $('#home_youtube_preview').click(function(){
            $('#home_youtube_preview').fadeOut(200, function(){
                $('#video-box-inner').html(youTubeIFrameHtml);
            });
        });
        // Pop ups
        $('a.popup').colorbox({transition:'elastic', speed:400});

        // load Blog Content (several divs)
        loadAndDisplayPressBlogContent();
        loadAndDisplayPressAndReviewsBlogContent();
    }
);

function loadAndDisplayPressAndReviewsBlogContent(){
    var webroot = $('#webroot').html();
    var url = webroot + 'public_ajax/proxy?target_url=' + encodeURIComponent(Configuration["blog.url"]);
    if ($('#blog_content_press_and_reviews').length > 0)
    {
        $('#blog_content_press_and_reviews').load(url + ' #press-thumb-boxes', function() {
            if (status == "error") {
                alert("error");
            }
            if (status != "error") {
            }
            $('#blog_content_press_and_reviews').show();
        });
    }
}

function loadAndDisplayPressBlogContent(){
    var webroot = $('#webroot').html();
    var url = webroot + 'public_ajax/proxy?target_url=' + encodeURIComponent(Configuration["blog.url"]);
    var noToShow = Configuration['blog.no_to_show_accounts_home'];
    if ($('#blog_content_press').length > 0)
    {
        $('#blog_content_press').load(url + ' #posts-cat-press', function() {
            if (status == "error") {
                alert("error");
            }
            if (status != "error") {
                var i = 0;
                $('div[id^="post-"]').each(function () {
                    if (i < noToShow)
                    {
                    }else
                    {
                        $(this).hide();
                    }
                    i++;
                });

                if (Configuration["blog.show_entry-title"])
                {
                }else
                {
                    $('.entry-title').hide();
                }
                if (Configuration["blog.show_entry-meta"])
                {
                }else
                {
                    $('.entry-meta').hide();
                }
                if (Configuration["blog.show_entry-summary"])
                {
                }else
                {
                    $('.entry-summary').hide();
                }
                if (Configuration["blog.show_entry-utility"])
                {
                }else
                {
                    $('.entry-utility').hide();
                }
                if (Configuration["blog.show_entry-meta_social-shares"])
                {
                    alert("jo");
                }else
                {
                    $('div[id="social-shares"]').hide();
                }
                $('#blog_content').show();
            }
        });
    }
}
