var $j = jQuery.noConflict(); 

$j(function(){

    $j("#sidebar li a").hover(function(){
    	$j(this).stop().animate({
    		paddingLeft: "20px"
    	}, 400);
    }, function() {
    	$j(this).stop().animate({
    		paddingLeft: 0
    	}, 400);
    });
    
    if ($j("#s").val() == "") {
    	$j("#s").val("Search...");
    }
    
    $j("#s").click(function() {
        if (jQuery(this).val() == "Search...") {
            jQuery(this).val("");
        } 
    });

	$j("#respond input[type=text], #respond textarea").focus(function(){
		$j(this)
			.css("border-color", "#CC7D1F")
			.parent()
			.find("label")
			.css("background-color", "#CC7D1F");
	});
	
	$j("#respond input[type=text], #respond textarea").blur(function(){
		$j(this)
			.css("border-color", "#9E5500")
			.parent()
			.find("label")
			.css("background-color", "#9E5500");
	});
	
	
	$j("pre").hover(function() {

		var codeInnerWidth = $j("code", this).width() + 10;

        if (codeInnerWidth > 563) {
	
			$j(this)
				.stop(true, false)
				.css({
					zIndex: "100",
					position: "relative"
				})
				.animate({
					width: codeInnerWidth + "px"
				});

			}
		
		}, function() {
				$j(this).stop(true, false).animate({
					width: 563
			});
			
		});
		
    var offset = 5;
		
    $j("#postContainer").load("/additional-posts/?offset="+offset);
    $j("#another").click(function(){
        
        offset = offset+5;
    
        $j("#postContainer")
            .slideUp()
            .load("/additional-posts/?offset="+offset, function() {
                $j(this).slideDown();
            });
            
        return false;
    });

});