﻿function OxSearch(path) {
    var searchtext = $j("#searchtext").val();
    if (searchtext != "") {
        var redirectLocation = path + "?s=" + searchtext;
        window.location.href = redirectLocation;
    }
    return false;
}

// function to onload bind the searchtext input field to make a search on enter key
$j(function() {
    $j("#searchtext").keypress(function(e) {
        if ((e.which && e.which == 13) || (e.keyCode && e.keyCode == 13)) {
            $j("#btnSearch").click();
            return false;
        } else {
            return true;
        }
    });
});

$j(document).ready(function() {
    $j('a.scbleml').each(function() {
        e = this.rel.replace('/', '@');
        this.href = 'mailto:' + e;
    });
    if ($j.getURLParam("s") != null) {
        $j('#container').highlight($j.getURLParam("s"));
    }
    var heightstSpot = 0;
    $j('.info-list-item strong').each(function() {
        if ($j(this).height() > heightstSpot)
            heightstSpot = $j(this).height();
    }
    );
    $j('.info-list-item strong').each(function() {
        $j(this).height(heightstSpot);
    }
    );

});

// iframe onload script
function iframonload(){
if($j("#iframe")) {
    $j("#iframe").attr('height', 600);
    }
}

function OnClientItemsRequesting(sender, eventArgs) {
    if (sender.get_text().length <= 2) {
        eventArgs.set_cancel(true);
    } else {
        var context = eventArgs.get_context();
        context["FilterString"] = eventArgs.get_text();
    }
}
