﻿$(document).ready(function() {
    $(".searchPageButton").click(function() {
        doSearch();
    });

    $(".searchPageTextBox").keypress(function(e) {
        if ((e.which && e.which == 13) || (e.keyCode && e.keyCode == 13)) {
            doSearch();
            return false;
        } else {
            return true;
        }
    });

    $('.bubble').click(function() {
        $(this).parent().next('.bubbleContent').slideToggle('normal');
        return false;
    });

    $('.UnselectedPagingItem').click(function() {
        
        if ($(this).attr('id').indexOf('FileSearchPageList') >= 0) {
            document.getElementById("ctl00_CPHFullContent_CPHContent_HiddenPagingNumber").value = "33";
        }

    });

});

function setfocs() {
    self.location.hash = "FilesAnchor";
}

function doSearch()
{
    var lang = "";
    var searchOptions = "";
    $(".advSearchClass input[checked!='']").each(function() {
       lang  += jQuery(this).attr('value') + ',';
    });
    $(".advSearchOptionsClass input[checked!='']").each(function() {
       searchOptions  += jQuery(this).attr('value') + ',';
    });

    var q = encodeURIComponent($(".searchPageTextBox")[0].value);
    var url = document.location.pathname + "?q=" + q + "&lang=" + lang + "&SearchOptions=" + searchOptions;
    $("body").css("cursor", "progress");
    self.location = url;
}

function hideSearchAdvMenu() {

    $(".bubbleContent").hide();
}
