/*!
 * simpletabs
 * A simple jquery plugin to control custom tabs
 * 2010 David Hammond
 */
(function($){
    $.fn.simpleTabs = function(tabclass, contentclass){
        if (!tabclass) 
            tabclass = "tab";
        if (!contentclass) 
            contentclass = "content";
        var tabs = $(this).find("." + tabclass), contents = $(this).find("." + contentclass), currTab = tabs.get(0), tempTab, c, to;
        function showTab(tab){
            tabs.each(function(index){
                if (this == tab) {
                    this.src = this.src.replace("off", "on");
                    $(contents.get(index)).show();
                }
                else {
                    this.src = this.src.replace("on", "off");
                    $(contents.get(index)).hide();
                }
            })
        }
        tabs.mouseover(function(){
            clearTimeout(to);
            tempTab = this;
            showTab(tempTab);
        }).mouseout(function(){
            to = setTimeout(function(){
                showTab(currTab)
            }, 50);
        }).click(function(){
            currTab = this;
        })
        contents.mouseover(function(){
            clearTimeout(to);
        }).mouseout(function(){
            to = setTimeout(function(){
                showTab(currTab)
            }, 50);
        })
        return $(this);
    };
}(jQuery));
