(function($){
    $.fn.extend({
        tabify:function(){
            return this.each(function(){
                $(this).find("li").each(function(){
                    if($(this).hasClass("active")){
                        $("#"+$(this).attr("rel")).show();
                    } else{
                        $("#"+$(this).attr("rel")).hide();
                    }
                    $(this).click(function(){
                        $(this).parent().find("li").each(function(){
                            $(this).removeClass("active");
                            $("#"+$(this).attr("rel")).hide();
                        });
                        $("#"+$(this).attr("rel")).show();
                        $(this).addClass("active");
                    });
                });
            });
        }
    });
})(jQuery);

$(document).ready(function() {
	$("#ask-button").click(function() {
		$("ul[id^='tabs1']").children("li").each(function(){
      $(this).removeClass("active");
      $("#"+$(this).attr("rel")).hide();
    });		
    
		$("ul[id^='tabs1']").children("li:last").addClass("active");
		
		var div_id = $("ul[id^='tabs1']").children("li:last").attr("rel");
		$("#"+div_id).show();
	});
});
