function _show_play_btn() { $(".slide-btn-play").show(); $(".slide-btn-stop").hide(); }
function _show_stop_btn() { $(".slide-btn-play").hide(); $(".slide-btn-stop").show(); }
function slider_play() { $("#slider").tabs("rotate", 5000, 1); _show_stop_btn(); }
function slider_stop() { $("#slider").tabs("rotate", 0); _show_play_btn(); }
$(function() {
    $("#slider").prepend("<ul></ul>");
    var num = 0, items = '';
    $("#tabs>div[id^='tab-']").each(function(index) {
        num++;
        items += '<li><a href="#' + $(this).attr("id") + '">&nbsp;</li>';
    });
    $("#slider>ul").append(items + '<li><a class="slide-btn-play" title="">&nbsp;</a><a class="slide-btn-stop" title="">&nbsp;</a></li>');
    $("#slider").tabs({
        selected: Math.floor(Math.random()*num)+1,
        select: _show_stop_btn,
        fx: {opacity: "toggle", duration: 2000}
    });
});
$(document).ready(function() {
    $("#slider").show();
    //$(".ui-tabs-panel").click(function() { location=$(this).attr("rel"); });
    $(".slide-btn-play").click(slider_play);
    $(".slide-btn-stop").click(slider_stop);
    slider_play();
});

