/** popupmenu **/
$.fn.hoverClass = function(c) {
    return this.each(function(){
        $(this).hover( 
            function() { $(this).addClass(c);  },
            function() { $(this).removeClass(c); }
        );
    });
};

$(document).ready(function(){
    $("#nav-one li").hover(
        function(){ $("ul", this).fadeIn("fast"); }, 
        function() { } 
    );
    if (document.all) {
        $("#nav-one li").hoverClass ("sfHover");
    }
    $("textarea.autoresize").keyup(function(e){
        if (!$(this).attr("first_rows")) {
            if ($(this).attr("rows") < 1) {
                $(this).attr("first_rows", 2);
            } else {
                $(this).attr("first_rows", $(this).attr("rows"));
            }
        }
        var value = $(this).val();
        var lines = 1;
        for (var i = 0, l = value.length; i < l; i++) {
            if(value.charAt(i)=='\n') lines++;
        }
        if ($(this).attr("first_rows") > lines) {
            return;
        }
        $(this).attr("rows", lines);
    });
});

