$(function() { $(".elist").totheside(".e.catbutton"); $(".jlist").totheside(".j.catbutton"); $(".tlist").totheside(".t.catbutton"); var over_j=false; var over_e=false; var over_t=false; $(".elist").mouseenter(function() { over_e=true }).mouseleave(function() { over_e=false; }) $(".e.catbutton,.elist").mouseover(function() { $(".elist").show(2); }).mouseleave(function() { setTimeout(function() { if (!over_e) { $(".elist").hide(2); } },40) }); $(".jlist").mouseenter(function() { over_j=true }).mouseleave(function() { over_j=false; }) $(".j.catbutton,.jlist").mouseover(function() { $(".jlist").show(2); }).mouseleave(function() { setTimeout(function() { if (!over_j) { $(".jlist").hide(2); } },40) }); $(".tlist").mouseenter(function() { over_t=true }).mouseleave(function() { over_t=false; }) $(".t.catbutton,.tlist").mouseover(function() { $(".tlist").show(2); }).mouseleave(function() { setTimeout(function() { if (!over_t) { $(".tlist").hide(2); } },40) }); $(".elist").delegate("li","click",function() { $(".elist").hide(0); location.href='european.php?'+$(this).html(); }); $(".jlist").delegate("li","click",function() { $(".jlist").hide(0); location.href='japanese.php?'+$(this).html(); }); $(".tlist").delegate("li","click",function() { $(".tlist").hide(0); location.href='trailer.php?'+$(this).html(); }); }); $.fn.totheside = function(anchor_selector) { var anchor=$(anchor_selector); var x=anchor.position().left+parseInt(anchor.css("marginLeft"))+anchor.outerWidth(); var y=anchor.position().top+parseInt(anchor.css("marginTop")); this.css("left",x+"px") this.css("top",y+"px") }