function hidenav(nTO) {
  var oNav=document.getElementById("navtab");
  oNav.style.visibility="hidden";
  setTimeout("shownav();",nTO*1000);
}

function shownav() { 
  var oNav=document.getElementById("navtab");
  oNav.style.visibility="visible";
} 

$(document).ready(function() {
  if($('td.perror').length>0) {
    var $div=$('td.perror div');
    var s=$div.html();
    $div.html('<div>'+s+'</div>');
  }
});

var slider=function(selector,animate,pipe){
        var anim=(animate==undefined || !animate)?false:true;
        var pipe=(pipe==undefined || !pipe)?false:true;

        $(document).ready(function(){
                $(selector).each(function(){
                        var select=$(this).parent().prev().children('select:first').get(0);
                        var vMax=select.length-1;
                        var cursor;

                        $(this).slider({
                                max:vMax,
                                min:1,
                                animate:anim,
                                start:function(event,ui){
                                        if(cursor.css('visibility')=='hidden')
                                                cursor.css('visibility','visible');
                                },
                                stop:function(event,ui){
                                        select.selectedIndex=ui.value;
                                }
                        });

                        if(pipe) $(this).append('<div class="pipe ui-state-default"></div>');
                        cursor=$(this).children('a:first');

                        if(select.selectedIndex>0) {
                                $(this).slider('value',select.selectedIndex);
                                cursor.css('visibility','visible');
                        }
                });
        });
};
