function buildMenus() { var addr = ''; var htmlcode = ''; $("div#menu").find('li').each(function(){ addr = $(this).find('a').attr('href'); lida = addr.split('/'); lid = lida[lida.length - 2]; if(lid == 'seniors') { $(this).html('Teams'); } if(lid == 'junior') { $(this).html(''); } }); $("a#teamsmenu").mouseover(function() { var pos = $("a#teamsmenu").offset(); $("div#menu").append(''); $("div#dropdownmenu").css({ position: 'absolute', zIndex: 5000, left: pos.left, top: pos.top }); $("div#dropdownmenu").hide().fadeIn(); $("div#dropdownmenu").mouseleave(function() { $("div#dropdownmenu").fadeOut(); }); $("div#dropdownmenu ul li a").click(function() { $("div#dropdownmenu").fadeOut(); }); }); } function showBigTeamPhoto(text, url) { var htmlcode = '
'; $("body").append(htmlcode); $("#dialog-modal").dialog({ height: 480, width: 640, modal: true, close: function() { $("#dialog-modal").remove(); } }); } $(document).ready(function() { buildMenus(); $("img.seniorteamphoto").click(function() { var url = $(this).attr('src').replace('clubphotos/m', 'clubphotos/n'); var text = $(this).attr('alt'); showBigTeamPhoto(text, url); return false; }); $("img.seniorteamphoto").css('cursor', 'pointer'); });