function search(search_url) {
    var sNode = document.getElementById('search-global-query');
    if ( sNode ) {
        window.location = ( search_url + '/search.html?str=' + sNode.value );
    }
    else {
        window.location = ( search_url + '/search.html' );
    }
}

function getCookie(c_name) {
    if (document.cookie.length > 0) {
        c_start=document.cookie.indexOf(c_name + "=");

        if (c_start != -1) {
            c_start=c_start + c_name.length+1;
            c_end=document.cookie.indexOf(";", c_start);
            if (c_end == -1) {
                c_end = document.cookie.length;
            }
            return unescape(document.cookie.substring(c_start,c_end));
        }
    }
    return "";
}

function signInLink(url) {
    if (getCookie('acceptcookies')) {
        document.write(
            '<iframe id="signin-frame" frameborder="0" scrolling="no" src="' + url + '">' +
              '<p>Your browser does not support iframes.</p>' +
            '</iframe>'
        );
    }
    else {
        document.write(
            '<div id="signin-div">' +
                '<div id="signin">' +
                    '<a href="' + url + '" target="_top">Sign in</a> to manage your account' +
                '</div>' +
            '</div>'
        );
    }
}


// Change the jQuery $ operator to $j for IE compatibility.
var $j = jQuery.noConflict();

// Wrap everything inside the $j(document).ready() function. Everything
// inside it will load as soon as the DOM is loaded and before the
// page contents are loaded.
$j(document).ready(function() {
    /**
     *
     * function:     $j("tr.results-row").hover()
     *
     * parameters:   none
     *
     * description:  Set row background color for results row that currently
     *               has the cursor hovering on it. When cursor moves off of
     *               this row, restore original background color for the row.
     *
     */
    $j("tr.results-row").hover( function() {
        // Store the old background.
        $j(this).attr( 'old_bg_hover', $j(this).css( 'background-color' ) );

        // Set the background to pink.
        $j(this).css( 'background-color', 'pink' );

    }, function() {
        // Restore the old background.
        $j(this).css( 'background-color', $j(this).attr( 'old_bg_hover' ) );
    });
});