  var over = false;
function showMenu(id){

  $(".home_container span.active").hide();
  $(".home_container span.inactive").show();
  
  $("#link_" + id + " span.inactive").hide();
  $("#link_" + id + " span.active").show();

  jQuery(".text-small-menu-top").hide();
  jQuery("#subcat_" + id).show();
   
}
function hideMenu(id){
  if(over != true){
    jQuery("#subcat_" + id).hide();
  }else{
    setTimeout('hideMenu('+id+')',1000);
  }
  
}


function showMenuSub(id){

  $(".text-small-menu-top span.active").hide();
  $(".text-small-menu-top span.inactive").show();
  
  $("#link_" + id + " span.inactive").hide();
  $("#link_" + id + " span.active").show();

  $(".text-small-menu-sub").hide();

  $("#subcatsub_" + id).show(); 

}



function hideMenuSub(id){

  if(over != true){

    $("#subcatsub_" + id).hide();

  }else{

    setTimeout('hideMenuSub('+id+')',1000);

  }
}


function hideflash2()
{
        /* hide all flash in the page */
        flash = document.getElementsByTagName('embed')
        for (var i = 0; i < flash.length; i++) 
        { 
                flash[i].style.visibility = 'hidden';
        }
        flash = document.getElementsByTagName('object')
        for (var i = 0; i < flash.length; i++) 
        { 
                flash[i].style.visibility = 'hidden';
        }
}
function showflash2()
{
        /* show all flash */
        flash = document.getElementsByTagName('embed')
        for (var i = 0; i < flash.length; i++) 
        { 
                flash[i].style.visibility = 'visible';
        }
        flash = document.getElementsByTagName('object')
        for (var i = 0; i < flash.length; i++) 
        { 
                flash[i].style.visibility = 'visible';
        }
}

var over2 = false;
function showMenu2(id){ 
  //hideflash2();
  jQuery('.submenu').hide();
  jQuery('#subcat_' + id).show();
  jQuery('.top-banner-grey').slideDown(300);
   
}


function hideMenu2(id){ 
  if(over2 != true){
    jQuery("#subcat_" + id).hide();
    jQuery('.top-banner-grey').slideUp(300);
    //showflash2();
  }else{
    setTimeout('hideMenu2('+id+')',1000);
    
  }
  
}

function search(){
 var string = jQuery("#search-textbox").val();
 document.location = full_url + '/artists/index/search:' + string; 
}

jQuery(function(){

  //jQuery('#search-textbox').autocomplete(full_url + '/artists/autocomplete/');
  
  jQuery('#search-textbox').autocomplete(full_url + '/artists/autocomplete/').result(function(event, item) {
    var url = item.toString();
    url = url.toLowerCase();
    url = url.replace(/^\s+|\s+$/g, ''); // remove leading and trailing whitespaces
    url = url.replace(/\s+/g, '-'); // convert (continuous) whitespaces to one -
    url = url.replace(/[^a-z-]/g, ''); // remove everything that is not [a-z] or -
 
    location.href = full_url + 'category/' + url;
  });

  jQuery('.text-small-menu').bind('mouseover',function(){
    over = true;
  });
  jQuery('.text-small-menu').bind('mouseout',function(){
    over = false;
  });
  jQuery('.mainlink').bind('mouseover',function(){
    over = true;
  });
  jQuery('.mainlink').bind('mouseout',function(){
    over = false;
  });

  jQuery('.top-banner-black').bind('mouseover',function(){
    over2 = true;
  });
  jQuery('.top-banner-black').bind('mouseout',function(){
    over2 = false;
  });
  jQuery('.top-banner-grey').bind('mouseover',function(){
    over2 = true;
  });
  jQuery('.top-banner-grey').bind('mouseout',function(){
    over2 = false;
  });
});
