$(document).ready(function() {
    /*Tooltips*/
    
    // ajax loading element
    $(".searchLoader").ajaxStart(function(){
        $(this).show();
    }).ajaxStop(function(){
        $(this).hide();
    });
    
    var href = document.location.href.split("#");
    if (href[1]) {
        href = href[1].split("&");
    }

    if (href[0]) {
        var query = href[0].split("=")[1];
    }

    var regexp = new RegExp('("[^"]*")|([^ ]*[^ ])', 'gi');

    if (query) {
        Words = Url.decode(query).match(regexp);
    }

    if (typeof(Words) != 'undefined') {
        for (i=0; i<Words.length; i++) {
            if (Words[i].length >= 2 && badWords.indexOf(Words[i]) == -1) {
                if (Words[i].indexOf('"') != -1) {
                    Words[i] =  Words[i].slice(1, Words[i].length-1)
                }
                autoBoxObj[0].addBox(Words[i]);
            }
        }
        makeSearch(function(){
            if (typeof (href[1]) != 'undefined') {
                var siteId = href[1].split("=")[1];
                if (typeof(siteId) != 'undefined')
                loadDetails(siteId);
            }
        });
        searchRequest.page = 1;
    }

});

function showDialog(id, prnt) {
    var dialog = $(id).parent();
    $('.ui-dialog').css({'display':'none'});
    $(dialog).css({'top': ( prnt.top + 26 ) + "px",
    'left': ( prnt.left - 158 ) + "px" });
    $(dialog).fadeIn('300');
}
function is_int( mixed_var )
{
    var y = parseInt(mixed_var * 1);

    if (isNaN(y)) {
        return false;
    }

    return mixed_var == y && mixed_var.toString() == y.toString();
}