// DOM Ready
jQuery(function() {

    var jQueryel, topPos, newHeight;
        
    jQuery("#flowtabs").append("<li id='magic-line'></li>");
    
    var jQuerymagicLine = jQuery("#magic-line");
       
         jQuerymagicLine
        .height(jQuery(".current_page_item").height())
        .css("top", jQuery(".current_page_item a").position().top)
        .data("origTop", jQuerymagicLine.position().top)
        .data("origHeight", jQuerymagicLine.height());
   
    jQuery("#flowtabs li a").hover(function() {
        jQueryel = jQuery(this);
        topPos = jQueryel.position().top;
        newHeight = jQueryel.parent().height();
        
        jQuerymagicLine.stop().animate({
            top: topPos,
            height: newHeight
        });
    }, function() {
        jQuerymagicLine.stop().animate({
            top: jQuerymagicLine.data("origTop"),
            height: jQuerymagicLine.data("origHeight")
        });    
    });
	
	jQuery("#flowtabs li a").click(function() {
        jQuery(this).parent().siblings().removeClass("current_page_item");
                jQuery(this).parent().addClass("current_page_item");
        jQuerymagicLine
                .height(jQuery(".current_page_item").height())
                .css("top", jQuery(".current_page_item a").position().top)
                .data("origTop", jQuerymagicLine.position().top)
                .data("origHeight", jQuerymagicLine.height());
	});
});
