﻿$(document).ready(function () {

    $("input[id$=TextBoxSearchQuery]").keyup(function (e) {
        if (e.keyCode == 13) {
            $("input[id$=ButtonSearchQuery]").click();
        }
    });

    if ($('.lightboxholder').length > 0) {
        $(".imagesBoxPopup").fancybox({
            cyclic: true,
            centerOnScroll: true,
            padding: 20,
            titlePosition: 'inside'
        });
    }

    var hideArticle = true;
    $(".column630 .huvudyta .mainNews article").children().each(function () {
        if ($(this).html().trim() != "") {
            hideArticle = false;
        }
    });

    if ($(".column630 .huvudyta .mainNews article").children().length > 0 && hideArticle) {
        $(".column630 .huvudyta").css("height", "0").css("padding", "0").css("border", "0");
    }
});

$(window).load(function(){
    if($('.lightboxholder').length > 0) {
        if ($('.imagesBoxPopup').length > 0) { $('.imagesBoxPopup').trigger('click'); }
    }
});


