﻿function trim(stringToTrim) {
    return stringToTrim.replace(/^\s+|\s+$/g, "");
}
function ltrim(stringToTrim) {
    return stringToTrim.replace(/^\s+/, "");
}
function rtrim(stringToTrim) {
    return stringToTrim.replace(/\s+$/, "");
}


function WrapImagesToDivWithBorder(images) {

    images.css('border', 'solid 1px #DEDEDE');
    return;
    //debugger;
    images.wrap(document.createElement("div"));
    images.each(function() {
        $(this).parent().css('padding', '1px').css('border','solid 1px #575757');
    });
}

function RedirectToSearchPage(portalStatCat) {

    var text = $('input[id$=tbSearch]').val();
    text = trim(text)
    if (text.length > 2) {
        var s = '/Search.aspx?q=' + escape(text);
        if (portalStatCat != null) s += '&portalCat=' + portalStatCat;
        window.location.href = s;
    }

}