$(function() { var hideDelay = 500; var currentID; var hideTimer = null; // One instance that's reused to show info for the current person var container = $('
'); $('body').append(container); $('.popupTrigger').live('mouseover', function() { // format of 'rel' tag: pageid,personguid if ($(this).is('area')){ var lokal_nr = $(this).attr("rel")-0; var listID = getLokalLid(lokal_nr); } else { var listID = $(this).parent().attr("id") - 0; } // If no guid in url rel tag, don't popup blank if (listID == '') return; if (hideTimer) clearTimeout(hideTimer); if ($(this).is('area')){ var pos = $('#img_'+lokal_nr).offset(); var width = $('#img_'+lokal_nr).width(); }else{ var pos = $(this).offset(); var width = $(this).width(); } if ($(this).is('area')){ container.css({ left: (pos.left + width) + 'px', top: pos.top - 5 + 'px' }); }else{ container.css({ left: (pos.left - container.width()) + 'px', top: pos.top - 5 + 'px' }); } $('#tooltip').html(' '); $.ajax({ type: 'GET', url: '/includes/ajax_rundvandring_tooltip.asp', data: 'lid=' + listID, success: function(data) { // Verify that we're pointed to a page that returned the expected results. if (data.indexOf('highlight_tooltip') < 0) { $('#tooltip').html('Inget resultat'); } // Verify requested person is this person since we could have multiple ajax // requests out if the server is taking a while. $('#tooltip').html(data); } }); container.css('display', 'block'); }); $('.popupTrigger').live('mouseout', function() { // format of 'rel' tag: pageid,personguid /*if ($(this).is('area')){ var lokal_nr = $(this).attr("rel")-0; $('#img_' + lokal_nr).trigger('mouseout'); }*/ if (hideTimer) clearTimeout(hideTimer); hideTimer = setTimeout(function() { container.css('display', 'none'); }, hideDelay); }); // Allow mouse over of details without hiding details $('#tooltip').mouseover(function() { if (hideTimer) clearTimeout(hideTimer); }); // Hide after mouseout $('#tooltip').mouseout(function() { if (hideTimer) clearTimeout(hideTimer); hideTimer = setTimeout(function() { container.css('display', 'none'); }, hideDelay); }); }); $(document).ready(function(){ $('#rundvandring_meny ul').makeacolumnlists({cols:3,colWidth:0,equalHeight:false,startN:1}); }); function hover_on(lokal_nr) { $('#img_'+lokal_nr).attr('src', '/bilder/rundvandring/'+lokal_nr+'.gif'); } function hover_off(lokal_nr) { $('#img_'+lokal_nr) .attr('src', '/bilder/rundvandring/transparent_placeholder_image.gif') .click(function(){ window.location = '/Lokaler__.html/lid/' + getLokalLid(lokal_nr); }); } function hover_on_lid(lid) { $('#img_'+getLokalNr(lid)).attr('src', '/bilder/rundvandring/'+ getLokalNr(lid) +'.gif'); } function hover_off_lid(lid) { $('#img_'+getLokalNr(lid)).attr('src', '/bilder/rundvandring/transparent_placeholder_image.gif') } function getLokalLid(lokal_nr){ switch(lokal_nr) { case 4: return 83891; break; case 5: return 83887; break; case 6: return 83890; break; case 7: return 83875; break; case 8: return 83885; break; case 10: return 83867; break; case 11: return 83324; break; case 12: return 83872; break; case 13: return 83876; break; case 14: return 83866; break; case 15: return 83868; break; case 16: return 83877; break; case 17: return 83865; break; case 18: return 83873; break; case 19: return 83871; break; case 30: return 83869; break; case 31: return 83888; break; case 32: return 83889; break; case 36: return 83874; break; default: return ''; } } function getLokalNr(lid){ switch(lid) { case 83891: return 4; break; case 83887: return 5; break; case 83890: return 6; break; case 83875: return 7; break; case 83885: return 8; break; case 83867: return 10; break; case 83324: return 11; break; case 83872: return 12; break; case 83876: return 13; break; case 83866: return 14; break; case 83868: return 15; break; case 83877: return 16; break; case 83865: return 17; break; case 83873: return 18; break; case 83871: return 19; break; case 83869: return 30; break; case 83888: return 31; break; case 83889: return 32; break; case 83874: return 36; break; default: return ''; } }