$j(function() {
    var qPath = "/sia/sok?q=";
    //MAIN SEARCH BOX
    $j("#search-text-main").click(function() {
        if (this.value == this.defaultValue) {
            this.value = '';
            return true;
        }
    });
    $j("#search-text-main").keyup(function(event) {
        if (event.keyCode == '13') {
            event.preventDefault();
            location.href = qPath + $j(this).attr("value");
            return false;
        }
    })
    $j("#search-button-main").click(function() {
        location.href = qPath + $j("#search-text-main").attr("value");
        return false;
    });

    //END MAIN SEARCH BOX
    //SEARCH RESULT PAGE
    $j('#googlesokeord').keyup(function(event) {
        if (event.keyCode == '13') {
            event.preventDefault();
            location.href = qPath + $j(this).attr("value");
            return false;
        }
    })
    $j("#googlesubmit").click(function() {
        location.href = qPath + $j("#googlesokeord").attr("value");
        return false;
    });
    //END SEARCH RESULT PAGE
    //SIMPLE MAIL OBFUSCATION
    $j(function() {
        $j('span.mailme').each(function() {
            var at = / at /;
            var dot = / dot /g;
            var addr = $j(this).text().replace(at, "@").replace(dot, ".");
            $j(this).after('<a href="mailto:' + addr + '" title="Send an email">' + addr + '</a>').hover(function() { window.status = "Send a letter!"; }, function() {
                window.status = "";
            });
            $j(this).remove();
        });
    });
    //END SIMPLE MAIL OBFUSCATION
});

